---
id: protect-agent-config
track: coding
version: 0.7.8
label: blocks
keyword: block
where: command write turn-end
sha256: c3abb21054f2c25ff384be581f31c5c9473aa65119acdaf37c404c7afc8e86c4
source: https://github.com/open-coder-ai/chock-catalog/tree/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4/base/protect-agent-config
catalog_ref: e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4
---

# Protect Agent Config

protect-agent-config · version 0.7.8

Blocks — Refuses a matched shell command before it runs. Blocks on an agent's file writes and at turn end. Chock adds friction. It is not a security boundary. 

In a git repo: in agent (The agent's hooks check this once chock sync sets them up. If the hook crashes, the action goes through.)



## What it does

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.

## Its label on each agent

- Claude Code (tested): Blocks — Refuses a matched shell command before it runs. Blocks on an agent's file writes and at turn end. Builder: /coding/builder/#client=claude-code&p=protect-agent-config
- Cursor (tested): Blocks — 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. Builder: /coding/builder/#client=cursor&p=protect-agent-config
- Codex (tested): Blocks — 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). Builder: /coding/builder/#client=codex&p=protect-agent-config
- GitHub Copilot (tested): Blocks — 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). Builder: /coding/builder/#client=copilot&p=protect-agent-config
- Devin (tested): Blocks — 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). Builder: /coding/builder/#client=devin&p=protect-agent-config
- Grok (tested): Not graded yet for Grok. Builder: /coding/builder/#client=grok&p=protect-agent-config
- goose (tested): Not graded yet for goose. Builder: /coding/builder/#client=goose&p=protect-agent-config
- Antigravity (tested): Not graded yet for Antigravity. Builder: /coding/builder/#client=antigravity&p=protect-agent-config
- OpenHands (untested): Not graded yet for OpenHands. Builder: /coding/builder/#client=openhands&p=protect-agent-config
- Kimi Code (untested): Not graded yet for Kimi Code. Builder: /coding/builder/#client=kimi-code&p=protect-agent-config
- Factory Droid (untested): Not graded yet for Factory Droid. Builder: /coding/builder/#client=factory-droid&p=protect-agent-config

## What it misses

User config under ~/.config/, writes a script makes, an existing hard link.

## Examples

- Refused: An agent rewrites its own permission file in place. — `sed -i s/deny/allow/ .claude/settings.json`
- Allowed: An agent reads its permission file. — `cat .claude/settings.json`

## Latest change

0.7.8 · 2026-11-07 — 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.

## Provenance

- Tested by 1623 of 1623 cases run automatically
- SHA-256: `c3abb21054f2c25ff384be581f31c5c9473aa65119acdaf37c404c7afc8e86c4`
- Catalog commit: https://github.com/open-coder-ai/chock-catalog/commit/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4
- Source: https://github.com/open-coder-ai/chock-catalog/tree/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4/base/protect-agent-config (catalog path `base/protect-agent-config`)
- Presets: Agent configuration
- JSON: `/api/coding/policies/protect-agent-config.json`
- Report a problem: https://chock.sh/report/?policy=protect-agent-config&version=0.7.8&page=%2Fcoding%2Fpolicies%2Fprotect-agent-config%2F
