{
  "schema_version": 1,
  "id": "protect-agent-config",
  "track": "coding",
  "name": "Protect Agent Config",
  "version": "0.7.8",
  "sha256": "c3abb21054f2c25ff384be581f31c5c9473aa65119acdaf37c404c7afc8e86c4",
  "sha256_v1": "1403b717aef14c5e90fcf505bddf60ae0676630619c57f204cdb4de0725fcd5e",
  "keyword": "block",
  "word": "blocks",
  "says": "refuses a matched shell command before it runs. Blocks on an agent's file writes and at turn end",
  "description": "Stops an agent editing its guardrails (MITRE ATLAS AML.T0081). Shell guard refuses writes to AGENTS.md, whole agent folders (.claude/, .cursor/, .codex/, .gemini/, .agents/, .chock/, ...), MCP/hook client configs (.mcp.json, ...), guardrails toggles, plugin install markers, chock.lock, hook files of Cline, Kiro, Augment, Windsurf and Devin (user and machine level), ~/.claude.json, Claude Code plugin roots, project config of Kilo Code, opencode, Factory, Amp, Continue and Goose, .git/{hooks,config}, policy implementations/: redirect, rm/mv/tee/sed -i, cp into, git checkout/restore, a write through a symlink; CLAUDE_CODE_PLUGIN_DIRS, claude --plugin-dir, chock resume (best effort). Any case. An instruction file under docs/ asks a person. Coarse: also eval or sh -c of computed text, shells fed by pipe/variable, interpreter one-liners naming such a path. Reads, `chock sync` pass. Edit/Write: tool gate, same set and verdicts. Misses: user config under ~/.config/, writes a script makes, an existing hard link.",
  "misses": "user config under ~/.config/, writes a script makes, an existing hard link.",
  "where": [
    "command",
    "write",
    "turn-end"
  ],
  "groups": [
    "agent-config"
  ],
  "eval_cases": 1623,
  "eval_executed": 1623,
  "latest": {
    "version": "0.7.8",
    "date": "2026-11-07",
    "change": "Behaviour change, a false positive fixed (IR-F64; eval cases tc-1613 to tc-1623; tests in test_protect_agent_config_readonly.py). The read 0.7.7 allows as a `python3 -I -` here-document was still refused as a one-liner, `python3 -I -c \"import json; print(json.load(open('~/.claude/projects/...')))\"`: the `-c` code was judged by every string it named, by the shared shell reader's interpreter rule, pathwriters.interpreter and the pathopaque backstop. Now `python[...] -I [-EsSBuqOP flags] -c CODE` (or `-Ic`), with CODE the last argument, is judged by the same `pathpy` test (`pathpy.inline`): when CODE is in the 0.7.7 read-only subset, the quoted paths it passes straight to a read-mode `open()` leave the judged text. The conditions are those of 0.7.7: -I is required, the interpreter is the whole line (no `VAR=`, `env` or other launcher, `export`, `cd` or pipe), and the subset is unchanged; CODE holding `$` or a backquote, which the shell may expand, is never read-only. The shared shell reader is unchanged: this policy hands it the command with the judged code. The protected paths are unchanged, and so is every write: `-c` code that opens for writing or imports `os`, the read without `-I` or with `PYTHONPATH=` set, its output redirected or piped to `tee` on a protected path are refused."
  },
  "agent_labels": {
    "claude-code": {
      "keyword": "block",
      "says": "refuses a matched shell command before it runs. Blocks on an agent's file writes and at turn end"
    },
    "cursor": {
      "keyword": "block",
      "says": "refuses a matched shell command before it runs. Where its description says it asks, it asks. Blocks on an agent's file writes and at turn end. Where its description says it asks, it refuses at both points, because this client cannot prompt at either point"
    },
    "codex": {
      "keyword": "block",
      "says": "refuses a matched shell command before it runs. Where its description says it asks, it refuses, because this client cannot prompt before a shell command. Blocks on an agent's file writes and at turn end. Where its description says it asks, it refuses at both points, because this client cannot prompt at either point. If the hook errors, the action goes through (not witnessed; the vendor's row is only partly live-run)"
    },
    "copilot": {
      "keyword": "block",
      "says": "refuses a matched shell command before it runs. Where its description says it asks, it asks in VS Code and refuses in Copilot CLI, because it cannot prompt there. Blocks at turn end only. It does not check a file write when it happens. Where its description says it asks, it refuses at turn end, because this client cannot prompt there. If the hook errors, the action goes through (not witnessed; the vendor's row is only partly live-run)"
    },
    "devin": {
      "keyword": "block",
      "says": "refuses a matched shell command before it runs. Where its description says it asks, it refuses, because this client cannot prompt before a shell command. Blocks at turn end only. It does not check a file write when it happens. Where its description says it asks, it refuses at turn end, because this client cannot prompt there. If the hook errors, the action goes through (vendor docs only, not witnessed)"
    },
    "grok": {
      "keyword": "ungraded",
      "says": "Not graded yet for Grok"
    },
    "goose": {
      "keyword": "ungraded",
      "says": "Not graded yet for goose"
    },
    "antigravity": {
      "keyword": "ungraded",
      "says": "Not graded yet for Antigravity"
    },
    "openhands": {
      "keyword": "ungraded",
      "says": "Not graded yet for OpenHands"
    },
    "kimi-code": {
      "keyword": "ungraded",
      "says": "Not graded yet for Kimi Code"
    },
    "factory-droid": {
      "keyword": "ungraded",
      "says": "Not graded yet for Factory Droid"
    }
  },
  "source_url": "https://github.com/open-coder-ai/chock-catalog/tree/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4/base/protect-agent-config",
  "enforces": "best-effort (pre-tool-use, once hooks are installed; fails open if the hook crashes)",
  "examples": [
    {
      "word": "Refused",
      "prompt": "An agent rewrites its own permission file in place.",
      "command": "sed -i s/deny/allow/ .claude/settings.json"
    },
    {
      "word": "Allowed",
      "prompt": "An agent reads its permission file.",
      "command": "cat .claude/settings.json"
    }
  ]
}
