Repository navigation
Releases
AgentDetox 0.6.0
AgentDetox 0.6.0 adds an optional model check. It is off by default; with it off, 0.6.0 behaves as 0.5.0 does apart from two fixes. Upgrade the executable and, if installed, the Claude Code plugin, run agentdetox --version and agentdetox doctor, then start a fresh client session.
- A model's reading of each write (optional).
agentdetox config judge ask(orrecord) has a small model read the text a write adds to memory, rules or skills for what it would make the agent do. It is asked through the Claude Code you are logged in to, in a session with no tools, no MCP servers and none of your settings. It is asked after the rules and takes no question or refusal away. A flagged text stays flagged (the last 5,000 flags are kept). The text is sent to the model; see PRIVACY.md. It costs a model call of two to four seconds per write and sends that text to the model. - It says which lines. The question, the session notice,
review,agent inspectand the preview ofcleanname the lines the model pointed at. - Files that arrive outside the agent. With the check on, a session start reads what changed outside the agent, and
agentdetox agent inspect --judgereads every memory, rules and skill file on request. - Fixed on Windows:
clean,restoreand quarantine failed in folders deep enough to pass 260 characters.
Measured with real calls: 208 of 210 attack texts flagged across three sets (the rules alone stop about a third), with 6 of 210 short ordinary texts and 3 of 120 whole ordinary files flagged. It is not certain and not proof against a text written to persuade it. Measurements and what they do not say
Claude Code remains the supported hook integration. Codex and Cursor hooks are experimental. The release-candidate Claude Code lab, with the model check off, passed 9 of 12 scenarios with AgentDetox installed; two failures were the client's or the model's own, and in one run of five a later memory write naming a non-default registry was saved after the first attempt was asked about. Lab results
AgentDetox 0.5.0
AgentDetox 0.5.0 fixes security issues that could let protected memory, client configuration or AgentDetox trust settings change without the expected approval. Upgrade the executable and, if installed, the Claude Code plugin. Run agentdetox --version and agentdetox doctor, then start a fresh client session. Security advisory
- Check previously existing files with
agentdetox agent inspect. Review the findings, preview removal of selected lines, and keep unrelated edits and a recovery copy. - Inspect larger memory folders with
agentdetox library scan <folder>. Rescan after upgrading so the inventory uses the current detection rules. - Protected writes that cannot be checked now ask for approval, or are refused on clients without approval prompts. Reinstalling hooks checks existing files for outside changes before updating settings.
- The default installation has a smaller dependency set. Install
agentdetox[kb]for knowledge-base passage comparison or retainagentdetox[nli]for local contradiction detection.
Claude Code remains the supported hook integration. Codex and Cursor hooks are experimental. OpenClaw supports local file inspection and recovery. The release-candidate Claude Code lab passed 23 of 24 scenario/arm checks. One verbatim-edit check failed, with no AgentDetox interruption in the seven attempts at that scenario. Lab results
AgentDetox 0.4.1
AgentDetox 0.4.1 improves everyday use, large-write latency, and recovery from contaminated context. It remains a preview release and is not a security boundary or factual verifier.
- Selectively remove contaminated added lines while preserving benign content and later edits; preview, version checks and quarantine protect recovery.
- Keep Claude runtime caches and cosmetic settings changes quiet while guarding executable configuration.
- Reuse provenance indexes and analyze outside the global store lock, with version checks before committing history.
- Load fewer modules for hooks and queue observed bytes for background contradiction checks.
- Add frozen acceptance cases, concurrent-write checks, wheel lifecycle checks and real-client scenarios.
On the reference Mac, the initial 100-sample run passed all 12 latency budgets: ordinary Bash pre/post P95 145.6 ms, a 100-line post-write check with 3.9 MB history 95.3 ms, and four concurrent writes plus a Bash pair 491.0 ms. These exclude optional NLI inference and plugin downloads. Busy-host full reruns passed 10/12 and 11/12; the affected scenarios passed focused follow-up checks. Failed runs and paired baseline comparisons are retained in the report.
Validation includes 901 local tests passed (one skipped), two offline regression gates with declared semantic gaps, and ten latest real Claude Code scenarios passing across 13 sessions, including three retained native-sensitive-path setup failures.
See the changelog, latency protocol, accuracy limitations, and real-client results.
AgentDetox 0.4.0
A security and hardening release. An independent security review of 0.3.0 found ways to change what a Claude Code agent loads or runs without AgentDetox noticing; this release closes them and adds the attacks to the regression gallery that CI runs. Upgrading is recommended for everyone on 0.3.0. Back up the entire store, including objects/, before upgrading.
uv tool upgrade agentdetox # or: pipx upgrade agentdetox
agentdetox doctor # says if the hooks need re-registeringIf doctor (or the first session after upgrading) asks, run agentdetox install claude-code --apply. For plugin installations, run claude plugin marketplace update agentdetox and claude plugin update agentdetox@agentdetox, then restart Claude Code. The store upgrades itself to format 3 on first use and keeps the old database as ~/.agentdetox/state.v1.sqlite3; 0.3.0 cannot open the upgraded store, so to go back, reinstall 0.3.0 and put that copy back as state.sqlite3 (changes recorded since the upgrade are lost).
Security fixes
- Settings that run code. A hook or hook script, helper or status line command, MCP server, plugin, or an environment variable that loads code or redirects traffic, added outside the agent (by an install script, for example), is now mentioned once at the next session instead of being accepted silently. The notice names what was added and says there is nothing to do if you added it yourself (
claude mcp add,/plugin install); the change stays inagentdetox review. An agent changingenvor a helper command needs your approval, and setting anAGENTDETOX_*variable that way is blocked. - Files the agent loads under another name or place. Writing
claude.md(macOS and Windows ignore case), writing through a symlink, CLAUDE.md in parent folders and subfolders, output styles and.claude/hooksscripts are now checked. - Shell commands checked before they run. The check now follows
bash -c(alsobash -lcand other option bundles),eval, wrappers such asnice,sudoorxargswith their options (sudo -u root,env -u X,timeout -s KILL 10, also bundled assudo -Eu root), the folder a wrapper or git switches to (env -C .claude,sudo -D,git -C .claude,--work-tree),cd(alsocd -P) and variables earlier in the command (assuming the worse case where acdmay fail or a branch may be skipped),git checkout/restoreof files or a whole folder, a copy into a folder, which keeps the source's name (cp x/CLAUDE.md .,cp -t .claude),rm -rof a folder holding context,curl -o(also-sSLo),perl -i, inline code and shell heredocs. Where the folder can't be known in advance, the target is judged by its file name. - Notices can't be faked. Line breaks and terminal escapes in file names and flagged text are shown as
\uXXXX, so a planted file name can't add a "reviewed and accepted" line to AgentDetox's message. - A blocked store is reported. A process holding AgentDetox's lock no longer lets writes through unchecked.
- A Write whose text contained
*** Begin Patchwas treated as a Codex patch and skipped the content check.
Also
agentdetox reviewlists who made each change (the agent, copied from a named source, outside the agent, during a shell command), its size and its worst open finding.- The check right after a shell command now says when the new content was flagged, and tells the agent not to follow it.
agentdetox agent restoreuses the same journalled, stale-checked recovery asreview.- A permission rule Claude Code saves when you approve a command is recorded without a notice; logs, state files and installed packages (
node_modules,.venv) in.claude/hooksare not watched;review acceptworks on settings Claude Code rewrites at every start. agentdetox uninstall(for example when switching to the plugin) is not reported as AgentDetox's hooks being removed, and a session notice lists at most ten items per section so its guidance is never cut off.- History no longer depends on the clock (daylight saving could misattribute changes).
- Session start is faster (about 130 ms with 1,000 watched files, from 177 ms).
Evidence
- Regression gallery, run in CI (bench/ACCURACY.md), comparing released 0.3.0 with 0.4.0 on the same cases:
- shell commands: 18 of 49 → 49 of 49;
- settings changed outside the agent: 2 of 7 → 7 of 7;
- writes under another name or place: 0 of 5 → 5 of 5;
- notice injection: fail → pass.
- A replay of 7,780 distinct real agent shell commands changed one decision, a
git checkout -- .in a project with context files, which now asks; later replays of 8,640 and 8,878 after the last parser fixes changed none. - The plugin and marketplace manifests pass
claude plugin validateon Claude Code 2.1.111 and 2.1.314. - End to end with the real
claude mcp add, a plugin install, an approval during a shell command and a hook log: each settings addition is mentioned once and the rest is quiet. - An independent review exercised everyday use (MCP add/remove, plugin install and uninstall, settings edits, approvals, git, formatters, the 0.3.0 upgrade); the alarms it found that a user could not reasonably clear are fixed in this release.
- Lab: 16 real Claude Code sessions, all checks pass (lab/results).
- Hook latency: every case within budget (bench/HOOK_LATENCY.md).
Known gaps are listed in the user guide. Full list of changes: CHANGELOG.md.
AgentDetox 0.3.0
AgentDetox 0.3.0 brings a review workflow for changes to agent memory, instructions, rules and config.
- Review diffs and attribution evidence; accept an exact version or dismiss one finding.
- Preview recovery before applying it. Newer edits are protected by stale-version checks and current content is backed up first.
- Use indexed SQLite history with transactional migration, preserved original files, explicit retention and JSONL export.
- Keep hook failures and interrupted recovery visible, including disabled Claude Code hooks.
- Inspect weekly context changes with
agentdetox review --since 7d.
Upgrade with uv tool upgrade agentdetox, then try agentdetox demo and agentdetox doctor. Migration occurs on the next state-writing command or hook. Keep a backup of the entire store, including objects/; JSONL export is an inspection format, not a full backup.
Validation: 289 local tests passed with one platform skip; 13 modules type-checked. Five 100-sample hook benchmarks met their documented P95 budgets on the reference Mac. Twenty authorized real Claude Code sessions were used, including fixture and notice retests; all final scenario assertions passed. Guardrail success is reported separately from whether the user's requested task completed. See lab notes and latency results.
Claude Code remains the primary supported agent. Text attribution is inference, paraphrases remain a gap, and optional contradiction detection remains experimental.
AgentDetox 0.2.0
The first release on PyPI, and a preview. AgentDetox protects what AI coding agents remember and obey: their memory, CLAUDE.md and rules files, skills, and config. Claude Code is supported; Codex and Cursor hooks are experimental.
uv tool install agentdetox
agentdetox demoThen, inside Claude Code: /plugin install agentdetox --marketplace chriswu727/agentdetox (or agentdetox install claude-code --apply), and restart Claude Code.
What it does
- Checks every write to memory, rules, skills and config, including through shell commands. Planted instructions are blocked; changes to the agent's own hooks, MCP servers or permissions, suspicious writes, and memory copied from a web page or tool output need your approval. Text you typed or pasted yourself asks instead of being blocked.
- Notices changes made behind the agent's back, by a dependency's install script or another program, and reports them at the next session with the command that restores each file. Restores quarantine the current file; nothing is deleted.
- Records where every change came from: you, the agent, a named page or tool output it copied, or something outside the agent.
agentdetox logshows the history andagentdetox blame <file>the origin of each line. status,events,doctor,allow <id>andconfigfor day-to-day use. Contradiction detection with a local NLI model is an optional, experimental extra.
Tested in real sessions
The lab in lab/ replays attacks against real Claude Code sessions, with and without AgentDetox. An install script tampering with CLAUDE.md, a planted onboarding instruction and a registry redirect got through without AgentDetox and were stopped with it; everyday edits and "remember this" ran without a single prompt. Results: lab/results/latest.md.
Known gaps
Detection is not a security boundary, text the model rewrites in its own words can pass, and a change made outside the agent is reported at the next session rather than when it happens. The full list is in the README; where it is going is in the roadmap.
Full list of changes: CHANGELOG.md.