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