polytropos · spec-driven development · a guide

Spec-driven development: a guide, with polytropos

A guide to spec-driven development, a map from the practice to polytropos and from polytropos back to the practice, and an assessment of what polytropos should build next.

How to read this guide. Part 1 is about spec-driven development itself and names no polytropos feature. Part 2 walks the practice stage by stage and principle by principle and shows how polytropos does each one. Part 3 goes the other way: every polytropos component and the idea it implements, including the ones the practice has no name for. Part 4 assesses where polytropos stands and what it should build next.

Companions: docs/sdd/core-four.md maps Spec Kit's phases one by one; docs/SPEC-DRIVEN.md is the long form of how polytropos works; docs/spec-driven-pitch.html is the four-page pitch. Claims about other tools come from the sources at the end, many of them secondary write-ups; each tool's own documentation is the authority on its current behavior. Claims about polytropos name the file or command that makes them true.

Part 1 · Spec-driven development

What it is

Spec-driven development (SDD) means writing down what a change must do, and how it will be checked, before an AI agent writes the code, and then holding the agent's work to that written spec rather than to the conversation that produced it.

The problem it answers is specific to agents. An agent given a prompt builds what it understood, and reports success in the same confident voice whether it succeeded or not. Without a written spec there is nothing outside the conversation to check the result against, so review falls back on reading the code and trusting the summary. Iterating on prompts until the output looks right is usually called "vibe coding". IBM's primer names three debts it builds up: context drift, where a fix in one place breaks another; fragmentation, where new code ignores the existing architecture; and token cost, from long prompting cycles that fix what a clear spec would have prevented.

The idea is old. SDD descends from test-driven development, which writes the test before the code, and behavior-driven development, which writes the behavior before the test. SDD moves one step earlier still and asks whether the change has been defined at all. What is new is the executor: a model that can produce a lot of plausible code quickly makes the spec the one fixed point that every step is checked against.

The field has not settled what belongs in a spec. Spec Kit keeps technology choices out of its specify step and puts them in a later plan. IBM's definition includes implementation details, agreed before coding starts. Most practitioners split the difference: the what and why first, reviewed on their own, then the how.

The levels

Birgitta Böckeler's analysis on martinfowler.com sorts SDD by how long the spec lives and who edits it. IBM's primer adds a fourth, hybrid level.

LevelWhat happens to the specExample
Spec-firstWritten for a change, used to build it, then set aside.Kiro; most tools in practice
HybridKept as a versioned record of the change, like an architecture decision record, but not maintained.Specs as ADRs; issue trackers as the source of truth
Spec-anchoredKept and maintained for the feature's lifetime. Automated tests, often in CI, tie the spec to the code and catch drift.OpenSpec; Spec Kit's stated aim
Spec-as-sourceThe only thing people edit; code is regenerated from it.Tessl (reported as in beta); Spec Kit's long-term vision

Böckeler's finding, as several summaries report it, is that most tools claim a higher level than they deliver. Spec-as-source has "the least field evidence behind it", in Panaversity's words, and regeneration is non-deterministic. Spec-anchored is widely called the defensible middle, and the usual advice is to start spec-first and grow into it.

The lifecycle

Every tool walks the same stages under different names. A stage's gate is what must be true before the next stage starts.

StagePurposeTypical outputGate
Standing rulesConstraints every change obeysa constitution or rules fileexists before the first change
ResearchMap the problem and the existing codefindings, not designfindings reviewed
SpecifyWhat and why, without designgoal, scenarios, acceptance criteria, out-of-scopea person approves it
ClarifySurface ambiguity while it is cheapquestions and answers folded into the specno open question would change the plan
PlanHow, with reasonsarchitecture, decisions, risksconsistent with the standing rules
TasksOrdered, checkable worka task list with dependenciesevery task traces to the plan
AnalyzeCheck the artifacts against each othera consistency reportno contradiction or gap
ImplementBuild against the taskscode, task by taskeach task verified
Verify and convergeProve the whole matches the spectest results, review verdictsthe spec's "done" holds
FeedbackLearn from the runupdated rules, better specs next timerecorded where the next planner reads it

Panaversity's crash course gives the reason for the early gates: clarification is "the cheapest place in the entire process to fix a mistake". Its rule for a gap found mid-build is to fix the spec first, so that the spec's history and the code's history tell the same story.

Principles

These recur across the tools, Böckeler's analysis, Anthropic's harness research and the practitioner literature. The first ten are common ground. The last two are rarely stated outright, and they are where agent-era SDD most differs from its ancestors.

Writing a good spec

A spec is good when a stranger could build the right thing from it, and could not build the wrong thing while still satisfying it. In practice:

Two line-by-line tests catch most bad specs. The wrong-build test: could "a competent person build the wrong thing and still technically satisfy this line"? The red-first test: would this acceptance check have failed before the work began?

Failure modes

FailureWhat it looks likeThe counter
Waterfall againA long spec written once and defended after reality changesSpecs per change; a broken spec goes back to a person, not around them
Ceremony for small changesBöckeler saw a minor bug turned into several user stories with many acceptance criteriaA size threshold; lighter flows for fixes
DriftSpec and code disagree a month laterTests that tie the spec to the code, run in CI
False confidenceThe code matches a spec that was wrongApproval before design; recording spec defects
Spec bloatReview moves from code to verbose, repetitive specsPin contracts, leave implementation open
Self-gradingThe builder reports success and is believedAn independent verifier, and a check the builder does not control
Lenient evaluationA separate evaluator still waves work throughHard thresholds; a check that must be able to fail; calibrating the evaluator
Over-specificationThe spec becomes pseudo-code, and the program is written twiceSpecify behavior and contracts, not statements

When not to use it

SDD fits work whose outcome can be stated before it starts. It fits exploration poorly, where the point is to find out what to build: when the outcome is not known yet, explore first and write the spec from what the exploration found. It also costs more than it returns on changes small enough to check by reading the diff. Anthropic's version of the cost rule is about review rather than specs, but it generalizes: an evaluator "is worth the cost when the task sits beyond what the current model does reliably solo."

The field

ApproachShapeLevelDistinctive
GitHub Spec KitOpen-source templates and slash commands for many agentsspec-first, aiming at anchoredA constitution with articles such as test-first; Specify, Plan, Tasks, Implement, then converge until done
Kiro (AWS)An agentic IDE with specs built inspec-firstrequirements.md in EARS notation ("WHEN … THE SYSTEM SHALL …"), design.md, tasks.md; approval gates; steering files; hooks on file events
OpenSpecA lightweight, tool-neutral formatspec-anchoredEach change is a delta (added, modified, removed) against a living spec
BMAD methodA full methodology with persona agentsspec-firstAnalyst, product, architect and developer roles hand work along a pipeline
TesslA framework and registry built around specsanchored, aiming at as-sourceOne spec per file; generated code marked not to be edited
Anthropic's harnessA published research design, not a productspec-firstPlanner, generator and evaluator; sprint contracts for "done"; an evaluator that drives the running app

Practitioner comparisons place the tools on a ceremony scale, with OpenSpec lightest, Spec Kit in the middle and BMAD heaviest, and report time and cost rising with ceremony. Those are single-author trials with their own rubrics, not controlled benchmarks.

Anthropic's harness research deserves a closer look than its place in the table suggests. In "Harness design for long-running application development" (March 2026), Prithvi Rajasekaran of Anthropic Labs ran a three-agent design on multi-hour builds. A planner expands a short prompt into a product spec, a generator builds it one feature per sprint, and an evaluator tests the running app like a user, with a hard threshold per criterion: "if any one fell below it, the sprint failed." Before each sprint, generator and evaluator agree "what 'done' looked like". Agents hand work to each other through files, and a context reset starts "a fresh agent" with "a structured handoff".

Its findings are the field's best evidence on verification. Self-grading is lenient. A separate evaluator, out of the box, would find real issues and then "talk itself into deciding they weren't a big deal and approve the work anyway", until the author tuned it by reading its logs for "examples where its judgment diverged from mine". And the parts of a harness should change as models do: "every component in a harness encodes an assumption about what the model can't do on its own." The full harness cost over twenty times as much as a solo run, which buys quality with spend. The evidence comes from a small number of runs.

Part 2 · From spec-driven development to polytropos

polytropos is a Claude Code plugin. /polytropos:architect writes the spec once on the frontier tier, as an execution kit in .claude/kits/<slug>/. /polytropos:execute builds against it task by task on cheaper tiers, and checks every task against the kit rather than against the builder's report. A ledger in the kit's NOTES.md records how it went. This part maps the practice onto that system.

The lifecycle in polytropos

StageIn polytroposWhere
Standing rulesCLAUDE.md holds always-on invariants, many enforced by tests. Each kit's GUARDRAILS.md holds rules for that change only.the repo; the kit
ResearchThe architect explores before planning, optionally grounded in a code graph with bin/graph_ground.py; a scout role is available.skills/architect/SKILL.md
SpecifyThe spec half of PLAN.md: a goal, a checkable "done", constraints and an out-of-scope fence.skills/architect/SKILL.md Step 1
ClarifyScoping questions before the frontier run; assumptions and open questions listed under the spec draft.Steps 0–1
(gate)The approval pause. The architect shows the spec draft and writes nothing to disk until the user approves it.Step 1
PlanThe design half of PLAN.md: decisions with rationale, risks with tripwires, and optional autonomy:, budget:, roles: and workflow: lines.Step 1
TasksTASKS.md: per task an id, a pinned model, a self-contained brief, acceptance, a verify command, evidence: and depends:.Step 2
Analyzebin/kit_contract.py graph rejects duplicate ids, unknown or self dependencies and cycles. bin/kit_contract.py analyze then checks, statically, the paths a brief names and whether each verify command can be read and run, and the P0 spec review looks for contradictory acceptance and uncovered goals, all before the first dispatch. The P0 review is interactive-only: headless drivers and workflow: direct kits print analyze's warnings, and nothing judges them.bin/kit_contract.py, skills/execute/references/spec-review.md
ImplementEach task is dispatched to the implementer on its pinned tier.skills/execute/SKILL.md
Verify and convergeThe orchestrator runs every verify command itself; a fresh-context verifier and a phase reviewer check the work; one retry, then a frontier consult. The kit converges when kit_contract.py graph reports every task done.skills/execute/SKILL.md
Feedbackoutcome:, agent:, reviewer: and defect: lines in NOTES.md, read by bin/routing_scorecard.py and by the next architect.skills/execute/references/ledger.md

The principles in polytropos

#PrincipleHow polytropos meets itRating
P1Intent before implementationPLAN.md opens with the spec under the rule "what and why, no design yet".Strong
P2A person approves the specThe approval pause; skipping it must be asked for and is disclosed in the handoff.Strong
P3Standing rules, enforcedCLAUDE.md invariants are backed by tests: tests/test_kit_contract.py fails if the kit contract is copied into a second driver, and tests/test_guardrails_layout.py fails for a kit without GUARDRAILS.md. Kit fences are re-read from disk at every phase start.Strong
P4Testable acceptanceEvery task carries acceptance and a verify command; the red-green evidence rule blocks a task whose check already passed before the work.Strong; no requirements notation
P5Design with reasonsDecisions carry rationale "so a cheaper model can make consistent micro-decisions later".Strong
P6Small, ordered, traceable tasksPhased task blocks with machine-read depends:; the graph check before any dispatch.Strong; no requirement ids
P7Verified independently"The implementer's claim of success is not evidence": orchestrator-run verify, a read-only verifier, an opus phase reviewer, and confirmation required before a finding counts.Strongest in the field
P8Spec and code stay in syncWithin a kit, kit_contract.py freshness marks a finished task stale when work it relied on is re-accepted, and refresh re-verifies it. After a kit ends, kit_contract.py accept records interactive acceptances and drift re-runs a finished kit's verify commands inside the execution boundary and reports drift, not failure; drift itself writes nothing in the tree, but the verifies it runs may. Nothing updates a spec automatically.Partial: detection exists, but a check that starts its own sandbox reads drifted under enforced confinement (PLAN R6), and nothing updates a spec automatically
P9Changes specified as changesOne kit is one change, bounded by its fence; there is no delta format against a standing spec.Partial
P10Right-sized ceremony/polytropos:route handles a single task without a kit; workflow: direct drops independent review for low-risk kits. No threshold says when a kit is needed.Partial
P11Spend judgment where it paysThe spec is written once on the frontier tier; each task is pinned to sonnet, opus or haiku; the frontier is reached again only when a task fails.Strong, and rare in the field
P12Measure the specEvery confirmed brief defect becomes a defect: line by kind, and the architect is told to read recurring kinds "as evidence about YOUR OWN briefs".Strong, and rare in the field

Spec Kit, phase by phase

Spec Kit is the closest tool, mapped in full in docs/sdd/core-four.md. Its constitution splits into CLAUDE.md and GUARDRAILS.md. Specify and clarify become the spec half of PLAN.md with the approval pause. Plan becomes the design half. Tasks becomes TASKS.md, where Spec Kit's parallel marker is an explicit independent: yes. Implement becomes the execute loop, and converge corresponds to the loop ending only when every task is done. Spec Kit's Article III states test-first as a principle; polytropos's red-green rule enforces it at run time. Spec Kit's plan template checks the design against the constitution in a "Phase -1" gate, which polytropos has no counterpart for.

Anthropic's harness, component by component

Their harnesspolytroposMatch
Planner writes a high-level spec so that spec errors do not cascadeThe architect; briefs "pin down contracts and interfaces precisely; leave implementation judgment open"Close
Generator builds one feature per sprintThe implementer builds one task per dispatch, on the task's pinned tierClose
Sprint contract agreed between two agents before each sprintAcceptance and verify fixed per task when the kit is written, and approved by a personSame aim, set earlier, by a human
Evaluator drives the running app, with a hard threshold per criterionOrchestrator-run verify commands, a verifier and a phase reviewerPartial: no running-app check, no graded criteria
Communication through filesKit files and the NOTES.md ledgerSame
Context reset with a structured handoffA fresh subagent per task, with the brief as the handoffSame
Evaluator tuned from its logsEvery verifier and reviewer line records findings against confirmedMeasured, not yet fed back
Components removed when no longer load-bearingRoles kept only when their measured value earns their cost; tiers re-pinned from the ledgerSame principle

The sharpest difference is cost. Their harness buys quality with spend and describes no split of models between its agents. polytropos claims the reverse trade, and its ledger is how that claim gets tested: when the verifier tier is wrong, the record shows it, which is how polytropos moved its default verifier from haiku to sonnet.

The other tools

The failure modes, answered

Failurepolytropos's answerStill open
Waterfall againSpecs per change; a spec that cannot hold goes back to the user, and an executor that hits a wrong brief stops and reportsNo sanctioned re-plan mid-run
Ceremony for small changes/polytropos:route for single tasks; workflow: direct; optional roles off unless declaredNo stated threshold for when a change needs a kit
DriftPhase-end drift review; fences re-read at every phase start; freshness within a kit; drift re-runs a finished kit's checks and reportsNothing updates a spec automatically
False confidenceThe approval pause catches misread intent; defect: lines record specs that were wrong"The checks cover what the architect thought to check"
Spec bloatContracts pinned, implementation left openNo size limit on a kit
Self-gradingThe orchestrator runs every verify command; the implementer's report is not evidence—
Lenient evaluationThe red-green rule; a finding counts only once confirmedVerifier prompts are not tuned from their own record
Over-specificationBriefs pin interfaces and paths, not statements—

Exploring before a kit. A single exploratory task needs no kit: /polytropos:route picks a model for it. Trying it cheap behind a check is /polytropos:escalate. A kit can declare a scout role, and a low-ceremony kit declares workflow: direct, which skips independent review and the P0 spec review. analyze refuses only a verify the drivers cannot read, and every other finding is a printed warning, so spike checks like true or python3 spike/run.py pass. A finished spike becomes the input to /polytropos:architect.

Part 3 · From polytropos to spec-driven development

Every component, and the idea it implements

ComponentWhat it doesSDD idea
/polytropos:architectWrites the kit once, on the frontier tierSpecify, plan, tasks
Approval pauseShows the spec draft; writes nothing until approvedHuman approval of the spec (P2)
PLAN.md spec halfGoal, checkable done, constraints, out-of-scope fenceSpecify (P1)
PLAN.md design halfDecisions with rationale; risks with tripwiresPlan (P5)
CLAUDE.md invariantsAlways-on rules, many backed by testsConstitution (P3)
GUARDRAILS.mdRules that bind only while one kit runsConstitution, scoped to a change
TASKS.mdPhased, self-contained task blocksTasks (P6)
model fieldThe tier a task runs onNo SDD equivalent (P11)
evidence: fieldred-green by default: the check must be able to fail firstTest-first (P4)
depends: / independent:A machine-read dependency graphTask ordering; parallel markers
kit_contract.py graphRejects an invalid task graph before any dispatchAnalyze, structural part
kit_contract.py analyzeStatic pre-run check of the paths a brief names and each verify command; runs nothingAnalyze, mechanical part
kit_contract.py acceptRecords an interactive acceptance in the ledger outside the tree, from the task's own outcome: line; binds the tree when it runs, and refuses a line from another run or a run more than a day oldFeedback; sync (P8)
kit_contract.py driftRe-runs finished tasks' verify commands inside the execution boundary and reports drift, not failure; the verifies it runs may write, trusted-host confines nothing, --all's exit 3 is not evidence of drift on its own, and acceptance= reads unknown without an **Acceptance.** heading or for records written before the parser carried itDrift detection after a change (P8)
Kit agents in .claude/agents/Implementer, read-only verifier, read-only reviewerRole separation (P7)
/polytropos:executeDispatches, verifies, retries, reviewsImplement and converge
Orchestrator-run verifyThe verify command run by the loop, never trusted from a reportIndependent verification (P7)
Verifier and phase reviewerFresh-context checks against the kit and PLAN.mdIndependent verification; drift review (P8)
Fence re-readGUARDRAILS.md and the out-of-scope fence re-read from disk each phaseStanding rules, enforced (P3)
Stop-and-reportA wrong brief halts the task instead of being worked aroundFix the spec first
Retry, then frontier consultOne retry with the failure; then an evidence-only consultNo SDD equivalent (P11)
autonomy: / budget:Advisory-by-default re-routing; caps that stop a run cleanlyNo SDD equivalent
roles: / workflow:Optional review roles; the assurance levelRight-sized ceremony (P10)
NOTES.md ledgerMachine-read lines for every outcome, dispatch and reviewFeedback
defect: linesConfirmed brief defects, by kindMeasure the spec (P12)
bin/routing_scorecard.py--history, --roles, --sessionFeedback, measured
freshness / refreshStale evidence within a kit; re-verify without dispatchDrift detection, within a change (P8)
Headless driversbin/claude_execute.py and peers run the same kit elsewhereOne spec, several executors
bin/exec_policy.py, bin/attempt_ledger.pyA boundary for verify commands; a record of every dispatchVerification you can audit
/polytropos:routeOne task, no kit, with a cost estimateRight-sized ceremony (P10)

What polytropos adds that SDD has no name for

Part 4 · Assessment and roadmap

Where polytropos stands

On the levels of Part 1, polytropos is hybrid: each kit is a spec for one change, committed and kept as a record but not maintained afterward. Within a run it behaves like spec-anchored, because every task is checked against the spec and stale evidence is detected. It is strongest where the field is weakest, in independent verification (P7), spending judgment where it pays (P11) and measuring the spec (P12). Before kit kit-preflight it was weakest at keeping specs in sync after a change ships (P8) and at checking artifacts against each other before a run; those now have detection (drift, analyze and the P0 spec review), and right-sizing (P10) remains weak.

What its own ledger says

The ledger is the best evidence for what to improve, because it records where specs actually failed. python3 bin/routing_scorecard.py --history lists every brief defect by kind across every kit. When this guide was written, on 2026-10-24, the most frequent kinds were contradictory acceptance, stale plan decisions, stale pins (references to files or lines that had moved) and unspecified paths. Most were caught mid-run, after dispatches had already been spent. The same card showed several kinds outside the sanctioned vocabulary, coined mid-run, which splits recurring problems across synonyms. As of this kit the vocabulary is nine sanctioned kinds with definitions (stale-pin, tautological-verify, unrunnable-verify, missing-helper, unspecified-path, contradictory-acceptance, stale-plan-decision, false-zero-spec, underivable-requirement), coined kinds are folded or flagged unsanctioned on the card, and nothing in a committed NOTES.md was rewritten. python3 bin/routing_scorecard.py --roles showed red-team and test-author with the highest rate of catches no earlier check made, on small samples. Re-run both commands before acting on any of this.

Since kit kit-preflight, the interactive execute loop records acceptances through kit_contract.py accept, which freshness compares. Kits finished earlier stay unknown unless refresh re-verifies them on the current tree, and nothing backfills an acceptance from NOTES.md prose. The headless drivers always recorded them.

Roadmap

Each item would be its own kit, approved through the architect's approval pause. A, B and C were built together as kit kit-preflight (see .claude/kits/kit-preflight/PLAN.md); D–H are not built.

#ImprovementEvidencePrincipleSize
ACheck the spec before the run. — built (kit-preflight). A read-only pass before the first dispatch: every path and script a brief names exists, every verify command can run, and a fresh-context review of PLAN.md against TASKS.md looks for contradictory acceptance and uncovered goals.The most frequent defect kinds; Spec Kit's analyzeP6, P12Medium
BMake freshness work interactively, then re-check finished kits. — built (kit-preflight). The interactive loop records the versions freshness needs. A follow-on command re-runs finished kits' verify commands against the current tree and reports drift, not failure, since some checks are legitimately superseded.Every task unknown on an interactive kit; IBM's CI-anchored levelP8Medium
CSettle the defect vocabulary. — built (kit-preflight). Sanction the coined kinds that recur, map the rest onto existing kinds.Coined kinds in --historyP12Small
DClose the calibration loop. A report of each role's unconfirmed findings across kits, for the architect to read before writing that role's prompt.Anthropic's log-reading; findings vs confirmedP7Small
ERecommend the roles that earn their place for high-risk kits, as advice backed by --roles, not a mandate.--rolesP7, P10Small
FRequirement ids and coverage. An optional id per goal and a covers: field per task. It makes A's coverage check exact, but changes the task contract shared by both skills and bin/kit_contract.py.Spec Kit, KiroP6Large
GRunning-app checks for kits with a user interface: guidance and a role-template variant that drives the app.Anthropic's evaluatorP7Small
HA ceremony threshold and rubrics. When a change is too small for a kit; graded criteria for subjective work.Not enough data yetP10Later

Recommended order: A, B and C together first: they target the most frequent defect kinds and make drift detection possible. D and E are small and can ride along. F waits until A shows whether coverage is a real gap.

Not recommended: regenerating code from specs, which trades polytropos's strength (verification) for determinism it cannot have; mandating EARS notation; and OpenSpec-style change deltas, which little of the evidence asks for.

Run it

/polytropos:architect <task>                # spec, approval pause, design, tasks
/polytropos:execute <slug>                  # build and verify on the pinned tiers
python3 bin/routing_scorecard.py --history  # the record across every kit
python3 bin/routing_scorecard.py --roles    # what each review role has caught
python3 bin/kit_contract.py freshness --kit .claude/kits/<slug>   # stale evidence
python3 bin/kit_contract.py analyze --kit .claude/kits/<slug>     # static pre-run check
python3 bin/kit_contract.py accept --kit .claude/kits/<slug> --task <id> --run <run-id>   # record an acceptance
python3 bin/kit_contract.py drift --kit .claude/kits/<slug>       # re-run finished tasks' checks; reports drift

Sources

On spec-driven development: Böckeler, "Understanding Spec-Driven-Development: Kiro, spec-kit, and Tessl" (martinfowler.com, via a summary); IBM, "What is spec-driven development?" (Gutowska, May 2026); Panaversity, "Spec-Driven Development: A Crash Course"; Wikipedia: Spec-driven development. On Anthropic's harness research: Rajasekaran, "Harness design for long-running application development" (Anthropic, March 2026). On Spec Kit: github/spec-kit README; Spec Kit's spec-driven.md; Augment Code practical guide. On Kiro: Kiro docs: first project; Smile: Kiro, AWS's agentic IDE. On OpenSpec, BMAD, Tessl and the criticisms: Spec Kit vs Kiro vs Tessl (Particula); OpenSpec vs Spec Kit vs BMAD vs Kiro; BMAD vs OpenSpec (FAUN); Spec Driven Development: what it fixes (and breaks).