compound-workflow 1.8.0 → 1.9.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 (92) hide show
  1. package/README.md +61 -69
  2. package/package.json +2 -8
  3. package/scripts/check-pack-readme.mjs +1 -16
  4. package/scripts/check-workflow-contracts.mjs +34 -44
  5. package/scripts/install-cli.mjs +273 -555
  6. package/src/AGENTS.md +59 -192
  7. package/src/{.agents/agents → agents}/research/best-practices-researcher.md +2 -2
  8. package/src/{.agents/commands → commands}/assess.md +4 -4
  9. package/src/commands/install.md +43 -0
  10. package/src/{.agents/commands → commands}/metrics.md +1 -1
  11. package/src/commands/workflow-agents.md +101 -0
  12. package/src/{.agents/commands → commands}/workflow-compound.md +1 -1
  13. package/src/{.agents/commands → commands}/workflow-plan.md +24 -33
  14. package/src/commands/workflow-work.md +836 -0
  15. package/src/{.agents/references → references}/README.md +1 -1
  16. package/src/{.agents/skills → skills}/capture-skill/SKILL.md +1 -1
  17. package/src/{.agents/skills → skills}/compound-docs/SKILL.md +6 -6
  18. package/src/{.agents/skills → skills}/compound-docs/references/yaml-schema.md +2 -2
  19. package/src/skills/setup-agents/SKILL.md +250 -0
  20. package/src/skills/standards/SKILL.md +79 -0
  21. package/src/skills/standards/references/architecture.md +228 -0
  22. package/src/skills/standards/references/code-quality.md +192 -0
  23. package/src/skills/standards/references/presentation.md +515 -0
  24. package/src/skills/standards/references/services.md +172 -0
  25. package/src/skills/standards/references/state-management.md +936 -0
  26. package/.claude-plugin/plugin.json +0 -7
  27. package/.cursor-plugin/plugin.json +0 -20
  28. package/.cursor-plugin/registration.json +0 -5
  29. package/scripts/check-version-parity.mjs +0 -36
  30. package/scripts/generate-platform-artifacts.mjs +0 -230
  31. package/src/.agents/commands/install.md +0 -51
  32. package/src/.agents/commands/workflow-work.md +0 -690
  33. package/src/.agents/registry.json +0 -48
  34. package/src/.agents/scripts/self-check.mjs +0 -227
  35. package/src/.agents/scripts/sync-opencode.mjs +0 -362
  36. package/src/.agents/skills/presentation-composability/SKILL.md +0 -72
  37. package/src/.agents/skills/react-ddd-mvc-frontend/SKILL.md +0 -51
  38. package/src/.agents/skills/react-ddd-mvc-frontend/references/feature-structure.md +0 -25
  39. package/src/.agents/skills/react-ddd-mvc-frontend/references/implementation-principles.md +0 -21
  40. package/src/.agents/skills/react-ddd-mvc-frontend/references/responsibility-gates.md +0 -41
  41. package/src/.agents/skills/react-ddd-mvc-frontend/references/source-map.md +0 -11
  42. package/src/.agents/skills/standards/SKILL.md +0 -747
  43. package/src/.agents/skills/xstate-actor-orchestration/SKILL.md +0 -197
  44. package/src/.agents/skills/xstate-actor-orchestration/agents/openai.yaml +0 -4
  45. package/src/.agents/skills/xstate-actor-orchestration/assets/statecharts/.gitkeep +0 -0
  46. package/src/.agents/skills/xstate-actor-orchestration/references/actor-system-patterns.md +0 -71
  47. package/src/.agents/skills/xstate-actor-orchestration/references/event-contracts.md +0 -73
  48. package/src/.agents/skills/xstate-actor-orchestration/references/functional-domain-patterns.md +0 -53
  49. package/src/.agents/skills/xstate-actor-orchestration/references/machine-structure-and-tags.md +0 -36
  50. package/src/.agents/skills/xstate-actor-orchestration/references/react-container-pattern.md +0 -45
  51. package/src/.agents/skills/xstate-actor-orchestration/references/reliability-observability.md +0 -39
  52. package/src/.agents/skills/xstate-actor-orchestration/references/skill-validation.md +0 -33
  53. package/src/.agents/skills/xstate-actor-orchestration/references/source-map.md +0 -44
  54. package/src/.agents/skills/xstate-actor-orchestration/references/statechart-review-and-signoff.md +0 -59
  55. package/src/.agents/skills/xstate-actor-orchestration/references/testing-strategy.md +0 -35
  56. package/src/.agents/skills/xstate-actor-orchestration/scripts/create-statechart-artifact.sh +0 -71
  57. package/src/.agents/skills/xstate-actor-orchestration/scripts/validate-skill.sh +0 -138
  58. package/src/generated/opencode.managed.json +0 -115
  59. /package/src/{.agents/agents → agents}/research/framework-docs-researcher.md +0 -0
  60. /package/src/{.agents/agents → agents}/research/git-history-analyzer.md +0 -0
  61. /package/src/{.agents/agents → agents}/research/learnings-researcher.md +0 -0
  62. /package/src/{.agents/agents → agents}/research/repo-research-analyst.md +0 -0
  63. /package/src/{.agents/agents → agents}/review/agent-native-reviewer.md +0 -0
  64. /package/src/{.agents/agents → agents}/review/planning-technical-reviewer.md +0 -0
  65. /package/src/{.agents/agents → agents}/workflow/bug-reproduction-validator.md +0 -0
  66. /package/src/{.agents/agents → agents}/workflow/lint.md +0 -0
  67. /package/src/{.agents/agents → agents}/workflow/spec-flow-analyzer.md +0 -0
  68. /package/src/{.agents/commands → commands}/test-browser.md +0 -0
  69. /package/src/{.agents/commands → commands}/workflow-brainstorm.md +0 -0
  70. /package/src/{.agents/commands → commands}/workflow-review.md +0 -0
  71. /package/src/{.agents/commands → commands}/workflow-tech-review.md +0 -0
  72. /package/src/{.agents/commands → commands}/workflow-triage.md +0 -0
  73. /package/src/{.agents/references → references}/standards/README.md +0 -0
  74. /package/src/{.agents/skills → skills}/agent-browser/SKILL.md +0 -0
  75. /package/src/{.agents/skills → skills}/audit-traceability/SKILL.md +0 -0
  76. /package/src/{.agents/skills → skills}/brainstorming/SKILL.md +0 -0
  77. /package/src/{.agents/skills → skills}/compound-docs/assets/critical-pattern-template.md +0 -0
  78. /package/src/{.agents/skills → skills}/compound-docs/assets/resolution-template.md +0 -0
  79. /package/src/{.agents/skills → skills}/compound-docs/schema.project.yaml +0 -0
  80. /package/src/{.agents/skills → skills}/compound-docs/schema.yaml +0 -0
  81. /package/src/{.agents/skills → skills}/data-foundations/SKILL.md +0 -0
  82. /package/src/{.agents/skills → skills}/document-review/SKILL.md +0 -0
  83. /package/src/{.agents/skills → skills}/file-todos/SKILL.md +0 -0
  84. /package/src/{.agents/skills → skills}/file-todos/assets/todo-template.md +0 -0
  85. /package/src/{.agents/skills → skills}/financial-workflow-integrity/SKILL.md +0 -0
  86. /package/src/{.agents/skills → skills}/git-worktree/SKILL.md +0 -0
  87. /package/src/{.agents/skills → skills}/pii-protection-prisma/SKILL.md +0 -0
  88. /package/src/{.agents/skills → skills}/process-metrics/SKILL.md +0 -0
  89. /package/src/{.agents/skills → skills}/process-metrics/assets/daily-template.md +0 -0
  90. /package/src/{.agents/skills → skills}/process-metrics/assets/monthly-template.md +0 -0
  91. /package/src/{.agents/skills → skills}/process-metrics/assets/weekly-template.md +0 -0
  92. /package/src/{.agents/skills → skills}/technical-review/SKILL.md +0 -0
@@ -0,0 +1,836 @@
1
+ ---
2
+ name: work
3
+ invocation: workflow:work
4
+ description: Orchestrate execution of an approved plan by deriving executable todo contracts, resolving skills from AGENTS.md, sequencing work by dependencies, delegating execution to subagents, enforcing intent alignment, and requiring independent verification before completion
5
+ argument-hint: "<required: plan file path>"
6
+ ---
7
+
8
+ # /workflow:work
9
+
10
+ Orchestrate execution of an approved plan. This command plans, delegates, collects, and verifies — it does not implement directly.
11
+
12
+ ## Introduction
13
+
14
+ Correctness takes priority over speed.
15
+ Do not optimise for momentum if it risks drift, ambiguity, or a weaker solution.
16
+
17
+ Contract precedence: if this command conflicts with other workflow docs, follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md` or `AGENTS.md`, then this command.
18
+
19
+ It is critical that you follow this workflow in order; do not skip or shortcut steps.
20
+
21
+ ## Core Shift
22
+
23
+ This command is an orchestrator, not an implementer.
24
+
25
+ This command is responsible for:
26
+
27
+ - reading and validating the approved plan
28
+ - deriving executable todo contracts from approved feature requirements
29
+ - preserving intent from the plan during task derivation and execution
30
+ - resolving required skills from the capability registry
31
+ - determining execution order based on dependencies and preconditions
32
+ - **delegating execution to subagents**
33
+ - **collecting and verifying subagent output**
34
+ - routing work through required review gates
35
+ - deciding `complete`, `changes_required`, `blocked`, or `plan_conflict`
36
+
37
+ This command is not responsible for:
38
+
39
+ - implementing the feature directly
40
+ - redefining the approved plan
41
+ - improving or reshaping the approved solution during execution
42
+ - self-approving unverified work
43
+ - skipping dependency or review gates to move faster
44
+ - silently inventing new scope to fill gaps in the plan
45
+
46
+ ## Non-goals (unless explicitly requested)
47
+
48
+ - Creating commits
49
+ - Pushing branches
50
+ - Creating pull requests
51
+
52
+ ## DO NOTs
53
+
54
+ - Do not skip plan validation
55
+ - Do not skip registry resolution
56
+ - Do not delegate without a full todo contract
57
+ - Do not delegate without passing the intent alignment gate
58
+ - Do not unblock downstream tasks from `implemented`
59
+ - Do not mark tasks complete without required review
60
+ - Do not silently absorb plan ambiguity
61
+ - Do not silently improve the plan during execution
62
+ - Do not modify the capability registry in this command
63
+ - Do not create commits, push branches, or create PRs unless explicitly asked
64
+ - Do not claim feature completion if only implementation exists without verification
65
+ - Do not use invalid state transitions
66
+ - Do not treat described phases as optional guidance
67
+ - Do not prefer speed over correctness
68
+
69
+ ## Input Document
70
+
71
+ <input_document> #$ARGUMENTS </input_document>
72
+
73
+ The input must be a plan file path.
74
+
75
+ - If it is empty, ask the user for the plan file path.
76
+ - If it does not exist or is not readable, stop and ask for the correct path.
77
+ - Read the plan file completely before starting work.
78
+
79
+ ## Operating Priority
80
+
81
+ 1. Correct solution
82
+ 2. Alignment to approved intent
83
+ 3. Clear verification
84
+ 4. Safe dependency order
85
+ 5. Execution efficiency
86
+
87
+ Never trade correctness for speed.
88
+
89
+ ---
90
+
91
+ ## Gate Model
92
+
93
+ Gates are mandatory. A task MUST NOT advance unless the conditions of the next gate are satisfied.
94
+
95
+ ### Gate Summary
96
+
97
+ - Contract Gate
98
+ - Dependency Gate
99
+ - Intent Alignment Gate
100
+ - Execution Gate
101
+ - Validation Gate
102
+ - Review Gate
103
+ - Drift Detection Gate
104
+ - Completion Gate
105
+
106
+ ### Contract Gate
107
+
108
+ A task may only move from `drafted` to `ready` when:
109
+
110
+ - the todo contract is valid
111
+ - the objective is clear
112
+ - the responsibility is clear
113
+ - acceptance criteria are present
114
+ - dependencies are defined
115
+ - required skills are resolved
116
+ - required validation commands are known
117
+ - required verification gates are defined
118
+ - the intent anchor is present
119
+
120
+ ### Dependency Gate
121
+
122
+ A task may only move from `ready` to `in_progress` when:
123
+
124
+ - all dependencies are `complete`
125
+ - all preconditions are satisfied
126
+ - no blocking discussion/spike todo is unresolved
127
+ - required access exists
128
+
129
+ ### Intent Alignment Gate
130
+
131
+ A task may only move from `ready` to `in_progress` when:
132
+
133
+ - the intent alignment check passes
134
+ - no plan drift is detected before delegation
135
+
136
+ ### Execution Gate
137
+
138
+ A task may only move from `in_progress` to `implemented` when:
139
+
140
+ - execution output was returned from the subagent
141
+ - expected outputs were produced
142
+ - implementation summary was provided
143
+ - changed files were declared
144
+ - tests run were recorded or explicitly marked not applicable with reason
145
+
146
+ ### Validation Gate
147
+
148
+ A task may only move from `implemented` to `in_review` when:
149
+
150
+ - required validation commands were executed
151
+ - results were captured
152
+ - evidence required by the todo contract is present
153
+
154
+ ### Review Gate
155
+
156
+ A task may only move from `in_review` to `complete` when:
157
+
158
+ - every required verification gate passed
159
+ - all acceptance criteria are satisfied
160
+ - no critical issue remains open
161
+ - the result still aligns with the approved plan
162
+
163
+ A task in `in_review` must move to `changes_required` when:
164
+
165
+ - any required validation fails
166
+ - any required review fails
167
+ - evidence is incomplete
168
+ - the result does not satisfy the contract
169
+
170
+ ### Drift Detection Gate
171
+
172
+ A task may only move from `in_review` to `complete` when:
173
+
174
+ - the drift detection gate passes
175
+ - no silent scope, constraint, or intent change was introduced
176
+
177
+ ### Completion Gate
178
+
179
+ A task is only complete when:
180
+
181
+ - all prior gates passed
182
+ - the orchestrator accepts the result as satisfying the todo contract
183
+ - downstream work can safely rely on it
184
+
185
+ A subagent saying "done" is not enough. Code existing is not enough.
186
+
187
+ ---
188
+
189
+ ## Enforced State Model
190
+
191
+ ```yaml
192
+ task_status_flow:
193
+ drafted:
194
+ can_transition_to:
195
+ - ready
196
+ - blocked
197
+ ready:
198
+ can_transition_to:
199
+ - in_progress
200
+ - blocked
201
+ - plan_conflict
202
+ in_progress:
203
+ can_transition_to:
204
+ - implemented
205
+ - blocked
206
+ - changes_required
207
+ - plan_conflict
208
+ implemented:
209
+ can_transition_to:
210
+ - in_review
211
+ - changes_required
212
+ - plan_conflict
213
+ in_review:
214
+ can_transition_to:
215
+ - complete
216
+ - changes_required
217
+ - plan_conflict
218
+ changes_required:
219
+ can_transition_to:
220
+ - ready
221
+ - in_progress
222
+ - blocked
223
+ blocked:
224
+ can_transition_to:
225
+ - ready
226
+ complete:
227
+ terminal: true
228
+ plan_conflict:
229
+ terminal: true
230
+ ```
231
+
232
+ Rules:
233
+
234
+ - Any invalid transition is a workflow failure — report immediately.
235
+ - `implemented -> complete` is not allowed.
236
+ - `drafted -> in_progress` is not allowed.
237
+ - `ready -> complete` is not allowed.
238
+
239
+ ---
240
+
241
+ ## Hard Stop Conditions
242
+
243
+ Stop immediately and report when any of the following occur:
244
+
245
+ - the plan is missing acceptance criteria
246
+ - the plan is missing clear scope or non-goals
247
+ - a todo has no clear responsibility
248
+ - a todo has no explicit acceptance criteria
249
+ - a todo has no intent anchor
250
+ - required skills cannot be resolved
251
+ - the capability registry is missing or ambiguous
252
+ - dependencies are cyclic, undefined, or contradictory
253
+ - required validation commands are missing
254
+ - a task attempts to skip a required gate
255
+ - a plan conflict is detected that affects dependent work
256
+
257
+ Do not continue through ambiguity.
258
+
259
+ ---
260
+
261
+ ## Intent Preservation Rules
262
+
263
+ Intent from the approved plan is locked for execution. The orchestrator must execute approved intent — not reinterpret, expand, or silently improve it.
264
+
265
+ ### Intent lock
266
+
267
+ Every todo must carry an explicit intent anchor derived from the plan:
268
+
269
+ ```yaml
270
+ intent_anchor:
271
+ objective: <exact or tightly paraphrased objective from plan>
272
+ scope_notes:
273
+ - <relevant scope boundaries from plan>
274
+ constraints:
275
+ - <relevant constraints from plan>
276
+ acceptance_criteria:
277
+ - <relevant acceptance criteria from plan>
278
+ non_goals:
279
+ - <relevant non-goals from plan>
280
+ source_plan_reference:
281
+ file: <plan path>
282
+ section: <heading or anchor>
283
+ ```
284
+
285
+ Rules:
286
+
287
+ - the orchestrator must not modify the intent anchor during execution
288
+ - a todo may narrow execution detail, but must not change product intent
289
+ - if a better idea is discovered, record it as a follow-up note — do not fold it into execution
290
+
291
+ ### Intent alignment check
292
+
293
+ Before a todo moves from `ready` to `in_progress`, verify:
294
+
295
+ - the todo objective still matches the plan objective
296
+ - the todo still contributes to plan acceptance criteria
297
+ - the todo does not introduce new scope
298
+ - the todo does not weaken or bypass plan constraints
299
+ - the todo does not conflict with declared non-goals
300
+
301
+ If any check fails: set the todo to `plan_conflict` and stop dependent execution.
302
+
303
+ ### Drift detection
304
+
305
+ After subagent output is collected and before final completion, explicitly check:
306
+
307
+ - does the implemented result still align to the original plan intent?
308
+ - did execution introduce new assumptions?
309
+ - did scope expand or shift?
310
+ - did constraints get bypassed or softened?
311
+
312
+ If yes: set `status = plan_conflict`, stop further dependent execution, surface the drift for review.
313
+
314
+ ---
315
+
316
+ ## Execution Workflow
317
+
318
+ ### Phase 1: Setup & Validation
319
+
320
+ #### 1.1 Read and Validate Plan File
321
+
322
+ - Read the plan file completely
323
+ - Confirm the file exists and is readable
324
+ - If missing acceptance criteria, scope, or non-goals — stop and return for refinement
325
+ - Do not compensate for a weak plan by improvising hidden assumptions
326
+
327
+ #### 1.2 Resolve Repo Defaults
328
+
329
+ Read `AGENTS.md` and look for the Repo Config Block. Resolve:
330
+
331
+ - `test_command`
332
+ - `test_fast_command` (optional)
333
+ - `lint_command` (optional)
334
+ - `typecheck_command` (optional)
335
+ - `format_command` (optional)
336
+
337
+ If any required quality gate command is missing:
338
+
339
+ - ask once for run-provided commands
340
+ - record them in the first active todo work log entry
341
+ - do not mark related todos complete unless the commands were run successfully
342
+
343
+ #### 1.3 Resolve Plan Contract
344
+
345
+ Extract from the plan:
346
+
347
+ - feature objective
348
+ - scope contract (`solution_scope`, `completion_expectation`, `non_goals`)
349
+ - acceptance criteria
350
+ - constraints
351
+ - rollout expectations
352
+ - risk/fidelity/confidence if present
353
+ - `Agentic Access & Validation Contract`
354
+ - implementation phases, tasks, and checklists
355
+ - discussion points and spikes if present
356
+
357
+ If any of the following are missing, stop and return the plan for refinement:
358
+
359
+ - clear objective
360
+ - explicit acceptance criteria
361
+ - explicit scope or non-goals
362
+ - actionable access/validation contract
363
+ - enough implementation detail to derive executable tasks
364
+
365
+ #### 1.4 Resolve Skill Assignments
366
+
367
+ Read the Skill Index from `AGENTS.md`.
368
+
369
+ For each implementation phase or task in the plan:
370
+
371
+ - Check if the plan already carries `required_skills` annotations (written during `/workflow:plan`)
372
+ - If annotations exist: validate each skill against the registry — confirm it exists and is applicable
373
+ - If annotations are missing: resolve skills now by mapping task responsibility, objective, and constraints to the Skill Index
374
+ - Record resolved skills per task — these will be attached to todo contracts in Phase 3
375
+
376
+ If a required skill cannot be resolved from the registry:
377
+
378
+ - surface it as a capability gap
379
+ - do not proceed with that task until resolved
380
+
381
+ #### 1.5 Resolve Testing Cadence
382
+
383
+ Infer testing cadence from the plan's risk profile.
384
+
385
+ - Prefer `fidelity` and `confidence` from plan frontmatter if present
386
+ - Otherwise default to `fidelity=medium`, `confidence=medium`
387
+
388
+ Testing cadence:
389
+
390
+ - Low risk: fast checks per todo, full suite at milestone and end
391
+ - Medium risk: fast checks per todo, full suite at milestones + end
392
+ - High risk: fast checks per todo, full suite frequently (every 1–2 build todos) + end
393
+
394
+ Record the chosen cadence before execution begins.
395
+
396
+ ---
397
+
398
+ ### Phase 2: Environment Setup (Hard Gate)
399
+
400
+ No file writes, implementation commands, test/lint/typecheck commands, or dependency-install commands may run before this gate passes.
401
+
402
+ Allowed before gate: read-only inspection only (e.g. `ls`, `git status`, `git branch`).
403
+
404
+ **Default: use a worktree. Opt-out requires explicit user confirmation.**
405
+
406
+ Steps:
407
+
408
+ 1. Resolve your current branch (this is the default worktree base)
409
+ 2. Ask the user: create a worktree for this plan? (Yes / No — explicit opt-out required)
410
+ 3. If Yes: ask for branch name if missing (e.g. `feat/<slug>`, `fix/<slug>`), then run `skill: git-worktree`
411
+ 4. If No: require explicit opt-out confirmation, then create or switch to a feature branch (never work directly on the default branch)
412
+
413
+ Worktree bootstrap (required when worktree created):
414
+
415
+ - Immediately after entering the new worktree, run bootstrap per the `git-worktree` skill
416
+ - Copy env/config, install deps, apply `worktree_bootstrap_notes`
417
+ - Record the worktree path (e.g. `.worktrees/feat-xyz`) in a visible place — all subsequent steps use this as the implementation root
418
+
419
+ Gate completion record (required before Phase 3):
420
+
421
+ - `worktree_decision: yes|no`
422
+ - `worktree_path: <path>` when yes, else `execution_branch: <branch>`
423
+ - `gate_status: passed`
424
+
425
+ **Preflight Violation Recovery:** If implementation starts before this gate is complete — disclose the violation immediately, stop all implementation actions, return to Phase 2, complete the gate record, resume only after `gate_status: passed`.
426
+
427
+ ---
428
+
429
+ ### Phase 3: Derive Todo Contracts
430
+
431
+ Convert the approved plan into executable todo contracts.
432
+
433
+ A todo is not a note. A todo is not a loose checklist item. A todo is an executable contract that can be delegated to a subagent, verified, and closed.
434
+
435
+ #### 3.1 Todo Contract Rules
436
+
437
+ Every derived todo must be:
438
+
439
+ - independently understandable
440
+ - narrow enough to execute without hidden subprojects
441
+ - mapped to a single primary responsibility
442
+ - explicit about dependencies
443
+ - explicit about verification
444
+ - explicit about evidence required for closure
445
+ - explicitly anchored to approved intent
446
+ - carrying resolved skill assignments from Phase 1.4
447
+
448
+ If a candidate task is too broad: split it before delegation.
449
+ If a candidate task is ambiguous: refine it before delegation.
450
+ If a candidate task depends on unresolved decisions: mark it `blocked`.
451
+
452
+ #### 3.2 Required Todo Contract Schema
453
+
454
+ Every executable todo MUST contain:
455
+
456
+ ```yaml
457
+ id: <stable task id>
458
+ title: <short action-oriented title>
459
+ status: drafted
460
+ type: build | review | qa | docs | spike | discussion
461
+ objective: <what this task must achieve>
462
+ responsibility: <primary responsibility domain>
463
+ required_skills:
464
+ - <resolved from plan annotations or Phase 1.4>
465
+ optional_skills:
466
+ - <attached when they materially reduce risk>
467
+ intent_anchor:
468
+ objective: <from plan>
469
+ scope_notes:
470
+ - <relevant scope boundary>
471
+ constraints:
472
+ - <relevant constraint>
473
+ acceptance_criteria:
474
+ - <relevant acceptance criterion>
475
+ non_goals:
476
+ - <relevant non-goal>
477
+ source_plan_reference:
478
+ file: <plan path>
479
+ section: <heading or anchor>
480
+ depends_on:
481
+ - <task ids or none>
482
+ preconditions:
483
+ - <conditions that must be true before execution>
484
+ inputs:
485
+ - <required references, docs, plan sections, fixtures, routes>
486
+ constraints:
487
+ - <do not change x>
488
+ - <must align to y>
489
+ expected_outputs:
490
+ - <artifact or implementation output>
491
+ acceptance_criteria:
492
+ - <task-level success condition>
493
+ validation_commands:
494
+ - <repo-runnable checks>
495
+ verification:
496
+ - type: technical_review | qa_review | integration_check | docs_review | custom
497
+ required: true
498
+ status: pending | approved | changes_required | not_required
499
+ notes: null
500
+ evidence_required:
501
+ - <logs, screenshots, test output, file list, notes>
502
+ unblocks:
503
+ - <downstream task ids or none>
504
+ work_log: []
505
+ implementation_summary: null
506
+ files_changed: []
507
+ tests_run: []
508
+ evidence_collected: []
509
+ drift_check:
510
+ status: pending | passed | failed
511
+ notes: null
512
+ open_issues: []
513
+ review_outcome:
514
+ summary: pending
515
+ ```
516
+
517
+ #### 3.3 Todo Status Model
518
+
519
+ - `drafted` — derived but not yet ready to execute
520
+ - `ready` — dependencies and preconditions satisfied
521
+ - `blocked` — cannot start due to dependency, access, or unresolved decision
522
+ - `in_progress` — delegated and being executed by a subagent
523
+ - `implemented` — subagent output returned, not yet verified
524
+ - `in_review` — undergoing required verification gates
525
+ - `changes_required` — failed verification or returned incomplete evidence
526
+ - `complete` — all required verification gates passed
527
+ - `plan_conflict` — execution exposed a conflict with approved plan intent
528
+
529
+ Important: `implemented` does not unblock downstream work. Only `complete` unblocks downstream work.
530
+
531
+ #### 3.4 Responsibility Classification
532
+
533
+ Every todo must declare one primary responsibility. If a task truly spans multiple major responsibilities, split it.
534
+
535
+ Recommended values: `frontend`, `backend`, `schema`, `testing`, `playwright`, `infra`, `docs`, `spike`, `discussion`, `technical_review`, `qa_review`
536
+
537
+ #### 3.5 Blocking Unknowns
538
+
539
+ When the plan includes unresolved decisions, missing access, risky unknowns, spike candidates, or discussion points — these must become explicit todos before dependent build work begins.
540
+
541
+ - discussion todos → resolve decisions (no code)
542
+ - spike todos → reduce risk with a timebox and deliverable
543
+ - build work blocked by them stays `blocked`
544
+
545
+ #### 3.6 Create Todo Files
546
+
547
+ Confirm `file-todos` exists in the AGENTS.md registry before running. If missing, surface as a capability gap and stop.
548
+
549
+ Run:
550
+
551
+ ```
552
+ skill: file-todos
553
+ # Input: plan file path
554
+ # Output: todos/*-ready-*.md and/or todos/*-pending-*.md
555
+ ```
556
+
557
+ Prerequisites:
558
+
559
+ - Ensure `todos/` exists; create it if not
560
+ - Ensure the todo template exists at `file-todos/assets/todo-template.md` within the skills directory of the current harness (resolve from `harnesses` in AGENTS.md Repo Config)
561
+
562
+ Plan → todos mapping:
563
+
564
+ - implementation phases/tasks → build todos (carrying `required_skills` from plan)
565
+ - discussion points → discussion todos (`status: pending`)
566
+ - spike candidates → spike todos (`status: pending`)
567
+ - review/qa requirements → review/qa todos
568
+
569
+ #### 3.7 Dependency Rules
570
+
571
+ Execution order is dependency-driven, not list-order driven.
572
+
573
+ A todo is `ready` only when all `depends_on` items are `complete` and all `preconditions` are satisfied.
574
+
575
+ A todo is `blocked` when any dependency is not `complete`, any precondition is unmet, required access is missing, or a blocking spike/discussion task is unresolved.
576
+
577
+ The orchestrator must:
578
+
579
+ - recompute readiness after every task completion, rework, or block
580
+ - never delegate a blocked task
581
+ - never allow `implemented` work to unblock downstream tasks
582
+
583
+ ---
584
+
585
+ ### Phase 4: Triage Pass
586
+
587
+ Run an in-command triage pass before any implementation work.
588
+
589
+ - Approve and prioritize the queue for this plan
590
+ - Make execution order explicit
591
+ - Confirm blocking spikes are front-loaded before dependent build todos
592
+ - Verify every `ready` todo has an executable contract (access preconditions, validation path, evidence expectations, quality gate commands all explicit)
593
+ - If no unblocked `ready` todos remain: stop and report pending/deferred/blocked items
594
+
595
+ Use standalone `/workflow:triage` only when the user explicitly requests manual queue curation.
596
+
597
+ Contract checksum (all must be true before proceeding to Phase 5):
598
+
599
+ - [ ] auto-triage completed
600
+ - [ ] isolation gate recorded (`worktree_decision`, `gate_status: passed`)
601
+ - [ ] blocking spikes front-loaded
602
+ - [ ] every `ready` todo has explicit agentic execution contract
603
+
604
+ ---
605
+
606
+ ### Phase 5: Task Execution Loop
607
+
608
+ All file writes and terminal commands MUST use the execution context resolved in Phase 2.
609
+
610
+ - If `worktree_decision: yes`: use the worktree path. Do not make code changes in the main repo checkout.
611
+ - If `worktree_decision: no`: use the recorded execution branch only (never default branch).
612
+
613
+ #### Todo Selection Rules
614
+
615
+ - Consider only `todos/*-ready-*.md` items
616
+ - Skip blocked todos (any dependency without a corresponding `*-complete-*.md`)
617
+ - Prioritise blocking spikes first
618
+ - Then prioritise by priority (`p1` before `p2` before `p3`), then lower `issue_id` first
619
+
620
+ Stop condition: if no unblocked `ready` todos remain, summarise pending/deferred/blocked items and stop. Do not invent work.
621
+
622
+ #### Execution Loop
623
+
624
+ For each ready todo in priority order:
625
+
626
+ ```
627
+ 1. SELECT — next ready, unblocked todo
628
+ 2. CHECK — intent alignment gate passes
629
+ 3. DELEGATE — dispatch to subagent with:
630
+ - todo contract (objective, constraints, acceptance criteria)
631
+ - resolved required_skills
632
+ - intent anchor
633
+ - execution context (worktree path / branch)
634
+ - relevant plan sections and file references
635
+ 4. COLLECT — receive subagent output:
636
+ - implementation summary
637
+ - files changed
638
+ - tests run
639
+ - evidence collected
640
+ 5. VALIDATE — run validation gate:
641
+ - re-state acceptance criteria being validated (1–3 bullets)
642
+ - run required validation commands
643
+ - run lint/typecheck for changed scope
644
+ - record evidence in todo Work Log
645
+ 6. REVIEW — assess against todo contract:
646
+ - all acceptance criteria satisfied?
647
+ - evidence complete?
648
+ - no new scope introduced?
649
+ 7. DRIFT — verify result aligns to original plan intent
650
+ 8. ADVANCE — move to `complete` if all gates pass
651
+ — move to `changes_required` if any gate fails
652
+ 9. SYNC — flip corresponding plan checkbox [ ] → [x]
653
+ 10. RECOMPUTE — update readiness of downstream todos
654
+ ```
655
+
656
+ #### Parallel Execution
657
+
658
+ Allowed only when:
659
+
660
+ - tasks do not depend on each other
661
+ - tasks do not mutate the same fragile surface in conflicting ways
662
+ - verification and merge-back can remain clear
663
+ - intent alignment can remain clear for each task independently
664
+
665
+ #### Discovery & Scope Changes
666
+
667
+ If new, non-critical work is discovered, do NOT silently expand scope. Ask the user to choose:
668
+
669
+ 1. Do now (scope increase): only if small + tightly coupled
670
+ 2. Create a triage item: new `pending` todo (default `p3` unless urgent)
671
+ 3. Park for reference: `*-deferred-*.md` with problem statement + findings
672
+ 4. Compound candidate only: capture as `/workflow:compound` documentation candidate
673
+
674
+ Always record the decision in the todo Work Log.
675
+
676
+ #### Scope Contract Checks (per todo)
677
+
678
+ - If `solution_scope: partial_fix`: update remaining gaps in todo Work Log as discovered
679
+ - If `solution_scope: migration`: record migration validation evidence and rollback readiness before marking migration todos complete
680
+
681
+ #### Stuck Guard
682
+
683
+ Trigger: cannot identify a clear next step after consulting available context, OR ≥2 distinct failed approaches on the same todo step, OR ≥3 total failures on the same todo.
684
+
685
+ Guard suppression: MUST NOT fire for todos tagged `tags: [spike]`.
686
+
687
+ When guard fires (mandatory order):
688
+
689
+ 1. Detect trigger (`unknown_territory` OR `repeated_failure`)
690
+ 2. Announce: "Pausing to investigate..."
691
+ 3. Transition todo: `ready` → `pending + tags: [blocker]`
692
+ 4. Add placeholder Work Log entry with stuck type and timestamp
693
+ 5. Dispatch subagents in parallel:
694
+ - Always: repo-research-analyst, learnings-researcher
695
+ - If failure mentions external library/API: + framework-docs-researcher
696
+ - If stuck on approach/architecture: + best-practices-researcher
697
+ - If modifying existing code: + git-history-analyzer
698
+ 6. Collect findings (single-pass; no recursive guard firing)
699
+ 7. Synthesise enriched output (format below)
700
+ 8. Update Work Log with full enriched output
701
+ 9. Present decision prompt to user
702
+ 10. After decision: convert to todos, re-approve through triage before returning to `ready`
703
+
704
+ Enriched output format:
705
+
706
+ ```markdown
707
+ ## Stuck Guard Triggered
708
+
709
+ **Detected:** [unknown_territory | repeated_failure]
710
+ **Investigating...** Launching: [subagents dispatched]
711
+
712
+ ---
713
+
714
+ ## Research Findings
715
+
716
+ - **repo-research-analyst:** [summary or "no findings returned"]
717
+ - **learnings-researcher:** [summary or "no findings returned"]
718
+ - **framework-docs-researcher:** [summary or "not invoked" | "no findings returned"]
719
+ - **best-practices-researcher:** [summary or "not invoked" | "no findings returned"]
720
+ - **git-history-analyzer:** [summary or "not invoked" | "no findings returned"]
721
+
722
+ **Synthesis confidence:** `high` | `medium` | `low`
723
+
724
+ ---
725
+
726
+ ## Blocker Summary
727
+
728
+ [1–2 sentences]
729
+
730
+ ## Constraints Discovered
731
+
732
+ - [constraint 1]
733
+
734
+ ## Options
735
+
736
+ **Option 1: [Name]** _(source: [agent(s)] | agent-reasoned)_
737
+ - Pros / Cons / Risk / Effort
738
+
739
+ **Option 2: [Name]**
740
+ ...
741
+
742
+ **Option 3: [Name]**
743
+ ...
744
+
745
+ ## Recommendation
746
+
747
+ [One option + 2–4 bullets citing research findings]
748
+
749
+ _Which option should we take?_
750
+ ```
751
+
752
+ When findings are empty: produce ≥3 options marked `*(agent-reasoned — research returned no findings)*`. Set synthesis confidence to `low`. Do not fabricate citations.
753
+
754
+ #### Blocker Protocol
755
+
756
+ Trigger: cannot proceed safely due to ambiguity, missing info, failing approach, or environment/tooling issue.
757
+
758
+ Output format (always):
759
+
760
+ - Blocker summary (1–2 sentences)
761
+ - Constraints discovered (bullets)
762
+ - Options (≥3): each with pros/cons, risks, effort
763
+ - Recommendation: one option + why (2–4 bullets)
764
+ - Decision prompt: "Which option should we take?"
765
+
766
+ After decision:
767
+
768
+ - Convert to explicit todos
769
+ - If chosen option is a timeboxed investigation: follow Spike Protocol
770
+ - Record decision in todo Work Log
771
+ - Re-approve through triage before returning to `ready`
772
+
773
+ #### Spike Protocol
774
+
775
+ Trigger: plan includes spike/discussion todos, or Blocker Protocol decision is to run a timeboxed investigation.
776
+
777
+ Steps:
778
+
779
+ 1. Create or convert todo to a spike todo tagged `tags: [spike]`. Fill Problem Statement, Proposed Solutions, Acceptance Criteria. Carry forward plan metadata (initial priority, depends_on, unblocks, parallelizable).
780
+ 2. Recommend a dedicated spike worktree using `skill: git-worktree` with branch `spike/<todo_id>-<slug>`. Run worktree bootstrap.
781
+ 3. Dispatch research subagents in parallel:
782
+ - Always: repo-research-analyst, learnings-researcher
783
+ - Conditional: framework-docs-researcher, best-practices-researcher, git-history-analyzer
784
+ 4. Spike deliverable (required in Work Log):
785
+ - Options (≥3) with pros/cons, risks, effort
786
+ - Recommendation (one option + why)
787
+ - Concrete next steps: build todos to create/update so the main plan can proceed
788
+ - Should we compound this? yes/no + one-line why
789
+ 5. Multiple independent spikes: create one worktree per spike. Run in dependency order; parallel when environment supports it.
790
+ 6. After completion: mark spike todo `*-complete-*.md`. If compound: yes, recommend `/workflow:compound` with the spike context.
791
+
792
+ ---
793
+
794
+ ### Phase 6: Quality Check
795
+
796
+ Run before declaring work complete:
797
+
798
+ - Run full test suite using `test_command` from AGENTS.md
799
+ - Run `lint_command` if configured
800
+ - Run `typecheck_command` if configured
801
+ - Run `format_command` if configured
802
+
803
+ Ask-once fallback: if commands are not configured, ask once for run-provided commands and record them in the active Work Log entry.
804
+
805
+ ---
806
+
807
+ ### Phase 7: Completion
808
+
809
+ #### 7.1 Final Drift Check
810
+
811
+ Verify the complete implementation still aligns to original plan intent:
812
+
813
+ - Does the result satisfy all plan acceptance criteria?
814
+ - Did execution introduce any new assumptions?
815
+ - Did scope expand or shift?
816
+ - Did constraints get bypassed or softened?
817
+
818
+ If drift detected: set `status = plan_conflict`, stop, surface for review before claiming completion.
819
+
820
+ #### 7.2 Completion Summary
821
+
822
+ Provide:
823
+
824
+ - Todos completed this cycle
825
+ - Ready queue remaining
826
+ - Blocked queue with reasons
827
+ - Pending / deferred items
828
+ - Capability gaps discovered
829
+ - Plan conflicts / drift detected
830
+ - Next execution step
831
+
832
+ #### 7.3 Handoff Options
833
+
834
+ - `/workflow:review` — validate quality of implemented work
835
+ - `/workflow:compound` — capture durable learnings from this execution
836
+ - `/workflow:triage` — re-prioritise remaining pending/blocked items