Skill: Condense AGENTS.md
Purpose
Root AGENTS.md files grow over time as pitfalls accumulate. This skill trims
them by migrating content to two destinations:
- Per-directory
AGENTS.md— subsystem-specific rules land in the
directory they govern (e.g., test/AGENTS.md, specs/AGENTS.md).
notes/references — pitfall write-ups that already have (or should
have) a canonical notes/ file are replaced by a single-line pointer.
Target: root AGENTS.md ≤ 400 lines.
Workflow
Phase 1 — Audit
bash .agents/skills/condense-agents-md/scripts/audit.sh AGENTS.md
Shows: each ##/### section, its line count, the running total, and the
excess over the 400-line target.
Phase 2 — Categorize
For every section over-budget, classify it using the rules in
| Label | Meaning |
|---|---|
| KEEP | Essential orientation — stays in root |
| MOVE:path/AGENTS.md | Subsystem-specific — move to that file |
| REF:notes/x.md | Already in notes/ — replace with one-liner |
| NEW-NOTE:notes/x.md | No existing home — create new notes/ file, then REF |
Phase 3 — Plan and get approval
Present the migration table (section → action → destination → rationale) to
the user via ask_user. Do not modify any files before approval.
Phase 4 — Execute
For each migration:
- REF / NEW-NOTE: append content as a new
##section at the bottom of
the target notes/ file (create with frontmatter if new — see
REFERENCE.md); replace the root section with a one-liner:
See [notes/x.md](notes/x.md) for <topic>.
- MOVE: append content to the per-directory AGENTS.md (create if needed);
remove the section from root entirely.
- KEEP: leave untouched.
Phase 5 — Validate and commit
wc -l AGENTS.md— verify within target../mdlint.sh AGENTS.md <other modified .md files>— lint the modified
markdown files.
- Commit:
docs: condense AGENTS.md — migrate <N> sections.
Hard rules
- Never delete content that is still true — always move it to a destination.
- Delete advice that is no longer true. If a section describes a pitfall,
workaround, or rule that has since been superseded, do not migrate it and do
not migrate a "this is retired" note about it — drop it, and state the current
rule in its place. AGENTS.md and notes/ carry current understanding; git
history is the record of what they used to say. Verify supersession against the
code before deciding (git log -S, grep for the pattern), and say so in the
commit message. Retired notes sections are removed via
uv run append-history note (PD-03-002, PD-03-004), not raw deletion.
- Keep the
## Common Pitfallsheading in root as a short index of one-liners. - When appending to an existing notes/ file, update its frontmatter
(related_notes, related_specs) to reflect the new content.
- New notes/ files MUST include the required frontmatter (
title,
status: active). See REFERENCE.md for the template.