Protected Rule Files
Agents can't commit changes to the files that govern them (review rules, CI, ownership, agent instructions); those changes need extra human approval.
Problem
Coding agents work under rules kept in the repository: the project memory file, review rules, CI workflows, code-owner lists, approval policies and git hooks. If an agent can edit those files as part of ordinary work, a fix can quietly loosen the checks that were meant to catch it, such as skipping a failing test in CI or deleting a review rule that kept flagging its change. A comment or PR text can also nudge an agent into doing exactly that.
- Rule files sit in the same repo agents are allowed to change.
- Some legitimate tasks do require editing CI or agent instructions.
- Anyone who can merge can edit these files, so the risk isn’t only agents.
- Checks an agent can turn off are not checks.
Solution
Treat the files that govern agents as protected. Unattended agents are blocked in tooling from committing to them: agent instruction files, review rules, approval policy, CI workflows, code-owner lists and git hooks. When a change to them is genuinely needed, a person commits it in its own PR, and the approval policy requires stricter review for those paths, such as two people or a code owner. Enforce required checks in CI and branch rules rather than in local hooks an agent’s commits can skip. Review changes to these files with the same care as CI changes.
Diagram
Agents can change the code but not the rules that judge the code. Rule changes take a separate, stricter path.
When to use
Use it when
- Agents commit to repos unattended
- Review rules, CI or agent instructions live in the repo
- Approval or review policies rely on files in the repo
- Agents read PR comments that outsiders can write
Avoid it when
- Repos where agents only suggest changes and never commit
- When the protection would also block the people who maintain CI; give them a clear path instead
Trade-offs
Gains
- Agents can't weaken the checks on their own work
- Rule changes are visible and deliberate
- Limits injected through comments or PR text have less reach
Costs
- Slower edits to CI and rule files
- Protected path lists need upkeep
- Can frustrate legitimate maintenance if the human path is unclear
Worked example
A PR steward is fixing a failing integration test on a Linkwatch PR. The test times out in CI.
- StewardAfter two attempts, the fastest way to green is raising the CI timeout in the workflow file. The tooling blocks the commit because the workflow file is protected.
- EscalateThe steward reports to the author: the test is slow because of a missing index, and raising the timeout would need a person.
- AuthorAdds the index instead. The test passes within the original timeout.
- LaterA platform engineer does want a longer timeout for a different job. She commits it in its own PR, and the approval policy requires a second person for
.github/paths.
Failure modes
| Failure | Symptom | Mitigation |
|---|---|---|
| Incomplete list | Agent edits a hook or policy file that wasn't listed | Protect by folder, such as all of `.github/` and agent config folders |
| Local-only enforcement | Checks live in git hooks that agent commits bypass | Enforce required checks in CI and branch rules |
| Human bypass | Rule changes ride along in a large feature PR | Approval policy requires stricter review for rule paths |
| Blocked maintenance | Nobody knows how to change CI legitimately | Document the human path for rule changes |