Every AI coding agent writes the secrets you paste straight to a plaintext history file — and nobody scans it
Source Reddit Cybersecurity
Discussion
Many AI coding agents store user inputs, including sensitive secrets like API keys and credentials, in local plaintext history files. These histories are reused as context by the agents, causing secrets to persist indefinitely on disk. There is currently no widespread scanning or auditing of these files for leaked secrets. An open-source tool named agentsweep has been developed to detect and redact secrets from these local history files for multiple AI coding agents, helping to mitigate this exposure risk.
r/cybersecurity (opens in a new tab)u/Ishannaik0 points0 comments
Pen-testers and blue-teamers: your devs are pasting API keys, DB URLs, .env contents, and cloud creds into Claude Code / Cursor / Copilot chat all day. Those tools log the conversation to a local plaintext file — and re-read it as context, so the secret keeps resurfacing long after.
I wrote an open-source CLI (agentsweep) that:
- Scans agent history with ~191 detection rules (ported from gitleaks) plus a BIP-39 seed-phrase detector
- Covers ~30 agents (Claude Code, Cursor, Codex, Cline, Aider, Windsurf, and more)
- Redacts in place with atomic writes, .bak backups, post-write validation, and full undo
- Read-only by default; nothing destructive without a typed confirm
Curious how your orgs currently handle secrets leaking into AI-tool history, and whether anyone is auditing it yet.
Links cited in the discussion
Also discussed in r/cybersecurity