agents-md
At a glance
- 1Read what exists
- 2Sort every existing line
- 3Draft the index
- 4Draft the homes
- 5Show the diff, then write
The skill
AGENTS.md (and CLAUDE.md, which imports it) loads into every session that opens the repository, so every line costs on every turn. Its job is to be an index: point at the material the agent cannot find in one search, give the commands it would otherwise guess, and hold the few rules that must always hold. Everything else lives where it is read on demand. Works on any repository, with or without BuilderOS. The retro mode, invoked by name (retro) or at the end of a build or an outcome review, reads a session and turns what slowed or misled the agent into changes to its environment: follow retro, with its own marker.
What goes where
| Material | Home |
|---|---|
| Where things are: entry points, the module holding the rules, where tests live, generated files | TECH.md → Map (or a docs/ file the index points at) |
| Build, test and lint commands an agent would guess wrong | AGENTS.md, one line each; on a BuilderOS project TECH.md → Verify, pointed at |
| Rules that must hold every time (never edit generated files, never deploy without approval) | AGENTS.md, each with the check that enforces it when one exists |
| A mechanical rule (a banned call, an import shape, a file location) | A check: lint rule, hook, CI step. AGENTS.md names the check, not the rule |
| Conventions that need judgment | TECH.md → Conventions, read by the reviewer |
| Product, domain and decisions | PRODUCT.md, DOMAIN.md, decisions/, pointed at |
| Host-specific instructions (Claude Code only) | CLAUDE.md below its @AGENTS.md import |
A pointer is one line: what the material is, and when to read it, with the trigger word first ("Changing an export: read src/export/README.md"). The wording decides whether the agent reaches the material, so sharpen a weak pointer before inlining what it points at.
Procedure
- Read what exists.
AGENTS.md,CLAUDE.md,README, the manifests and their scripts, the CI workflow, any pre-commit hook,docs/, and on a BuilderOS projectTECH.md,DOMAIN.mdand the BuilderOS block. Done when you can name the build, test and lint commands, the entry points and every rule already written down. - Sort every existing line into the table above: keep, move (to which home), turn into a check, or cut. A line is cut when it states what the agent does by default, what one look at the repository answers, or what is no longer true (a path that does not exist, a command that fails). Done when every line has a verdict.
- Draft the index. Commands, pointers, must-hold rules, in that order, then the BuilderOS block on a BuilderOS project (
references/builderos-state-schema.md, Session Start), with the end-of-turn check registered where the host reads project hooks (bos.mjs vendor --hooks). Write each rule as the behavior wanted ("write migrations with the generator indb/"); a prohibition stays only as a hard guardrail, paired with what to do instead. Aim for well under 150 lines. MakeCLAUDE.md@AGENTS.mdplus Claude-only lines; create it when missing. Done when every kept or new line is a command, a pointer with its trigger word first, or a must-hold rule. - Draft the homes.
TECH.md→ Map from the repository (on a BuilderOS project; elsewhere adocs/file or the README section the index points at), and each moved line in its new place. Done when every line marked move in step 2 has a home and every pointer in the index lands on one. - Show the diff, then write. Lines they wrote are moved or cut only with their yes, one round per
pressure-testingfor the moves and cuts that are not obviously dead; new lines and fixes to dead paths need no question. Done when the files are written and every path they name exists (scripts/bos.mjs gate 5checks it as 5.11 on a BuilderOS project).
On a BuilderOS project this runs at initialization, at the end of each build (phase 5, step 11) and when a retro or the briefing flags a dead pointer or a file over 150 lines.
Capabilities
| Capability | Used for | Floor if absent |
|---|---|---|
repo.read | Manifests, CI, entry points, existing steering files | Ask for the commands and the layout; mark the map unverified |
files.write | The index and its homes | Return the full files for the person to apply |
shell.exec | Running the commands once to confirm they work | Write them as found and say they were not run |
Output Contract
## AGENTS.MD UPDATED with the line count before and after, what was moved and where, what became a check, what was cut and why, and the commands confirmed to run.
References
Read only when a step needs them, so they cost no context until then.
Retroreferences/retro.md
A retrospective on the agent's environment, not on the product: what made a session slower or wronger than it needed to be, each turned into a change so the next session does not repeat it. Invoked by name at the end of any session; the build (phase 5, step 11) and the outcome review (phase 7, step 6b) run this same procedure. Adapted from Pocock's retro (MIT).
Procedure
- Read the session. The one the person names, otherwise the current one: its transcript where
sessions.readresolved, the conversation otherwise, plus what it changed (the diff, the files under.builderos/). Done when you can list the moments the agent searched long, went wrong, was corrected or was blocked. - Read the guardrail and the steering files before proposing anything: the repository's check commands (its build-tool scripts, its CI workflow, its pre-commit hook),
AGENTS.mdandCLAUDE.mdat the root,TECH.md→ Verify, Guardrail and Conventions. A check that exists but is unwired or broken is the finding, not a new check. Done when you can say what runs on each commit and what the steering files already ask for. - Find the candidates, category by category, each tied to a moment from step 1:
- Navigation. The agent took long to find a file or a fact, or missed a hidden dependency between files. The change: a pointer, one line in
AGENTS.mdorTECH.mdnaming the file and when to read it. - Automated checks. The agent made a mistake a lint rule, a type, a test or a file-layout check would have caught; or the repository has no guardrail at all (no CI job and no pre-commit hook running Verify), which is itself the finding.
- Conventions for the reviewer. The review missed a mistake. Classify it first: a mechanical one (a fixed pattern, a banned call, an import shape, a file location) becomes a deterministic check, full stop; only a judgment call (consistency across files, matching the surrounding style) goes into
TECH.md→ Conventions, which the reviewer reads. - Steering files.
AGENTS.mdorCLAUDE.mdcarries rules a check or a convention should hold instead, or has grown large. These files load into every session: keep them to pointers and the rules that must always hold, and make the change withagents-md. - No-ops. An instruction that changed nothing the agent would have done anyway. Cut it.
- Tool economy. A call that cost far more than its answer (a whole-repo dump, a verbose tool, a repeated search). The change: a narrower command, a script, a pointer to the right file.
- Information access. A fact the agent needed and could not reach: server logs, a read-only view of a service, an export. The change: the access, or the place where the fact is written down.
- Process. A gate overridden or failed twice, a spec rewritten after the build plan, a round asked twice, a decision taken without the person. Read
scripts/bos.mjs pacewhere commands run. The change goes to the phase skill or the project's conventions, named. Done when every moment from step 1 has a candidate or a stated reason it needs none.
- Navigation. The agent took long to find a file or a fact, or missed a hidden dependency between files. The change: a pointer, one line in
- Present them by severity, most costly first: the moment, the cost (time, a wrong result, a correction), the change, and where it lands. One round per
pressure-testingfor the changes that touch shared files or CI. Done when the person has picked which changes to make. - Make the chosen changes within what the person authorized. Done when each chosen change exists in the repository (a mechanical rule with its check wired and run once) and is listed.
Capabilities
| Capability | Used for | Floor if absent |
|---|---|---|
sessions.read | The transcript of the session under review | The current conversation; name the sessions not read |
repo.read | Check commands, CI, steering files | Ask what runs on each commit |
files.write | The pointers, conventions and checks | Return the exact edits for the person to apply |
shell.exec | bos.mjs pace, running a new check once | Read the history in state.json |
Output Contract
## RETRO COMPLETE with each candidate (moment, cost, change, where it lands), which ones the person chose, and the changes made. In a lifecycle phase, the build plan or the outcome writes the same list under its **Environment:** line.
skills/agents-md/SKILL.mdView on GitHub