Repository navigation
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.