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
@@ -1,690 +0,0 @@
1
- ---
2
- name: work
3
- invocation: workflow:work
4
- description: Execute a plan file systematically (implementation + verification) without auto-shipping
5
- argument-hint: "<required: plan file path>"
6
- ---
7
-
8
- # /workflow:work
9
-
10
- Execute a work plan efficiently while maintaining quality and finishing features.
11
-
12
- ## Introduction
13
-
14
- This command takes a plan file and executes it systematically. The focus is on completing the work while understanding requirements quickly, following existing patterns, and maintaining quality throughout.
15
-
16
- Contract precedence: if this command conflicts with other workflow docs, follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then this command.
17
-
18
- It is critical that you follow this workflow in order; do not skip or shortcut steps.
19
-
20
- Non-goals (unless explicitly requested):
21
-
22
- - Creating commits
23
- - Pushing branches
24
- - Creating pull requests
25
-
26
- ## Input Document
27
-
28
- <input_document> #$ARGUMENTS </input_document>
29
-
30
- The input must be a plan file path.
31
-
32
- - If it is empty, ask the user for the plan file path.
33
- - If it does not exist or is not readable, stop and ask for the correct path.
34
- - Read the plan file completely before starting work.
35
-
36
- ## Execution Workflow
37
-
38
- ### Phase 1: Quick Start
39
-
40
- 1. **Read Plan and Clarify**
41
-
42
- - Read the work document completely
43
- - Review any references or links provided in the plan
44
- - If anything is unclear or ambiguous, ask clarifying questions now
45
- - Get user approval to proceed
46
- - **Do not skip this** - better to ask questions now than build the wrong thing
47
-
48
- 1.1. **Apply state-orchestration trigger (enforcement)**
49
-
50
- If the plan or implementation involves state-machine or actor
51
- orchestration, load the selected state-orchestration skill (see Skill
52
- Index in AGENTS.md) before coding.
53
-
54
- Trigger examples:
55
-
56
- - React container-as-orchestrator composition for complex UI flows
57
- - Backend/internal workflow orchestration with hidden complexity
58
- - Spawned children or receptionist-style actor lookup
59
- - Retries/timeouts/cancellation/recovery state handling
60
- - More than one boolean/flag controlling one workflow
61
-
62
- 1.25. **Resolve Repo Defaults (ALWAYS FIRST)**
63
-
64
- Read `AGENTS.md` and look for the "Repo Config Block" YAML.
65
-
66
- Use it to resolve:
67
-
68
- - `test_command`
69
- - `test_fast_command` (optional)
70
- - `lint_command` (optional)
71
- - `typecheck_command` (optional)
72
- - `format_command` (optional)
73
-
74
- If not present, ask once for the project's test command and suggest adding it to `AGENTS.md`.
75
-
76
- 1.5. **Determine Testing Mode (Risk-Based)**
77
-
78
- Infer a testing cadence from the plan's risk.
79
-
80
- Inputs:
81
-
82
- - If the plan file has frontmatter `fidelity` and `confidence`, use them.
83
- - Otherwise default to `fidelity=medium`, `confidence=medium`.
84
-
85
- Testing modes:
86
-
87
- - Low risk: fast checks per todo, full suite at end
88
- - Medium risk (default): fast checks per todo, full suite at milestones + end
89
- - High risk: fast checks per todo, full suite frequently (every 1-2 todos) + end
90
-
91
- Command sources:
92
-
93
- - Prefer `test_command` and optional `test_fast_command` from `AGENTS.md`.
94
- - If missing, ask once for the repo's test command and suggest adding it to `AGENTS.md`.
95
-
96
- 1.6. **Run-Scoped Quality Gate Fallback Setup (PREP STEP)**
97
-
98
- Ask-once fallback policy for missing lint/typecheck config:
99
-
100
- - If `lint_command` and/or `typecheck_command` is missing from `AGENTS.md`, ask once in this run for run-provided commands.
101
- - Record run-provided commands in the first active todo Work Log entry.
102
- - Continue only when provided commands run successfully.
103
- - If commands are not provided or fail, do not mark related todos complete.
104
-
105
- Note: full execution preflight (auto-triage + contract checks + isolation checks) runs after todo creation in Step 3.5.
106
-
107
- 1.75. **Resolve Plan Scope Contract (REQUIRED)**
108
-
109
- Before any environment setup or implementation, resolve the plan's scope contract:
110
-
111
- - `solution_scope`: `partial_fix | full_remediation | migration`
112
- - `completion_expectation`: explicit definition of done
113
- - `non_goals`: explicitly out of scope
114
-
115
- If any scope-contract field is missing:
116
-
117
- - Pause execution and ask the user to update the plan via `/workflow:plan`, or provide explicit values now.
118
- - Record the resolved values in the first todo Work Log entry before coding.
119
-
120
- Scope implications:
121
-
122
- - `partial_fix`: maintain an explicit remaining-gaps list while executing.
123
- - `migration`: identify migration verification + rollback checks before executing todos.
124
- - `full_remediation`: complete all known gaps in the scoped area before completion.
125
-
126
- 2. **Setup Environment (HARD GATE - WORKTREE FIRST)**
127
-
128
- Determine how to isolate the work for this plan.
129
-
130
- This gate MUST run immediately after Step 1.75.
131
-
132
- No file writes, implementation commands, test/lint/typecheck commands, or dependency-install commands may run before this gate passes.
133
-
134
- Allowed before gate: read-only inspection only (e.g., `ls`, `rg`, `cat`, `git status`, `git branch`).
135
-
136
- Default: use a worktree. Opt-out requires explicit user confirmation.
137
-
138
- 1) Resolve your current branch (this is the default worktree base):
139
-
140
- - If you are already on a branch that clearly matches this plan, continue.
141
- - Otherwise, continue anyway — the current active branch remains the reference/base for a new worktree unless the user explicitly requests a different base.
142
-
143
- 2) Resolve the user decision (required prompt/create gate):
144
-
145
- - If the user already gave an explicit instruction in this run:
146
- - "create a worktree" / "yes use a worktree" => use worktree path
147
- - "do not use a worktree" / "no worktree" => opt-out path
148
- - Otherwise, you MUST ask this exact decision before proceeding:
149
- - "Use a worktree for this work? (Yes/No; default recommendation: Yes)"
150
- - Options:
151
- - Yes (worktree)
152
- - No (stay in current checkout; create/switch to a feature branch)
153
-
154
- Mandatory behavior:
155
-
156
- - Do not infer or assume an answer when the user has not answered.
157
- - Do not run `skill: git-worktree` until the user has answered Yes (or already explicitly requested worktree creation).
158
- - If Yes: ask for the new branch name when missing (e.g., `feat/<slug>`, `fix/<slug>`), then continue.
159
- - If No: require explicit opt-out confirmation, then continue with the non-worktree path.
160
-
161
- 3) If worktree is chosen, run:
162
-
163
- ```bash
164
- skill: git-worktree
165
- # Provide:
166
- # - branch-name: <new branch name>
167
- # - from-branch: <current active branch> (ALWAYS, unless the user overrides)
168
- ```
169
-
170
- 3.5) Worktree bootstrap (REQUIRED when worktree created)
171
-
172
- Immediately after entering the new worktree, run bootstrap per the `git-worktree` skill (AGENTS keys + autodetect). See `.agents/skills/git-worktree/SKILL.md` for the canonical algorithm (copy env/config, install deps, and `worktree_bootstrap_notes`).
173
-
174
- 3.6) Record worktree path (REQUIRED when worktree created)
175
-
176
- When a worktree was created, record the worktree path (e.g. `<worktree_dir>/<sanitized-branch-name>`) in a single visible place (e.g. at the top of the plan frontmatter as `worktree_path: .worktrees/feat-xyz` or in the first Phase 2 step). All subsequent steps assume this path as the implementation root.
177
-
178
- 4) If worktree is not chosen (opt-out):
179
-
180
- - Require explicit user confirmation of the opt-out.
181
- - Create or switch to a feature branch (never work directly on the default branch).
182
- - Record the execution branch in a visible place.
183
-
184
- Gate completion record (REQUIRED before Phase 2):
185
-
186
- - `worktree_decision: yes|no`
187
- - `worktree_path: <path>` when yes, else `execution_branch: <branch>`
188
- - `gate_status: passed`
189
-
190
- 2.5. **Preflight Violation Recovery (REQUIRED)**
191
-
192
- If implementation starts before the hard gate above is completed:
193
-
194
- - Immediately disclose the violation.
195
- - Stop all implementation actions.
196
- - Return to Step 2 and complete the gate record.
197
- - Resume only after `gate_status: passed`.
198
-
199
- 3. **Create Todo List**
200
-
201
- Run:
202
-
203
- ```bash
204
- skill: file-todos
205
- # Input: plan file path (the input document)
206
- # Output: todos/*-ready-*.md and/or todos/*-pending-*.md per skill rules
207
- ```
208
-
209
- - Break the plan into actionable, persistent todo files under `todos/`
210
- - Include dependencies between tasks
211
- - Prioritize based on what needs to be done first
212
- - Include testing and quality check tasks
213
- - Keep tasks specific and completable
214
-
215
- Prerequisites:
216
-
217
- - Ensure `todos/` exists.
218
- - Ensure the todo template exists at `.agents/skills/file-todos/assets/todo-template.md`.
219
-
220
- If `todos/` does not exist, create it and proceed.
221
-
222
- Plan -> todos mapping (default behavior):
223
-
224
- - If the plan contains checkboxes (`- [ ]`), create one todo per checkbox (group only when items are tightly coupled).
225
- - If the plan has no checkboxes, create 3-7 todos based on the plan's major phases/sections.
226
- - Each todo MUST include a link back to the plan file in `Resources` and reference the specific section(s) it implements.
227
- - Default todo `status`:
228
- - `ready` when the plan is approved and confidence is not low
229
- - `pending` when plan confidence is low or requires additional triage decisions
230
- - Default todo `priority`: `p2` unless the plan indicates urgency/risk.
231
-
232
- After creating todos, run an in-command triage pass (same readiness/dependency rules as `/workflow:triage`) before any implementation work:
233
-
234
- - approve/prioritize queue items for this plan
235
- - make execution order explicit
236
- - if no unblocked `ready` todos remain, stop and report pending/deferred/blocked items
237
- - use standalone `/workflow:triage` only when the user explicitly requests manual queue curation
238
-
239
- 3.5. **Execution Preflight (HARD GATE before Phase 2)**
240
-
241
- Contract checksum (MUST all be true before implementation):
242
-
243
- - auto-triage completed for this plan (or standalone `/workflow:triage` completed)
244
- - isolation gate recorded (`worktree_decision`, execution context, `gate_status: passed`)
245
- - blocking spikes execute before dependent build todos
246
-
247
- Before any implementation commands:
248
-
249
- - Verify each `ready` todo has an executable Agentic Execution Contract:
250
- - access preconditions are explicit
251
- - validation path is explicit (commands/routes/checks)
252
- - evidence expectations are explicit
253
- - quality gate commands are explicit or marked for ask-once fallback
254
- - If a todo lacks this contract, move it to `pending` and require triage resolution before coding.
255
-
256
- ### Phase 2: Execute
257
-
258
- 1. **Task Execution Loop**
259
-
260
- All implementation edits (file reads/writes) and all terminal commands (run tests, install, lint, etc.) MUST use the execution context resolved in Step 2.
261
-
262
- - If `worktree_decision: yes`: use the worktree path for file paths and set terminal cwd to the worktree root. Do not make code changes in the main repo checkout.
263
- - If `worktree_decision: no`: use the recorded execution branch context only (never default branch).
264
-
265
- Todo selection rules (default):
266
-
267
- - Consider only `todos/*-ready-*.md` items. Do not execute `pending` or `deferred` todos.
268
- - Skip blocked todos:
269
- - blocked if `dependencies` is non-empty and any dependency does not have a corresponding `*-complete-*.md` file.
270
- - Prioritize blocking spikes first:
271
- - if a ready spike todo unblocks downstream implementation todos, execute that spike before dependent build todos.
272
- - independent ready spikes may run in parallel when environment/worktree setup supports it.
273
- - Prioritize by priority then id:
274
- - `p1` before `p2` before `p3`
275
- - lower `issue_id` first
276
-
277
- Stop condition:
278
-
279
- - If no unblocked `ready` todos remain:
280
- - summarize remaining `pending`, `deferred` (parked for reference), and blocked items
281
- - require re-running triage (auto-triage within `/workflow:work` or standalone `/workflow:triage`) for pending/blocked prioritization
282
- - stop (do not invent work)
283
-
284
- For each task in priority order:
285
-
286
- ```
287
- while (tasks remain):
288
- - Select the next `*-ready-*.md` todo that is unblocked
289
- - Read any referenced files from the plan
290
- - Look for similar patterns in codebase
291
- - Implement following existing conventions
292
- - Write tests for new functionality
293
- - Run tests after changes according to the selected testing mode
294
- - REQUIRED: Validation Gate (prove acceptance criteria + record evidence)
295
- - Update the todo file Work Log and Acceptance Criteria (include evidence)
296
- - Mark off the corresponding checkbox in the plan file ([ ] → [x])
297
- - When a todo is complete, rename it to `*-complete-*.md` and update frontmatter
298
- ```
299
-
300
- Unblocked definition:
301
-
302
- - `dependencies: []`, or
303
- - all dependency issue_ids have a corresponding `*-complete-*.md` file
304
-
305
- Plan sync rules:
306
-
307
- - If the plan contains checkboxes, each todo should include one of:
308
- - `Resources -> Plan checkbox:` with the exact checkbox text, or
309
- - `Resources -> Plan section:` with a heading reference.
310
- - When a todo completes, update the plan:
311
- - Prefer matching the exact checkbox line and flipping `[ ]` -> `[x]`.
312
- - If only a section pointer exists, add a short "Completed" note under that section.
313
- - If the plan has no checkboxes, do not invent a new checklist in the plan by default.
314
-
315
- IMPORTANT: Keep the plan accurate. It should reflect what is done vs remaining.
316
-
317
- Minimum work log requirement (per todo):
318
-
319
- - At least one Work Log entry per session containing:
320
- - actions (file references)
321
- - commands executed
322
- - tests run
323
- - results
324
- - next steps
325
- - status context (`ready`, `pending`, `complete`)
326
-
327
- Discovery + scope changes (ask each time):
328
-
329
- - If new, non-critical work is discovered, do NOT silently expand scope.
330
- - Ask the user to choose one:
331
- 1) Do now (scope increase): only if small + tightly coupled
332
- 2) Create a triage item: create a new `pending` todo (default `p3` unless urgent) to be approved or deferred via triage
333
- 3) Park for reference: create a todo with Problem Statement + Findings + rationale, then mark it **deferred** (`*-deferred-*.md`, `status: deferred`) so it is kept for future reference but not in the executable queue
334
- 4) Compound candidate only: capture as a `/workflow:compound` documentation candidate (no todo by default)
335
- - Always record the decision in the todo Work Log.
336
-
337
- **Validation Gate (per todo)**
338
-
339
- Before marking a todo complete, you MUST prove acceptance/success criteria are met.
340
-
341
- For each todo:
342
- - Re-state the acceptance/success criteria being validated (1–3 bullets)
343
- - Run the smallest verification that proves it (tests, command output, UI check)
344
- - Run lint/typecheck quality gates for changed scope:
345
- - `lint_command` when configured, else run the ask-once run-provided lint command
346
- - `typecheck_command` when configured, else run the ask-once run-provided typecheck command
347
- - Record evidence in the todo Work Log:
348
- - commands run + results
349
- - files changed (paths)
350
- - if UI: route(s) validated + screenshots/logs when applicable
351
-
352
- If validation fails:
353
- - stop and fix immediately, or
354
- - if blocked, follow the Blocker Protocol.
355
-
356
- Scope contract checks:
357
- - If `solution_scope: partial_fix`, update remaining gaps in todo Work Log as they are discovered.
358
- - If `solution_scope: migration`, record migration validation evidence and rollback readiness evidence before marking migration todos complete.
359
-
360
- **Blocker Protocol (pause implementation)**
361
-
362
- Trigger: you cannot proceed safely due to ambiguity, missing info, failing approach, or environment/tooling issue.
363
-
364
- **Stuck Guard (auto-research pre-step)**
365
-
366
- When the Blocker Protocol triggers, evaluate whether the guard should fire:
367
-
368
- **Trigger 1 — Unknown territory:** The agent explicitly cannot identify a clear next step after consulting available context and codebase patterns. Requires agent self-declaration (e.g. "required API behavior is not in context," "no codebase pattern exists for this operation").
369
-
370
- **Trigger 2 — Repeated failures:** ≥2 distinct failed approaches on the same todo step, OR ≥3 total failures on the same todo regardless of step or approach variety. Failure = a test, lint, type, or runtime check produces an error the agent cannot resolve within one further attempt.
371
-
372
- **Guard suppression:** The Stuck Guard MUST NOT fire for todos tagged `tags: [spike]`. If a Spike is inconclusive, surface through standard Spike completion flow.
373
-
374
- **When guard fires (steps 1–10, mandatory order):**
375
-
376
- 1. Guard trigger detected (unknown_territory OR repeated_failure)
377
- 2. Announce to user: "Pausing to investigate..."
378
- 3. **Immediately** transition todo: `ready` → `pending + tags: [blocker]`
379
- 4. Add placeholder Work Log entry: `"Stuck Guard triggered. Investigation in progress. [stuck_type]. [timestamp]. Partial changes may exist — review working directory before resuming."`
380
- 5. Dispatch sub-agents in **parallel**:
381
- - **Mandatory (always):** `Task repo-research-analyst(<context>)`, `Task learnings-researcher(<context>)`
382
- - **Conditional (by signal, not discretion):**
383
- - If failure mentions external library/package/API → add `Task framework-docs-researcher(<context>)`
384
- - If stuck on approach/pattern/architecture choice → add `Task best-practices-researcher(<context>)`
385
- - If modifying existing code (not creating new) → add `Task git-history-analyzer(<context>)`
386
- 6. Collect findings (single-pass; no recursive guard firing)
387
- 7. Synthesize enriched output (format below)
388
- 8. Update Work Log `Blocker Decision` section with full enriched output
389
- 9. Present decision prompt to user
390
- 10. After user decision: apply existing Blocker Protocol after-decision steps (convert to todos; triage re-approval before returning to `ready`)
391
-
392
- **Context payload for each sub-agent:**
393
- ```
394
- {
395
- todo_title: <title>,
396
- todo_description: <problem statement>,
397
- stuck_type: "unknown_territory" | "repeated_failure",
398
- failure_description: <specific error/blocker>,
399
- working_directory: <worktree path>
400
- }
401
- ```
402
-
403
- **Fallback when Task dispatch unavailable:** Announce: "Research sub-agents unavailable — proceeding with agent-reasoned options only." Produce standard Blocker output (no enrichment). Do NOT silently present unresearched options as researched.
404
-
405
- **Enriched output format (replaces standard Blocker output):**
406
-
407
- ```markdown
408
- ## Stuck Guard Triggered
409
-
410
- **Detected:** [unknown_territory | repeated_failure]
411
- **Investigating...** Launching: repo-research-analyst, learnings-researcher[, framework-docs-researcher][, best-practices-researcher][, git-history-analyzer]
412
-
413
- ---
414
-
415
- ## Research Findings
416
-
417
- - **repo-research-analyst:** [2–5 sentence summary, or "no findings returned"]
418
- - **learnings-researcher:** [2–5 sentence summary, or "no findings returned"]
419
- - **framework-docs-researcher:** [2–5 sentence summary, or "not invoked" | "no findings returned"]
420
- - **best-practices-researcher:** [2–5 sentence summary, or "not invoked" | "no findings returned"]
421
- - **git-history-analyzer:** [2–5 sentence summary, or "not invoked" | "no findings returned"]
422
-
423
- **Synthesis confidence:** `high` | `medium` | `low` (low when all agents return empty)
424
-
425
- ---
426
-
427
- ## Blocker Summary
428
-
429
- [1–2 sentences describing what blocked execution]
430
-
431
- ## Constraints Discovered
432
-
433
- - [constraint 1]
434
- - [constraint 2]
435
-
436
- ## Options
437
-
438
- **Option 1: [Name]** *(source: [agent name(s)] | agent-reasoned)*
439
- - Pros: ...
440
- - Cons: ...
441
- - Risk: ...
442
- - Effort: ...
443
-
444
- **Option 2: [Name]** *(source: [agent name(s)] | agent-reasoned)*
445
- - ...
446
-
447
- **Option 3: [Name]** *(source: [agent name(s)] | agent-reasoned)*
448
- - ...
449
-
450
- ## Recommendation
451
-
452
- [One option + 2–4 bullets citing research findings]
453
-
454
- ---
455
-
456
- *Which option should we take?*
457
- ```
458
-
459
- **When findings are empty:** Produce ≥3 options marked `*(agent-reasoned — research returned no findings)*`. Set synthesis confidence to `low`. Do not fabricate citations.
460
-
461
- **When a Spike is recommended:** Use standard Spike Candidate format from Spike Protocol (Initial priority, Depends on, Unblocks, Timebox, Deliverable, Parallelizable metadata).
462
-
463
- Rules:
464
- - Pause implementation. Do not “push through” with guesses.
465
- - Timebox investigation to reach options (not a full rewrite).
466
- - Produce at least 3 viable options.
467
- - Immediately move the active todo back to `pending`, add/ensure `tags: [blocker]`, and record blocker status in Work Log.
468
-
469
- Output format (always):
470
- - Blocker summary (1–2 sentences)
471
- - Constraints discovered (bullets)
472
- - Options (>=3): each with pros/cons, risks, effort
473
- - Recommendation: one option + why (2–4 bullets)
474
- - Decision prompt (single question): “Which option should we take?”
475
-
476
- After decision:
477
- - Convert the decision into explicit todos (implementation/investigation/deferral).
478
- - If the chosen option is to run a timeboxed investigation or prototype, follow the **Spike Protocol** below.
479
- - Record the decision + rationale in the todo Work Log.
480
- - Re-approve the todo through triage before returning it to `ready`.
481
-
482
- **Spike Protocol (allocate a spike)**
483
-
484
- Trigger: the plan includes spike/discussion todos (e.g. `tags: [spike]`), or the Blocker Protocol decision is to run a timeboxed investigation/prototype to de-risk.
485
-
486
- Steps:
487
-
488
- 1. **Spike todo:** Create a new `todos/*-pending-*.md` todo tagged `tags: [spike]` (or convert the current blocked todo to a spike todo). Fill Problem Statement, Proposed Solutions (options), and Acceptance Criteria (deliverable). Carry forward any plan metadata (initial priority, depends_on, unblocks, parallelizable). Ensure triage approves the spike and sets timebox + deliverable before treating it as `ready`.
489
- 2. **Isolated execution:** Recommend a dedicated spike worktree. Use `skill: git-worktree` with branch name `spike/<todo_id>-<slug>` (e.g. `spike/003-auth-approach`). Run worktree bootstrap per the git-worktree skill. Execute the spike in that worktree so build work is not mixed with exploration.
490
- 3. **Research subagents (per spike):** Run mandatory baseline research in parallel:
491
- - Always (when agents exist): Task repo-research-analyst(context), Task learnings-researcher(context)
492
- - Conditional: Task framework-docs-researcher(topic), Task best-practices-researcher(topic), Task git-history-analyzer(context) when touching existing behavior or framework choices
493
- 4. **Spike deliverable (required in spike todo Work Log):**
494
- - Options (>=3) with pros/cons, risks, effort
495
- - Recommendation (one option + why)
496
- - Concrete next steps: create or update build todos (or plan checkbox to flip) so the main plan can proceed
497
- - **Should we compound this?** yes/no + one-line why (if yes, recommend `/workflow:compound` with spike context after the spike is complete)
498
- 5. **Multiple spikes:** If there are N approved spike todos and they are independent, create N worktrees (one per spike, under configured `worktree_dir`). Run one spike per worktree; when the environment supports multiple agents, spikes may run in parallel. If spikes have dependency edges, execute them in dependency order.
499
- 6. **After spike completion:** Mark the spike todo complete (`*-complete-*.md`). If the deliverable said "compound: yes", recommend running `/workflow:compound` with the spike context so the learning is captured in `docs/solutions/` with `tags: [..., spike]`.
500
-
501
- 2. **Follow Existing Patterns**
502
-
503
- - The plan should reference similar code - read those files first
504
- - Match naming conventions exactly
505
- - Reuse existing components where possible
506
- - Load and follow `skill: standards` as the mandatory baseline for declarative, immutable, maintainable implementation quality
507
- - When in doubt, grep for similar implementations
508
-
509
- 3. **Test Continuously**
510
-
511
- - Run relevant tests after each significant change
512
- - Don't wait until the end to test
513
- - Fix failures immediately
514
- - Add new tests for new functionality
515
-
516
- 4. **UI Validation (Optional)**
517
-
518
- If the plan includes UI changes:
519
-
520
- - Validate key flows and critical screens.
521
- - Use `/test-browser` for snapshots and basic interaction checks when applicable.
522
-
523
- 5. **Track Progress**
524
- - Keep todo files updated as you complete work
525
- - Note any blockers or unexpected discoveries
526
- - Create new tasks if scope expands
527
- - Keep user informed of major milestones
528
-
529
- ### Phase 3: Quality Check
530
-
531
- 1. **Run Core Quality Checks**
532
-
533
- Always run before declaring the work complete:
534
-
535
- ```bash
536
- # Run full test suite (use project's test command)
537
- # Examples: bin/rails test, npm test, pytest, go test, etc.
538
-
539
- # Run linting (per AGENTS.md)
540
- ```
541
-
542
- Prefer running the configured commands from `AGENTS.md`:
543
-
544
- - `test_command` (required when available)
545
- - `test_fast_command` (optional)
546
- - `lint_command` (optional)
547
- - `typecheck_command` (optional)
548
- - `format_command` (optional)
549
-
550
- Ask-once fallback:
551
-
552
- - If `test_command` is not configured, ask once for the project's test command and suggest adding it to `AGENTS.md`.
553
- - If `lint_command` or `typecheck_command` is not configured, ask once for run-provided commands and use them for this run.
554
-
555
- 2. **Prepare Review Handoff (REQUIRED for code/config changes)**
556
-
557
- If this run changed code or configuration, prepare an explicit `/workflow:review current` handoff summary:
558
-
559
- - files changed
560
- - validations run and outcomes
561
- - known risks or unresolved notes
562
-
563
- Docs-only runs may skip this handoff using the docs-only review exemption.
564
-
565
- 3. **Standards Compliance Gate (REQUIRED for code/config changes)**
566
-
567
- For code/config changes, standards compliance is a hard gate before todo completion:
568
-
569
- - Use `skill: standards` as the source of truth.
570
- - This gate cannot run until the isolation/worktree gate is passed and recorded (`gate_status: passed`).
571
- - Record standards evidence in todo Work Log using the standards evidence format:
572
- - declarative flow
573
- - immutable transforms
574
- - maintainability boundaries
575
- - hidden mutable state check
576
- - If any mandatory standards line fails:
577
- - do not rename todo to `*-complete-*.md`
578
- - move todo back to `pending`
579
- - add `tags: [blocker]`
580
- - record blocking rationale + remediation steps in Work Log
581
-
582
- Docs-only runs: mark this gate `not_applicable` and continue.
583
-
584
- 4. **Final Validation**
585
- - All todo files created for this plan are marked complete
586
- - All tests pass
587
- - Linting/typechecking/formatting checks pass (configured or run-provided via ask-once fallback)
588
- - Code follows existing patterns and passes the standards compliance gate
589
- - UI validation completed (if applicable)
590
- - No console errors or warnings
591
- - Scope contract satisfied:
592
- - `partial_fix`: remaining gaps are materialized as `pending` or `deferred` todos before completion
593
- - `migration`: migration verification and rollback checks are documented as passing
594
- - `full_remediation`: scoped remediation goals are complete per `completion_expectation`
595
-
596
- 5. **Update Plan Status**
597
-
598
- If the input document has YAML frontmatter with a `status` field, update it to `completed`:
599
- ```
600
- status: active → status: completed
601
- ```
602
-
603
- 6. **Notify User**
604
- - Summarize what was completed
605
- - Note any follow-up work needed
606
- - Suggest next steps if applicable
607
-
608
- Completion policy:
609
-
610
- - If this run changed code or configuration, report status as:
611
- - `implementation_complete: true`
612
- - `workflow_complete: false (pending /workflow:review current)`
613
- - If this run is docs-only (no code/config changes), report status as:
614
- - `implementation_complete: true`
615
- - `workflow_complete: true (docs-only review exemption)`
616
-
617
- Stop here by default.
618
-
619
- If the user wants to ship (commits/PR/screenshots), handle that as a separate explicit request or a separate command.
620
-
621
- ---
622
-
623
- ## Key Principles
624
-
625
- ### Execute with Deterministic Gates
626
-
627
- - Resolve unclear requirements early, then execute decisively
628
- - Keep hard gates explicit and non-skippable
629
- - Optimize for correct, verifiable completion
630
-
631
- ### The Plan is Your Guide
632
-
633
- - Work documents should reference similar code and patterns
634
- - Load those references and follow them
635
- - Don't reinvent - match what exists
636
-
637
- ### Test As You Go
638
-
639
- - Run tests after each change, not at the end
640
- - Fix failures immediately
641
- - Continuous testing prevents big surprises
642
-
643
- ### Quality is Built In
644
-
645
- - Follow existing patterns
646
- - Write tests for new code
647
- - Run linting/typechecking/formatting as configured in `AGENTS.md` (or run-provided via ask-once fallback)
648
- - For code/config changes, require `/workflow:review current` before declaring workflow completion
649
-
650
- ### Ship Complete Features
651
-
652
- - Mark all tasks completed before moving on
653
- - Don't leave features 80% done
654
- - A finished feature that ships beats a perfect feature that doesn't
655
-
656
- ## Quality Checklist
657
-
658
- Before marking work complete, verify:
659
-
660
- - [ ] All clarifying questions asked and answered
661
- - [ ] Hard gate completed before implementation (`worktree_decision`, execution context, `gate_status: passed`)
662
- - [ ] All todo files created for this plan are marked complete
663
- - [ ] Tests pass (run `test_command`)
664
- - [ ] Linting/typechecking/formatting passes (run `lint_command` / `typecheck_command` / `format_command`; ask once if lint/typecheck is not configured)
665
- - [ ] Code follows existing patterns
666
- - [ ] UI validation completed (if applicable; use `/test-browser` when useful)
667
- - [ ] Scope contract satisfied (`solution_scope`, `completion_expectation`, `non_goals`)
668
- - [ ] For `partial_fix`, unresolved work is captured as `pending/deferred` todos
669
- - [ ] If shipping is requested, capture any required artifacts (screenshots, release notes) per repo conventions
670
-
671
- ## Review Completion Gate
672
-
673
- For code/config changes, completion of `/workflow:work` is implementation-complete only. Workflow completion requires `/workflow:review current`.
674
-
675
- Docs-only exception:
676
-
677
- - If no code/config files changed, `/workflow:work` may close as workflow-complete without `/workflow:review`.
678
- - When taking this exemption, explicitly state "docs-only review exemption" in the final summary.
679
-
680
- ## Common Pitfalls to Avoid
681
-
682
- - **Analysis paralysis** - Don't overthink, read the plan and execute
683
- - **Skipping clarifying questions** - Ask now, not after building wrong thing
684
- - **Skipping the worktree hard gate** - No implementation before Step 2 gate passes
685
- - **Starting writes before isolation gate** - no file writes or run commands before Step 2
686
- - **Ignoring plan references** - The plan has links for a reason
687
- - **Testing at the end** - Test continuously or suffer later
688
- - **Forgetting todo updates** - Update todo files and plan checkboxes or lose track of progress
689
- - **80% done syndrome** - Finish the feature, don't move on early
690
- - **Skipping required review on code/config changes** - workflow completion requires `/workflow:review current`