AgentSweep CLI

A command-line tool that finds secrets in local AI agent history and redacts them while keeping JSONL structure intact.

  • 88 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • Edits agent history files in place, though it makes backups first
  • The report prints found secrets, so it should not be pasted into chats
All reasons and checks

ishannaik/agent-sweep

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/agentsweep

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Edits agent history files in place, though it makes backups first
  • The report prints found secrets, so it should not be pasted into chats

This is third-party code. Review the repository files before installing.

What it does

AgentSweep reads the conversation history that coding agents keep on disk, such as `~/.claude/projects/` for Claude Code and `~/.codex/sessions/` for Codex, and looks for secrets: cloud keys, `.env` contents, database URLs. The README claims support for 32 agents, with some sources marked as not yet verified on a real install. The pipeline has five stages: directory walk, matching against 207 regex rules plus a BIP-39 wordlist, a report, redaction and a list of keys to rotate with each provider's revocation link. `scan` stops at the report, `fix` goes through redaction. Everything runs locally with no network calls.

Who it is for. Developers who pasted real keys into agent chats and want to clean the accumulated history.

Good fit when

  • Before a work machine goes to repair or is handed to another person, agent history needs a check.
  • After news of a malicious package that steals files from disk, agent history is inspected for leaks.
  • A key from `.env` was pasted into an agent chat and must be found and redacted.
  • Redaction damaged a history file, and files are restored with `agentsweep undo`.

Not a fit when

  • The key already reached the model provider: the tool cleans only local files, and the key itself must be revoked.
  • Protection before a leak is needed: the tool works after the fact and does not intercept input.
  • The agent keeps history in the cloud or in a format missing from the supported list.

Example request

Scan Claude Code and Codex history for secrets, show the report and redact nothing without my confirmation.

Limitations

Needs Python 3.11 or newer; the recommended install is `uv tool install agentsweep`. The tool edits history files in place, so before redaction it creates `.bak` backups, validates JSONL structure after writing and refuses symlinks. For 13 sources, including Warp, Zed and Junie, storage paths come from research and are not verified on a real install, so some secrets may go unnoticed. It does not revoke keys already sent to a provider.

How to disable. Remove the package with `uv tool uninstall agentsweep`. Delete `.bak` backups in history directories by hand.

FAQ

How do I run it without installing?

With `uvx agentsweep@latest`. A permanent install uses `uv tool install agentsweep` or `pipx install agentsweep`.

What happens to files during redaction?

Writing is atomic, a `.bak` copy is kept beside the file and JSONL structure is validated afterwards. Changes roll back with `agentsweep undo`.

Does any data leave the machine?

No, the tool is local and makes no network calls. It does not affect keys that already reached the model provider.

What should I do after keys are found?

Revoke and replace them: the report gives a revocation link for each provider. Redaction in history alone does not close access.

What does the short `asweep` command do?

It is an alias for `agentsweep`. Running it with no arguments opens an interactive menu that walks through every stage.

Discussion

No questions or reviews yet.

CLI tools

agent-secrets lends keys to an AI agent for a limited time: age encryption, TTL leases, an access log and an emergency revoke.

CLIBroad access114Repository stars

AgentShield audits the .claude folder for plaintext keys, broad permissions, dangerous hooks and risky MCP servers and grades the setup from A to F

CLIExtended access1.4KRepository stars

A local guard for coding agents: blocks secret writes and force pushes to main, warns about risky commands.

CLIExtended access156Repository stars

AgentGuard checks a coding agent's actions before they run and scans third-party skills for secrets, backdoors and injections.

PluginExtended access494Repository stars

A static scanner for vulnerabilities in AI agent code and MCP configs with 66 rules mapped to OWASP Agentic Top 10

CLIExtended access245Repository stars

sofagent audits changes made by an AI agent against rules and leaves a log and a snapshot for rollback.

SkillExtended access55Repository stars

README in short

Describes the problem of secrets kept in agent history, the pipeline stages, installation and optional `google-re2` acceleration.

README badge

Report a problem