valent-pipeline 0.7.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +65 -54
  2. package/bin/cli.js +502 -40
  3. package/package.json +2 -3
  4. package/pipeline/docs/agent-reference.md +6 -5
  5. package/pipeline/docs/communication-standard.md +1 -1
  6. package/pipeline/docs/index.md +1 -1
  7. package/pipeline/docs/knowledge-system.md +12 -12
  8. package/pipeline/docs/npx-implementation-plan.md +5 -7
  9. package/pipeline/docs/npx-packaging.md +10 -13
  10. package/pipeline/docs/pipeline-overview.md +11 -11
  11. package/pipeline/docs/task-graph.md +2 -2
  12. package/pipeline/docs/template-skeleton.md +1 -1
  13. package/pipeline/orchestrators/claude-code/README.md +21 -23
  14. package/pipeline/orchestrators/claude-code/plan.workflow.js +177 -60
  15. package/pipeline/orchestrators/claude-code/retro.workflow.js +31 -14
  16. package/pipeline/orchestrators/claude-code/sprint.workflow.js +1721 -257
  17. package/pipeline/prompts/bend.md +10 -21
  18. package/pipeline/prompts/critic.md +12 -23
  19. package/pipeline/prompts/data.md +8 -9
  20. package/pipeline/prompts/docgen.md +8 -9
  21. package/pipeline/prompts/fend.md +10 -21
  22. package/pipeline/prompts/iac.md +10 -11
  23. package/pipeline/prompts/judge.md +10 -22
  24. package/pipeline/prompts/libdev.md +8 -9
  25. package/pipeline/prompts/mcp-dev.md +8 -9
  26. package/pipeline/prompts/mobile.md +10 -11
  27. package/pipeline/prompts/pmcp.md +1 -1
  28. package/pipeline/prompts/qa-a.md +22 -15
  29. package/pipeline/prompts/qa-b.md +13 -23
  30. package/pipeline/prompts/reqs.md +10 -11
  31. package/pipeline/prompts/retrospective.md +8 -8
  32. package/pipeline/prompts/uxa.md +9 -10
  33. package/pipeline/schemas/atdd-proof.schema.json +62 -0
  34. package/pipeline/schemas/atdd-red-baseline.schema.json +78 -0
  35. package/pipeline/schemas/bugs-block.schema.json +30 -0
  36. package/pipeline/schemas/evidence-assert.schema.json +63 -0
  37. package/pipeline/schemas/evidence-baseline.schema.json +38 -0
  38. package/pipeline/schemas/evidence-run.schema.json +118 -0
  39. package/pipeline/schemas/gate-pin.schema.json +20 -0
  40. package/pipeline/schemas/qa-spec-manifest.schema.json +53 -0
  41. package/pipeline/schemas/reqs-manifest.schema.json +28 -0
  42. package/pipeline/schemas/verdict.schema.json +5 -0
  43. package/pipeline/steps/bend/estimate.md +1 -1
  44. package/pipeline/steps/bend/handoff.md +2 -2
  45. package/pipeline/steps/bend/read-inputs.md +2 -2
  46. package/pipeline/steps/bend/write-tests.md +8 -5
  47. package/pipeline/steps/common/agent-protocol.md +13 -31
  48. package/pipeline/steps/common/distilled-handoff-format.md +2 -2
  49. package/pipeline/steps/common/no-api-passthrough.md +1 -1
  50. package/pipeline/steps/common/no-ui-passthrough.md +1 -1
  51. package/pipeline/steps/critic/acceptance-audit.md +8 -6
  52. package/pipeline/steps/critic/write-verdict.md +6 -12
  53. package/pipeline/steps/data/estimate.md +1 -1
  54. package/pipeline/steps/data/handoff.md +2 -2
  55. package/pipeline/steps/data/read-inputs.md +2 -2
  56. package/pipeline/steps/data/write-tests.md +5 -0
  57. package/pipeline/steps/docgen/estimate.md +1 -1
  58. package/pipeline/steps/docgen/handoff.md +2 -2
  59. package/pipeline/steps/docgen/read-inputs.md +2 -2
  60. package/pipeline/steps/docgen/write-tests.md +5 -0
  61. package/pipeline/steps/fend/estimate.md +1 -1
  62. package/pipeline/steps/fend/handoff.md +3 -3
  63. package/pipeline/steps/fend/read-inputs.md +2 -2
  64. package/pipeline/steps/fend/write-tests.md +8 -5
  65. package/pipeline/steps/iac/estimate.md +1 -1
  66. package/pipeline/steps/iac/handoff.md +2 -2
  67. package/pipeline/steps/iac/implement.md +1 -1
  68. package/pipeline/steps/iac/read-inputs.md +2 -2
  69. package/pipeline/steps/iac/write-tests.md +7 -4
  70. package/pipeline/steps/judge/bug-review.md +1 -1
  71. package/pipeline/steps/judge/evidence-review.md +31 -17
  72. package/pipeline/steps/judge/ship-decision.md +3 -6
  73. package/pipeline/steps/libdev/estimate.md +1 -1
  74. package/pipeline/steps/libdev/handoff.md +2 -2
  75. package/pipeline/steps/libdev/read-inputs.md +2 -2
  76. package/pipeline/steps/libdev/write-tests.md +5 -0
  77. package/pipeline/steps/mcp-dev/estimate.md +1 -1
  78. package/pipeline/steps/mcp-dev/handoff.md +2 -2
  79. package/pipeline/steps/mcp-dev/read-inputs.md +2 -2
  80. package/pipeline/steps/mcp-dev/write-tests.md +5 -0
  81. package/pipeline/steps/mobile/emulator-lifecycle.md +2 -2
  82. package/pipeline/steps/mobile/estimate.md +1 -1
  83. package/pipeline/steps/mobile/handoff.md +3 -6
  84. package/pipeline/steps/mobile/read-inputs.md +2 -2
  85. package/pipeline/steps/mobile/write-tests.md +8 -5
  86. package/pipeline/steps/orchestration/bug-intake.md +4 -1
  87. package/pipeline/steps/orchestration/git-flow.md +99 -0
  88. package/pipeline/steps/orchestration/pm-autonomy.md +109 -0
  89. package/pipeline/steps/orchestration/resolve-next-work-item.md +52 -27
  90. package/pipeline/steps/orchestration/update-backlog-status.md +84 -69
  91. package/pipeline/steps/orchestration/validate-story-inputs.md +3 -1
  92. package/pipeline/steps/qa-a/read-inputs.md +4 -4
  93. package/pipeline/steps/qa-a/self-attack.md +14 -0
  94. package/pipeline/steps/qa-a/write-acceptance-tests.md +45 -0
  95. package/pipeline/steps/qa-a/write-spec.md +8 -4
  96. package/pipeline/steps/qa-b/api.md +10 -3
  97. package/pipeline/steps/qa-b/execute-tests.md +20 -1
  98. package/pipeline/steps/qa-b/file-bugs.md +12 -1
  99. package/pipeline/steps/qa-b/write-report.md +18 -10
  100. package/pipeline/steps/reqs/pre-mortem.md +1 -1
  101. package/pipeline/steps/reqs/read-inputs.md +3 -3
  102. package/pipeline/steps/reqs/write-output.md +16 -1
  103. package/pipeline/steps/retrospective/directives.md +10 -4
  104. package/pipeline/steps/retrospective/embed-instructions.md +1 -2
  105. package/pipeline/steps/retrospective/report.md +5 -2
  106. package/pipeline/steps/uxa/read-inputs.md +2 -2
  107. package/pipeline/steps/uxa/write-output.md +0 -1
  108. package/pipeline/task-graphs/backend-api.yaml +3 -84
  109. package/pipeline/task-graphs/data-pipeline.yaml +3 -84
  110. package/pipeline/task-graphs/document-generation.yaml +3 -84
  111. package/pipeline/task-graphs/frontend-only.yaml +3 -92
  112. package/pipeline/task-graphs/fullstack-web.yaml +4 -102
  113. package/pipeline/task-graphs/library.yaml +3 -84
  114. package/pipeline/task-graphs/mcp-server.yaml +3 -84
  115. package/pipeline/task-graphs/mobile-app.yaml +3 -92
  116. package/pipeline/templates/bugs.template.md +12 -0
  117. package/pipeline/templates/embed-instructions.template.md +1 -1
  118. package/pipeline/templates/qa-test-spec.template.md +6 -2
  119. package/pipeline/templates/reqs-brief.template.md +2 -1
  120. package/pipeline/templates/retrospective.template.md +1 -1
  121. package/pipeline/templates/story-report.template.md +1 -1
  122. package/pipeline/templates/uxa-spec.template.md +1 -1
  123. package/pipeline/templates/visual-validation-checklist.template.md +1 -1
  124. package/skills/valent-configure/SKILL.md +37 -7
  125. package/skills/valent-debug-export/SKILL.md +1 -2
  126. package/skills/valent-help/SKILL.md +5 -5
  127. package/skills/valent-knowledge/SKILL.md +3 -7
  128. package/skills/valent-resume/SKILL.md +3 -3
  129. package/skills/valent-review-cost/SKILL.md +2 -2
  130. package/skills/valent-run-deferred-tests/SKILL.md +17 -8
  131. package/skills/valent-run-epic-workflow/SKILL.md +60 -15
  132. package/skills/valent-run-project-workflow/SKILL.md +39 -14
  133. package/skills/valent-run-spike/SKILL.md +96 -0
  134. package/skills/valent-run-story-workflow/SKILL.md +7 -7
  135. package/skills/valent-setup-backlog/SKILL.md +43 -2
  136. package/src/commands/analyze.js +204 -0
  137. package/src/commands/audit.js +13 -1
  138. package/src/commands/backlog.js +376 -0
  139. package/src/commands/check-spec-conformance.js +21 -1
  140. package/src/commands/crosscheck.js +113 -0
  141. package/src/commands/db-directives.js +0 -0
  142. package/src/commands/db-index.js +3 -70
  143. package/src/commands/db-query.js +14 -1
  144. package/src/commands/db-rebuild.js +10 -10
  145. package/src/commands/detect-project.js +36 -0
  146. package/src/commands/evidence.js +609 -0
  147. package/src/commands/git-flow.js +143 -0
  148. package/src/commands/init.js +89 -10
  149. package/src/commands/rejection-cap.js +20 -15
  150. package/src/commands/resolve-eligible.js +16 -2
  151. package/src/commands/spec-check.js +72 -0
  152. package/src/commands/sprint-pack.js +15 -2
  153. package/src/commands/trace.js +99 -0
  154. package/src/commands/upgrade.js +8 -1
  155. package/src/commands/validate.js +7 -0
  156. package/src/lib/analyze.js +173 -0
  157. package/src/lib/audit.js +1 -0
  158. package/src/lib/backlog-lint.js +160 -0
  159. package/src/lib/backlog.js +559 -0
  160. package/src/lib/config-schema.js +227 -9
  161. package/src/lib/crosscheck.js +141 -0
  162. package/src/lib/db.js +21 -28
  163. package/src/lib/detect.js +387 -0
  164. package/src/lib/evidence.js +0 -0
  165. package/src/lib/git-flow.js +701 -0
  166. package/src/lib/graph.js +25 -4
  167. package/src/lib/handoff.js +16 -6
  168. package/src/lib/junit.js +231 -0
  169. package/src/lib/locked-file.js +61 -0
  170. package/src/lib/obsolete-manifest.js +11 -0
  171. package/src/lib/spec-check.js +98 -0
  172. package/src/lib/spec-conformance.js +39 -3
  173. package/src/lib/sprint.js +150 -23
  174. package/src/lib/trace.js +199 -0
  175. package/pipeline/prompts/readiness.md +0 -73
  176. package/pipeline/providers/claude-code/runtime.md +0 -148
  177. package/pipeline/providers/claude-code/spawn.template.md +0 -16
  178. package/pipeline/scripts/db-bootstrap.ts +0 -153
  179. package/pipeline/scripts/embed-sqlite.ts +0 -288
  180. package/pipeline/scripts/embed.ts +0 -425
  181. package/pipeline/scripts/query-kb.ts +0 -183
  182. package/pipeline/spawn-templates/agent-spawn.template.md +0 -16
  183. package/pipeline/spawn-templates/pipeline-context.template.md +0 -47
  184. package/pipeline/steps/orchestration/load-pipeline-config.md +0 -39
  185. package/pipeline/steps/readiness/sprint-review.md +0 -45
  186. package/pipeline/steps/readiness/standalone-review.md +0 -131
  187. package/pipeline/templates/readiness-review.template.md +0 -147
package/README.md CHANGED
@@ -29,23 +29,24 @@ npx valent-pipeline init
29
29
 
30
30
  ## How It Works
31
31
 
32
- A persistent **Lead** agent reads your story, assembles a team of specialist agents, and orchestrates them through a dependency-driven pipeline:
32
+ A deterministic **Workflow orchestrator** (`sprint.workflow.js`) reads your story, spawns specialist agents per task, and drives them through a dependency-driven pipeline:
33
33
 
34
34
  ```
35
- REQS -> UXA -> QA-A -> READINESS -> BEND + FEND -> CRITIC -> QA-B -> JUDGE -> SHIP
35
+ REQS -> UXA -> QA-A -> SPECCHECK -> RED -> BEND + FEND -> STATIC -> CRITIC -> GREEN -> QA-B -> EVIDENCE -> JUDGE -> SHIP
36
36
  ```
37
37
 
38
- 1. **REQS** translates acceptance criteria into an implementation brief
38
+ 1. **REQS** translates acceptance criteria into an implementation brief (+ a machine-readable AC manifest)
39
39
  2. **UXA** converts UX specs into component specifications (frontend projects)
40
- 3. **QA-A** writes behavioral test specifications *before any code exists*
41
- 4. **READINESS** gate validates the spec chain -- stops on first failure
40
+ 3. **QA-A** writes behavioral test specifications *before any code exists* (+ a spec manifest mapping every case to its AC)
41
+ 4. **SPECCHECK** gate validates the spec chain mechanically (`valent spec check` + `trace check`); **RED** gate proves the acceptance suite fails pre-implementation (ATDD)
42
42
  5. **BEND + FEND** implement production code and tests in parallel
43
- 6. **CRITIC** runs a 3-pass adversarial code review (blind hunt, edge cases, acceptance audit)
44
- 7. **QA-B** executes tests against real infrastructure, files bugs, builds traceability matrix
45
- 8. **JUDGE** makes an evidence-based SHIP or REJECT decision
46
- 9. **Lead** commits code, writes the story report, and picks the next story
43
+ 6. **STATIC** gate runs deterministic checks at mechanical cost: lint/type commands, spec-conformance (no dropped assertion targets or un-waived skips), trace check (every AC has a covering case)
44
+ 7. **CRITIC** runs a 3-pass adversarial code review (blind hunt, edge cases, acceptance audit), pinning the git SHA it reviewed
45
+ 8. **QA-B** executes tests against real infrastructure **through `evidence run`** — exit codes, full logs, junit reports (frozen + SHA-256-hashed), and the git SHA are captured by the CLI, never transcribed by a model — then files bugs and builds the traceability matrix
46
+ 9. **EVIDENCE** gate deterministically re-verifies the machine record: report hashes intact, junit green (with the brownfield pre-existing carve-out), every spec'd case executed, CRITIC's pin matches the tested SHA
47
+ 10. **JUDGE** makes the SHIP or REJECT decision from the machine verdicts (its self-reported numbers are recounted from the artifacts afterward — a mismatch stops the run)
47
48
 
48
- Two quality gates (**READINESS** and **JUDGE**) enforce pass/fail checkpoints. Rejection loops send work back to the responsible agent with specific corrections, with a circuit breaker to prevent infinite cycles.
49
+ Quality gates (**SPECCHECK**, **RED**, **STATIC**, **CRITIC**, **GREEN**, **EVIDENCE**, **JUDGE**) enforce pass/fail checkpoints. Rejection loops send work back to the responsible agent with specific corrections, with a code-owned circuit breaker to prevent infinite cycles. The trust property throughout: **facts are captured by code, not transcribed by models** — test results live in `stories/<id>/evidence/` as hashed, machine-written records that gates re-verify.
49
50
 
50
51
  ## Project Types
51
52
 
@@ -62,7 +63,7 @@ The pipeline supports 7 project types, each with a tailored task graph and speci
62
63
  | `library` | LIBDEV | UXA, FEND, PMCP |
63
64
  | `mobile-app` | MOBILE | *(conditional)* |
64
65
 
65
- The Lead selects which agents to spawn based on `project.type` in your `pipeline-config.yaml` and the story's `testing_profiles`.
66
+ The workflow selects which agents to spawn based on `project.type` in your `pipeline-config.yaml` and the story's `testing_profiles` (resolved deterministically by `resolve-graph`).
66
67
 
67
68
  ## Agent Roster
68
69
 
@@ -75,13 +76,14 @@ Spawned fresh per story, torn down after ship or cancel.
75
76
  | REQS | Sonnet | Requirements analyst | `reqs-brief.md` |
76
77
  | UXA | Sonnet | UX specification | `uxa-spec.md` |
77
78
  | QA-A | Sonnet | Test specification | `qa-test-spec.md`, `visual-validation-checklist.md` |
78
- | READINESS | Sonnet | Spec quality gate | `readiness-review.md` |
79
+ | SPECCHECK | Haiku | Mechanical spec gate (artifact matrix + AC coverage CLIs) | gate transcript |
79
80
  | BEND | Sonnet | Backend developer | `bend-handoff.md` |
80
81
  | FEND | Sonnet | Frontend developer | `fend-handoff.md` |
81
82
  | CRITIC | Opus | Adversarial code reviewer | `critic-review.md` |
82
83
  | QA-B | Sonnet | Test executor | `execution-report.md`, `bugs.md`, `traceability-matrix.md` |
83
- | JUDGE | Sonnet | Final quality gate | `judge-review.md`, `judge-decision.md` |
84
- | Knowledge | Haiku | Knowledge retrieval | *(inbox only)* |
84
+ | JUDGE | Sonnet/Opus | Final quality gate (evidence pass / binding decision) | `judge-review.md`, `judge-decision.md` |
85
+
86
+ Knowledge retrieval has no dedicated agent — every agent self-serves from curated files and the SQLite knowledge base via the `db` CLI commands.
85
87
 
86
88
  ### Domain Developer Agents
87
89
 
@@ -96,15 +98,13 @@ Specialized agents that replace BEND for non-API project types:
96
98
  | IAC | Sonnet | Cross-cutting (any type) | `iac-handoff.md` |
97
99
  | MOBILE | Sonnet | `mobile-app` | `mobile-handoff.md` |
98
100
 
99
- ### Persistent & Ephemeral Agents
101
+ ### Cross-Story Stages
100
102
 
101
- | Agent | Model | Lifecycle | Trigger |
102
- |---|---|---|---|
103
- | Lead | Opus | Persistent across stories | Always running |
104
- | PMCP | Sonnet | Ephemeral | QA-B requests visual validation |
105
- | Embed | Haiku | Ephemeral | After Retrospective curates |
106
- | Retrospective | Sonnet | Ephemeral | Every N stories (configurable) |
107
- | Help | Haiku | Ephemeral | User request |
103
+ | Stage | Model | Trigger |
104
+ |---|---|---|
105
+ | PMCP (visual evidence) | Haiku | Orchestrator stage after QA-B on `ui` stories |
106
+ | Retrospective | Sonnet | Retro workflow after a sprint |
107
+ | Knowledge persist | Haiku | `db index-curated` CLI step driven by the retro workflow |
108
108
 
109
109
  ## Installation
110
110
 
@@ -177,13 +177,19 @@ models:
177
177
  haiku: [Knowledge, Embed, Help] # Retrieval, indexing, lookups
178
178
 
179
179
  quality:
180
- max_rejection_cycles: 5 # Circuit breaker for rejection loops
180
+ max_rejection_cycles: 3 # Circuit breaker for rejection loops
181
181
  retrospective_every_n_stories: 5 # Retrospective trigger frequency
182
182
  stall_threshold_minutes: 15 # Agent stall detection timeout
183
183
 
184
- git:
185
- target_branch: "" # Base branch for story branches
186
- story_branch_prefix: story/ # Branch naming convention
184
+ git: # Story git flow (valent git start-story|commit-phase|ship-story|leave-story)
185
+ enabled: true # Branch-per-story + typed commit trail + merge --no-ff on ship
186
+ target_branch: "" # Base/merge-back branch ("" = the branch the sprint starts on)
187
+ story_branch_prefix: story/ # Branch naming convention (story/<id>)
188
+ parallelism: # Concurrent stories in git worktrees (merges stay serialized)
189
+ enabled: false # OFF = strictly sequential sprint (the default)
190
+ max_stories: 2 # Concurrency cap when enabled
191
+ worktree_dir: .valent-worktrees # Worktrees at <dir>/<story-id> (ignored via .git/info/exclude)
192
+ setup_commands: [] # Run in each fresh worktree (env files, per-story ports, installs)
187
193
 
188
194
  knowledge:
189
195
  mode: sqlite # none | sqlite | local-docker | connect-to-existing
@@ -212,10 +218,17 @@ sprint: # Only used in epic/project mode
212
218
  | Command | Description |
213
219
  |---|---|
214
220
  | `valent-pipeline db init` | Initialize SQLite knowledge database |
215
- | `valent-pipeline db rebuild` | Drop and recreate all tables |
216
- | `valent-pipeline db index <story-dir>` | Index a story's artifacts |
217
- | `valent-pipeline db query <text>` | Full-text search across artifacts |
218
- | `valent-pipeline db embed <file>` | Generate and store embeddings |
221
+ | `valent-pipeline db rebuild` | Rebuild the database from story artifacts |
222
+ | `valent-pipeline db index-handoff --file <path>` | Index a single handoff artifact |
223
+ | `valent-pipeline db search --query <text>` | Full-text search across all artifacts |
224
+ | `valent-pipeline db query-artifact --story <id> --type <type>` | Fetch a specific artifact |
225
+ | `valent-pipeline db query-directives [--agent <role>]` | Get active correction directives |
226
+ | `valent-pipeline db add-directive --json-file <path> --batch <n>` | Persist correction directives (canonical YAML + queryable index, one call) |
227
+ | `valent-pipeline db retire-directive --id <id> [--status expired\|superseded]` | Expire/supersede a directive (status change only — audit trail kept) |
228
+ | `valent-pipeline db sync-directives` | Re-derive the directives index from knowledge/correction-directives.yaml |
229
+ | `valent-pipeline db index-curated --file <path>` | Process embed-instructions.md from a retrospective |
230
+
231
+ Calibration/query helpers: `db record-calibration`, `db query-velocity`, `db query-list`, `db query-stories`, `db query-bugs-since` (see `valent-pipeline db --help`).
219
232
 
220
233
  ### Claude Code Skills
221
234
 
@@ -228,6 +241,7 @@ Invoked as slash commands inside Claude Code:
228
241
  | `/valent-run-story-workflow STORY-ID` | Execute a single story via the Claude Code **Workflow** orchestrator |
229
242
  | `/valent-run-epic-workflow EPIC-ID` | Execute an epic (sprint planning + execution) via the **Workflow** orchestrator |
230
243
  | `/valent-run-project-workflow` | Execute a full project across all epics via the **Workflow** orchestrator |
244
+ | `/valent-run-spike SPIKE-ID` | Run a time-boxed de-risking spike to a recorded GO/STEP-DOWN/HALT decision |
231
245
  | `/valent-run-deferred-tests` | Run deferred iOS tests on Mac |
232
246
  | `/valent-debug-export` | Export diagnostic dump |
233
247
  | `/valent-help` | Pipeline documentation and FAQ |
@@ -263,7 +277,7 @@ For each story, the pipeline produces 15+ artifacts in `stories/{story-id}/outpu
263
277
  | `execution-report.md` | QA-B | Test execution results |
264
278
  | `bugs.md` | QA-B | Filed bugs with priorities |
265
279
  | `traceability-matrix.md` | QA-B | AC-to-test coverage map |
266
- | `readiness-review.md` | READINESS | Spec gate results |
280
+ | `evidence/atdd-red.json`, `evidence/proof.json` | RED/GREEN gates (CLI-written) | ATDD red baseline + the red/green/diff proof object |
267
281
  | `judge-review.md` | JUDGE | Bug review findings |
268
282
  | `judge-decision.md` | JUDGE | Ship/reject decision with evidence |
269
283
  | `story-report.md` | orchestrator | Story completion summary |
@@ -274,10 +288,10 @@ Plus committed, tested production code in your project source tree.
274
288
 
275
289
  All inter-agent communication follows the [Distilled Communication Standard](pipeline/docs/communication-standard.md):
276
290
 
277
- - **Handoff documents** -- structured artifacts with YAML frontmatter, orchestrator summary, and facts-only content. Every handoff follows a [template skeleton](pipeline/docs/template-skeleton.md).
278
- - **Inbox messages** -- terse coordination messages (~500 tokens max) with file pointers. Types include `[HANDOFF]`, `[BLOCKER]`, `[REVISION]`, `[CRITIC-REJECTION]`, `[BUG]`, `[DESIGN-COUNCIL]`, `[ESCALATION]`.
291
+ - **Handoff documents** -- structured artifacts with YAML frontmatter, orchestrator summary, and facts-only content. Every handoff follows a [template skeleton](pipeline/docs/template-skeleton.md). The handoff file IS the completion signal -- the orchestrator sequences agents from it.
292
+ - **Structured returns** -- each agent returns a terse, schema-validated machine block with file pointers; the orchestrator routes all coordination (rejections, bugs, escalations) from these.
279
293
  - **Design Council** -- structured deliberation protocol for contested design decisions with position statements, synthesis, and escalation to user if consensus fails.
280
- - **Human Escalation** -- when agent deliberation is insufficient, the Lead surfaces the issue to the user with full context.
294
+ - **Human Escalation** -- when agent deliberation is insufficient, the orchestrator surfaces the issue to the user with full context.
281
295
 
282
296
  ## Knowledge System
283
297
 
@@ -287,9 +301,9 @@ The pipeline learns from its own output through a [knowledge system](pipeline/do
287
301
  |---|---|---|
288
302
  | Correction directives | `knowledge/correction-directives.yaml` | Behavioral changes for agents from past patterns |
289
303
  | Curated knowledge | `knowledge/curated/` | Conventions, validated patterns, known pitfalls |
290
- | SQLite / ChromaDB | `.valent-pipeline/pipeline.db` | Embedding-based retrieval (optional) |
304
+ | SQLite (FTS5) | `.valent-pipeline/pipeline.db` | Full-text retrieval over indexed artifacts and curated lessons |
291
305
 
292
- The **Retrospective** agent (triggered every N stories) is the sole gatekeeper for what enters persistent knowledge. It analyzes batch outputs, writes correction directives, and produces indexing instructions for the **Embed** agent. The **Knowledge** agent reads all sources and responds to teammate queries during story execution.
306
+ The retrospective workflow (`retro.workflow.js`, triggered every N stories) is the sole gatekeeper for what enters persistent knowledge: it analyzes batch outputs, synthesizes gated correction directives, and emits indexing instructions executed by its EMBED stage. During story execution, agents self-serve from the knowledge sources via the `valent-knowledge` skill.
293
307
 
294
308
  ### Knowledge Modes
295
309
 
@@ -302,7 +316,7 @@ The **Retrospective** agent (triggered every N stories) is the sole gatekeeper f
302
316
 
303
317
  ## Execution Modes
304
318
 
305
- The pipeline runs on a single orchestration path: the **Claude Code Workflow** path. A deterministic Workflow script (`pipeline/orchestrators/claude-code/{plan,sprint,retro}.workflow.js`) drives the pipeline with schema-validated gates, a code-owned rejection cap, parallel CRITIC passes, and journal-based resume (`resumeFromRunId`). Control flow lives in JavaScript and the journal — not in a model interpreting prose. Validated by `scripts/test-workflow.js` but not yet exercised end-to-end against a live story validate against a fixture before relying on it. See `pipeline/orchestrators/claude-code/README.md`.
319
+ The pipeline runs on a single orchestration path: the **Claude Code Workflow** path. A deterministic Workflow script (`pipeline/orchestrators/claude-code/{plan,sprint,retro}.workflow.js`) drives the pipeline with schema-validated gates, a code-owned rejection cap, parallel CRITIC passes, and journal-based resume (`resumeFromRunId`). Control flow lives in JavaScript and the journal — not in a model interpreting prose. Control flow is validated by `scripts/test-workflow.js`, and the orchestrator is exercised end-to-end against live stories (live runs have driven the version history). See `pipeline/orchestrators/claude-code/README.md`.
306
320
 
307
321
  > Requires Claude Code (the Workflow tool). `runtime.provider` must be `claude-code`.
308
322
 
@@ -340,14 +354,20 @@ Converts your epics and stories documents into a prioritized `pipeline-backlog.y
340
354
 
341
355
  ## Quality Gates
342
356
 
343
- ### READINESS Gate
357
+ ### SPECCHECK Gate (mechanical)
358
+
359
+ Validates the spec chain before any code is written — as CLIs, not LLM judgment:
360
+ - `valent spec check`: artifact-existence matrix per testing profile, acceptance-file existence, and the acceptance-tier mock ban
361
+ - `valent trace check`: every unwaived AC covered by at least one spec'd case
362
+
363
+ Rework routes to the CLI-named owner (REQS/UXA/QA-A) with downstream specs re-derived automatically.
344
364
 
345
- Validates the spec chain before any code is written:
346
- - REQS brief completeness and accuracy
347
- - UXA spec consistency (frontend projects)
348
- - QA test spec coverage and depth
365
+ ### RED / GREEN Gates (ATDD)
349
366
 
350
- Stops on first failure. The responsible upstream agent must rework before the pipeline proceeds.
367
+ When `atdd.command` is configured, QA-A authors **executable acceptance tests** before any implementation exists:
368
+ - **RED** (pre-dev): the suite runs via `valent evidence run` and every required acceptance case must FAIL — a pre-passing test is a spec bug. The passing red writes `evidence/atdd-red.json`, snapshot-hashing the acceptance sources.
369
+ - The acceptance tests are **read-only for dev agents** — any edit is hash-detected and auto-REJECTed to QA-A arbitration (restore, or amend with an audited `evidence rebaseline`).
370
+ - **GREEN** (post-CRITIC): the suite re-runs and must pass with the sources byte-identical since red. `valent evidence proof` then assembles `proof.json`: the failing run before AI wrote code, the passing run after, the exact diff between, and the hashes.
351
371
 
352
372
  ### JUDGE Gate
353
373
 
@@ -358,14 +378,14 @@ Makes the final ship decision based on evidence:
358
378
  - PMCP visual evidence (UI projects)
359
379
  - Applies "evidence over assertion" -- independently verifies every upstream claim
360
380
 
361
- Verdicts: **SHIP** (commit and close), **SHIP-PARTIAL** (mobile: ship Android, defer iOS), **REJECT** (send back with corrections).
381
+ Verdicts: **SHIP** (the story branch merges `--no-ff` into the target branch and the backlog flips to shipped), **SHIP-PARTIAL** (mobile: ship Android, defer iOS), **REJECT** (the story branch is left unmerged for the fix/retry; send back with corrections).
362
382
 
363
383
  ### Rejection Loops
364
384
 
365
385
  When CRITIC or JUDGE rejects work:
366
386
  1. Lead re-queues the responsible agent with the specific rejection findings
367
387
  2. Agent reworks and resubmits
368
- 3. Circuit breaker (`max_rejection_cycles`, default 5) prevents infinite loops
388
+ 3. Circuit breaker (`max_rejection_cycles`, default 3) prevents infinite loops
369
389
  4. After max cycles, Lead escalates to user
370
390
 
371
391
  ## Crash Recovery
@@ -397,7 +417,6 @@ After initialization, the pipeline installs to `.valent-pipeline/` in your proje
397
417
  qa-a/ # Test spec steps (domain-specific)
398
418
  qa-b/ # Test execution steps (domain-specific)
399
419
  reqs/ # Requirements analysis steps
400
- readiness/ # Readiness gate steps
401
420
  judge/ # Judge gate steps
402
421
  orchestration/ # Shared orchestration steps (config, story resolution, status)
403
422
  retrospective/ # Retrospective analysis steps
@@ -410,7 +429,6 @@ After initialization, the pipeline installs to `.valent-pipeline/` in your proje
410
429
  mcp-dev/ # MCP server developer steps
411
430
  mobile/ # Mobile developer steps
412
431
  uxa/ # UX specification steps
413
- spawn-templates/ # Agent spawn configuration
414
432
  scripts/ # Pipeline utility scripts
415
433
  docs/ # Pipeline reference documentation
416
434
  knowledge/
@@ -428,19 +446,12 @@ Full reference documentation lives in `pipeline/docs/`:
428
446
  | [Pipeline Overview](pipeline/docs/pipeline-overview.md) | Architecture, flow, artifact map |
429
447
  | [Agent Reference](pipeline/docs/agent-reference.md) | All agents, models, inputs/outputs |
430
448
  | [Communication Standard](pipeline/docs/communication-standard.md) | Handoff format, inbox protocol, Design Council |
431
- | [Lead Lifecycle](pipeline/docs/lead-lifecycle.md) | Kick-off, monitoring, ship, crash recovery |
432
449
  | [Task Graph Specification](pipeline/docs/task-graph.md) | Dependencies, task states, claiming |
433
450
  | [Pipeline State Schema](pipeline/docs/pipeline-state-schema.md) | JSON schema for pipeline-state.json |
434
451
  | [Knowledge System](pipeline/docs/knowledge-system.md) | RAG assessment, correction directives, curation |
435
452
  | [Template Skeleton](pipeline/docs/template-skeleton.md) | Universal handoff document structure |
436
453
  | [NPX Packaging](pipeline/docs/npx-packaging.md) | Package distribution and init workflow |
437
454
 
438
- ### Reference
439
-
440
- | Document | Description |
441
- |---|---|
442
- | [Refactor Checklist](pipeline/docs/design/refactor-checklist.md) | Every location to update when changing agents, config, tables, or phases |
443
-
444
455
  ## License
445
456
 
446
457
  MIT