tokenhunt

Catch secrets at chat time, not commit time.

secret scanning for the agentic era

By the time you run git commit, your key has been sitting in the agent transcript for 30 minutes — indexed, synced, maybe re-emitted by a later tool call. token-hunt fires while it's happening.

$pip install token-hunt# v0.1.0 · zero cloud · fail-closed
$claude plugin install token-hunt@tokenhunt# the six-hook guard

Scanners watch git.
Your keys live in chat.

gitleaks and trufflehog scan history. The transcript is the new leak surface — pastes, file reads, tool output. token-hunt hooks the agent runtime itself, at all six points a secret can enter.

token-hunt watch catching an Anthropic API key leak in real time, then scan reporting the finding with a rotate URL

01 Six hooks. Every entry point.

hookwhat it seesaction on leak
UserPromptSubmityour pasteWARN
PreToolUse:Bashcommand about to runBLOCK
PostToolUse:Bashcommand outputWARN + log
PostToolUse:Readfile contentsWARN + log
PreToolUse:Edit/Writenew file contentBLOCK
PostToolUse:Edit/WriteechoWARN + log

02 Catches what regex can't.

Bash evaluates secrets into emitted text with no literal in sight. token-hunt runs a runtime detector for the escape-hatch class — no other scanner sees it.

BLOCKED

echo ${ANTHROPIC_API_KEY:+SET}
${ANTHROPIC_API_KEY:-UNSET}

both branches run — the value leaks

BLOCKED

echo $GITHUB_TOKEN

direct echo of a secret var

ALLOWED

[ -n "$ANTHROPIC_API_KEY" ] \
&& echo SET

status check — no value emitted

03 Three shapes. One hunt.

01token-huntfree · BUSL-1.1The engine. CLI (scan / list / close / watch), six hooks with block-and-rotate behavior, the allowlist, and the bash escape-hatch runtime detector no regex can see.→02pat-scannerfree · MITThe one-command plugin. One hook, 13 credential classes, regex matching. Install it and you're covered. The guard, without the workflow.→03token-hunt-procommercialSilent redaction — the agent never sees the raw value. Active verification — checks whether a found key is actually live against GitHub, Stripe, and Slack. Offline ed25519 licensing. Zero phone-home.→

265 rules · 51 providers built in

04 Measured, not marketed.

Three chat-time vectors, synthetic fixtures, fake values only, one OS. Commit-time scanners evaluate after the secret has already been sent to a model; the numbers below are what that gap looks like in practice.

vectortoken-hunt 0.1.1gitleaks 8.30.1trufflehog 3.97.9
pasted secret in chat (10 keys)10/109/106/10
bash escape-hatch (7 shapes)7/70/70/7
.claude/settings.local.json (5 keys)5/51/53/5
59 benign lines (false positives)14 — all low-confidence entropy; 0 at ≥ 0.500

escape-hatch runs at the PreToolUse:Bash detection point; the other tools return zero findings on the same file at any setting.

3.2% vs 1.5% — AI-assisted commits leak at twice the baseline rate. GitGuardian, State of Secrets Sprawl 2026

2,539 keys — persisted into.claude/settings.local.json across 1,994 repos that traditional scanning missed. Apiiro, Nov 2026

+81% YoY — 1.27M AI-service credentials leaked in 2025.GitGuardian 2026