polytropos · spec-driven development · two pipelines

The usual SDD pipeline, and polytropos's

Part 1 walks through spec-driven development: the stages every spec-driven tool shares, what each one produces, and the gates between them. Part 2 walks through the same stages as polytropos runs them. Part 3 puts the usual AI pipeline beside polytropos's and compares the two.

Part 1

Spec-driven development

Spec-driven development writes down what to build, and why, before any code, and then checks the code against that spec. Every spec-driven tool walks the same stages under different names. Each stage produces an output and ends at a gate: what must be true before the next stage starts.

The stages

Stages 1 to 10 follow the lifecycle table in docs/sdd/guide.md, and stage 11 is its principle P8.

  1. 1Standing rules

    Constraints every change obeys, set once for the whole project.

    Outputa constitution or rules file

    Gateexists before the first change

  2. 2Research

    Map the problem and the existing code before deciding anything.

    Outputfindings, not design

    Gatethe findings are reviewed

  3. 3Specify

    What to build and why, without design.

    Outputthe goal, scenarios, acceptance criteria and what is out of scope

    Gatea person approves it

  4. 4Clarify

    Surface ambiguity while it is still cheap to fix.

    Outputquestions and answers, folded back into the spec

    Gateno open question would change the plan

  5. 5Plan

    How to build it, with the reasons.

    Outputthe architecture, the decisions and the risks

    Gateconsistent with the standing rules

  6. 6Tasks

    Break the plan into ordered, checkable work.

    Outputa task list with the dependencies between tasks

    Gateevery task traces to the plan

  7. 7Analyze

    Check the spec, plan and tasks against each other before anything is built.

    Outputa consistency report

    Gateno contradiction or gap

  8. 8Implement

    Build against the tasks, one task at a time.

    Outputcode, task by task

    Gateeach task verified

  9. 9Verify and converge

    Prove the whole matches the spec, not just each piece.

    Outputtest results and review verdicts

    Gatethe spec's "done" holds

  10. 10Feedback

    Learn from the run.

    Outputupdated rules, and better specs next time

    Gaterecorded where the next planner reads it

  11. 11Keep in sync

    After the change ships, check that the spec and the code still agree.

    Outputtests that tie the spec to the code, often run in CI

    Gatedrift is detected, not discovered

The flow, with its gates

The same stages as a flow chart, read row by row. A diamond is a gate: yes moves the work on, and no sends it back along a dashed arrow.

Scroll sideways to see the whole chart.

1 Standing rules constitution or rules 2 Research findings, not design 3 Specify goal, scenarios, criteria 4 Clarify answers fold into spec Approved? no: revise the spec yes: approved 5 Plan architecture, decisions 6 Tasks tasks with dependencies 7 Analyze consistency report Consistent? no: fix the tasks or the plan yes FOR EACH TASK, IN DEPENDENCY ORDER 8 Implement code, task by task Verify the task against its acceptance Pass? Tasks left? yes no Fix the work using the failure try again yes: next task no: all done 9 Verify and converge tests, review verdicts “Done” holds? 10 Feedback rules and specs improve 11 Keep in sync spec and code agree yes later no: amend the spec and plan feeds the next change
A change runs top row first. The spec is approved, the plan and tasks pass a consistency check, each task is built and verified in turn, and the whole is checked against the spec's "done". The numbers match the cards above, and the small line in each box is that stage's typical output.

Part 2

polytropos

/polytropos:architect plans a change once, on the frontier tier, and writes an execution kit: PLAN.md, TASKS.md and GUARDRAILS.md. /polytropos:execute runs the kit, sending each task to the cheapest tier that can do it and checking every result. Here are the same stages again, as polytropos runs them.

Each stage in polytropos

The numbers match Part 1. The last line of each card says where the behavior is defined.

Before the run · the architect, on the frontier tier

  1. 1Standing rules

    CLAUDE.md holds always-on invariants, many enforced by tests. The architect writes each kit's GUARDRAILS.md, rules for that change only, and the run re-reads it from disk at every phase start.

    Wherethe repo's CLAUDE.md; the kit's GUARDRAILS.md

  2. 2Research

    The architect explores before planning, optionally grounded in a code graph with bin/graph_ground.py. A scout role is available.

    Whereskills/architect/SKILL.md

  3. 3Specify

    The spec half of PLAN.md: a goal, a checkable "done", constraints and an out-of-scope fence. The architect writes nothing to disk until you approve it.

    Whereskills/architect/SKILL.md, Step 1

  4. 4Clarify

    Scoping questions before the frontier run, then assumptions and open questions listed under the spec draft, for you to settle at the approval pause.

    Whereskills/architect/SKILL.md, Steps 0–1

  5. 5Plan

    The design half of PLAN.md: decisions with rationale, risks with tripwires, and optional autonomy:, budget:, roles: and workflow: lines.

    Whereskills/architect/SKILL.md, Step 1

  6. 6Tasks

    TASKS.md: per task an id, a pinned model, a self-contained brief, acceptance, a verify command, an evidence: rule and its depends:.

    Whereskills/architect/SKILL.md, Step 2

The run · the execute loop

  1. 7Analyze

    kit_contract.py graph rejects duplicate ids, unknown dependencies and cycles. analyze checks the paths each brief names and whether each verify command can run, without running anything. Then, in an interactive run, one opus spec review looks for contradictory acceptance and uncovered goals.

    Wherebin/kit_contract.py; skills/execute/references/spec-review.md

  2. 8Implement

    Each task goes to the implementer on its pinned tier, with its brief and nothing else; the implementer stops and reports if the brief is wrong. The loop then runs the verify command itself, and a check that already passed before the work blocks the task.

    Whereskills/execute/SKILL.md

  3. 9Verify and converge

    A fresh-context verifier re-checks each task, joined by a test-author and red-team when the kit declares them. A failure gets one retry, then a frontier consult. An opus reviewer checks each phase against PLAN.md, and once kit_contract.py graph reports every task done, the plan's done check runs.

    Whereskills/execute/SKILL.md

After the run

  1. 10Feedback

    outcome:, agent:, reviewer: and defect: lines in NOTES.md, and an acceptance record from accept for each passing task. bin/routing_scorecard.py grades the tiers, the review roles and the briefs, and the next architect reads it.

    Whereskills/execute/references/ledger.md

  2. 11Keep in sync

    kit_contract.py drift re-runs a finished kit's verify commands inside the execution boundary and reports drift, not failure. Within a kit, freshness marks a finished task stale when work it relied on is re-accepted, and refresh re-verifies it. A check that starts its own sandbox reads drifted, a known limit.

    Wherebin/kit_contract.py

The flow in polytropos

The same flow, with the part of polytropos that does each stage named in its box. Two paths are polytropos's own: a failed task gets one retry and then a frontier consult, and a "done" that does not hold sends the work back to amend PLAN.md.

Scroll sideways to see the whole chart.

1 Standing rules CLAUDE.md, GUARDRAILS.md 2 Research the architect explores 3 Specify PLAN.md, the spec half 4 Clarify open questions listed Approved? no: revise the spec yes: you approve 5 Plan PLAN.md, the design half 6 Tasks TASKS.md, model pinned 7 Analyze graph, analyze, P0 review Consistent? no: fix the tasks or the plan yes FOR EACH TASK, IN DEPENDENCY ORDER 8 Implement on the pinned tier Verify the task loop + fresh verifier Pass? Tasks left? yes no Retry once then a frontier consult retry with the failure yes: next task (a phase end gets a review first) no: all done 9 Verify and converge the plan's done check “Done” holds? 10 Feedback NOTES.md → scorecard 11 Keep in sync drift re-runs checks yes later no: amend PLAN.md, then re-plan feeds the next change
The numbers match the stage cards, and the orange line in each box names the part of polytropos that does that stage.

Part 3

Side by side

The left column is how most AI spec-driven tools run a change. The right column is how polytropos runs one. Both start from a written spec. The difference is in who checks the work, which model does each part, and what happens to what was learned.

a person decides frontier tier (fable) opus sonnet / haiku

Typical AI spec-driven development

The common shape of tools such as Spec Kit and Kiro, simplified. Individual tools add steps, such as clarify, analyze, checklists, hooks or converge.

  1. once per projectStanding rulesA constitution or rules file the agent reads as context.
    rules are context, not enforced; nothing fails when one is broken
  2. you + the agentSpecifyWhat to build and why: stories, scenarios, acceptance criteria.
  3. the agentPlanThe technical approach and design documents.
  4. the agentTasksAn ordered task list, some marked parallel.
    no model choice per task; one model does everything
  5. the same agent, same modelImplementWorks through the task list, writing code and tests.
  6. the same agentVerifyRuns the tests it wrote and reports the result.
    the builder grades its own work; Anthropic found agents "reliably skew positive" doing so
  7. after the changeDoneThe spec is set aside, or kept but not re-checked.
    drift goes unnoticed, and nothing records whether the spec itself was wrong

polytropos

/polytropos:architect writes an execution kit once; /polytropos:execute runs it. The source of each box is named in skills/architect/SKILL.md and skills/execute/SKILL.md.

  1. always on, plus per kitStanding rules, enforcedCLAUDE.md invariants backed by tests, plus the kit's own GUARDRAILS.md, re-read from disk at every phase start.
    many invariants fail the test suite when broken
  2. fable · onceSpecThe architect drafts the goal, a checkable "done", constraints and an out-of-scope fence.
  3. you gateApproval pauseNothing is written to disk until you approve the spec.
  4. fable · onceDesign and tasksDecisions with reasons, risks with tripwires, and per task a self-contained brief, acceptance, a verify command, an evidence: rule and a pinned model.
    every task names its proof and its price
  5. before any dispatchPre-run checkkit_contract.py analyze checks paths and verify commands without running anything; then one opus spec review for contradictions and uncovered goals, skipped for workflow: direct kits.
  6. for each task

    1. haiku / sonnet / opus, as pinnedImplementerBuilds from the brief alone; stops and reports if the brief is wrong.
    2. the loop, not the builderVerify, red-greenThe orchestrator runs the verify command itself. A check that already passed before the work blocks the task.
    3. sonnet, fresh contextIndependent verifierRe-checks acceptance against the files, plus a test-author and red-team when the kit declares them.
      passmarked done; the outcome goes in the ledger
      failone retry with the failure; then a fable consult carrying only the evidence
  7. opus · each phase endPhase reviewChecks the phase against PLAN.md for drift before the next phase starts.
  8. every outcome, dispatch and reviewLedgerNOTES.md lines that record what passed, what each reviewer found, and which briefs were wrong (defect:). accept also records each acceptance.
  9. after the changeDrift checkkit_contract.py drift re-runs a finished kit's checks against today's code and reports drift, without marking anything failed.
  10. across every kitScorecardbin/routing_scorecard.py --history grades the tiers, the review roles and the briefs.
    ↺ read by the next architect before it writes the next spec

What changes

QuestionTypical AI SDDpolytropos
Who approves the spec?You, usually informallyYou, at an explicit pause before any design
Which model builds each part?One model throughoutThe frontier tier plans once; each task is pinned to the cheapest tier that can do it
Who decides the work is done?The agent that built itThe loop runs the check, and a fresh-context verifier and a phase reviewer judge it
Can a check that proves nothing pass?YesNo: the red-green rule blocks a check that already passed before the work
What if the spec is wrong?The agent works around itThe task stops and reports, and the defect is recorded by kind
Is the spec checked before spending anything?Some tools have an analyze stepanalyze and a spec review, both before the first dispatch
Is it re-checked after the change ships?Rarelydrift, a re-run of a finished kit's checks inside the execution boundary
Does the next spec learn from this one?No recordThe scorecard's defect kinds and tier and role history feed the next architect