agenttrail-scrub-lite: scan Claude Code transcripts for leaked secrets
Claude Code saves every session transcript as local JSONL under ~/.claude, including any API key, token or .env value that passed through the terminal or a pasted file. agenttrail-scrub-lite helps you find those secrets with a read-only scan using only the standard library: it reports where they are and never modifies your files.
Need to scan other AI coding agents, redact secrets in place, or get a per-provider rotation checklist? That is the full AgentTrail Scrub (one-time payment, yours to keep, no subscription). A table later in this README lists what lite does and what the paid tool adds. Or get every PyForge tool, current and future, with the All-Access Pass ($99, one payment).
- One file, Python 3.9+. Nothing to
pip install. - Default target:
~/.claude/projects/**/*.jsonl(override with--path). - Masked previews only; exit code
1when at least one secret pattern is reported.
Install
curl -fsSLO https://raw.githubusercontent.com/alessio1999xx-debug/agenttrail-scrub-lite/main/agenttrail_scrub_lite.py
chmod +x agenttrail_scrub_lite.py
python agenttrail_scrub_lite.py --help
Where Claude Code stores transcripts (and why secrets end up there)
Claude Code keeps project session logs under ~/.claude/projects/, usually as .jsonl files (one JSON object per line). Anything you typed, pasted, or that an agent echoed — including export lines, .env snippets, and provider tokens — can sit there in plaintext. Sharing a transcript, opening a bug report, or syncing that folder to a backup is how keys leak.
agenttrail-scrub-lite walks that tree (or a path you pass), opens each .jsonl as text, and matches common patterns for provider credentials. It does not claim to find every possible secret.
Patterns currently checked:
| Provider / kind | Example shape (not a real key) |
|---|---|
| Anthropic API key | sk-ant-api03-… |
| Anthropic legacy key | sk-ant-… |
| OpenAI API key | sk-… / sk-proj-… |
| Google Gemini / Cloud | AIzaSy… |
| GitHub PAT / OAuth | ghp_ / gho_ / … |
| GitHub fine-grained | github_pat_… |
| AWS access key id | AKIA… / ASIA… |
| AWS secret access key | aws_secret_access_key=… |
| Stripe secret / restricted | sk_live_ / sk_test_ / rk_… |
| Slack token | xoxb- / xoxp- / … |
| Private key header | -----BEGIN … PRIVATE KEY----- |
| JWT | eyJh….….… |
Generic .env assignment |
API_KEY= / TOKEN= / … |
Scan Claude Code logs for API keys and tokens
# default: ~/.claude/projects
python agenttrail_scrub_lite.py
# one project folder or a single .jsonl file
python agenttrail_scrub_lite.py --path ~/.claude/projects/my-encoded-path
python agenttrail_scrub_lite.py --path ./session.jsonl
Example output, recorded 25 Nov 2026 (Europe/Rome) on a throwaway sample JSONL. The token is fake and is shown only as a masked preview. Exit code 1.
================================================================================
AGENTTRAIL-SCRUB-LITE SCAN REPORT
================================================================================
Target : session.jsonl
JSONL Files Scanned : 1
Findings : 1
Secrets Reported : 1
--------------------------------------------------------------------------------
Findings (1 total):
1. Provider : OpenAI API Key
Path : session.jsonl
Line : 1
Preview : sk-p...aaa
Details : OpenAI API Key match (masked preview)
================================================================================
Read-only scan. No files were modified. Rotate any real credentials at the provider.
The report lists provider, file path, line number and a masked preview (abcd...xyz). Nothing is written back to disk. If matches appear, rotate the real credentials at the provider — this tool only helps you find them.
Run it before sharing a transcript or a bug report
python agenttrail_scrub_lite.py --path ./transcript-to-share.jsonl
echo $? # 0 = no common patterns found; 1 = at least one match
Use the exit code in a pre-share checklist or a local hook so you do not paste a log that still holds keys.
agenttrail-scrub-lite vs AgentTrail Scrub (redact and clean)
agenttrail-scrub-lite checks Claude Code JSONL transcripts only, with regex patterns and a text report. It is read-only.
| Capability | Lite (free) | Paid AgentTrail Scrub |
|---|---|---|
| Default scan target | Claude Code ~/.claude/projects (override with --path) |
Discovers Claude Code, Cursor, Gemini CLI, Aider, Codex, Continue.dev and Open Interpreter, plus any --paths you pass |
| Detection | Regex patterns (Anthropic, OpenAI, Google, GitHub, AWS, Stripe, Slack, JWT, private-key headers, .env-style assignments) |
Regex plus Shannon entropy checks |
| Redact secrets in the files | No (read-only) | Yes (--redact, with a backup first) |
| Allowlist for known-safe values | No | Yes (--allowlist) |
| Retention / cleanup of old transcripts | No | Yes (--apply-retention, --retention-days) |
| Per-provider rotation checklist | No | Yes (--rotation-guide) |
| Output | Plain text | Text or JSON (--json) |
One-time payment, yours to keep. No subscription. Full tool: AgentTrail Scrub. Or get every PyForge tool, current and future, with the All-Access Pass ($99, one payment).
Need more?
Need the full version? AgentTrail Scrub on PyForge: https://py-forge.com/products/agenttrail-scrub-ai-transcript-secret-cleaner?utm_source=github&utm_medium=readme&utm_campaign=agenttrail-scrub-lite
Or get every PyForge tool, current and future, with the All-Access Pass: https://py-forge.com/pass?utm_source=github&utm_medium=readme&utm_campaign=agenttrail-scrub-lite
Tests
python3 test_agenttrail_scrub_lite.py
More free tools from the same author
- agentconfig-audit-lite — Audit MCP config for secrets: plaintext tokens and unpinned npx/uvx servers in
.mcp.jsonandCLAUDE.md. - cronpulse-lite — Cron job monitoring in one Python file: alerts to Slack/Discord/webhook on failure or hang.
- depcooldown-lite — Dependency cooldown check: fail CI when a pinned PyPI or npm package is newer than N days.
- homelab-doctor-lite — Read-only homelab health check: stale images, exposed ports, expiring certs, silent cron, disk.
- imagenudge-lite — Docker image update checker: find running containers with a newer image (digest or tag).
- pthguard-lite — Scan Python site-packages for malicious
.pthfiles and startup backdoors. - pulseping-lite — Check SSL certificate expiry and URL/port uptime from cron.
- secenv-lite — Find
.envfiles committed to git or missing from.gitignore, plus obvious API keys inside.
License
MIT (this lite version). The full AgentTrail Scrub tool is sold separately under its own license.
Metadata
Release files for agenttrail-scrub-lite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agenttrail_scrub_lite-0.1.0.tar.gz | 8.4 kB | With provenance | Details for agenttrail_scrub_lite-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agenttrail_scrub_lite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for agenttrail_scrub_lite-0.1.0-py3-none-any.whl |
Total release size: 17.5 kB
Release files / agenttrail_scrub_lite-0.1.0.tar.gz
| Download URL | agenttrail_scrub_lite-0.1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b6c7322820a4fd4ffd47a5052300642f0af7efaf3dc0c0042c3b5e67dab6162
|
|
BLAKE2b-256 checksum How to use checksums |
d9df6af7d3ff0fb5efb95d3a116b5376902de495b126eb658f40d493f0e58d26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / agenttrail_scrub_lite-0.1.0-py3-none-any.whl
| Download URL | agenttrail_scrub_lite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0391099be93a65cb569705c60e6df2f3b99cd343d4bca4356edfd7825350bca
|
|
BLAKE2b-256 checksum How to use checksums |
427882492a3758ce2b09cebb515e729a2201788a2023a611cfa20166356f02fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for agenttrail-scrub-lite 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agenttrail_scrub_lite-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.