SPEC-0001 · automatic refund on pre-shipment cancellation

Spec Pipeline Walkthrough

One spec, followed from the words a user types into the UI to a tagged spec the execution loop can build. It shows every agent step, every verify and eval gate, and every human decision. The artifacts it produces are the ones in examples/.

The platform

The target architecture in layers: UI, control, orchestration and execution, with evidence, observability and knowledge cutting across them. Dashed boxes are still being placed in Discussion #21.

Platform layers: UI, control, orchestration and execution, with cross-cutting evidence, observability and knowledgeUI layerControl layerOrchestration layerExecution layerone pi session per actionCross-cuttingUserBA / Architectapprove, answerUIthin client · holds no statetalks only to the control planeAPIrequests · commandsGovernancepolicy · identityRegistriespipeline.lock.yamlLLM gatewaylitellm · placement #21Reconcilerstateless loop · git is stateRunnerclean workspaceVerifyspec-lintEval gateLLM judgeGraph enginenodes = actions · edges = routesIRARGDADGDDDLoop engine + harnesspi agent loop inside one actionguards · lint repair · pinnedAGENTS.md, prompts, templatesSkills · tools · MCPvalidate_artifact · trace_linkterm_lookup · kb_searchskills · MCP serversEvidence + provenancegit: specs/, domain/, PRsartifact headerstrace.yaml · tagsObservabilityrun_id on every callcost · run.json · tracesKnowledge + memoryorg KB · constitutionKG later · placement #21plan → code → QAspec-to-code loop · consumes tagged specscommandsstart, approverun actiontag SPEC-n readycode-to-spec: proposed spec changes

Scroll sideways on narrow screens.

The scenario

Read top to bottom. Each numbered arrow is one step. In the pi-agent lane, the purple tag names the agent acting at that point.

SPEC-0001 swimlane 66 numbered steps across 11 lanes and four phases, from the user typing an intent to a tagged, handoff-ready spec. Userrequester BAbusiness analyst Architectsenior UIthin client Reconcilerorchestrator Git / PRworkflow state pi agentone per step DDD agentpi Verifyspec-lint Eval judgerubric + articles Org KBconstitution P1Intent19 SepThe user's words become intent.md, grounded in the org KB and checked against the constitution. User BA Architect UI Reconciler Git / PR pi agent DDD agent Verify Eval judge Org KB P2Requirements19–20 SepAnalysis finds gaps, DDD fixes the language and boundaries, and generation is verified, repaired, evaluated and revised. User BA Architect UI Reconciler Git / PR pi agent DDD agent Verify Eval judge Org KB In parallel · route: ddd and route: human findings resolve at the same time Verify → repair · deterministic · ≤ 3 attempts Eval → revise · judgment · ≤ 2 retries P3Design21–22 SepDesign analysis raises risks for the architect, DDD adds the tactical model, and generation passes verify and eval first time. User BA Architect UI Reconciler Git / PR pi agent DDD agent Verify Eval judge Org KB P4Verify & handoff22 Sep →A whole-spec verify on main, a ready tag, and the feedback path from execution back to eval. User BA Architect UI Reconciler Git / PR pi agent DDD agent Verify Eval judge Org KB Types the raw intent 1 New spec request 2 Branch spec/SPEC-0001/intent + template 3 INTENT Start session (create) 4 INTENT kb_search: refund policy, provider refunds 5 refund-policy v4 · provider doc v7 · constitution v3 6 INTENT ask_user Q-1: what does “quickly” mean? 7 Refund must start within 1 hour 8 INTENT Writes intent.md · validate_artifact ✓ 9 spec-lint intent.md 10 Clean · no open Q (F6) · CON-1 cites KB (K2) 11 Intent rubric + ART-1 12 Pass 0.86 13 ddd-seed 14 Proposed terms → glossary 15 status in-review · PR 11 · ready-for-review 16 Approves intent 17 Re-verify · status approved · merge 18 REQ ANALYSIS Round 1 19 RAF-1..4 · RAF-4 boundary is a blocker 20 spec-lint 21 Gate F1: blocker RAF-4 still open 22 ddd-strategic for RAF-2, RAF-4 23 Refund, Order Reference · Ordering → Payments map 24 needs-input: RAF-1 25 /answer RAF-1: whole Order only 26 REQ ANALYSIS Round 2 27 No new findings · ART-2, ART-5 apply 28 REQ GENERATION Create (attempt 1) 29 requirements.md + trace links 30 spec-lint 31 L5 “quickly” · D5 “reimbursement” · L2 two “shall” 32 REQ GENERATION Repair (attempt 2) with error list 33 spec-lint 34 Clean 35 Rubric + ART-2, ART-5 36 ART-2: REQ-002 has no duplicate-trigger AC 37 REQ GENERATION Revise with judge rationale 38 Adds AC-002.2 (no second Refund) 39 Re-verify + re-eval 40 Pass 0.91 41 PR 12 in-review · BA + architect (domain/ changed) 42 Approves domain changes 43 Approves requirements 44 Merge · glossary v2 on main 45 DESIGN ANALYSIS Round 1 46 DESIGN ANALYSIS kb_get provider doc v7 47 Refund API limit: 20 per second 48 DAF-1 rate-limit risk · DAF-2 duplicates 49 needs-input: DAF-1 (2 options) 50 /answer DAF-1: durable refund queue 51 ddd-tactical 52 Orders, Refunds aggregates · cml_check ✓ 53 DESIGN GENERATION Create 54 DES-1..4 · ADR-1 · realizes links 55 spec-lint 56 Clean · coverage C5–C8 · no boundary violation (D9) 57 Rubric + ART-2..5 58 Pass 0.88 59 PR 15 in-review 60 Approves design 61 Merge 62 Whole-spec verify on main 63 C1–C9 ✓ · no stale pins · metrics.json 64 Tag SPEC-0001/v1.1-ready 65 Execution loop feeds lagging signals back 66

The diagram is 1,400 px wide. Scroll sideways on smaller screens.

Step by step

The same steps in words, with the detail that doesn't fit on an arrow.

P1

Intent

19 Sep

The user's words become intent.md, grounded in the org KB and checked against the constitution.

  1. User → UIhuman

    Types the raw intent

    “Customers who cancel before we ship keep emailing support to get their money back… Support is drowning.”

  2. UI → Reconciler

    New spec request

  3. Reconciler → Git / PR

    Branch spec/SPEC-0001/intent + template

    The header pins constitution v3 and the AGENTS.md hash before any agent runs.

  4. Reconciler → Intent agent

    Start session (create)

  5. Intent agent → Org KB

    kb_search: refund policy, provider refunds

  6. Org KB → Intent agent

    refund-policy v4 · provider doc v7 · constitution v3

  7. Intent agent → User

    ask_user Q-1: what does “quickly” mean?

    Relayed through the reconciler and the UI. The agent never guesses a number.

  8. User → Intent agent

    Refund must start within 1 hour

  9. Intent agent

    Writes intent.md · validate_artifact ✓

    STK-1..3, GOAL-1 (must), GOAL-2 (should), NG-1, CON-1 citing kb:finance-refund-policy@4, SC-1/2, ASM-1, Q-1 answered.

  10. Reconciler → Verify

    spec-lint intent.md

  11. Verify → Reconcilerpassed

    Clean · no open Q (F6) · CON-1 cites KB (K2)

  12. Reconciler → Eval judge

    Intent rubric + ART-1

  13. Eval judge → Reconcilerpassed

    Pass 0.86

  14. Reconciler → DDD agent

    ddd-seed

  15. DDD agent → Reconciler

    Proposed terms → glossary

  16. Reconciler → Git / PR

    status in-review · PR 11 · ready-for-review

  17. BA → UIhuman

    Approves intent

  18. Reconciler → Git / PR

    Re-verify · status approved · merge

P2

Requirements

19–20 Sep

Analysis finds gaps, DDD fixes the language and boundaries, and generation is verified, repaired, evaluated and revised.

  1. Reconciler → Req analysis agent

    Round 1

  2. Req analysis agent → Reconciler

    RAF-1..4 · RAF-4 boundary is a blocker

    RAF-1 partial cancellation (human) · RAF-2 “money back” wording (ddd) · RAF-3 provider rejects refund (self) · RAF-4 which context decides (ddd, blocker).

  3. Reconciler → Verify

    spec-lint

  4. Verify → Reconcilerfailed

    Gate F1: blocker RAF-4 still open

  5. Reconciler → DDD agent

    ddd-strategic for RAF-2, RAF-4

  6. DDD agent → Reconciler

    Refund, Order Reference · Ordering → Payments map

    Adds TERM-005 Refund (avoid: reimbursement, money back) and TERM-008 Order Reference. Declares the Ordering and Payments contexts and maps Ordering [OHS,PL] → Payments [ACL].

  7. Reconciler → UI

    needs-input: RAF-1

  8. BA → UIhuman

    /answer RAF-1: whole Order only

  9. Reconciler → Req analysis agent

    Round 2

  10. Req analysis agent → Reconciler

    No new findings · ART-2, ART-5 apply

  11. Reconciler → Req generation agent

    Create (attempt 1)

  12. Req generation agent → Reconciler

    requirements.md + trace links

  13. Reconciler → Verify

    spec-lint

  14. Verify → Reconcilerfailed

    L5 “quickly” · D5 “reimbursement” · L2 two “shall”

    Errors are deterministic, so the same draft always fails the same way. The step is re-run in repair mode with the error list.

  15. Reconciler → Req generation agent

    Repair (attempt 2) with error list

  16. Reconciler → Verify

    spec-lint

  17. Verify → Reconcilerpassed

    Clean

  18. Reconciler → Eval judge

    Rubric + ART-2, ART-5

  19. Eval judge → Reconcilerfailed

    ART-2: REQ-002 has no duplicate-trigger AC

    The draft was lint-clean but broke a constitution article. Only a judgment check could catch this.

  20. Reconciler → Req generation agent

    Revise with judge rationale

  21. Req generation agent → Reconciler

    Adds AC-002.2 (no second Refund)

  22. Reconciler → Eval judge

    Re-verify + re-eval

  23. Eval judge → Reconcilerpassed

    Pass 0.91

  24. Reconciler → Git / PR

    PR 12 in-review · BA + architect (domain/ changed)

  25. Architect → UIhuman

    Approves domain changes

  26. BA → UIhuman

    Approves requirements

  27. Reconciler → Git / PR

    Merge · glossary v2 on main

P3

Design

21–22 Sep

Design analysis raises risks for the architect, DDD adds the tactical model, and generation passes verify and eval first time.

  1. Reconciler → Design analysis agent

    Round 1

  2. Design analysis agent → Org KB

    kb_get provider doc v7

  3. Org KB → Design analysis agent

    Refund API limit: 20 per second

  4. Design analysis agent → Reconciler

    DAF-1 rate-limit risk · DAF-2 duplicates

    DAF-1 nfr-risk goes to the architect with two options and a recommendation. DAF-2 is a gap the step resolves itself, citing const:ART-2.

  5. Reconciler → UI

    needs-input: DAF-1 (2 options)

  6. Architect → UIhuman

    /answer DAF-1: durable refund queue

  7. Reconciler → DDD agent

    ddd-tactical

  8. DDD agent → Reconciler

    Orders, Refunds aggregates · cml_check ✓

    Ordering v2: Order + OrderCancelled. Payments v2: Refund keyed by OrderReference, plus RefundIssued and RefundFailed.

  9. Reconciler → Design generation agent

    Create

  10. Design generation agent → Reconciler

    DES-1..4 · ADR-1 · realizes links

  11. Reconciler → Verify

    spec-lint

  12. Verify → Reconcilerpassed

    Clean · coverage C5–C8 · no boundary violation (D9)

    DES-3 in Payments depends on DES-2 in Ordering. That is allowed only because the context map has Ordering → Payments.

  13. Reconciler → Eval judge

    Rubric + ART-2..5

  14. Eval judge → Reconcilerpassed

    Pass 0.88

  15. Reconciler → Git / PR

    PR 15 in-review

  16. Architect → UIhuman

    Approves design

  17. Reconciler → Git / PR

    Merge

P4

Verify & handoff

22 Sep →

A whole-spec verify on main, a ready tag, and the feedback path from execution back to eval.

  1. Reconciler → Verify

    Whole-spec verify on main

  2. Verify → Reconcilerpassed

    C1–C9 ✓ · no stale pins · metrics.json

  3. Reconciler → Git / PR

    Tag SPEC-0001/v1.1-ready

  4. Git / PR → Eval judge

    Execution loop feeds lagging signals back

    plan → code → QA consumes only the tag and adds implements/tests links. Clarification requests, spec-rooted rework and escaped defects are attributed to IDs and flow into the eval sets.

Leading metrics at handoff

What spec-lint recorded in metrics.json by the time the spec was tagged. The lagging signals from plan → code → QA are later checked against these.

MetricValueWhat it says
goal_coverage1.00the must-goal has requirements
ears_rate5 / 5every REQ statement is valid EARS
testable_ac_rate7 / 7every AC is Given/When/Then
nfr_measurable_rate2 / 2every NFR has a number and unit
findings4 RAF · 2 DAF1 blocker, 4 major, 1 minor
human_questions3Q-1, RAF-1, DAF-1
repair_attempts1req-generation, lint errors
eval_retries1req-generation, ART-2
realization_rate5 / 5every must REQ is realized by a DES
boundary_violations0D9
back_edges0no requirement changes from design

Where it lives

All of this is in the spec-contracts bundle and is generated from one model, so the page, the drawing and the diagrams can't drift apart.