{"_id":"@codingcoffee/pi-privacy-filter","name":"@codingcoffee/pi-privacy-filter","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@codingcoffee/pi-privacy-filter","version":"0.1.0","keywords":["pi-package","pi-extension","pi","llm-tools","pi-coding-agent","privacy","filter","privacy-filter","redact","secrets","llm","agent"],"author":{"name":"Ameya Shenoy","url":"https://codingcoffee.dev"},"license":"MIT","homepage":"https://pi-privacy-filter.codingcoffee.dev","repository":{"type":"git","url":"git+https://github.com/codingcoffee/pi-privacy-filter.git"},"bugs":{"url":"https://github.com/codingcoffee/pi-privacy-filter/issues"},"type":"module","description":"pi extension that redacts PII/secrets before sending to the LLM and restores them in responses","pi":{"extensions":["./index.ts"],"image":"https://pi-privacy-filter.codingcoffee.dev/og.png"},"dependencies":{"@huggingface/transformers":"^4.2.0"},"devDependencies":{"@earendil-works/pi-coding-agent":"^0.74.0","typescript":"^6.0.3"},"scripts":{"clean":"echo 'nothing to clean'","build":"echo 'nothing to build'","check":"echo 'nothing to check'"},"gitHead":"e5be6049bb4b263b670a166fe20277a7d89fcea1","_id":"@codingcoffee/pi-privacy-filter@0.1.0","_nodeVersion":"24.3.0","_npmVersion":"11.14.1","dist":{"integrity":"sha512-UFMe150JCEf2hCgJMG/As0U145ah5svTRR7Toun2zs5tffQXfnE1y2EJqrldkufhWLNv3788rydWtm8mzUaGwA==","shasum":"853f828b9b265b58087fa989bf5df1483161cb78","tarball":"https://registry.npmjs.org/@codingcoffee/pi-privacy-filter/-/pi-privacy-filter-0.1.0.tgz","fileCount":4,"unpackedSize":21562,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEUhWJHZQTb3e8c3aKPTmh6REi6334r/mpStuX+DD3DFAiAvVXObgSqTctyKjDdFKXGSGcVkIMRswI/NBAk3CAhIgg=="}]},"_npmUser":{"name":"codingcoffee","email":"shenoy.ameya@gmail.com"},"directories":{},"maintainers":[{"name":"codingcoffee","email":"shenoy.ameya@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-privacy-filter_0.1.0_1778400406167_0.18389141815264476"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-10T08:06:46.099Z","0.1.0":"2026-05-10T08:06:46.346Z","modified":"2026-05-10T08:06:46.533Z"},"maintainers":[{"name":"codingcoffee","email":"shenoy.ameya@gmail.com"}],"description":"pi extension that redacts PII/secrets before sending to the LLM and restores them in responses","homepage":"https://pi-privacy-filter.codingcoffee.dev","keywords":["pi-package","pi-extension","pi","llm-tools","pi-coding-agent","privacy","filter","privacy-filter","redact","secrets","llm","agent"],"repository":{"type":"git","url":"git+https://github.com/codingcoffee/pi-privacy-filter.git"},"author":{"name":"Ameya Shenoy","url":"https://codingcoffee.dev"},"bugs":{"url":"https://github.com/codingcoffee/pi-privacy-filter/issues"},"license":"MIT","readme":"# pi-privacy-filter\n\nA [pi](https://pi.dev) extension that runs every prompt through a local privacy classifier (`openai/privacy-filter` via `@huggingface/transformers`) **before** it is sent to the LLM, and transparently **restores** the original values in the LLM's response.\n\n```\nuser input ──► [redact] ──► LLM\n                  │\n                  └── placeholder→original mapping (in memory)\n\nLLM response ──► [unredact via mapping] ──► you see the real values\n```\n\nExample:\n\n- you type:    `My AWS account number is 22922829292`\n- LLM sees:    `My AWS account number is [ACCOUNT_NUMBER_1]`\n- you see:     `... My AWS account number is 22922829292 ...` (assistant's reply, restored)\n\nThe mapping lives in memory for the session only — nothing is written to disk by this extension. Your original message is still stored in the session file (since that's where pi keeps it); only the bytes leaving for the model are redacted.\n\n## How it works\n\n- Hooks the `context` event to mutate the deep-cloned messages pi is about to send to the model. User messages and tool results have their text run through the classifier; matched spans are replaced with stable placeholders like `[ACCOUNT_NUMBER_1]`.\n- Hooks the `message_end` event to swap any placeholders back to their original values in the assistant's finalized message before pi displays / persists it.\n- Identical values reuse the same placeholder for the whole session.\n\n## Install\n\n```bash\ncd pi-privacy-filter\nnpm install   # or: bun install\n```\n\nThen wire it into pi using any one of:\n\n### Quick test\n```bash\npi -e ./index.ts\n```\n\n### Project-local\n```bash\nmkdir -p .pi/extensions\nln -s \"$PWD\" .pi/extensions/pi-privacy-filter\n```\n\n### Global\n```bash\nmkdir -p ~/.pi/agent/extensions\nln -s \"$PWD\" ~/.pi/agent/extensions/pi-privacy-filter\n```\n\n### Or via pi settings (`~/.pi/settings.json`)\n```json\n{\n  \"extensions\": [\"/absolute/path/to/pi-privacy-filter\"]\n}\n```\n\n## Commands\n\n- `/privacy-mapping` — dump the current placeholder→value mapping (handy for debugging).\n\n## Files\n\n- `index.ts` — the extension\n- `sample.ts` — original standalone POC (`bun run sample.ts`)\n","readmeFilename":"README.md","_rev":"1-e3a1770bc481e5b6a199269a754744fe"}