Playbooks · Coding
Cloakroom: hide your secrets from your agent
Written November 11, 2026
Cloakroom sits between your coding agent and your files, swapping keys and personal details for placeholders before the model sees them.
The problem
Point a coding agent at a project and it reads everything it can reach: the .env file, the output of the last command, a support ticket with a customer's name and email, a log with a live API key. All of that goes to the model. Once a key is in the model's context, you cannot take it back, and rotating it after the fact is the only repair.
How it works
Cloakroom runs as hooks around the agent's tool calls. On the way in, pattern rules plus a small local detection model find secrets and personal data, and each value is swapped for a placeholder such as PII_SECRET_1 that stays the same for the session. The pairs live in an encrypted vault on your machine, with its key in the operating system keystore, and the agent cannot read the key. On the way out, placeholders in file writes and commands get their real values back just before they run, so the files on your disk still hold the real values.
Everything runs locally. The only network call is a one-time download of the detection model. If Cloakroom cannot check something, it holds it instead of letting it through. A command that would send a known secret off your machine is held until you say so, and a key written into a file git would commit is refused.
What it covers
Cloakroom works with Claude Code, Codex CLI, Gemini CLI, and Cursor's command-line agent, and masks API keys, passwords, emails, names, addresses, and card and bank numbers. The current release is 1.4.0, which extends the exposure check to personal data typed in old chats across Codex, Cursor, and Gemini CLI, not only Claude Code. Coverage is not identical across agents: the README carries a table of what is masked, held, or not covered per agent, and the gaps matter. Output from a long-running command on Codex reaches the model unmasked, and Gemini CLI lets a call through if a check runs past its time limit.
How to install it
In Claude Code, one line at a time, then restart it:
/plugin marketplace add shanjeevrajendran/cloakroom
/plugin install cloakroom@cloakroom
For Codex, Gemini CLI, or Cursor, on Mac or Linux:
uv tool install "cloakroom[model,torch,ocr]" # Python 3.10+
cloakroom install codex # or: gemini, cursor
Codex skips new hooks until you trust them once, from /hooks inside Codex. Then run cloakroom doctor. Every line should say ok.
The commands you will use
| Command | What it does |
|---|---|
cloakroom doctor | Health check, versions, per-check timing |
cloakroom exposure | Lists the keys and passwords your coding agents saw, so you know what to rotate. Hints only, never the key itself |
cloakroom scan | Shows the commands a repo's agent and editor config would run |
cloakroom check FILE | Previews what would be masked in a file, and why |
cloakroom dashboard | Alerts in the browser. Mark a false alarm once and a rule stops it next time |
cloakroom update | Updates the program and sets the hooks up again |
The exposure list is hints only. It tells you which keys an agent saw so you can rotate them. It never shows the key itself.
Results, as reported
On held-out test sets, Cloakroom reports letting through 0 of 1,005 personal details and 0 of 77 keys and passwords in real vendor formats. The other tools it was tested against let through 119 to 992. Those numbers are the project's own, on its own test data, and no independent test exists. The trade-off is false alarms: it masks more harmless text than secret-only scanners, and false alarms are its main weakness.
Limits
- Cloakroom stops accidental leaks. It is not built to stop a model that is determined to leak, and its own docs say so.
- A prompt holding a secret can be stopped, not cleaned. Typed prompts are blocked rather than rewritten.
- Cursor's tab completion and the vendors' own server-side web search are not covered.
- Nothing on this page comes from installing or running Cloakroom. The behaviour above is as described in the project docs.
Related playbooks
- Apiiro: 1,122 Claude settings files leak secrets
- Copilot code review goes Adaptive, checks secrets
- Two MCP packages on npm were stealing secrets
- T3 Code: drive your agents from your phone
Sources
- shanjeevrajendran/cloakroom — GitHub
- Keep your secrets and personal data away from your coding agent — Shanjeev Rajendran, Medium
Back to: Coding playbooks hub · Also: Secret scanning now catches Actions log leaks · Lazarus: ten neurons can backdoor an agent · Clean data can strengthen a hidden backdoor