Maintain Agent Governance Files
Scope: $ARGUMENTS
Keeps agent governance files synchronized with codebase state. Detects stale references, missing updates, and promotion candidates.
Governance Files
| File | Authority | Purpose |
|---|---|---|
AGENTS.md |
Behavioral | Rules, role boundaries, compliance requirements |
CONTRIBUTING.md |
Technical | Workflows, commands, coding standards |
AGENT_LEARNINGS.md |
Knowledge | Accumulated patterns and solutions |
AGENT_REQUESTS.md |
Escalation | Active blockers requiring human input |
When to Use
- After PRs that change project structure, commands, or patterns
- At sprint start/end for governance health check
- When promoting patterns from
AGENT_LEARNINGS.mdto.claude/rules/ - After
make validatepipeline or Makefile changes - When adding/removing skills or plugins
Modes
audit (default)
Scan governance files for staleness and inconsistencies.
Checks:
- Stale paths: Grep governance files for
src/,docs/,tests/paths. Verify each path still exists. - Stale commands: Parse
CONTRIBUTING.mdcommand reference table. Verify eachmakerecipe exists inMakefile. - Missing learnings: Check recent git log for patterns not yet in
AGENT_LEARNINGS.md. Ifralph/docs/LEARNINGS.mdexists, check it too. - Resolved requests: Check
AGENT_REQUESTS.mdentries — flag any whose referenced files/issues no longer exist. - Role boundary drift: Verify AGENTS.md role definitions match current
.claude/skills/inventory.
Output: Findings table with file, line, issue type, description.
sync
Fix staleness found by audit. For each finding:
- Propose the specific edit
- Apply on user approval
- Follow priority order: AGENTS.md > CONTRIBUTING.md > AGENT_LEARNINGS.md > AGENT_REQUESTS.md
promote
Evaluate AGENT_LEARNINGS.md entries for promotion per the criteria in
.claude/rules/compound-learning.md (3rd occurrence → rule, recurring → skill).
Procedure:
- Read
AGENT_LEARNINGS.mdentries - Grep codebase for each pattern's problem statement
- If pattern appears in 3+ locations or has been referenced in 3+ commits,
recommend promotion to
.claude/rules/ - Draft the rule file content for user approval
full
Run all three modes in sequence: audit → sync → promote.
Maintenance Priority Order
When multiple files need updates, follow this order to prevent hierarchy conflicts:
- AGENTS.md — behavioral rules first (highest impact)
- CONTRIBUTING.md — technical standards second
- AGENT_LEARNINGS.md — patterns third (high-value, low-risk)
- AGENT_REQUESTS.md — escalations last (time-sensitive, not structural)
References
docs/howtos/maintaining-agents-md.md— full strategy document.claude/rules/compound-learning.md— promotion path- CONTRIBUTING.md "Documentation Hierarchy" — authority structure
- AGENTS.md "Decision Framework" — anti-redundancy rules