Redact customer PII before Claude Code sends it to the model
In Claude Code, ACP can swap a customer’s email for [REDACTED:email] before the agent sees it. This covers Bash output, Read of a text file and MCP text results. For those, the model provider never receives the original.
Other results reach the model unchanged and are only detected and logged. That includes Grep, Glob, WebFetch and WebSearch output, subagent results and non-text results such as images and PDFs.
Without removal, an email in any support export or query result the agent reads sits in the model’s context. It goes to the provider with the next request, and it can end up in whatever the agent writes next.
The test run, 16 November
I ran this on the evening of 16 November 2026 with real Claude Code and ACP plugin 0.31.0. The workspace PII setting was Detect & redact. The model proxy was off, so the plugin’s hook did all of it.
The agent read a file with a customer email in it.
- The agent saw
contact: [REDACTED:email]. - The terminal printed
[ACP] Removed PII before the agent saw it: email. - The audit log recorded
Read → redact, "redacted PII: email". - The Claude Code session transcript on disk held only the redacted value. It held zero copies of the address.
The transcript was the check I cared about. In a Read test with the proxy off, the address was gone from the tool result and still gone in the file Claude Code keeps on your machine. I didn’t repeat the test for Bash or MCP.
Where the value goes
For Bash output, Read of a text file and MCP text results under 200 KB, with the plugin removing PII:
| Place | Gets the email? |
|---|---|
| ACP’s gateway | Yes, in memory for the scan. It stores the type, not the value |
| The model’s context | No |
| The model provider, and its logs | No |
| Anything the agent writes next | No |
| The local session transcript | No |
| The source file or database | Yes, it stays where it was |
The gateway scans up to 200 KB of each result. Output larger than that isn’t redacted; it is recorded as detected. The stored record holds the PII type by default. Two things can store more: argument and result previews, if you turn them on, and the arguments of a call held for approval. The privacy policy has the full list.
Each call makes two round trips to the gateway, one before it runs and one after. If ACP can’t be reached, unattended sessions are blocked until it answers. Interactive sessions go ahead unscanned with an UNGOVERNED notice. When ACP is unreachable has the details.
Tool input
ACP also rewrites what goes out to MCP tools, WebFetch and WebSearch, so the outside service gets the placeholder. There are three exceptions. A call held for approval runs unchanged if you approve it. Input over 200 KB isn’t rewritten. A labelled SSN or a valid card number in that input is blocked outright.
Shell commands and file edits are never rewritten, because changing a command can change what it does. To stop PII there, set the tool to Detect & block.
With the model proxy
If you launch Claude Code with claude-acp, model calls go through ACP’s proxy. The proxy masks PII in tool results before the model provider receives them, on every plan and PII setting.
The proxy doesn’t change the session transcript on your machine. The original value stays there.
What gets detected
The detector knows six built-in types: email, phone, card number, SSN, IBAN and IP address. It doesn’t detect names, postal addresses or dates of birth. A regex can’t reliably catch a name either.
Each type has a check the value must pass. Cards need a known issuer, a valid length and a passing Luhn checksum. SSNs need a valid range, and IBANs need mod-97. IP addresses must parse, and private and loopback addresses are skipped. Phone numbers must parse too, and a bare run of digits needs a word like “phone” nearby.
Test data is skipped on purpose. You won’t see flags for example.com addresses, published test card numbers or sample SSNs.
Your own ID formats need a custom pattern. Add a regex in Policies → Patterns, for example CUST-[A-Z0-9]{8} for customer IDs. The type name you choose shows up in the placeholder and the audit log.
Try it in 30 seconds
Install the plugin, or update it if you already have it. Removal needs ACP plugin 0.31.0 or later (claude plugin update agentic-control-plane@acp).
curl -sf https://agenticcontrolplane.com/install.sh | bash
In the console’s Policies page, set PII to Detect & redact for the tier your session runs in. Headless claude -p runs in the background tier, so set it there for this test.
Then, in a Claude Code project folder:
printf 'contact: dana@agenticcontrolplane.com\n' > acp-pii-test.txt
claude -p "Read acp-pii-test.txt and print its contents exactly"
The agent should print contact: [REDACTED:email]. The proof of removal is the call counted under “PII removed” in the console. In an interactive session the terminal also shows Removed PII before the agent saw it. The activity log’s decision can read redact even when nothing was removed, for example on a Grep, so don’t rely on it alone.
Keep a real-looking address like this one. An example.com address is skipped, and the test shows nothing.
A sandbox doesn’t do this job. It limits what the agent can do, not what it reads and sends to the provider.
Other harnesses
Qwen Code rewrites MCP, WebFetch and WebSearch input, and detects PII in output. The Python and TypeScript SDKs replace the output with the redacted text.
On Cursor, Codex CLI, GitHub Copilot, pi, dsh, Prime Agent and the rest, you get detection and an audit-log entry, and the value still reaches the model. Where the harness shows ACP’s messages, the terminal says the value got through. The PII guide has the full table.
Limits
- Text you type into the prompt isn’t masked.
- Calls that don’t go through ACP aren’t scanned.
- Names, postal addresses and dates of birth aren’t detected.
- Other formats the detector doesn’t know need a custom pattern.
- Counts can still identify people. “3 enterprise users in Norway” gives them away if there are only three.
For PII in tool results more broadly, including SQL agents and the SDK, see Stop your AI agent from leaking PII through tool calls.
Pick one tool whose output holds customer records and run the test on it. If it worked, the console counts the call under “PII removed”.
Running Claude Code? One command adds a hook. Each tool call is recorded, the session's model calls are priced, and a force-push, destructive SQL or curl | sh waits for your OK in the session.
curl -fsSL https://agenticcontrolplane.com/install.sh | bash
irm https://agenticcontrolplane.com/install.ps1 | iex
What the installer writes · Claude Code guide · free up to 5 agents