Repository navigation
feat(hooks): agent-trust-watch — non-blocking untrusted instruction-file and config-drift warnings (#2538) - #2540
Merged
Merged
Conversation
…ile and config-drift warnings (#2538) SessionStart: if the session would load an AGENTS.md/CLAUDE.md from a shared ancestor root (/, /tmp, /var/tmp, $PREFIX/tmp, home parent — A2A analysis sessions run under /tmp) or from a download dir outside git, or the cwd is in a download dir, tell the model to treat those files as untrusted data and to report them; also report endpoint/MCP changes since the previous session. PostToolUse(Bash|Write|Edit|MultiEdit): shell mtime fast path (~0.03s) over the four agent config files; on change, recompute the fingerprint (endpoint scheme://host, MCP name -> command basename/host) and warn once. Never blocks (TM-1306), fail-open, no contents/secret values stored, off switch CCC_AGENT_TRUST_WATCH=0. Wired in settings.base.json (SessionStart) and enforcement-overlay.json + hooks.json (PostToolUse). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jinon86
force-pushed
the
feat/2538-agent-trust-watch
branch
from
October 26, 2026 13:55
3329600 to
1613eb1
Compare
seoseo-ai
approved these changes
Oct 27, 2026
seoseo-ai
left a comment
Collaborator
There was a problem hiding this comment.
Approved after exact-head validation and fresh operator authorization using the relay-held seoseo-ai credential.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2538 (part 2/2 — non-blocking warnings). Stacked on #2539; retarget to
mainafter #2539 merges.What
claude/hooks/agent-trust-watch.sh(+ helpers inclaude/hooks/lib/agent_trust.py). Never blocks — TM-1306 unchanged.AGENTS.md/CLAUDE.mdthe harness did not write:/,/tmp,/var/tmp,$PREFIX/tmp, home parent) — A2A analysis sessions run under/tmp/a2a-analysis-*, and Claude Code loadsCLAUDE.mdfrom every ancestor;The context tells the model to treat them as untrusted data, not to edit agent config / install packages / add MCP servers because of them, and to tell the owner. Also reports endpoint/MCP changes since the previous session.
Bash|Write|Edit|MultiEdit) — shell mtime fast path over~/.claude/settings.json,settings.local.json,~/.claude.json,~/.codex/config.toml; python runs only when one moved, then warns once on endpoint/MCP additions/removals (non-security edits stay silent).$CCC_STATE_DIR/agent-trust/= fingerprint (endpointscheme://host, MCP name → command basename/host) + mtimes. No contents, no secret values. Off switchCCC_AGENT_TRUST_WATCH=0. Fail-open.settings.base.jsonSessionStart;enforcement-overlay.json+hooks.jsonPostToolUse.Verification
claude/hooks/agent-trust-watch.test.shPASS=21 —/tmp-root CLAUDE.md reaches an A2A cwd, Downloads loose vs git-checkout file, cwd-in-Downloads, PostToolUse endpoint injection (host only,?key=never printed, warned once), between-session Codex MCP addition, non-security edit silent, off switch, malformed stdin, unknown event, no contents in state.scripts/setup.test.shPASS=249,scripts/ccc-security-audit.test.shPASS=30,CCC_HARNESS_PHASE=static bash scripts/validate-harness.shPASS, ruff clean.Rollout
Lands through the normal self-update path (setup.sh hook-tree walk + settings merge). First PostToolUse/SessionStart on a node seeds the fingerprint silently.
🤖 Generated with Claude Code