Masks API keys, secrets and personal data before your AI coding agent sees them, and restores them locally. Works with Claude Code, Codex CLI and Gemini CLI.
pip install cloakroom==0.8.1 Copy PIP instructions
Cloakroom is free and open source. It masks API keys, passwords and personal data (names, emails, addresses and the like) on your machine before your AI coding agent sees them. Works with Claude Code, Codex CLI and Gemini CLI.
▶ 40-second demo (Claude Code) · Get started · Blocked prompt? · Results · How it works · Extra protections · Dashboard · FAQ · Known limits
Cloakroom swaps your secrets and personal data for placeholders before Claude sees them, and puts the real values back in the files Claude writes.
On test data it hadn't seen before, Cloakroom let through 0 of 1,005 personal details (the other tools we tested let through 119 to 992) and 0 of 77 keys and passwords in the formats vendors really issue. Its weak spot is false alarms: it masks more harmless text than secret-only tools do. Results
When Claude writes a file, Cloakroom puts the real value back in on your disk.
Install (inside Claude Code, one line at a time):
/plugin marketplace add shanjeevrajendran/cloakroom /plugin install cloakroom@cloakroom Or, from a terminal:
claude plugin marketplace add shanjeevrajendran/cloakroom claude plugin install cloakroom@cloakroom Then restart Claude Code. Details and other tools: Get started.
A placeholder is a label such as PII_PERSON_1 or PII_SECRET_1. The AI sees the label and works with it. The real value stays on your machine.
Cloakroom catches personal data as well as keys. It masks the data and lets the AI carry on, instead of stopping the whole step. And it learns from your corrections.
It runs on your machine, sets itself up on first start, and works on Mac, Windows and Linux. Free and open source. It's new, so expect rough edges.
New in 0.7, it also protects two other AI coding agents that run in a terminal (Mac and Linux):
✓ Masked: the AI sees a placeholder, never the real value · ⛔ Stopped: Cloakroom blocks it and tells you how to send it safely · ✗ Not covered: Cloakroom can't see it
Why typed messages are stopped instead of masked: these agents let an add-on stop what you type, but not reliably change it. So Cloakroom stops a message holding a key or personal data before it's sent, and nothing reaches the AI.
MCP tools are add-ons that give the AI extra abilities, such as a browser or a database. "Block message" is explained under the table.
Cloakroom works through hooks: small checks the agent runs before and after each action, such as reading a file or running a command.
Both were tested live (Codex 0.164, Gemini CLI 0.65). Everything else: Known limits.
Claude Code plugin updates arrive a few days after each PyPI release (PyPI is the Python package site), once the release has settled (how updates reach you). All changes: CHANGELOG.md.
Hand Claude the files you'd never paste into a chat:
You need Claude Code, installed and signed in. Then:
Open a terminal. Mac: press Cmd+Space, type "Terminal", press Enter. Windows: open Start, type "PowerShell", press Enter. Linux: press Ctrl+Alt+T. Type claude and press Enter.
Add Cloakroom. Inside Claude Code, type these two lines, one at a time. If it asks where to install, pick the option for all your projects (user scope).
Check it. Open a new terminal window and run:
cloakroom doctor # every line should say ok cloakroom dashboard # opens your alerts in the browser What you need first:
Tested from clean installs on macOS, Windows and Ubuntu.
Prefer to install by hand: uv tool install "cloakroom[model,torch,ocr]" (Python 3.10+; the part in brackets adds the detection model and OCR, which reads text out of pictures), then add the plugin as above.
Claude Code: Claude Code updates the Cloakroom plugin, and the plugin then updates the cloakroom program the next time you start Claude Code. A plugin update comes out a few days after each new Cloakroom release. Claude Code only does this by itself if automatic updates are on for the place you added Cloakroom from (Claude Code calls it a marketplace). They're off unless you added Cloakroom from the plugin directory on claude.ai, where they're on. To switch them on:
When an update arrives, Claude Code says "Run /reload-plugins": type that, or restart Claude Code. To update right away instead, run claude plugin update cloakroom@cloakroom in a terminal.
Codex, Gemini CLI, git commits, or a cloakroom you installed yourself: run cloakroom update in a terminal. It updates Cloakroom with the installer you used (uv, pipx or pip) and keeps the optional parts you had (the detection model and OCR, the reading of text in scans and photos). Then it sets up Cloakroom's checks again for Codex, Gemini CLI and git commits in the current folder, only where they were set up before, so they match the new version. If Codex's checks changed, Codex asks you to approve them once more: start codex, type /hooks and trust each Cloakroom entry. To see what it would do without changing anything: cloakroom update --check. It never changes the Claude Code plugin; Claude Code does that.
Which version you have: cloakroom doctor shows the version of the program and, if you use Claude Code, of the plugin, and says what to do when they differ.
When Claude reads a file or runs a command, Cloakroom checks the result on your machine first. Each real value it finds is swapped for a placeholder. The pair is kept in the vault, an encrypted file on your machine. When Claude writes a file or runs a command that holds a placeholder, Cloakroom puts the real value back just before it runs.
Claude Code reads a file or runs a tool │ "Nadia Petrov called about…" sk_live_51Hx9Q… ▼ ┌────────────────────────────────────────────┐ │ Cloakroom (on your machine) │ │ rules + local model -> find the values │ │ encrypted vault -> remember them │ └────────────────────────────────────────────┘ │ "PII_PERSON_1 called about…" PII_SECRET_1 ▼ the model works with placeholders only │ Write reply.md: "Hi PII_PERSON_1," ▼ Cloakroom puts the real value back, locally │ ▼ reply.md on your disk: "Hi Nadia Petrov," Details: docs-HOW-IT-WORKS.md.
Masking is the core. These come with it, on by default, and need nothing from you.
Once Cloakroom has seen a key, password, card or account number, or an email, it also looks for copies a command changed on the way. Each copy gets its own placeholder, and the exact copy is put back in files Claude writes.
Git saves versions of your code, and those versions are often shared online.
Where you correct Cloakroom. Each false alarm you mark can become a rule, so it stops happening. The detection model itself never changes.
cloakroom dashboard opens a page that Cloakroom serves from your own machine only (127.0.0.1). You're signed in with a one-time link.
Claude Code lets Cloakroom stop a prompt but not rewrite it. So a prompt holding a key, an email, a phone, a card or an ID number is stopped before it's sent, and the AI never sees it. Names alone and plain dates go through. The message says what it found and gives your prompt back with each private value swapped for a placeholder (like PII_EMAIL_1_k7q2ab), ready to copy and send:
Cloakroom stopped this prompt: it holds private data (EMAIL x1, SECRET x1), so it wasn't sent. In the copy below that data is replaced by placeholders, which Cloakroom turns back into the real values on this computer when Claude uses them. Send this instead: Add PII_SECRET_1_dhqyhg to .env and mail PII_EMAIL_1_p2iq6z when it's done Send it anyway: add cr! at the start. ... Claude only ever sees the placeholders. When it writes one into a file or a local command, Cloakroom puts the real value back on your computer, so the file ends up with the real key. A very long prompt (over 10,000 characters) gets the advice below instead of a copy. Other ways past a stop:
Files and command output stay masked the whole time. Only you can do this: Claude never sees these commands and can't change Cloakroom's settings. For a long paste: put the detail in a file and ask Claude to read it. It gets masked on the way in and the real values come back when Claude writes.
Claude Code reads whatever your task touches: .env files, logs, customer exports, support tickets. All of it goes to the model. Secret scanners catch keys with a known shape, but a customer's name in a ticket or an address in a log looks like ordinary text to them.
In short: in our tests Cloakroom let through fewer secrets and personal details than the other tools we tried, and masked more harmless text by mistake. The tables below are the detail.
A live agent run (bench/black-october/): the same Claude Code task on a repo of 11 dummy keys and passwords, once without Cloakroom and once with it, then two secret scanners on what each run left behind. Without Cloakroom the model saw all 11 (11 of 11); with it, none (0 of 11), and none reached the saved transcript or the commit. One machine, one model, one prompt: it shows the pieces work together, not a rate you should expect everywhere.
Unless it says otherwise, every number comes from a test set run once, before Cloakroom was adjusted for it. All tools at default settings, offline, tested 12 to 14 October 2026 (Cloakroom's rows rerun 24 October for 0.6.2). maisecrets' maintainers reproduced our numbers and pointed out where the older sets were unfair to them (keys in formats vendors don't issue, and the regions setting); the key-format set and the setting below are the fix. The maintainers of the compared tools were contacted before publishing. Method, versions and every run: bench/RESULTS.md.
Made-up agent traffic (five sets written by a different model: chats, logs, config files, spreadsheets, support tickets): 1,339 key and personal values (the rest are in RESULTS.md) and 200 safe look-alikes. Fewer is better. These sets have been seen by now, so Cloakroom's second row is not an honest score; the first row is its run before any tuning on them.
Some of these tools only aim at secrets, so their personal-data column shows scope as much as quality. Cloakroom's one leak today: a date of birth in a dating-profile export.
Keys in the formats vendors really issue (a new set written after the first comparison: 15 key types, passwords with no fixed shape, encoded emails; 77 values, 15 look-alikes):
Real passwords and keys from public code (Samsung CredData): 14,471 real secrets and 15,422 harmless look-alikes, each line checked alone, the way a tool output reaches Claude. One repository is almost all cipher test vectors (sample keys for testing encryption code), which maisecrets' keyword rule is built to catch: first number without it, in brackets the whole set.
Without the test-vector repository, Cloakroom catches the most; with it, maisecrets does, and maisecrets is the most precise either way (of what it masks, 86 to 91 in 100 are real secrets, against Cloakroom's 73 to 74). Cloakroom masks far more harmless look-alikes (3,457 against maisecrets' 997 on the whole set, down from 3,903 before 0.6.2): false alarms are Cloakroom's main open problem (precision, recall and F1 for every tool).
On public datasets we didn't write (run once; details in bench/public/RESULTS.md):
On Gretel, over half of those extra masks are number strings Cloakroom treats as account or reference numbers; the rest are mostly names and addresses Gretel leaves unlabelled.
Cloakroom also works with OpenAI's Codex CLI, on Mac and Linux (tested with Codex 0.164).
What works as in Claude Code: shell output and MCP results are masked before the model sees them, placeholders in shell commands and patches (Codex's file edits) get their real values back on your machine, real values are kept out of MCP calls, and a prompt holding a secret is stopped, with a copy to send instead. What's different:
To remove it: cloakroom uninstall codex. More in Known limits.
Cloakroom also works with Google's Gemini CLI, on Mac and Linux (built against Gemini CLI 0.65).
What works as in Claude Code: the output of every tool (shell, file reads, MCP) is masked before the model sees it, pictures are read by local OCR or held back, placeholders in shell commands, write_file and replace get their real values back on your machine, real values are kept out of MCP calls and web tools, and a prompt holding a secret is stopped, with a copy to send instead. What's different:
To remove it: cloakroom uninstall gemini (deletes that folder, nothing else). More in Known limits.
Exceptions, how the model runs (backends), automated builds (CI) and troubleshooting: the handbook.
Does it send my data anywhere? No. It downloads the detection model once from Hugging Face (a fixed version); the OCR models come inside the package. Everything else runs on your own machine (127.0.0.1).
How much slower is Claude? Each action is checked by a small program running in the background on your machine: about 20 to 70 ms (thousandths of a second) on Apple Silicon, where the model runs on the built-in graphics chip (an M5 Max to an 8 GB M1 Air), 60 ms on an Apple M-series processor alone, about 300 ms on a small 2-core cloud server. Without an Apple Silicon or NVIDIA graphics chip, a fast processor-only version of the model is built on first start. The first run downloads the model once (about 1 GB). cloakroom doctor prints your numbers.
Will it mask things it shouldn't? Sometimes, see above. Documented examples (Stripe test cards, example.com, fictional 555 numbers), plain dates and job titles are left alone. Mark a false alarm on the dashboard and it suggests a rule, or add exceptions to allow in ~/.cloakroom/config.json. cloakroom check FILE previews masks.
What doesn't it protect? It stops accidental leaks, like a key in a file Claude happened to open. It isn't a sandbox (a sealed-off space the AI can't get out of). Out of scope: a prompt injection (hidden text in a file that steers Claude) set on smuggling data out piece by piece, what you type into a prompt (a prompt with a key or personal data is stopped before it's sent but can't be rewritten, and names alone go through), and Claude Code's own local logs. Keys are kept out of files git would commit when Claude writes them with Write or Edit, but a file a shell command writes some other way (a script, cp, sed -i) is not checked yet, so a commit made from it can still carry a key. Details: docs-LIMITS.md.
What about PDFs, scans and photos? Cloakroom pulls the text out on your machine and masks it like any file; Claude gets the text, never the PDF or the picture. Scanned pages and photos (png, jpg) are read by OCR (reading text from an image), running on your processor with its models inside the package: no download, no cloud, no account. Screenshots and images returned by MCP tools (a browser or desktop tool, say) get the same treatment: the picture is read by local OCR and Claude gets the masked text in its place. The trade-off: Claude reads the text, it doesn't see the picture (layout, colours, charts and anything that isn't text are lost), and OCR can miss or misread small or faint text. Without OCR (no cloakroom[ocr], or an Intel Mac) such an image is held back, and Claude is told why. A scan it can't read in time, encrypted PDFs, figures in a notebook and other pictures are held back, and Claude is told so; to show Claude a picture anyway, attach it to your own prompt. Page and time limits: known limits.
Made by Shanjeev Rajendran · GitHub · LinkedIn
Detection model: PII-Tracer. The one-string hook command that runs in both bash and PowerShell comes from maisecrets (Apache-2.0). Licensed Apache-2.0.
All 2 files in this release have provenance metadata.
privacy pii secrets redaction claude-code ai-agents dlp
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




