How it works
Why Pretense mutates secrets rather than redacting them, and how the round trip stays byte-exact.
Mutation, not redaction
Redaction destroys. A redacted secret cannot come back, so the model sees a hole where your code was and the answer degrades with it.
Pretense swaps each secret for a deterministic synthetic, sends that, then swaps it back byte for byte in the response. What reaches the provider is the synthetic. What reaches you is your own code.
your code ──▶ mutate ──▶ provider sees synthetics
│
▼
reversal map (stays on your machine)
│
your result ◀── reverse ◀── provider responseThe round trip
Reversal is byte-exact or it is a bug. You do not have to run it yourself: the proxy mutates every request on the way out and restores it on the way back, so the round trip happens on each call.
pretense run claude pretense audit --limit 20
The audit log records what was swapped, request by request, so you can confirm the outbound side rather than take it on trust.
The same engine runs over a single file through mutate and reverse. Both take flags that decide where the file and its map are written, and those are in the CLI reference.
What gets mutated
| Kind | Example | Action |
|---|---|---|
| API keys and tokens | sk-…, AKIA…, ghp_… | Reversible swap |
| PII | SSN, email | Reversible swap |
| Identifiers | variables, functions, classes | Left as written |
| Comments and strings | left as written | Preserved verbatim |
Pretense mutates secret and PII values, not identifiers. Your function, class and variable names reach the provider exactly as you wrote them, which is what keeps the answer about your code.
Earlier versions of this page claimed the opposite, and showed renamed output to prove it. That was wrong: identifier-level mutation is on the roadmap and is not in this release. What init records is a code graph of those names, not a rename of them.
Where the map lives
The way back is a reversal map, encrypted with AES-256-GCM and written owner-only into ~/.pretense/maps/. It is not part of the request, so it is not something the provider receives.
Mutating a file in place writes that file's map and prints the exact command that restores it, so the way back exists before you need it. A mutation you cannot reverse is a bug, not a mode.