specification-first-agentic-development
AGENTS.md41 starsChanged 15 days agoMITView on GitHub
This file is the project's AGENTS.md: Codex, Cursor, Copilot and other coding agents read it at the start of a session. Claude Code reads it through CLAUDE.md, which imports it with @AGENTS.md. Where a step names a spec-first plugin command (Claude Code only), the same step says how to do it by hand. .spec-first/memory/ holds typed Markdown facts: one file per memory with frontmatter name (kebab-slug = filename), description (one line), and metadata.type (feedback = how the operator wants the…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- apply-specSkill
- bootstrap-projectSkill
- create-specSkill
- deliver-seriesSkill
- deliver-specSkill
- log-decisionSkill
- review-specSkill
- spec-first-workflowSkill
- update-projectSkill
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Recall before re-deriving: when the index hints at a fact you are about to work out from scratch, read the entry file instead.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
specification-first-agentic-development -- AI Agent Instructions
This file is the project's AGENTS.md: Codex, Cursor, Copilot and other coding agents read it at the
start of a session. Claude Code reads it through CLAUDE.md, which imports it with @AGENTS.md. Where a
step names a spec-first plugin command (Claude Code only), the same step says how to do it by hand.
Context Files (read in this order)
- Every
.spec-first/contexts/<name>/context.yaml(globcontexts/*/context.yaml) -- read it down tostate:for architecture, stack and integrations PER stack.state.doneis an index, one line per finished spec with a pointer to it: search it for the area you touch, never read it front to back - Every
.spec-first/contexts/<name>/coding-principles.md-- code quality rules per stack (ALWAYS follow) .spec-first/specs/active/*.yaml-- the spec being implemented (itsapplies_to:names the dominant context).spec-first/decisions/*.yaml-- past decisions, one YAML per spec or run (read the active spec's file and itsrequires:chain).spec-first/memory/MEMORY.md-- the experiential-memory index, one line per recorded fact; recall detail from.spec-first/memory/<name>.mdon demand when a line touches your task
Spec Directory Structure
.spec-first/specs/
done/ # completed specs (historical reference)
active/ # spec currently being worked on
planned/ # upcoming specs with requirementsExperiential Memory (remember / recall)
.spec-first/memory/ holds typed Markdown facts: one file per memory with
frontmatter name (kebab-slug = filename), description (one line), and
metadata.type (feedback = how the operator wants the agent to work,
ratification required; project = goals/constraints/state not derivable from
code or git; reference = external pointers). MEMORY.md is the index --
one line per memory, content never in the index.
- Recall before re-deriving: when the index hints at a fact you are about to work out from scratch, read the entry file instead.
- Remember sparingly: store what code and git cannot already tell the
next agent -- one fact per file; check the index for an existing entry and
update rather than duplicate; delete a memory that turns out wrong; link
related memories as
[[slug]](a cited slug requires its committed definition). A new or changedfeedbackentry is a PROPOSAL until the operator ratifies it. - Memory vs decision: a decision records a CHOICE (
decisions/); a memory records a transferable FACT or RULE. Never duplicate one into the other.
Implementation Workflow (follow this order for every spec)
- Write spec first -- create
.spec-first/specs/planned/{id}-slug.yamlwith goal,applies_to:, steps, and definition of done BEFORE writing any code. No exceptions. The id is today's UTC date plus four random hex digits, e.g.2026-08-24-8a3f. (Plugin:/spec-first:create-spec.) - A worktree per spec -- commit the spec and its planned entry on branch
spec/{id}in a new worktree cut from the default branch (git worktree add -b spec/{id} ../<repo>-{id} origin/main); all work on the spec happens there. - Review the spec -- before any code. (Plugin:
/spec-first:review-spec.) By hand: run the evidence check,python3 <spec-first clone>/skills/review-spec/scripts/check-evidence.py <spec>(needs python3 and PyYAML), until it is clean; then open a fresh session with no history of this conversation, give it the spec, the goal in two or three sentences and the brief below, and apply its cuts. Build only on BUILD, or BUILD WITH CUTS with every cut applied. - Move to active -- move the spec file from
planned/toactive/when starting work. - Plan first -- explore codebase, design approach, get user approval before coding. (Plugin:
/spec-first:apply-specruns steps 4 to 11.) - Implement step by step -- contracts/models first, then implementation, then wiring, then tests.
- Build after each step -- fix errors immediately, don't accumulate them.
- Test what you changed -- the build and the affected tests while iterating; zero failures before moving on. The full
verify:stages run once, at the spec commit, by the commit gate: the plugin's hook (gate: plugin, the default), the git commit-msg hook in this clone (gate: git, for every agent; install it withpython3 <spec-first clone>/hooks/install-git-hook.py), or the project's own (gate: project). Without any of them, run theverify:commands by hand before the spec commit. - Log decisions -- one YAML per spec at
.spec-first/decisions/{id}.yaml; each entry: what was chosen, what alternatives existed, and why. (Plugin:/spec-first:log-decision.) - Update state -- move spec from
planned/activetodonein the relevant context'scontext.yaml. - Move to done -- move the spec file from
active/todone/. - Deliver -- one commit
feat: {short description} ({id})through the gate, its verdict read inspec-first-gate.login the git common directory, then push and open the pull request. (Plugin:/spec-first:deliver-spec.)git commit --no-verifyskips the git hook: don't use it on a spec commit.
The review brief
Give the fresh reviewer this text verbatim:
Attack this spec before anyone builds it. Open every cited file around the cited lines — a valid citation is not a true claim. Follow every field, setting and value the spec touches to its sinks: who reads it, who writes it, what else breaks. Extract archives and generated files before reasoning about them. Check every step against the code as it is, not as the spec says it is. Answer with exactly one verdict — BUILD, BUILD WITH CUTS, or REFUSE — and back each finding with file:line evidence. For BUILD WITH CUTS name each cut precisely. REFUSE is a successful result when the spec is wrong. Check
upgrade_impact:against what the steps will change: a new required setting, a changed default, a migration old instances cannot run beside, or a deploy file an operator must edit is an upgrade impact, and it is either opt-in or argued in the spec. A spec that consolidates or changes existing behaviour without a characterisation step is a finding.
Key Rules
- English only -- all code, comments, docs, exceptions, logs, commit messages.
- No over-engineering -- only build what the spec requires, nothing more.
- Tests -- every new public method gets at least one test.
- Follow each context's coding-principles.md -- these are constraints, not suggestions.
This repository
- The plugin's own specs, decisions and memory live under
.spec-first/. The roottemplates/,skills/,hooks/andexamples/are the plugin payload. - The verify stages in each
.spec-first/contexts/*/context.yamlare the checks a spec commit must pass. With plugin 2.7.0 or later installed, its commit gate runs them; with an older plugin, run them by hand from the repository root before the spec commit. The evidence check and the git hook installer are in this repository itself: skills/review-spec/scripts/ and hooks/.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

