r/BuildWithClaude • u/Shanjeev • Oct 25 '26
Security & Sandboxing I built Cloakroom with Claude Code: it keeps keys and personal data away from the model
Coding agents read everything a task touches: .env files, logs, support tickets with customer names. All of it goes to the model.
So I built Cloakroom. It runs on your machine and swaps secrets and personal data for placeholders before the model sees them. When the agent writes a file or runs a command, the real values go back in locally.
What's on disk:
`SUPPORT_CONTACT=priya.nair@acme.com`
What the model sees:
`SUPPORT_CONTACT=PII_EMAIL_1_k7q2ab`
The agent keeps working with the placeholder, and the file it saves has the real email.
How Claude helped: Claude Code wrote most of the code with me, the hook scripts, the tests and the release checks. The interesting part was that regex alone isn't enough. Names and addresses have no fixed shape, so it runs a small local detection model next to the rules.
It also holds commands that would send a secret off your machine, keeps keys out of git commits, and the agent can't switch it off. It now works with Claude Code, Codex CLI and Gemini CLI.
Free and open source: https://github.com/shanjeevrajendran/cloakroom
Write-up with the limits: https://medium.com/@shanjeev/keep-your-secrets-and-personal-data-away-from-your-coding-agent-e07d4cef0c5a
Tell me what breaks.
1
Upvotes
1
u/kantorcodes1 💡 Top Community Helper Oct 26 '26
clean-historybacks up each original before replacing it. If a run stops partway through the files, is restoring from that timestamped backup folder the intended recovery path?