redact for Claude Code

Every key a developer pastes into Claude Code goes to the model and stays in a session file on disk. redact swaps it for a placeholder inside Claude Code before the model reads it, keeps the placeholder in the conversation rows the session file stores, and puts the real value back only inside file edits. Zero network reach.
Site: redact.aidojo.si. It is a Claude Code mod: a plugin of TypeScript function hooks that runs in the Claude Code process.
What happens
# Interactive session on Claude Code 2.1.288, Opus 5.5, accept-edits mode. Fake key, masked here as AKIA****************.
⏺ redact: hid 1 AWS_KEY in your prompt
❯ Save this AWS access key id to a new file named key.txt in this directory, exactly as given, then stop: [REDACTED:AWS_KEY#08956cf3]
⏺ Write(key.txt)
⎿ Wrote 1 line to key.txt
1 AKIA****************
⏺ I saved the AWS access key ID to key.txt, exactly as you gave it with no trailing newline. The write tool fills in the
real value when it creates the file, so it should be on disk as you sent it. I didn't open the file to check, because that would print the key back
into this conversation.
key.txt on disk held the real key. The session file held the placeholder in every conversation row; /redact answered hid 1 values this session (1 AWS_KEY); restored 1 placeholders.
The same value gets the same placeholder for the whole session. When Claude later edits a file that holds it, redact puts the real value back inside the Edit, Write or NotebookEdit arguments only. In a live session this was driven end to end: a key typed in the prompt, Claude asked to save it to a file, the file on disk holding the real key while every conversation row holds the placeholder. See Where it was proven.
Install
claude plugin marketplace add karanb192/claude-code-redact
claude plugin install redact@claude-code-redact
Then run /reload-plugins in an open session. Requires Claude Code 2.1.287 or later. Type /redact to see what it hid.
To try it for one session without installing: claude --plugin-dir ./plugins/redact.
What makes it safe to run
- Reach L0. It runs no process, reads no file, env var or setting, and writes no file. The validator lines in What it reaches list every hook, call and state key.
- No network. Nothing leaves the machine. It starts no daemon and calls no scanner binary.
- No model call. Detection never asks a model. A redactor that sent your text to a model to find secrets would defeat its own purpose.
- Deterministic rules. 24 secret rules and 7 opt-in PII rules: regex plus checksums (Luhn, Verhoeff, IBAN mod-97, JWT header decode). The same input gives the same output. Every quantifier is bounded.
- Reversible only inside
Edit, Write and NotebookEdit. Placeholders turn back into real values only in those arguments, so an edit to a line that held a key still matches the file. Bash never gets the real value, so the model cannot echo a placeholder into a network command and send the secret out.
- Fail closed. A row that makes the scanner throw is replaced with
[redact withheld this content: the redactor failed while scanning it]. It is never stored raw.
- The transcript file too. It rewrites at
session.append, the one event that sees every row before it is stored and sent: prompts, tool results, Claude's own blocks, attachments, notices. The model and the session file get the same rewritten row.
- Proof files. The repo ships the threat model below,
RULES.md with a public source for every rule, and DECISIONS.md with every rejected option and every assumption not yet checked.
Where it was proven
| Surface | Status | Evidence |
|---|
| Terminal, interactive, logged in | ran and passed | A session on Claude Code 2.1.288 (Opus 5.5): the prompt echo showed the placeholder, Claude's Write call carried the placeholder, the file on disk holds the real key, the session file holds the placeholder in every conversation row and /redact reported restored 1 placeholders |
Headless claude -p | ran and passed | The stored user row held the placeholder; the system-prompt snapshot carried the redaction notice; /redact answered |
| Plugin test kit | ran and passed | claude plugin test: 65 pass, 0 fail, on the real engine |
| Subagent rows | unverified | The types say session.append and tool.call fire for subagents with agentId; not yet driven live |
/reload-plugins | unverified | Designed for: the value map lives in $.state, which survives a reload |
| SDK, VS Code panel, Desktop, cloud sessions | unverified | Same hooks, no drawing; not yet run there |
What it reaches