sddx-workflow 0.9.0 → 0.10.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 (98) hide show
  1. package/README.md +249 -63
  2. package/dist/cli.js +370 -129
  3. package/package.json +1 -1
  4. package/templates/AGENTS.md +38 -5
  5. package/templates/CLAUDE.md +76 -5
  6. package/templates/claude-commands/conventions-sync.md +3 -0
  7. package/templates/claude-commands/impl-gap.md +10 -0
  8. package/templates/claude-commands/research.md +7 -0
  9. package/templates/claude-commands/review.md +1 -1
  10. package/templates/claude-commands/scan.md +5 -0
  11. package/templates/claude-commands/spec-amend.md +7 -0
  12. package/templates/claude-commands/spec-analyze.md +5 -0
  13. package/templates/claude-commands/spec-clarify.md +5 -0
  14. package/templates/claude-commands/spec-conflicts.md +3 -0
  15. package/templates/claude-commands/spec-status.md +3 -0
  16. package/templates/claude-commands/spec-tasks.md +3 -3
  17. package/templates/claude-commands/verify.md +5 -0
  18. package/templates/codex-skills/conventions-sync/SKILL.md +8 -0
  19. package/templates/codex-skills/impl-gap/SKILL.md +10 -0
  20. package/templates/codex-skills/research/SKILL.md +10 -0
  21. package/templates/codex-skills/review/SKILL.md +2 -2
  22. package/templates/codex-skills/scan/SKILL.md +8 -0
  23. package/templates/codex-skills/spec-amend/SKILL.md +10 -0
  24. package/templates/codex-skills/spec-analyze/SKILL.md +8 -0
  25. package/templates/codex-skills/spec-clarify/SKILL.md +8 -0
  26. package/templates/codex-skills/spec-conflicts/SKILL.md +8 -0
  27. package/templates/codex-skills/spec-status/SKILL.md +8 -0
  28. package/templates/codex-skills/spec-tasks/SKILL.md +3 -3
  29. package/templates/codex-skills/verify/SKILL.md +8 -0
  30. package/templates/conventions/base.md +7 -0
  31. package/templates/copilot-instructions.md +35 -5
  32. package/templates/copilot-prompts/conventions-sync.prompt.md +8 -0
  33. package/templates/copilot-prompts/impl-gap.prompt.md +10 -0
  34. package/templates/copilot-prompts/research.prompt.md +10 -0
  35. package/templates/copilot-prompts/review.prompt.md +2 -2
  36. package/templates/copilot-prompts/scan.prompt.md +8 -0
  37. package/templates/copilot-prompts/spec-amend.prompt.md +10 -0
  38. package/templates/copilot-prompts/spec-analyze.prompt.md +8 -0
  39. package/templates/copilot-prompts/spec-clarify.prompt.md +8 -0
  40. package/templates/copilot-prompts/spec-conflicts.prompt.md +8 -0
  41. package/templates/copilot-prompts/spec-status.prompt.md +8 -0
  42. package/templates/copilot-prompts/spec-tasks.prompt.md +3 -3
  43. package/templates/copilot-prompts/verify.prompt.md +8 -0
  44. package/templates/cursor-rules/sddx-workflow.mdc +34 -5
  45. package/templates/gemini-commands/ask.toml +8 -0
  46. package/templates/gemini-commands/assume.toml +10 -0
  47. package/templates/gemini-commands/bootstrap.toml +9 -0
  48. package/templates/gemini-commands/bugfix.toml +10 -0
  49. package/templates/gemini-commands/conventions-sync.toml +6 -0
  50. package/templates/gemini-commands/finish.toml +8 -0
  51. package/templates/gemini-commands/impl-gap.toml +10 -0
  52. package/templates/gemini-commands/refactor.toml +8 -0
  53. package/templates/gemini-commands/research.toml +10 -0
  54. package/templates/gemini-commands/review.toml +8 -0
  55. package/templates/gemini-commands/scan.toml +6 -0
  56. package/templates/gemini-commands/spec-amend.toml +10 -0
  57. package/templates/gemini-commands/spec-analyze.toml +6 -0
  58. package/templates/gemini-commands/spec-clarify.toml +6 -0
  59. package/templates/gemini-commands/spec-conflicts.toml +6 -0
  60. package/templates/gemini-commands/spec-new.toml +7 -0
  61. package/templates/gemini-commands/spec-plan.toml +7 -0
  62. package/templates/gemini-commands/spec-status.toml +6 -0
  63. package/templates/gemini-commands/spec-tasks.toml +8 -0
  64. package/templates/gemini-commands/verify.toml +6 -0
  65. package/templates/gemini.md +37 -5
  66. package/templates/specs/_template/1-requirements.md +42 -0
  67. package/templates/specs/_template/2-plan.md +14 -0
  68. package/templates/specs/_template/2a-data-model.md +29 -0
  69. package/templates/specs/_template/2b-api-contracts.md +27 -0
  70. package/templates/specs/_template/2c-research.md +25 -0
  71. package/templates/specs/_template/3-tasks.md +2 -1
  72. package/templates/specs/_template/amendments.md +15 -0
  73. package/templates/specs/_template/analysis.md +49 -0
  74. package/templates/specs/_template/impl-gaps.md +15 -0
  75. package/templates/specs/_template/verify-report.md +43 -0
  76. package/templates/windsurf-rules/sddx-workflow.md +34 -5
  77. package/templates/windsurf-workflows/ask.md +9 -0
  78. package/templates/windsurf-workflows/assume.md +11 -0
  79. package/templates/windsurf-workflows/bootstrap.md +10 -0
  80. package/templates/windsurf-workflows/bugfix.md +11 -0
  81. package/templates/windsurf-workflows/conventions-sync.md +7 -0
  82. package/templates/windsurf-workflows/finish.md +9 -0
  83. package/templates/windsurf-workflows/impl-gap.md +9 -0
  84. package/templates/windsurf-workflows/refactor.md +9 -0
  85. package/templates/windsurf-workflows/research.md +9 -0
  86. package/templates/windsurf-workflows/review.md +9 -0
  87. package/templates/windsurf-workflows/scan.md +7 -0
  88. package/templates/windsurf-workflows/spec-amend.md +9 -0
  89. package/templates/windsurf-workflows/spec-analyze.md +9 -0
  90. package/templates/windsurf-workflows/spec-clarify.md +9 -0
  91. package/templates/windsurf-workflows/spec-conflicts.md +7 -0
  92. package/templates/windsurf-workflows/spec-new.md +10 -0
  93. package/templates/windsurf-workflows/spec-plan.md +10 -0
  94. package/templates/windsurf-workflows/spec-status.md +7 -0
  95. package/templates/windsurf-workflows/spec-tasks.md +11 -0
  96. package/templates/windsurf-workflows/verify.md +9 -0
  97. package/templates/workflow.md +323 -29
  98. package/templates/zed-rules/sddx-workflow.md +33 -5
@@ -13,6 +13,7 @@ These rules apply to every command. They are not suggestions.
13
13
  2. **Minimum code** — implement only what was asked. No extra abstractions, no "while I'm here" cleanups, no speculative flexibility, no error handling for impossible scenarios. Ask: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
14
14
  3. **Surgical changes** — touch only the lines the task requires. Do not reformat, rename, or refactor adjacent code. Match existing style, even if you'd do it differently. Remove imports, variables, and functions that *your* changes made unused — do not remove pre-existing dead code unless asked. Test: every changed line should trace directly to the user's request.
15
15
  4. **Verify before moving on** — define what "done" looks like before you start. Transform vague tasks into verifiable goals: "Fix the bug" → "Write a test that reproduces it, then make it pass." Strong success criteria let you loop independently without constant clarification. A task isn't done until its verification passes.
16
+ 5. **Use the right channel for changes** — once `1-requirements.md` and `2-plan.md` are approved, they are read-only. To change them, use `/spec-amend`. When an ambiguity blocks execution, use `/impl-gap`. Never edit approved spec files silently.
16
17
 
17
18
  ---
18
19
 
@@ -45,6 +46,8 @@ Infer what you can from the code. Ask only about what the code cannot answer:
45
46
  - Non-goals that aren't visible in code
46
47
  - What "done" means for this team
47
48
 
49
+ > For discovery-only without writing anything, use `/scan` instead. `/bootstrap --scan` is the shortcut that does scan + bootstrap in one.
50
+
48
51
  ⛔ **STOP. Present the full draft of `project-overview.md` and `conventions.md` for review before writing anything. Do not save files until both are explicitly approved.**
49
52
 
50
53
  After approval:
@@ -54,6 +57,25 @@ After approval:
54
57
 
55
58
  ---
56
59
 
60
+ ### /scan
61
+ **Purpose:** Discovery pass over an existing codebase. Writes no `.sdd/` files — produces a report only.
62
+
63
+ Use when: you want to understand a project before committing to `/bootstrap`, or to refresh awareness of structural changes.
64
+
65
+ Process:
66
+ 1. Read `package.json` / dependency manifests, environment files
67
+ 2. Scan directory structure, naming conventions, import patterns
68
+ 3. Identify ORM, router, state-management, auth, lint/format configs
69
+ 4. Detect existing patterns the agent should preserve (file layout, exports style, test structure)
70
+ 5. Write `scan-report.md` at repo root with findings — frameworks detected, observed conventions, open questions about intent
71
+
72
+ Rules:
73
+ - No file outside `scan-report.md` is created or modified
74
+ - Report is advisory; nothing is enforced
75
+ - If the user wants `.sdd/` populated from the scan, they re-run `/bootstrap --scan` (which uses this report as input)
76
+
77
+ ---
78
+
57
79
  ### /ask
58
80
  **Purpose:** Research and exploration. No code changes.
59
81
 
@@ -68,6 +90,29 @@ Rules:
68
90
 
69
91
  ---
70
92
 
93
+ ### /research
94
+ **Purpose:** Targeted exploration that produces a non-binding research artifact.
95
+
96
+ Usage: `/research <feature> <topic>`
97
+
98
+ Use when: comparing frameworks, libraries, patterns, or architectures *before* drafting a plan. Separates exploration from commitment.
99
+
100
+ Process:
101
+ 1. Read the relevant `specs/<feature>/1-requirements.md` to understand context
102
+ 2. Investigate options (web search if available, codebase scan, dependency analysis)
103
+ 3. Write `specs/<feature>/research-<topic>.md` (slugify `<topic>` for the filename) with:
104
+ - **Options** — each candidate (framework, library, approach)
105
+ - **Pros and cons** — concrete tradeoffs, not generic ones
106
+ - **Current state** — latest version, maintenance status, community signals
107
+ - **Recommendation (non-binding)** — agent's pick with a one-line justification
108
+
109
+ Rules:
110
+ - The artifact is exploratory; `/spec-plan` decides what gets adopted
111
+ - The agent does not write to `2-plan.md` from this command
112
+ - Multiple `research-*.md` files per feature are fine (one per topic)
113
+
114
+ ---
115
+
71
116
  ### /assume
72
117
  **Purpose:** Surface all assumptions before acting on a task.
73
118
 
@@ -101,10 +146,10 @@ Rules:
101
146
  **Purpose:** Lightweight flow for confirmed bugs.
102
147
 
103
148
  Stages (in order, no skipping):
104
- 1. **Reproduce** — confirm the bug with a test or minimal repro case
105
- 2. **Diagnose** — identify root cause, not just symptoms; state any assumptions about the cause
106
- 3. **Fix** — minimal targeted change; do not refactor surrounding code
107
- 4. **Validate** — run tests, confirm the fix doesn't regress anything
149
+ 1. **Reproduce** — if the repo has a test suite, write a failing test that captures the bug before doing anything else. If no suite exists or a test is not feasible, document a deterministic minimal repro (exact steps, inputs, observed vs. expected output) and state explicitly why a test isn't viable. If the bug cannot be reproduced at all, STOP and report — do not guess at a fix.
150
+ 2. **Diagnose** — identify the root cause, not the symptom. State the root cause in one sentence before proposing any fix. If you cannot, run /assume and surface what's missing.
151
+ 3. **Fix** — the minimum change that addresses the stated root cause. Do not refactor surrounding code, rename adjacent symbols, tidy formatting, or fix unrelated issues you notice along the way (note them, don't fix them).
152
+ 4. **Validate** — the failing test from Reproduce now passes, and the full suite is green. If Reproduce used a manual repro, walk it again and confirm the original symptom is gone.
108
153
 
109
154
  Stop points:
110
155
  - After Reproduce: if unable to reproduce, STOP and report
@@ -144,7 +189,28 @@ Process:
144
189
  4. Copy `specs/_template/3-tasks.md` → `specs/<name>/3-tasks.md`
145
190
  5. Replace `<Feature Name>` in each file title with the actual feature name
146
191
 
147
- Then: fill out `1-requirements.md` before running /spec-plan
192
+ Then: fill out `1-requirements.md` before running /spec-clarify or /spec-plan.
193
+
194
+ ---
195
+
196
+ ### /spec-clarify
197
+ **Purpose:** Structured clarification of a draft `1-requirements.md` before planning.
198
+
199
+ Use when: a draft is complete but you suspect open ambiguities that would corrupt the plan.
200
+
201
+ Process:
202
+ 1. Read `specs/<feature>/1-requirements.md`
203
+ 2. Generate a list of clarification questions, categorized:
204
+ - ⛔ **Blocking** — `/spec-plan` cannot start until answered
205
+ - ⚠️ **Non-blocking** — can be decided during planning with a reasonable default
206
+ 3. Present the questions to the user, wait for answers
207
+ 4. Record both questions and answers in a **Clarifications** section of `1-requirements.md` (append-only, dated)
208
+
209
+ Rules:
210
+ - Use the checkbox format: `- [ ] ⛔ BLOCKING — <question>` / `- [x] ⛔ BLOCKING — <question> → <answer>`; same for `⚠️ NON-BLOCKING`
211
+ - `/spec-plan` must scan for `[ ] ⛔ BLOCKING` entries (unchecked blocking questions) and stop if any are found
212
+ - Non-blocking questions without answers proceed with the documented default
213
+ - This command modifies `1-requirements.md` only by appending to the Clarifications section — no other field is touched
148
214
 
149
215
  ---
150
216
 
@@ -155,11 +221,16 @@ Input: completed `specs/<name>/1-requirements.md`
155
221
 
156
222
  Process:
157
223
  1. Read requirements and acceptance criteria
158
- 2. Run /assumelist every assumption about requirements, codebase state, and technical decisions; STOP and wait for confirmation before continuing
159
- 3. Consider the simplest approach that satisfies the requirements; if you reject it, explain why
160
- 4. Analyze codebase impact
161
- 5. Define abort criteria: conditions under which tasks must stop and return to planning
162
- 6. Draft technical plan in `specs/<name>/2-plan.md`
224
+ 2. Check Clarifications section if any `[ ] BLOCKING` entry (unchecked blocking question) exists, STOP and run /spec-clarify
225
+ 3. Run /assume list every assumption about requirements, codebase state, and technical decisions; STOP and wait for confirmation before continuing
226
+ 4. Consider the simplest approach that satisfies the requirements; if you reject it, explain why
227
+ 5. Analyze codebase impact
228
+ 6. Define abort criteria: conditions under which tasks must stop and return to planning
229
+ 7. Draft technical plan in `specs/<name>/2-plan.md`
230
+ 8. **Optionally**, when context warrants, emit additional artifacts alongside `2-plan.md`:
231
+ - `2a-data-model.md` — only if persistence is non-trivial (new tables, schemas, migrations)
232
+ - `2b-api-contracts.md` — only if new external HTTP/RPC/event contracts are introduced
233
+ - `2c-research.md` — only if outstanding research material from `/research` belongs in the plan
163
234
 
164
235
  ⛔ **STOP HERE. Do not write any code until the plan is explicitly approved.**
165
236
 
@@ -191,26 +262,189 @@ Rules:
191
262
  - Do NOT batch tasks or run ahead
192
263
  - Each task touches only what it requires — no cleanup of adjacent code, no style fixes, no refactors of nearby functions
193
264
  - If you notice something broken or worth improving nearby, note it in the spec — do not fix it now
194
- - If a task reveals new scope, STOP and update the plan before continuing
265
+ - If a task reveals a contradiction, ambiguity, or impossibility that blocks progress: STOP and run `/impl-gap`
266
+ - If `/impl-gap` resolution requires changing the requirements or plan: escalate to `/spec-amend` — never edit approved specs directly
195
267
 
196
- Generates / updates: `specs/<name>/3-tasks.md` checklist
268
+ Generates / updates: `specs/<name>/3-tasks.md` checklist.
197
269
 
198
270
  ---
199
271
 
200
- ### /review
201
- **Purpose:** Final audit before closing a spec or merging.
272
+ ### /impl-gap
273
+ **Purpose:** Formal stop-and-report channel when implementation hits an ambiguity, contradiction, or technical impossibility.
202
274
 
203
- Checks:
275
+ Usage: `/impl-gap <feature>`
276
+
277
+ Use when: during `/spec-tasks`, a task cannot proceed because the spec is unclear, internally inconsistent, or technically infeasible as written.
278
+
279
+ Process:
280
+ 1. STOP the current task — do not improvise a fix
281
+ 2. Create `specs/<feature>/impl-gaps.md` from the template if it does not exist
282
+ 3. Append an entry to `specs/<feature>/impl-gaps.md`:
283
+
284
+ ```markdown
285
+ ## GAP-<NNN> — <date>
286
+ - **Task:** T-<id> (<short description>)
287
+ - **Problem:** <what the spec says vs. what's blocking>
288
+ - **Impact:** <which tasks are blocked by this>
289
+ - **Proposed resolution:** <agent's suggestion, non-binding>
290
+ - **Action required:** <"Approval" if resolvable in-scope, "Escalate to /spec-amend" if spec must change>
291
+ - **Resolution:** <filled only after human direction>
292
+ ```
293
+
294
+ 4. Report the gap to the user and wait for direction
295
+ 5. If the resolution is approved as-is, document the decision in the gap entry and resume
296
+ 6. If the resolution requires spec changes, escalate via `/spec-amend` — the resulting CR ID is appended to the gap entry
297
+
298
+ Rules:
299
+ - Never modify `1-requirements.md` or `2-plan.md` from this command
300
+ - Never record implementation gaps inside `2-plan.md`; `impl-gaps.md` is the only gap log
301
+ - The agent's proposed resolution is always non-binding — only the human decides
302
+ - Multiple gaps per feature are normal; keep numbering monotonic
303
+
304
+ ---
305
+
306
+ ### /spec-amend
307
+ **Purpose:** Documented change-request mechanism for post-approval changes to `1-requirements.md` or `2-plan.md`.
308
+
309
+ Usage: `/spec-amend <feature> <change-summary>`
310
+
311
+ Use when: after a spec has been approved, real-world discovery reveals that requirements or plan need to change. Edits to approved spec files are not allowed without an amendment.
312
+
313
+ Process:
314
+ 1. Identify the trigger — typically an `/impl-gap` escalation or a user-initiated change
315
+ 2. Create `specs/<feature>/amendments.md` from the template if it does not exist
316
+ 3. Append an entry to `specs/<feature>/amendments.md`:
317
+
318
+ ```markdown
319
+ ## CR-<NNN> — <date>
320
+ - **Trigger:** <user-requested | gap-<id> | review-finding>
321
+ - **Motive:** <why this change is necessary>
322
+ - **Change in requirements:** <what sections of 1-requirements.md change, and how>
323
+ - **Change in plan:** <what sections of 2-plan.md change, and how>
324
+ - **Affected tasks:** <T-XX, T-YY — tasks that may need to redo work or whose verification changes>
325
+ - **Status:** Pending approval
326
+ ```
327
+
328
+ 4. ⛔ **STOP. Present the CR for approval — do not modify any other file yet.**
329
+ 5. After explicit approval:
330
+ - Apply the documented changes to `1-requirements.md` and `2-plan.md`
331
+ - Update CR status to "Approved" with the date
332
+ - If tasks are affected, update `3-tasks.md` accordingly (mark stale, add new)
333
+
334
+ Rules:
335
+ - One CR per logical change — do not bundle unrelated changes in a single CR
336
+ - CR numbering is per-spec, not global (CR-001 in feature A is unrelated to CR-001 in feature B)
337
+ - Rejected CRs stay in `amendments.md` with status "Rejected" and a one-line reason — never delete history
338
+
339
+ ---
340
+
341
+ ### /verify
342
+ **Purpose:** Strict mechanical audit. Read-only. Produces a report. Does not modify code or specs.
343
+
344
+ Use after `/spec-tasks` completes and before `/review`.
345
+
346
+ Checks (deterministic, listed in the report):
204
347
  - All tasks in `3-tasks.md` are marked complete
205
- - Every goal (G1, G2…) in `1-requirements.md` is satisfied by the implementation
206
- - Every scenario in `1-requirements.md` has a test that covers it and passes
207
- - Tests pass (full suite, not just the new ones)
208
- - No leftover debug code or TODO comments
209
- - Conventions in `.sdd/conventions.md` are followed
210
- - No out-of-scope changes were introduced
211
- - No speculative features, unused abstractions, or "just in case" code
212
- - Every changed line traces directly to the user's request — if not, explain why
213
- - The implementation is the simplest one that satisfies the requirements — if it's more complex, justify it
348
+ - Every goal (G1, G2…) in `1-requirements.md` has at least one task that references it and at least one observable artifact (file change, test, route)
349
+ - Every acceptance scenario in `1-requirements.md` has a corresponding passing test
350
+ - Test suite passes (full suite, not only new tests)
351
+ - No files were modified outside the components listed in `2-plan.md` "Components Affected"
352
+ - No outstanding `/impl-gap` entries marked unresolved
353
+ - No outstanding `/spec-amend` CRs in "Pending approval" status
354
+
355
+ Output: `specs/<feature>/verify-report.md` summarizing each check with pass/fail and evidence.
356
+
357
+ Rules:
358
+ - This command never modifies code, spec files, or tasks — output is the report only
359
+ - If a check fails, the report names the failure and the artifact that should resolve it
360
+ - `/verify` does not propose fixes — that is `/review`'s territory (or a new `/spec-amend` if the failure is structural)
361
+
362
+ ---
363
+
364
+ ### /review
365
+ **Purpose:** Lighter human-touch final pass after `/verify`.
366
+
367
+ Use after `/verify` reports green (or after explicit acknowledgement of remaining warnings).
368
+
369
+ Focus:
370
+ - Qualitative reading of the implementation — clarity, naming, simplicity
371
+ - Catch things mechanical checks miss: unclear variable names, leaky abstractions, copy-paste smell, comments that lie
372
+ - Note minor follow-ups (not blockers — these can be filed as separate bugfix items)
373
+ - Confirm that the implementation feels like the simplest one that satisfies the requirements
374
+
375
+ Rules:
376
+ - This is a read-only, recommendation-only pass — `/review` notes issues but does not apply changes
377
+ - If `/review` finds a structural issue, escalate to `/spec-amend`
378
+ - If `/review` finds minor follow-ups (naming, dead comment, etc.), record them as notes for the user to act on — file a separate `/bugfix` task if the user accepts them
379
+ - `/review` never edits code or spec files directly
380
+
381
+ ---
382
+
383
+ ### /spec-status
384
+ **Purpose:** Show the state of all active specs.
385
+
386
+ Process:
387
+ 1. List directories under `specs/` excluding `_template` and `_done`
388
+ 2. For each, infer current phase from file state:
389
+ - Only `1-requirements.md`: **drafting requirements**
390
+ - `2-plan.md` exists but unchecked: **awaiting plan approval**
391
+ - `2-plan.md` approved and `3-tasks.md` has incomplete tasks: **in /spec-tasks (N/M done)**
392
+ - All tasks complete, no `verify-report.md`: **awaiting /verify**
393
+ - `verify-report.md` present: **verified** or **review pending**
394
+ 3. Print a table: Feature | Phase | Progress | Outstanding (CRs, gaps)
395
+
396
+ Rules:
397
+ - This is a status view; no spec files are modified
398
+ - Completed specs (moved to `_done/`) are not listed
399
+
400
+ ---
401
+
402
+ ### /spec-conflicts
403
+ **Purpose:** Detect file-level conflicts between active specs.
404
+
405
+ Process:
406
+ 1. For each active spec, read `2-plan.md` "Components Affected"
407
+ 2. Cross-reference: any file listed by two or more specs is a potential conflict
408
+ 3. Print a table: File | Specs touching it | Recommendation (sequence them, merge plans, or escalate)
409
+
410
+ Rules:
411
+ - Detection only — resolution is always human-decided
412
+ - "Components Affected" is the source of truth; if a plan understates its surface, conflicts will be missed (user education, not enforcement)
413
+
414
+ ---
415
+
416
+ ### /spec-analyze
417
+ **Purpose:** Cross-consistency analysis between requirements, plan, and tasks for a single spec.
418
+
419
+ Process:
420
+ 1. Read `1-requirements.md`, `2-plan.md`, `3-tasks.md` for the target feature
421
+ 2. Run three checks:
422
+ - **Goal-to-task coverage:** each goal ID (G1, G2…) appears as a referenced goal in at least one task
423
+ - **Plan-to-task coverage:** each entry in "Components Affected" appears in at least one task's Changes field
424
+ - **Scope creep:** any task that does not reference a goal ID
425
+ 3. Write `specs/<feature>/analysis.md` with one section per check, naming concrete misses
426
+
427
+ Rules:
428
+ - Analysis does not modify any spec file
429
+ - Re-runs overwrite the previous `analysis.md`
430
+ - Output is advisory; the human decides whether to amend or accept the gap
431
+
432
+ ---
433
+
434
+ ### /conventions-sync
435
+ **Purpose:** Refresh `.sdd/conventions.md` against current project state, preserving manual sections.
436
+
437
+ Process:
438
+ 1. Scan: `package.json` (or equivalent), directory structure, naming patterns, lint/format configs, ORM/router/state-management library in use
439
+ 2. Identify sections of `conventions.md` marked `<!-- manual -->` — leave verbatim
440
+ 3. Regenerate auto-sections with current findings
441
+ 4. Present the diff for approval before writing — STOP for explicit confirmation
442
+ 5. After approval, write the updated `conventions.md`
443
+
444
+ Rules:
445
+ - Manual sections are never overwritten
446
+ - Auto-sections always reflect current state, not historical
447
+ - The diff is the contract: if the user does not approve, nothing changes
214
448
 
215
449
  ---
216
450
 
@@ -265,21 +499,81 @@ Rules for the message:
265
499
 
266
500
  ---
267
501
 
268
- ## Ceremony Levels
502
+ ## Default Flow
269
503
 
270
504
  | Change size | Required flow |
271
505
  |---|---|
272
- | Typo / comment | Direct no ceremony |
506
+ | Typo / comment | Direct change |
273
507
  | Bug (< ~50 lines, 1 file) | /bugfix → /finish |
274
508
  | Refactor (no behavior change) | /refactor → /finish |
275
- | Feature | /spec-new → /spec-plan → /spec-tasks → /review → /finish |
276
- | Architecture change | /spec-new → /spec-plan (mandatory human review) → /spec-tasks → /review → /finish |
509
+ | Feature | /spec-new → /spec-clarify → /spec-plan → /spec-tasks → /verify → /review → /finish |
510
+ | Architecture change | /spec-new → /spec-clarify → /spec-plan (mandatory human review) → /spec-tasks → /verify → /review → /finish |
511
+ | Post-approval change | /spec-amend → (resume with current phase) |
512
+
513
+ ---
514
+
515
+ ## Per-Phase Permissions
516
+
517
+ This table formalizes what the agent may read, edit, or create in each phase. Documentation, not runtime enforcement — but the agent is expected to comply.
518
+
519
+ | Command | Read specs | Edit specs | Edit code | Create files |
520
+ |---|---|---|---|---|
521
+ | /bootstrap, /scan | ✓ | ✗ | ✗ | Only docs / report files |
522
+ | /ask, /research | ✓ | ✗ | ✗ | Only research / report files |
523
+ | /assume | ✓ | ✗ | ✗ | None (output is conversational) |
524
+ | /spec-new | ✓ | ✓ (initial drafts only) | ✗ | Spec scaffold only |
525
+ | /spec-clarify | ✓ | ✓ (only Clarifications section) | ✗ | None |
526
+ | /spec-plan | ✓ | ✓ (only `2-plan.md` and optional 2a/2b/2c) | ✗ | Plan + artifacts |
527
+ | /spec-tasks | ✓ | ✓ (only `3-tasks.md` checklist) | ✓ | Code, tests, new modules |
528
+ | /impl-gap | ✓ | ✓ (only `impl-gaps.md`) | ✗ | Gap report only |
529
+ | /spec-amend | ✓ | ✓ (with CR approval) | ✗ | CR record |
530
+ | /verify | ✓ | ✗ | ✗ | Only `verify-report.md` |
531
+ | /review | ✓ | ✗ | ✗ | None — notes only |
532
+ | /spec-status, /spec-conflicts | ✓ | ✗ | ✗ | None (output is conversational) |
533
+ | /spec-analyze | ✓ | ✗ | ✗ | Only `analysis.md` |
534
+ | /bugfix | ✓ | ✗ | ✓ | Tests + fix |
535
+ | /refactor | ✓ | ✗ | ✓ | None |
536
+ | /conventions-sync | ✓ | ✗ | ✗ | Only `conventions.md` (with diff approval) |
537
+ | /finish | ✓ | ✗ | ✗ | None — staging + commit message only |
538
+
539
+ ---
540
+
541
+ ## Anti-Patterns
542
+
543
+ The agent must not:
544
+
545
+ 1. **Edit approved spec files silently.** `1-requirements.md` and `2-plan.md` after approval are read-only; use `/spec-amend`.
546
+ 2. **Improvise a fix when the spec is ambiguous.** Use `/impl-gap` and stop.
547
+ 3. **Mark tasks complete without an observable artifact.** A code change, a test, a file — something must back the checkmark.
548
+ 4. **Refactor adjacent code during a task.** Note it for later; do not change scope.
549
+ 5. **Add a dependency without surfacing it in `/research` or `/assume`.** Surprise dependencies are scope creep.
550
+ 6. **Batch tasks.** One task at a time during `/spec-tasks` — finish, verify, then move on.
551
+ 7. **Skip `/verify` to jump straight to `/finish`.** Mechanical checks exist to catch real problems.
552
+ 8. **Make decisions about what is "good enough" structurally.** Structure is a human decision; flag it, do not absorb it.
553
+ 9. **Move a spec to `_done/` before `/verify` and `/review` pass.** A spec is done when both have closed cleanly.
554
+
555
+ ---
556
+
557
+ ## Closing a Spec
558
+
559
+ When `/verify` and `/review` have both closed cleanly for a spec:
560
+
561
+ 1. Move `specs/<feature>/` to `specs/_done/<feature>/`
562
+ 2. `/spec-status` no longer lists it (it excludes `_done/`)
563
+ 3. Amendments (`amendments.md`) and gap records (`impl-gaps.md`) move with the spec folder
564
+
565
+ The `_done/` folder is write-never during active development. Only fully shipped specs live there. Moving a spec there is a human action — the agent must not do it unilaterally.
566
+
567
+ ---
277
568
 
278
569
  ## Stop Points (Non-Negotiable)
279
570
 
280
- 1. **Unclear requirements** — stop, ask via /ask, do not assume
571
+ 1. **Unclear requirements** — stop, ask via /ask or run /spec-clarify, do not assume
281
572
  2. **Unvalidated assumptions** — run /assume before /spec-plan; if a confirmed assumption turns out false mid-execution, stop and re-plan
282
573
  3. **After /spec-plan** — never proceed to tasks without explicit approval
283
574
  4. **Abort criterion triggered** — when any condition in the plan's Abort Criteria is met, stop immediately and return to /spec-plan
284
575
  5. **Scope creep detected** — stop, report, get a decision before continuing
285
576
  6. **Test failure during /spec-tasks** — stop, fix the failure before the next task
577
+ 7. **Implementation gap encountered** — run /impl-gap and stop; do not improvise
578
+ 8. **Spec change needed** — run /spec-amend; never edit approved files directly
579
+ 9. **Pending CR or unresolved gap** — `/verify` will not pass; resolve before continuing
@@ -1,23 +1,51 @@
1
1
  This project uses the SDD Protocol. Before starting any task, read:
2
2
 
3
- 1. `.sdd/workflow.md` — all commands, ceremony levels, and stop points
3
+ 1. `.sdd/workflow.md` — all commands, permissions, stop points, anti-patterns
4
4
  2. `.sdd/project-overview.md` — what this app is, its non-goals, and domains
5
5
  3. `.sdd/conventions.md` — project-specific conventions and patterns
6
6
 
7
7
  ## Workflows
8
8
 
9
+ ### Project setup
10
+ | Workflow | Purpose |
11
+ |---|---|
12
+ | `bootstrap` | Populate project context — interview or `--scan` |
13
+ | `scan` | Discovery-only pass over an existing codebase |
14
+ | `conventions-sync` | Refresh conventions, preserving manual sections |
15
+
16
+ ### Exploration
9
17
  | Workflow | Purpose |
10
18
  |---|---|
11
- | `bootstrap` | Populate project context — interview or codebase scan |
12
19
  | `ask` | Research only — no code changes |
20
+ | `research` | Non-binding research artifact |
13
21
  | `assume` | List assumptions and stop for confirmation |
14
- | `bugfix` | Reproduce → diagnose → fix → validate |
15
- | `refactor` | Restructure without behavior change |
22
+
23
+ ### Feature flow
24
+ | Workflow | Purpose |
25
+ |---|---|
16
26
  | `spec-new` | Scaffold a spec folder |
27
+ | `spec-clarify` | Pre-plan clarification |
17
28
  | `spec-plan` | Generate technical plan — stop for approval |
18
29
  | `spec-tasks` | Execute plan one task at a time, TDD-first |
19
- | `review` | Final audit before closing |
30
+ | `impl-gap` | Stop and report blocking ambiguity |
31
+ | `spec-amend` | Documented Change Request |
32
+ | `spec-analyze` | Cross-consistency analysis |
33
+ | `verify` | Strict mechanical audit |
34
+ | `review` | Lighter human-touch final pass |
20
35
  | `finish` | Stage files and generate commit message |
21
36
 
37
+ ### Multi-spec
38
+ | Workflow | Purpose |
39
+ |---|---|
40
+ | `spec-status` | Show all active specs and phase |
41
+ | `spec-conflicts` | Detect file conflicts between specs |
42
+
43
+ ### Other
44
+ | Workflow | Purpose |
45
+ |---|---|
46
+ | `bugfix` | Reproduce → diagnose → fix → validate |
47
+ | `refactor` | Restructure without behavior change |
48
+
22
49
  Invoke by name (e.g., "run bootstrap", "start spec-new for auth-refresh").
50
+ Standard workflow: `spec-new` → `spec-clarify` → `spec-plan` → `spec-tasks` → `verify` → `review` → `finish`.
23
51
  Full definitions are in `.sdd/workflow.md`.