# Show HN: Redacted - Stop Handing Claude Your Secrets

> Source: <https://github.com/svn-arv/redacted/>
> Published: 2026-11-16 02:29:03+00:00

Removes secrets from tool output before your AI coding assistant reads it.

Tool output:

```
DATABASE_URL=postgres://admin:secret@db.example.com:5432/prod
AWS_ACCESS_KEY_ID=AKIAEXAMPLEKEYID0001
SMTP_PASS="Qf7mZp2kLw9vTx4nRb2024"
APP_NAME=myapp
```

What the model reads (the third line needs `SMTP_PASS` learned by `redacted init`):

```
DATABASE_URL=[REDACTED:database_url ...prod]
AWS_ACCESS_KEY_ID=[REDACTED:aws_access_key ...0001]
SMTP_PASS="[REDACTED:smtp_pass ...2024]"
APP_NAME=myapp
```

Secrets reach the model through normal work, not only through `cat .env`:

- Ordinary output carries them: a committed key in `git diff` , a token in a log, a stack trace that prints the environment.
- Some commands exist to print them: `heroku config` ,`kubectl get secret -o yaml` ,`aws secretsmanager get-secret-value` .
- Deny lists check the command string. An npm script, a make target or a wrapper CLI changes the string, not the output.
- Once in context, a secret stays in the transcript on disk and in every later request.

`redacted` does not judge commands. It scrubs the output, whatever produced it.

- Runs as a Claude Code PostToolUse hook: `redacted scrub` reads each tool result on stdin.
- Scanning happens on your machine. No network calls.
- A secret is replaced inline by a marker that keeps its last 4 characters.
- Clean output passes through unchanged.

```
curl -sSL https://raw.githubusercontent.com/svn-arv/redacted/main/install.sh | sh
redacted init
```

Homebrew, Cargo and pre-built binaries for Linux, macOS and Windows are in the [reference](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#install).

- Learns the secrets in your `.env` files, so the hook catches them even when no vendor pattern knows their format.
- Stores a SHA-256 hash, the length and an optional shape for each value. Never the value.
- You pick the values to learn and confirm the config before anything is written.
- Registers the hook in your Claude Code settings. Safe to run again.

Full walkthrough and flags: [Setup: `redacted init`](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#setup-redacted-init).

| Tier | What it catches | Default | 
|---|---|---|
| Vendor signatures | Keys with a known format: 46 built-in patterns covering AWS, GitHub, Stripe, OpenAI, Anthropic, database URLs, private keys and more. | on | 
| Learned secrets | The values `redacted init` learned from your`.env` , matched by hash, plus rotated keys with the same prefix. | on once `init` writes entries | 
| Entropy heuristic | Random-looking values in `KEY=value` lines that no other tier knows. | off | 

Email addresses and phone numbers can be scrubbed too. Each is off until you turn it on in the config.

Every pattern and what it matches: [What it detects](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#what-it-detects).

- Claude Code, through the PostToolUse hook.
- OpenCode, through the plugin that `redacted init --format opencode` writes.

Other assistants, and whether their hooks can replace tool output, are listed under [Other tools](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#other-tools).

- Learned secrets match as whole tokens. One embedded mid-token, such as in a URL path, passes unless a vendor pattern catches it.
- A learned shape also matches a non-secret with the same prefix and similar length. Check the shape `init` shows before confirming.
- With the heuristic on, a high-entropy identifier that mixes case and digits (some tool or request ids) may be redacted. The 4-character hint makes these easy to spot.
- Every pattern scans the full output in turn, after a substring prefilter. Multi-megabyte output adds noticeable latency per call.
- Commands typed at the Claude Code prompt with `!` are not tool calls. Their output reaches the model unscrubbed.

- [Reference](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md) : install methods,`init` , every pattern, configuration and commands.
- [Architecture](https://github.com/svn-arv/redacted/blob/main/docs/ARCHITECTURE.md) : how the code fits together.
- [Benchmark](https://github.com/svn-arv/redacted/blob/main/docs/BENCHMARK.md) : recall and precision on the test corpus.
- [Contributing](https://github.com/svn-arv/redacted/blob/main/CONTRIBUTING.md) : development, adding a detection rule and releasing.

MIT
