@smartmemory/compose 0.1.0

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 (181) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1014 -0
  3. package/bin/compose.js +1515 -0
  4. package/dist/assets/_baseUniq-CQwX6VLz.js +1 -0
  5. package/dist/assets/arc-SxJ2J1sh.js +1 -0
  6. package/dist/assets/architectureDiagram-Q4EWVU46-BykunY1F.js +36 -0
  7. package/dist/assets/blockDiagram-DXYQGD6D-ohAKBOUw.js +132 -0
  8. package/dist/assets/c4Diagram-AHTNJAMY-DBDC3ENB.js +10 -0
  9. package/dist/assets/channel-DGElom1e.js +1 -0
  10. package/dist/assets/chunk-4BX2VUAB-Cv93Z7uM.js +1 -0
  11. package/dist/assets/chunk-4TB4RGXK-DE0WBDkj.js +206 -0
  12. package/dist/assets/chunk-55IACEB6-CE1EXenG.js +1 -0
  13. package/dist/assets/chunk-EDXVE4YY-DA7Ana6H.js +1 -0
  14. package/dist/assets/chunk-FMBD7UC4-CTDIPA3p.js +15 -0
  15. package/dist/assets/chunk-OYMX7WX6-uGBaPaTX.js +231 -0
  16. package/dist/assets/chunk-QZHKN3VN-CYlnXuUO.js +1 -0
  17. package/dist/assets/chunk-YZCP3GAM-ojGkzcZK.js +1 -0
  18. package/dist/assets/classDiagram-6PBFFD2Q-KqWP9wWZ.js +1 -0
  19. package/dist/assets/classDiagram-v2-HSJHXN6E-KqWP9wWZ.js +1 -0
  20. package/dist/assets/clone-DUJKJXd7.js +1 -0
  21. package/dist/assets/cose-bilkent-S5V4N54A-Bktn9hL-.js +1 -0
  22. package/dist/assets/dagre-KV5264BT-DFaSzuRF.js +4 -0
  23. package/dist/assets/defaultLocale-DX6XiGOO.js +1 -0
  24. package/dist/assets/diagram-5BDNPKRD-DnfmDzEm.js +10 -0
  25. package/dist/assets/diagram-G4DWMVQ6-Bm8W9YnG.js +24 -0
  26. package/dist/assets/diagram-MMDJMWI5-B5-TSKvp.js +43 -0
  27. package/dist/assets/diagram-TYMM5635-ls4rqlky.js +24 -0
  28. package/dist/assets/erDiagram-SMLLAGMA-giG6WO-r.js +85 -0
  29. package/dist/assets/flowDiagram-DWJPFMVM-XvlUuz-7.js +162 -0
  30. package/dist/assets/ganttDiagram-T4ZO3ILL-hLBV57oV.js +292 -0
  31. package/dist/assets/gitGraphDiagram-UUTBAWPF-BHu3s_Gn.js +106 -0
  32. package/dist/assets/graph-D0Cfv00Y.js +1 -0
  33. package/dist/assets/index-CUd6pFGF.css +1 -0
  34. package/dist/assets/index-DReRlzZI.js +1144 -0
  35. package/dist/assets/infoDiagram-42DDH7IO-DbqRsOo3.js +2 -0
  36. package/dist/assets/init-Gi6I4Gst.js +1 -0
  37. package/dist/assets/ishikawaDiagram-UXIWVN3A-DnCdx7zb.js +70 -0
  38. package/dist/assets/journeyDiagram-VCZTEJTY-CfD7eNcP.js +139 -0
  39. package/dist/assets/kanban-definition-6JOO6SKY-BYaO9-mK.js +89 -0
  40. package/dist/assets/katex-DkKDou_j.js +257 -0
  41. package/dist/assets/layout-Bj72wOEB.js +1 -0
  42. package/dist/assets/linear-BRFo114D.js +1 -0
  43. package/dist/assets/min-GCHnKlJS.js +1 -0
  44. package/dist/assets/mindmap-definition-QFDTVHPH-n0PMebY4.js +96 -0
  45. package/dist/assets/ordinal-Cboi1Yqb.js +1 -0
  46. package/dist/assets/pieDiagram-DEJITSTG-pN4CljHF.js +30 -0
  47. package/dist/assets/quadrantDiagram-34T5L4WZ-DNoAy8-D.js +7 -0
  48. package/dist/assets/requirementDiagram-MS252O5E-BhtY05PT.js +84 -0
  49. package/dist/assets/sankeyDiagram-XADWPNL6-B6AD-16A.js +10 -0
  50. package/dist/assets/sequenceDiagram-FGHM5R23-DShHM-uk.js +157 -0
  51. package/dist/assets/stateDiagram-FHFEXIEX-DMxn7HTo.js +1 -0
  52. package/dist/assets/stateDiagram-v2-QKLJ7IA2-o6PnCs4e.js +1 -0
  53. package/dist/assets/timeline-definition-GMOUNBTQ-Cdu6uq52.js +120 -0
  54. package/dist/assets/vennDiagram-DHZGUBPP-CpK29iRe.js +34 -0
  55. package/dist/assets/wardley-RL74JXVD-BQgSkdcO.js +162 -0
  56. package/dist/assets/wardleyDiagram-NUSXRM2D-DJHYev6O.js +20 -0
  57. package/dist/assets/xychartDiagram-5P7HB3ND-1d75pbaO.js +7 -0
  58. package/dist/index.html +30 -0
  59. package/lib/agent-chains.js +65 -0
  60. package/lib/agent-string.js +86 -0
  61. package/lib/budget-ledger.js +86 -0
  62. package/lib/build-all.js +162 -0
  63. package/lib/build-dag.js +120 -0
  64. package/lib/build-stream-writer.js +190 -0
  65. package/lib/build.js +2997 -0
  66. package/lib/capability-checker.js +53 -0
  67. package/lib/cert-inject.js +38 -0
  68. package/lib/cli-progress.js +483 -0
  69. package/lib/constants.js +69 -0
  70. package/lib/cross-layer-audit.js +84 -0
  71. package/lib/debug-discipline.js +173 -0
  72. package/lib/feature-json.js +106 -0
  73. package/lib/gate-prompt.js +291 -0
  74. package/lib/gate-tiers.js +194 -0
  75. package/lib/health-history.js +119 -0
  76. package/lib/health-score.js +227 -0
  77. package/lib/ideabox.js +570 -0
  78. package/lib/import.js +244 -0
  79. package/lib/migrate-roadmap.js +94 -0
  80. package/lib/model-pricing.js +67 -0
  81. package/lib/new.js +413 -0
  82. package/lib/pipeline-cli.js +489 -0
  83. package/lib/plan-parser.js +103 -0
  84. package/lib/qa-scoping.js +474 -0
  85. package/lib/questionnaire.js +200 -0
  86. package/lib/resolve-port.js +7 -0
  87. package/lib/result-normalizer.js +349 -0
  88. package/lib/review-lenses.js +166 -0
  89. package/lib/roadmap-gen.js +210 -0
  90. package/lib/roadmap-parser.js +176 -0
  91. package/lib/server-probe.js +23 -0
  92. package/lib/staleness.js +87 -0
  93. package/lib/step-prompt.js +260 -0
  94. package/lib/step-validator.js +49 -0
  95. package/lib/stratum-mcp-client.js +365 -0
  96. package/lib/team-flag.js +46 -0
  97. package/lib/test-bootstrap.js +401 -0
  98. package/lib/triage.js +274 -0
  99. package/lib/vision-writer.js +391 -0
  100. package/package.json +111 -0
  101. package/pipelines/bug-fix.stratum.yaml +230 -0
  102. package/pipelines/build.stratum.yaml +498 -0
  103. package/pipelines/content.stratum.yaml +112 -0
  104. package/pipelines/coverage-sweep.stratum.yaml +52 -0
  105. package/pipelines/refactor.stratum.yaml +169 -0
  106. package/pipelines/research.stratum.yaml +88 -0
  107. package/pipelines/review-fix.stratum.yaml +109 -0
  108. package/presets/team-feature.stratum.yaml +105 -0
  109. package/presets/team-research.stratum.yaml +108 -0
  110. package/presets/team-review.stratum.yaml +106 -0
  111. package/scripts/agent-activity-hook.sh +31 -0
  112. package/scripts/agent-error-hook.sh +28 -0
  113. package/scripts/analyze-orphans.mjs +50 -0
  114. package/scripts/find-orphans.mjs +26 -0
  115. package/scripts/fix-phases.mjs +49 -0
  116. package/scripts/generate-stratum-spec.mjs +137 -0
  117. package/scripts/import-roadmap.mjs +116 -0
  118. package/scripts/phase-audit.mjs +33 -0
  119. package/scripts/run-pipeline.mjs +314 -0
  120. package/scripts/session-end-hook.sh +18 -0
  121. package/scripts/session-start-hook.sh +38 -0
  122. package/scripts/vision-hook.sh +104 -0
  123. package/scripts/vision-track.mjs +554 -0
  124. package/scripts/wire-all-orphans.mjs +108 -0
  125. package/scripts/wire-orphans.mjs +164 -0
  126. package/server/activity-routes.js +123 -0
  127. package/server/agent-health.js +197 -0
  128. package/server/agent-hooks.js +102 -0
  129. package/server/agent-mcp.js +10 -0
  130. package/server/agent-registry.js +95 -0
  131. package/server/agent-server.js +290 -0
  132. package/server/agent-spawn.js +251 -0
  133. package/server/agent-templates.js +77 -0
  134. package/server/artifact-manager.js +247 -0
  135. package/server/artifact-templates/architecture.md +28 -0
  136. package/server/artifact-templates/blueprint.md +21 -0
  137. package/server/artifact-templates/design.md +36 -0
  138. package/server/artifact-templates/plan.md +25 -0
  139. package/server/artifact-templates/prd.md +43 -0
  140. package/server/artifact-templates/report.md +40 -0
  141. package/server/block-tracker.js +90 -0
  142. package/server/build-stream-bridge.js +502 -0
  143. package/server/coalescing-buffer.js +46 -0
  144. package/server/compose-mcp-tools.js +479 -0
  145. package/server/compose-mcp.js +324 -0
  146. package/server/connectors/agent-connector.js +78 -0
  147. package/server/connectors/claude-sdk-connector.js +198 -0
  148. package/server/connectors/codex-connector.js +240 -0
  149. package/server/connectors/connector-discovery.js +18 -0
  150. package/server/connectors/connector-runtime.js +13 -0
  151. package/server/connectors/opencode-connector.js +200 -0
  152. package/server/design-routes.js +540 -0
  153. package/server/design-session.js +161 -0
  154. package/server/feature-scan.js +593 -0
  155. package/server/file-watcher.js +284 -0
  156. package/server/find-root.js +29 -0
  157. package/server/graph-export.js +343 -0
  158. package/server/ideabox-cache.js +77 -0
  159. package/server/ideabox-routes.js +294 -0
  160. package/server/index.js +156 -0
  161. package/server/model-tiers.js +49 -0
  162. package/server/pipeline-routes.js +288 -0
  163. package/server/policy-evaluator.js +36 -0
  164. package/server/project-root.js +122 -0
  165. package/server/security.js +23 -0
  166. package/server/session-manager.js +403 -0
  167. package/server/session-routes.js +190 -0
  168. package/server/session-store.js +107 -0
  169. package/server/settings-routes.js +35 -0
  170. package/server/settings-store.js +234 -0
  171. package/server/stratum-api.js +102 -0
  172. package/server/stratum-client.js +192 -0
  173. package/server/stratum-sync.js +193 -0
  174. package/server/summarizer.js +139 -0
  175. package/server/supervisor.js +196 -0
  176. package/server/vision-routes.js +668 -0
  177. package/server/vision-server.js +393 -0
  178. package/server/vision-store.js +360 -0
  179. package/server/vision-utils.js +179 -0
  180. package/server/worktree-gc.js +137 -0
  181. package/templates/ROADMAP.md +46 -0
@@ -0,0 +1,498 @@
1
+ # metadata:
2
+ # id: build
3
+ # label: "Feature Build"
4
+ # description: "Execute a feature through the full Compose lifecycle — design, plan, implement, review, test, ship"
5
+ # category: development
6
+ # steps: 16
7
+ # estimated_minutes: 120
8
+
9
+ version: "0.3"
10
+
11
+ workflow:
12
+ name: build
13
+ description: "Execute a feature through the full Compose lifecycle"
14
+ input:
15
+ featureCode:
16
+ type: string
17
+ required: true
18
+ description:
19
+ type: string
20
+ required: true
21
+
22
+ contracts:
23
+ PhaseResult:
24
+ phase: {type: string}
25
+ artifact: {type: string}
26
+ outcome: {type: string, values: [complete, skipped, failed]}
27
+ summary: {type: string}
28
+
29
+ ReviewResult:
30
+ clean: {type: boolean}
31
+ summary: {type: string}
32
+ findings: {type: array}
33
+
34
+ TestResult:
35
+ passing: {type: boolean}
36
+ summary: {type: string}
37
+ failures: {type: array}
38
+
39
+ TaskGraph:
40
+ tasks: {type: array}
41
+
42
+ LensFinding:
43
+ lens: {type: string}
44
+ file: {type: string}
45
+ line: {type: number}
46
+ severity: {type: string, values: [must-fix, should-fix, nit]}
47
+ finding: {type: string}
48
+ confidence: {type: number}
49
+
50
+ LensTask:
51
+ id: {type: string}
52
+ lens_name: {type: string}
53
+ lens_focus: {type: string}
54
+ confidence_gate: {type: number}
55
+ exclusions: {type: string}
56
+
57
+ TriageResult:
58
+ tasks: {type: array}
59
+
60
+ LensResult:
61
+ clean: {type: boolean}
62
+ findings: {type: array, items: LensFinding}
63
+
64
+ MergedReviewResult:
65
+ clean: {type: boolean}
66
+ summary: {type: string}
67
+ findings: {type: array, items: LensFinding}
68
+ lenses_run: {type: array}
69
+ auto_fixes: {type: array, items: LensFinding}
70
+ asks: {type: array, items: LensFinding}
71
+
72
+ functions:
73
+ design_gate:
74
+ mode: gate
75
+ timeout: 3600
76
+
77
+ plan_gate:
78
+ mode: gate
79
+ timeout: 3600
80
+
81
+ ship_gate:
82
+ mode: gate
83
+ timeout: 1800
84
+
85
+ flows:
86
+ # --- Sub-flow: review ---
87
+ # Single-step: codex reviews, stratum retries via ensure_failed.
88
+ # Cross-agent fix (claude) is dispatched by build.js when ensure_failed
89
+ # fires with a recovery_agent configured on the parent flow step.
90
+ review_check:
91
+ input:
92
+ task: {type: string}
93
+ blueprint: {type: string}
94
+ output: ReviewResult
95
+ steps:
96
+ - id: review
97
+ agent: codex
98
+ intent: >
99
+ Review the implementation against the blueprint. Return structured JSON:
100
+ { "clean": boolean, "summary": string, "findings": string[] }.
101
+ Set clean=true only if no actionable findings with confidence >= 80 remain.
102
+ inputs:
103
+ task: "$.input.task"
104
+ blueprint: "$.input.blueprint"
105
+ output_contract: ReviewResult
106
+ ensure:
107
+ - "result.clean == True"
108
+ retries: 5
109
+
110
+ # --- Sub-flow: parallel_review ---
111
+ # Multi-lens review: triage selects lenses, parallel dispatch runs them,
112
+ # merge deduplicates and classifies findings. Falls back to review_check
113
+ # if parallel dispatch is unavailable.
114
+ parallel_review:
115
+ input:
116
+ task: {type: string}
117
+ blueprint: {type: string}
118
+ diff: {type: string}
119
+ prior_dirty_lenses: {type: array, optional: true}
120
+ output: MergedReviewResult
121
+ steps:
122
+ - id: triage
123
+ agent: "claude:orchestrator"
124
+ intent: >
125
+ Decide which review lenses to activate.
126
+
127
+ RETRY PATH — If the file .compose/prior_dirty_lenses.json exists, read it.
128
+ It contains a JSON array of lens IDs that had actionable findings in the prior
129
+ review run. In this case:
130
+ - Activate all lenses listed in that array.
131
+ - Always also include diff-quality and contract-compliance (baseline lenses —
132
+ they re-run on every retry to catch regressions introduced by the fix, even
133
+ if they passed clean last time).
134
+ - Skip all other lenses — they already passed clean.
135
+
136
+ FIRST RUN PATH — If .compose/prior_dirty_lenses.json does not exist:
137
+ - Always include diff-quality and contract-compliance.
138
+ - Add security if files touch auth, crypto, SQL, HTTP handlers.
139
+ - Add framework if detected framework files (React, Express, Next.js, etc).
140
+
141
+ Return JSON: { "tasks": LensTask[] } where each task has id, lens_name,
142
+ lens_focus, confidence_gate, exclusions.
143
+ inputs:
144
+ diff: "$.input.diff"
145
+ output_contract: TriageResult
146
+
147
+ - id: review_lenses
148
+ type: parallel_dispatch
149
+ agent: "claude:read-only-reviewer"
150
+ source: "$.steps.triage.output.tasks"
151
+ max_concurrent: 4
152
+ isolation: none
153
+ intent_template: >
154
+ You are a {lens_name} reviewer. Review ONLY through the {lens_name} lens.
155
+ Focus: {lens_focus}
156
+ Confidence gate: only report findings with confidence >= {confidence_gate}.
157
+ False-positive exclusions: {exclusions}
158
+ Return JSON: { "clean": boolean, "findings": LensFinding[] }
159
+ where each finding has: lens, file, line, severity (must-fix|should-fix|nit),
160
+ finding (description), confidence (1-10).
161
+ require: all
162
+
163
+ - id: merge
164
+ agent: "claude:orchestrator"
165
+ intent: >
166
+ Merge findings from all review lenses. The input contains the parallel
167
+ dispatch aggregate with tasks[].result for each lens.
168
+ 1. Collect all findings arrays from completed task results.
169
+ 2. Deduplicate: same file + same issue = one finding, keep highest confidence.
170
+ 3. Assign severity: must-fix (blocks ship), should-fix (next iteration), nit (logged).
171
+ 4. Classify: auto_fixes (mechanical: formatting, simple tests, obvious typos)
172
+ vs asks (requires judgment).
173
+ 5. lenses_run = IDs of lenses that produced must-fix or should-fix findings.
174
+ Return JSON: MergedReviewResult with clean, summary, findings, lenses_run,
175
+ auto_fixes, asks. Set clean=true only if zero must-fix and zero should-fix findings.
176
+ inputs:
177
+ results: "$.steps.review_lenses.output"
178
+ task: "$.input.task"
179
+ blueprint: "$.input.blueprint"
180
+ output_contract: MergedReviewResult
181
+ depends_on: [review_lenses]
182
+
183
+ # --- Sub-flow: coverage ---
184
+ # Single-step: claude runs tests, stratum retries via ensure_failed.
185
+ # Cross-agent fix is dispatched by build.js on ensure_failed.
186
+ coverage_check:
187
+ input:
188
+ task: {type: string}
189
+ plan: {type: string}
190
+ output: TestResult
191
+ steps:
192
+ - id: run_tests
193
+ agent: "claude::fast"
194
+ intent: >
195
+ Run the project test suite. Return structured JSON:
196
+ { "passing": boolean, "summary": string, "failures": string[] }.
197
+ inputs:
198
+ task: "$.input.task"
199
+ output_contract: TestResult
200
+ ensure:
201
+ - "result.passing == True"
202
+ retries: 15
203
+
204
+ # --- Main flow: compose feature lifecycle ---
205
+ build:
206
+ input:
207
+ featureCode: {type: string}
208
+ description: {type: string}
209
+ output: PhaseResult
210
+ max_rounds: 10
211
+ steps:
212
+ # Phase: Explore & Design
213
+ - id: explore_design
214
+ agent: claude
215
+ intent: >
216
+ Explore the codebase and write a design doc for this feature.
217
+ Launch 2-3 explorer subagents in parallel to map architecture,
218
+ find similar features, and analyze related implementations.
219
+ Write the design to docs/features/{featureCode}/design.md.
220
+ Return the artifact path in the "artifact" field.
221
+ inputs:
222
+ featureCode: "$.input.featureCode"
223
+ description: "$.input.description"
224
+ output_contract: PhaseResult
225
+ ensure:
226
+ - "result.outcome == 'complete'"
227
+ - "file_exists(result.artifact)"
228
+ retries: 2
229
+
230
+ # Gate: Design review
231
+ - id: design_gate
232
+ function: design_gate
233
+ on_approve: prd
234
+ on_revise: explore_design
235
+ on_kill: null
236
+ depends_on: [explore_design]
237
+
238
+ # Phase: PRD (skippable)
239
+ - id: prd
240
+ agent: claude
241
+ intent: >
242
+ Write a product requirements document for this feature.
243
+ Write to docs/features/{featureCode}/prd.md.
244
+ Return the artifact path in the "artifact" field.
245
+ inputs:
246
+ featureCode: "$.input.featureCode"
247
+ description: "$.input.description"
248
+ output_contract: PhaseResult
249
+ ensure:
250
+ - "result.outcome == 'complete'"
251
+ - "file_exists(result.artifact)"
252
+ retries: 2
253
+ skip_if: "true"
254
+ skip_reason: "PRD skipped by default — set skip_if to false to enable"
255
+ depends_on: [design_gate]
256
+
257
+ # Phase: Architecture (skippable)
258
+ - id: architecture
259
+ agent: claude
260
+ intent: >
261
+ Write an architecture doc with competing proposals.
262
+ Write to docs/features/{featureCode}/architecture.md.
263
+ Return the artifact path in the "artifact" field.
264
+ inputs:
265
+ featureCode: "$.input.featureCode"
266
+ description: "$.input.description"
267
+ output_contract: PhaseResult
268
+ ensure:
269
+ - "result.outcome == 'complete'"
270
+ - "file_exists(result.artifact)"
271
+ retries: 2
272
+ skip_if: "true"
273
+ skip_reason: "Architecture skipped by default — set skip_if to false to enable"
274
+ depends_on: [prd]
275
+
276
+ # Phase: Blueprint
277
+ - id: blueprint
278
+ agent: "claude::critical"
279
+ intent: >
280
+ Write an implementation blueprint with file:line references to existing code.
281
+ Ground every reference in actual files. Write to docs/features/{featureCode}/blueprint.md.
282
+ Return the artifact path in the "artifact" field.
283
+ inputs:
284
+ featureCode: "$.input.featureCode"
285
+ description: "$.input.description"
286
+ output_contract: PhaseResult
287
+ ensure:
288
+ - "result.outcome == 'complete'"
289
+ - "file_exists(result.artifact)"
290
+ retries: 3
291
+ depends_on: [architecture]
292
+
293
+ # Phase: Blueprint Verification
294
+ - id: verification
295
+ agent: claude
296
+ intent: >
297
+ Verify every file:line reference in the blueprint against the actual codebase.
298
+ Flag stale or incorrect references. Return { verified: true } only if all
299
+ references are valid. Return { verified: false, staleRefs: [...] } otherwise.
300
+ inputs:
301
+ featureCode: "$.input.featureCode"
302
+ description: "$.input.description"
303
+ output_contract: PhaseResult
304
+ ensure:
305
+ - "result.outcome == 'complete'"
306
+ retries: 2
307
+ on_fail: blueprint
308
+ depends_on: [blueprint]
309
+
310
+ # Phase: Implementation Plan
311
+ - id: plan
312
+ agent: claude
313
+ intent: >
314
+ Write an ordered implementation plan with tasks, dependencies, file paths (new/existing),
315
+ and acceptance criteria. Write to docs/features/{featureCode}/plan.md.
316
+ Return the artifact path in the "artifact" field.
317
+ inputs:
318
+ featureCode: "$.input.featureCode"
319
+ description: "$.input.description"
320
+ output_contract: PhaseResult
321
+ ensure:
322
+ - "result.outcome == 'complete'"
323
+ - "file_exists(result.artifact)"
324
+ retries: 2
325
+ depends_on: [verification]
326
+
327
+ # Gate: Plan review
328
+ - id: plan_gate
329
+ function: plan_gate
330
+ on_approve: decompose
331
+ on_revise: plan
332
+ on_kill: null
333
+ depends_on: [plan]
334
+
335
+ # Phase: Decompose — analyze the plan and emit a task graph
336
+ - id: decompose
337
+ type: decompose
338
+ agent: claude
339
+ intent: >
340
+ Read the implementation plan and decompose it into independent tasks.
341
+ For each task, identify files_owned (exclusive write), files_read (read-only),
342
+ and depends_on (tasks that must complete first).
343
+ Return a TaskGraph with the task array.
344
+ output_contract: TaskGraph
345
+ ensure:
346
+ - "no_file_conflicts(result.tasks)"
347
+ - "len(result.tasks) >= 1"
348
+ retries: 2
349
+ depends_on: [plan_gate]
350
+
351
+ # Phase: Execute — parallel dispatch of decomposed tasks
352
+ - id: execute
353
+ type: parallel_dispatch
354
+ source: "$.steps.decompose.output.tasks"
355
+ agent: claude
356
+ max_concurrent: 3
357
+ isolation: worktree
358
+ capture_diff: true
359
+ defer_advance: true
360
+ require: all
361
+ merge: sequential_apply
362
+ intent_template: >
363
+ Implement this task using TDD. Write the test first, watch it fail,
364
+ implement, watch it pass.
365
+
366
+ Task: {task.description}
367
+ You own these files (may create/modify): {task.files_owned}
368
+ You may read (but NOT modify): {task.files_read}
369
+
370
+ Feature: {task.id}
371
+ depends_on: [decompose]
372
+
373
+ # Sub-flow: Review (parallel multi-lens review; falls back to review_check)
374
+ # Parent-step ensure drives the fix loop: ensure_failed -> build.js fix ->
375
+ # retry the whole parallel_review sub-flow, which re-runs fresh triage/lenses/merge.
376
+ - id: review
377
+ flow: parallel_review
378
+ inputs:
379
+ task: "$.steps.execute.output.outcome"
380
+ blueprint: "$.steps.blueprint.output.artifact"
381
+ diff: "$.steps.execute.output.tasks"
382
+ ensure:
383
+ - "result.clean == True"
384
+ depends_on: [execute]
385
+
386
+ # Sub-flow: Codex review (independent cross-model pass after Claude lenses + fixes)
387
+ - id: codex_review
388
+ flow: review_check
389
+ inputs:
390
+ task: "$.steps.execute.output.outcome"
391
+ blueprint: "$.steps.blueprint.output.artifact"
392
+ ensure:
393
+ - "result.clean == True"
394
+ depends_on: [review]
395
+
396
+ # Sub-flow: Coverage (claude runs tests; build.js dispatches fix on ensure_failed)
397
+ - id: coverage
398
+ flow: coverage_check
399
+ inputs:
400
+ task: "$.steps.execute.output.outcome"
401
+ plan: "$.input.description"
402
+ ensure:
403
+ - "result.passing == True"
404
+ depends_on: [codex_review]
405
+
406
+ # Phase: Report (skippable)
407
+ - id: report
408
+ agent: claude
409
+ intent: >
410
+ Write a post-implementation report documenting what was built,
411
+ deviations from the plan, and lessons learned.
412
+ Write to docs/features/{featureCode}/report.md.
413
+ Return the artifact path in the "artifact" field.
414
+ inputs:
415
+ featureCode: "$.input.featureCode"
416
+ description: "$.input.description"
417
+ output_contract: PhaseResult
418
+ ensure:
419
+ - "result.outcome == 'complete'"
420
+ - "file_exists(result.artifact)"
421
+ retries: 2
422
+ skip_if: "true"
423
+ skip_reason: "Report skipped by default — set skip_if to false to enable"
424
+ depends_on: [coverage]
425
+
426
+ # Phase: Update Docs
427
+ - id: docs
428
+ agent: claude
429
+ intent: >
430
+ Update project documentation for this feature. You MUST:
431
+
432
+ 1. CHANGELOG.md — Add an entry under today's date with the feature code
433
+ and a bullet list of what was built. Read the existing format first.
434
+ 2. ROADMAP.md — Find this feature's row and change its status to COMPLETE.
435
+ If this completes a parent feature, update the parent header too.
436
+ 3. README.md — Update ONLY if the feature changes user-facing setup,
437
+ commands, or capabilities. Skip if purely internal.
438
+ 4. CLAUDE.md — Update ONLY if new conventions, commands, or architecture
439
+ patterns were introduced. Skip if no changes.
440
+ 5. Public docs — If the feature introduces or changes any of these, update
441
+ the relevant file in docs/:
442
+ - New CLI commands or flags → docs/compose-one-pager.md
443
+ - New connector or agent type → docs/connectors.md
444
+ - New workflow or lifecycle change → docs/use-cases.md
445
+ - API or config changes → docs/PRODUCT-SPEC.md
446
+ Read each file before editing. Skip if the feature is purely internal
447
+ with no user-facing changes.
448
+
449
+ Read each file before editing. Do not skip CHANGELOG and ROADMAP —
450
+ they are always required. Commit nothing — the ship step handles commits.
451
+ inputs:
452
+ featureCode: "$.input.featureCode"
453
+ description: "$.input.description"
454
+ output_contract: PhaseResult
455
+ retries: 2
456
+ depends_on: [report]
457
+
458
+ # Phase: Ship
459
+ - id: ship
460
+ agent: "claude::critical"
461
+ intent: >
462
+ Final verification and commit. You MUST:
463
+
464
+ 1. Run the test suite (npm test or node --test test/*.test.js).
465
+ If tests fail, fix them before proceeding.
466
+ 2. Run the build (npx vite build). Must pass.
467
+ 3. Check git status — verify CHANGELOG.md and ROADMAP.md were updated
468
+ by the docs step. If they weren't, update them now.
469
+ 4. Stage all changed files for this feature (git add — be explicit,
470
+ never stage worktrees, pycache, or node_modules).
471
+ 5. Commit with message: "feat(<featureCode>): <one-line summary>"
472
+ 6. Push to remote.
473
+ 7. Read docs/features/{featureCode}/plan.md and extract acceptance criteria
474
+ as plan_items: an array of objects { text, file, critical } where:
475
+ - text is the checkbox item text
476
+ - file is the backtick-quoted file path in the item (null if none)
477
+ - critical is true if the item mentions MUST, required, security, or tests
478
+ Use lib/plan-parser.js (parsePlanItems) to do this extraction.
479
+ 8. Collect the list of files you staged as files_changed.
480
+
481
+ Include plan_items and files_changed in your result JSON.
482
+ Report the commit hash and files changed.
483
+ inputs:
484
+ featureCode: "$.input.featureCode"
485
+ description: "$.input.description"
486
+ output_contract: PhaseResult
487
+ ensure:
488
+ - "plan_completion(result.plan_items, result.files_changed)"
489
+ retries: 2
490
+ depends_on: [docs]
491
+
492
+ # Gate: Ship review
493
+ - id: ship_gate
494
+ function: ship_gate
495
+ on_approve: null
496
+ on_revise: ship
497
+ on_kill: null
498
+ depends_on: [ship]
@@ -0,0 +1,112 @@
1
+ # metadata:
2
+ # id: content
3
+ # label: "Content"
4
+ # description: "Write documentation or content — research, draft, review, publish"
5
+ # category: documentation
6
+ # steps: 4
7
+ # estimated_minutes: 20
8
+
9
+ version: "0.1"
10
+
11
+ # content pipeline
12
+ #
13
+ # Four-step flow for documentation and content creation:
14
+ # 1. research — gather context, read existing docs, identify gaps
15
+ # 2. draft — write the content
16
+ # 3. review — review for accuracy, completeness, and clarity
17
+ # 4. publish — finalize and commit
18
+ #
19
+ # Inputs:
20
+ # task — what to write (doc type, topic, target audience)
21
+ #
22
+ # Usage:
23
+ # stratum_plan <this yaml> "content" {"task": "..."}
24
+
25
+ contracts:
26
+ ContentResult:
27
+ phase: {type: string}
28
+ artifact: {type: string}
29
+ summary: {type: string}
30
+ outcome: {type: string, values: [complete, failed]}
31
+
32
+ ReviewResult:
33
+ clean: {type: boolean}
34
+ summary: {type: string}
35
+ findings: {type: array}
36
+
37
+ functions:
38
+ research:
39
+ mode: compute
40
+ intent: >
41
+ Gather context for the content. Read existing documentation, related
42
+ code, and prior art. Identify gaps and outline key topics to cover.
43
+ Return a summary of research findings.
44
+ input:
45
+ task: {type: string}
46
+ output: ContentResult
47
+ retries: 1
48
+
49
+ draft:
50
+ mode: compute
51
+ intent: >
52
+ Write the content based on research findings. Follow existing
53
+ documentation conventions and standards. Write to the appropriate
54
+ file path. Return the artifact path.
55
+ input:
56
+ task: {type: string}
57
+ output: ContentResult
58
+ ensure:
59
+ - "result.outcome == 'complete'"
60
+ retries: 2
61
+
62
+ review:
63
+ mode: compute
64
+ intent: >
65
+ Review the drafted content for accuracy, completeness, and clarity.
66
+ Check that all claims are supported by code or documentation.
67
+ Return { "clean": boolean, "summary": string, "findings": string[] }.
68
+ input:
69
+ task: {type: string}
70
+ output: ReviewResult
71
+ ensure:
72
+ - "result.clean == true"
73
+ retries: 3
74
+
75
+ publish:
76
+ mode: compute
77
+ intent: >
78
+ Finalize the content. Update any cross-references (README, CHANGELOG,
79
+ index files). Commit with a descriptive message.
80
+ input:
81
+ task: {type: string}
82
+ output: ContentResult
83
+ retries: 1
84
+
85
+ flows:
86
+ content:
87
+ input:
88
+ task: {type: string}
89
+ output: ContentResult
90
+ steps:
91
+ - id: research
92
+ function: research
93
+ inputs:
94
+ task: "$.input.task"
95
+
96
+ - id: draft
97
+ function: draft
98
+ inputs:
99
+ task: "$.input.task"
100
+ depends_on: [research]
101
+
102
+ - id: review
103
+ function: review
104
+ inputs:
105
+ task: "$.input.task"
106
+ depends_on: [draft]
107
+
108
+ - id: publish
109
+ function: publish
110
+ inputs:
111
+ task: "$.input.task"
112
+ depends_on: [review]
@@ -0,0 +1,52 @@
1
+ # metadata:
2
+ # id: coverage-sweep
3
+ # label: "Coverage Sweep"
4
+ # description: "Run test suite in a loop until all tests pass"
5
+ # category: quality
6
+ # steps: 1
7
+ # estimated_minutes: 10
8
+
9
+ version: "0.1"
10
+
11
+ # coverage-sweep pipeline
12
+ #
13
+ # Runs the test suite in a loop until all tests pass.
14
+ # Same pattern as review-fix.stratum.yaml but for test coverage.
15
+ #
16
+ # Inputs:
17
+ # task — what to test (feature description, file paths, etc.)
18
+ #
19
+ # Usage:
20
+ # stratum_plan <this yaml> "coverage_sweep" {"task": "..."}
21
+
22
+ contracts:
23
+ CoverageResult:
24
+ passing: {type: boolean}
25
+ summary: {type: string}
26
+ failures: {type: array}
27
+
28
+ functions:
29
+ run_coverage:
30
+ mode: compute
31
+ intent: >
32
+ Run the project test suite. Return structured JSON:
33
+ { "passing": boolean, "summary": string, "failures": string[] }.
34
+ Set passing=true only if all tests pass with no failures.
35
+ If tests fail, list each failing test name in the failures array.
36
+ input:
37
+ task: {type: string}
38
+ output: CoverageResult
39
+ ensure:
40
+ - "result.passing == true"
41
+ retries: 15
42
+
43
+ flows:
44
+ coverage_sweep:
45
+ input:
46
+ task: {type: string}
47
+ output: CoverageResult
48
+ steps:
49
+ - id: sweep
50
+ function: run_coverage
51
+ inputs:
52
+ task: "$.input.task"