@engramm/dev-workflow 0.1.4 → 0.1.6

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -1
  3. package/dist/cli/index.js +11 -0
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/cli/init.d.ts.map +1 -1
  6. package/dist/cli/init.js +7 -1
  7. package/dist/cli/init.js.map +1 -1
  8. package/dist/cli/run.d.ts.map +1 -1
  9. package/dist/cli/run.js +2 -0
  10. package/dist/cli/run.js.map +1 -1
  11. package/dist/cli/task.d.ts.map +1 -1
  12. package/dist/cli/task.js +35 -0
  13. package/dist/cli/task.js.map +1 -1
  14. package/dist/mcp/handlers.d.ts +1 -0
  15. package/dist/mcp/handlers.d.ts.map +1 -1
  16. package/dist/mcp/handlers.js +7 -0
  17. package/dist/mcp/handlers.js.map +1 -1
  18. package/dist/mcp/tools.d.ts.map +1 -1
  19. package/dist/mcp/tools.js +11 -0
  20. package/dist/mcp/tools.js.map +1 -1
  21. package/dist/tasks/phase-tasks.d.ts +8 -0
  22. package/dist/tasks/phase-tasks.d.ts.map +1 -0
  23. package/dist/tasks/phase-tasks.js +35 -0
  24. package/dist/tasks/phase-tasks.js.map +1 -0
  25. package/package.json +1 -1
  26. package/templates/agents/architect.md +9 -3
  27. package/templates/agents/coder.md +9 -3
  28. package/templates/agents/committer.md +8 -0
  29. package/templates/agents/debugger.md +8 -2
  30. package/templates/agents/planner.md +8 -2
  31. package/templates/agents/reader.md +7 -0
  32. package/templates/agents/reviewer.md +8 -1
  33. package/templates/agents/tester.md +8 -2
  34. package/templates/claude/commands/git/merge.md +6 -4
  35. package/templates/claude/commands/session/handover.md +12 -4
  36. package/templates/claude/commands/session/resume.md +8 -0
  37. package/templates/claude/commands/session/review.md +7 -5
  38. package/templates/claude/commands/vault/analyze.md +9 -8
  39. package/templates/claude/commands/vault/from-spec.md +9 -6
  40. package/templates/claude/commands/workflow/dev.md +94 -907
  41. package/templates/claude/commands/workflow/steps/coder.md +105 -0
  42. package/templates/claude/commands/workflow/steps/commit.md +52 -0
  43. package/templates/claude/commands/workflow/steps/plan-review.md +67 -0
  44. package/templates/claude/commands/workflow/steps/plan.md +106 -0
  45. package/templates/claude/commands/workflow/steps/preflight.md +50 -0
  46. package/templates/claude/commands/workflow/steps/principles.md +35 -0
  47. package/templates/claude/commands/workflow/steps/read.md +39 -0
  48. package/templates/claude/commands/workflow/steps/review.md +168 -0
  49. package/templates/claude/commands/workflow/steps/test.md +38 -0
  50. package/templates/claude/commands/workflow/steps/vault-updates.md +98 -0
  51. package/templates/claude/commands/workflow/steps/verify.md +49 -0
@@ -3,12 +3,7 @@
3
3
  ## Output language
4
4
 
5
5
  All user-facing output (display blocks, verdicts, summaries, questions) MUST be in Russian (ru-RU).
6
- Internal protocol blocks (CONTEXT, PLAN, CODE_DONE, REVIEW, VERIFY) stay in English — they are machine-readable and parsed by the orchestrator.
7
-
8
- Orchestrates agents in a 10-step quality pipeline:
9
- read → plan (with pseudo-code) → plan-review → coder ↔ review×3 (loop) → test → verify → commit.
10
- Each agent has strict permission boundaries. Context passes between agents as blocks.
11
- Steps 4-6 form an iterative CODER↔REVIEW loop (max 3 iterations).
6
+ Internal protocol blocks (CONTEXT, PLAN, CODE_DONE, REVIEW, VERIFY) stay in English.
12
7
 
13
8
  ## Arguments
14
9
 
@@ -16,901 +11,110 @@ Steps 4-6 form an iterative CODER↔REVIEW loop (max 3 iterations).
16
11
  `/workflow:dev <path>` — task from file (.md, .txt).
17
12
  `/workflow:dev <task> --auto-commit` — autonomous mode (commits automatically, for swarm use).
18
13
 
19
- ### Commit mode
20
-
21
- | Mode | Flag | Commit | Gates on limit |
22
- |------|------|--------|---------------|
23
- | **Interactive** (default) | — | Ask user | Ask user |
24
- | **Autonomous** | `--auto-commit` | Auto-commit | Stop without commit |
25
-
26
- **Autonomous safety:** will NOT commit if any quality gate exhausts its retry limit.
27
- Better to leave changes uncommitted than commit broken code.
28
-
29
14
  ## Mode detection
30
15
 
31
16
  If argument is a file path, read the file and detect mode:
32
17
 
33
- - **Single task** (no `## Tasks` section or only 1 task) → **Normal mode** (Steps 1-8 below)
18
+ - **Single task** (no `## Tasks` section or only 1 task) → **Normal mode**
34
19
  - **Phase file** (has `## Tasks` with 2+ items, or has `phase:` in frontmatter) → **Phase mode**
35
20
 
36
- ### Phase mode
37
-
38
- Phase mode plans the entire phase, then codes each subtask separately for focused quality.
39
-
40
- **Phase startup:** before READ, orchestrator checks if tasks exist for this phase:
41
- 1. Read `## Tasks` section from phase file
42
- 2. Check `.dev-vault/tasks/` for matching tasks (by title substring match)
43
- 3. If tasks are missing — create them via `dev-workflow task create "<title>"` for each task in the phase
44
- 4. Display created tasks
45
-
46
- ```
47
- [auto-create tasks] → READ (full phase) → PLAN (full phase, outputs subtasks) → PLAN_REVIEW
48
- → for each subtask:
49
- CODER(subtask) → REVIEW×3(subtask) → fix loop → TEST (all tests)
50
- → VERIFY (full phase against spec)
51
- → COMMIT (all changes, one commit)
52
- → Summary
53
- ```
54
-
55
- **Step 2 (PLAN) in phase mode** — add to agent prompt:
21
+ ## Commit mode
56
22
 
57
- ```
58
- You are planning a PHASE with multiple subtasks.
59
- Break this into ordered implementation steps.
60
- Each step must be completable in one CODER iteration.
61
-
62
- Output format:
63
- PLAN:
64
- Summary: [phase goal]
65
- Scope: large
66
-
67
- Subtasks:
68
- 1. [name]
69
- Files: [list]
70
- Tests: [list]
71
- Depends on: [previous subtask number or "none"]
72
-
73
- 2. [name]
74
- Files: [list]
75
- Tests: [list]
76
- Depends on: 1
77
-
78
- ...
79
- END_PLAN
80
- ```
81
-
82
- **Steps 4-6 in phase mode** — loop over subtasks:
83
-
84
- ```
85
- for each subtask in PLAN.Subtasks:
86
- display: ── SUBTASK [N/total]: [name] ──
87
-
88
- CODER receives:
89
- - Current subtask from PLAN
90
- - Accumulated context from previous subtasks (CODE_DONE blocks)
91
- - Vault context
92
-
93
- REVIEW×3 receives (parallel):
94
- - Current subtask from PLAN
95
- - CODE_DONE for this subtask
96
- - Vault context
97
-
98
- fix loop (max 3 iterations per subtask)
99
-
100
- TEST after each subtask:
101
- - Run ALL tests (not just new ones) — catches regressions
102
- - If fail → CODER fix → re-test
103
-
104
- After subtask complete — VAULT REFRESH:
105
- - Re-read .dev-vault/conventions.md (may have new patterns from review)
106
- - Re-read .dev-vault/knowledge.md (may have new gotchas from review)
107
- - Pass updated vault content to next subtask's CODER and REVIEW agents
108
- - This ensures each subtask benefits from findings of previous subtasks
109
- ```
110
-
111
- **Step 7 (COMMIT) in phase mode** — one commit for the entire phase:
112
-
113
- ```
114
- feat(<scope>): implement Phase N — <phase name>
115
-
116
- <summary of all subtasks completed>
117
-
118
- Subtasks:
119
- - <subtask 1>: <files>
120
- - <subtask 2>: <files>
121
- ...
122
- ```
123
-
124
- **Step 8 (Summary) in phase mode** — show subtask breakdown:
125
-
126
- ```
127
- ═══════════════════════════════
128
- PHASE [N] COMPLETE
129
- ═══════════════════════════════
130
-
131
- Phase: [name]
132
- Subtasks: [completed]/[total]
133
-
134
- ✅ 1. [subtask name] — [N] files
135
- ✅ 2. [subtask name] — [N] files
136
- ...
137
-
138
- Agents:
139
- ✅ READ [Explore] — [N] files
140
- ✅ PLAN [Explore] — [N] subtasks
141
- ✅ PLAN_REVIEW [Explore] — APPROVED
142
- ✅ CODER [Full] — [total] changed, [total] created
143
- ✅ REVIEW [Explore] — [total iterations] across subtasks
144
- ✅ COMMIT [git] — [hash]
145
-
146
- ═══════════════════════════════
147
- ```
148
-
149
- ## Normal mode
150
-
151
- Steps below describe normal mode (single task). Phase mode follows the same agents and permission matrix but with the subtask loop described above.
23
+ | Mode | Flag | Commit | Gates on limit |
24
+ |------|------|--------|---------------|
25
+ | **Interactive** (default) | | Ask user | Ask user |
26
+ | **Autonomous** | `--auto-commit` | Auto-commit | Stop without commit |
152
27
 
153
28
  ## Permission matrix (violation = ABORT)
154
29
 
155
30
  ```
156
31
  Agent Read Write Bash Subagent
157
32
  ───────────── ───── ────── ──────────────── ────────
158
- READ ✅ ❌ Explore
159
- PLAN ✅ ❌ Explore
160
- PLAN_REVIEW ✅ ❌ Explore
161
- CODER ✅ ✅ build/test Full
162
- REVIEW×3 ✅ ❌ Explore
163
- TEST build/test Orchestrator (bash)
164
- VERIFY ✅ ❌ Explore
165
- COMMIT git only Full
166
- ```
167
-
168
- TEST is not a subagent — orchestrator runs bash commands directly.
169
-
170
- These rules are law. The orchestrator MUST launch each agent with the correct subagent type.
171
-
172
- ## Engineering principles (shared across all agents)
173
-
174
- Every agent in this pipeline receives these principles as baseline quality bar.
175
- Project-specific conventions (.dev-vault/conventions.md) override where they conflict.
176
-
177
- ```
178
- PRINCIPLES:
179
-
180
- Architecture:
181
- - Single Responsibility: one module/file = one reason to change
182
- - Dependency Rule: inner layers never import from outer layers
183
- - Explicit dependencies: constructor/parameter injection, no hidden globals or singletons
184
- - Boundaries: validate and sanitize at system entry points, trust internal code
185
-
186
- Error handling:
187
- - Fail fast at boundaries, recover gracefully inside
188
- - Every error path must be tested
189
- - No silent swallowing: catch → handle or propagate, never empty catch
190
- - External calls (network, FS, DB) always have error handling and timeouts
191
-
192
- Production readiness:
193
- - No TODO/FIXME/HACK in committed code
194
- - No debug logging (console.log/print) — use structured logging
195
- - No hardcoded values that should be config or constants
196
- - Idempotent operations where possible
197
-
198
- Code structure:
199
- - Max 300 lines per file, max 30 lines per function
200
- - Extract when reused 2+ times OR > 5 lines of non-trivial logic
201
- - Composition over inheritance
202
- - No god objects, no utility dumps (helpers/, utils/, misc/)
203
- - Types and names replace comments — if code needs a comment, rename or extract
204
-
205
- Testing:
206
- - Test behaviour, not implementation details
207
- - One logical assertion per test
208
- - No shared mutable state between tests
209
- - Cover: happy path, edge cases (empty, null, boundary), error paths
210
-
211
- END_PRINCIPLES
212
- ```
213
-
214
- ## Procedure
215
-
216
- ### Step 0: PREFLIGHT
217
-
218
- Orchestrator runs directly (no subagent):
219
-
220
- ```bash
221
- git status -s # check for uncommitted changes
222
- npm run build 2>&1 || true # baseline build (or cargo build, go build)
223
- npm test 2>&1 || true # baseline tests
224
- ```
225
-
226
- Save results as BASELINE block:
227
-
228
- ```
229
- BASELINE:
230
- Git: [clean / N uncommitted files]
231
- Build: [pass / fail]
232
- Tests: [N passed, M failed / no test command]
233
- Lint: [pass / N warnings / no lint command]
234
- END_BASELINE
235
- ```
236
-
237
- Display:
238
-
239
- ```
240
- ── PREFLIGHT ──
241
- Git: ✅ clean / ⚠️ N uncommitted files
242
- Build: ✅ / ❌ (baseline failure)
243
- Tests: ✅ N passed / ⚠️ M already failing
244
- ```
245
-
246
- **If uncommitted changes:**
247
- - **Interactive:** ask: stash / continue / abort
248
- - **Autonomous:** continue (don't touch existing work)
249
-
250
- **If tests already failing:** record failing test names in BASELINE. TEST step (Step 7) will compare against this — only NEW failures are coder's responsibility.
251
-
252
- ### Step 1: READ
253
-
254
- Read vault context files (if they exist):
255
- - `.dev-vault/stack.md`
256
- - `.dev-vault/conventions.md`
257
- - `.dev-vault/knowledge.md`
258
- - `.dev-vault/gameplan.md`
259
-
260
- Launch Explore subagent:
261
-
262
- ```
263
- You are a reader agent. Gather context for the task below.
264
-
265
- ## Task
266
- [task from user]
267
-
268
- ## Project Context
269
- [vault sections read above]
270
-
271
- ## Procedure
272
- 1. Read CLAUDE.md for project instructions
273
- 2. Find files relevant to the task (Glob/Grep)
274
- 3. Read relevant files (max 10 files, 500 lines each)
275
- 4. Find dependencies and tests for those files
276
- 5. Find how similar things are done in the project
277
-
278
- ## Output Format
279
- CONTEXT:
280
- Task: [reformulated task with project context]
281
- Files to change: [file list with what to change]
282
- Dependencies: [files depending on changes]
283
- Tests: [existing tests for those files]
284
- Patterns found: [how similar things are solved]
285
- Relevant code: [key fragments]
286
- END_CONTEXT
287
- ```
288
-
289
- Save CONTEXT block. Display:
290
-
291
- ```
292
- ── READ ──
293
- Files to change: [N]
294
- Dependencies: [N]
295
- Tests: [N]
296
- ```
297
-
298
- ### Step 2: PLAN
299
-
300
- Launch Explore subagent:
301
-
302
- ```
303
- You are a planner agent. Create a detailed implementation plan.
304
-
305
- ## Task
306
- [task from user]
307
-
308
- ## Context (from READ)
309
- [CONTEXT block from Step 1]
310
-
311
- ## Project Conventions
312
- [.dev-vault/conventions.md or "Not defined"]
313
-
314
- ## Architecture
315
- [.dev-vault/knowledge.md — Architecture section, or "Not defined"]
316
-
317
- ## Stack
318
- [.dev-vault/stack.md or "Not defined"]
319
-
320
- ## Gameplan
321
- [.dev-vault/gameplan.md — current phase, or "Not defined"]
322
-
323
- ## Engineering Principles
324
- [PRINCIPLES block from above]
325
-
326
- ## Rules
327
- - STRICTLY follow project conventions (naming, structure, error handling)
328
- - Each change tied to a specific file and location
329
- - New files placed according to architecture
330
- - Deviation from conventions — mark as DEVIATION with justification
331
- - Include PSEUDO-CODE for each change — concrete enough for CODER to implement without guessing
332
- - When adding dependencies: use context7 MCP (resolve-library-id → query-docs) to get current stable version. Specify exact version, not range
333
-
334
- ## Output Format
335
- PLAN:
336
- Summary: [what we're doing — 1-2 sentences]
337
- Scope: [small: 1-4 files / large: 5+ files]
338
-
339
- Architecture:
340
- Layer: [domain / infrastructure / presentation / API]
341
- Boundaries: [where this change sits, what calls it, what it calls]
342
- Dependencies: [new dependencies with direction →, justify each]
343
- Error boundaries: [external calls, user input, invariants]
344
-
345
- Changes:
346
- 1. [file] — [what to change]
347
- ```[language]
348
- // after [anchor: function/line/class]
349
- [pseudo-code or signature sketch]
350
- ```
351
-
352
- 2. [file] — [what to change]
353
- ```[language]
354
- // modify [function/block]
355
- [pseudo-code showing the change]
356
- ```
357
-
358
- New files:
359
- - [file] — [purpose]
360
- ```[language]
361
- [structure sketch: exports, key functions, types]
362
- ```
363
-
364
- Tests:
365
- - [test file] — [what to test]
366
- - happy path: [scenario]
367
- - edge case: [scenario]
368
- - error: [scenario]
369
-
370
- Order:
371
- 1. [file] — [why first]
372
- 2. [file] — [depends on previous]
373
-
374
- Deviations:
375
- - [deviation + justification, or "None"]
376
- END_PLAN
377
- ```
378
-
379
- Save PLAN block. Display:
380
-
381
- ```
382
- ── PLAN ──
383
- [Summary]
384
- Files: [N] change, [N] create, [N] tests
385
- Scope: [small / large]
386
- ```
387
-
388
- ### Step 3: PLAN_REVIEW
389
-
390
- Launch Explore subagent:
391
-
392
- ```
393
- You are a plan reviewer. Check the plan for completeness, correctness, and risks.
394
-
395
- ## Plan
396
- [PLAN block from Step 2]
397
-
398
- ## Context
399
- [CONTEXT block from Step 1]
400
-
401
- ## Conventions
402
- [.dev-vault/conventions.md if exists]
403
-
404
- ## Engineering Principles
405
- [PRINCIPLES block]
406
-
407
- ## Check criteria
408
- 1. Completeness — all files accounted for? Missing dependencies?
409
- 2. Conventions — matches project conventions?
410
- 3. Order — correct sequence of changes?
411
- 4. Tests — cover the changes?
412
- 5. Deviations — justified?
413
- 6. Risks — what could break? Edge cases?
414
- 7. Architecture — correct layer? dependency direction inward? single responsibility?
415
- 8. Production readiness — error handling for external calls? no TODOs? no hardcoded config?
416
- 9. Simplicity — simpler approach that achieves the same? over-engineered?
417
-
418
- ## Output Format
419
- PLAN_REVIEW:
420
- Verdict: [APPROVED / NEEDS_REVISION]
421
- Issues:
422
- - [issue + how to fix]
423
- Missing:
424
- - [what's missing]
425
- Risks:
426
- - [potential risk]
427
- END_PLAN_REVIEW
428
- ```
429
-
430
- **Result:**
431
-
432
- - APPROVED → save plan, then Step 4
433
- - NEEDS_REVISION → pass remarks to PLAN agent, re-run Step 2 with remarks.
434
-
435
- **Max revisions: 2.** After limit:
436
- - **Interactive:** show warnings, ask user whether to proceed
437
- - **Autonomous:** accept plan with warnings, proceed to Step 4
438
-
439
- **Save approved PLAN to vault** (orchestrator writes directly after approval):
440
-
441
- - **Phase mode:** save next to phase file as `<phase-file>.plan.md`
442
- - Example: `.dev-vault/phases/phase-1-foundation.plan.md`
443
- - **Normal mode:** save to `.dev-vault/plans/<date>-<slug>.md`
444
- - Example: `.dev-vault/plans/2026-04-01-add-email-validation.plan.md`
445
-
446
- This persists the plan for:
447
- - Resume if session is interrupted between PLAN and COMMIT
448
- - Audit: compare what was planned vs what was implemented
449
- - Reference: CODER can re-read plan from file if context is lost
450
-
451
- Display:
452
-
453
- ```
454
- ── PLAN_REVIEW ──
455
- Verdict: ✅ APPROVED / ⚠️ NEEDS_REVISION
456
- [If approved:] Plan saved → <path>
457
- ```
458
-
459
- ### Step 4: CODER
460
-
461
- Launch Full subagent:
462
-
463
- ```
464
- You are a coder agent. The ONLY agent allowed to modify files.
465
-
466
- ## Plan
467
- [PLAN block (final)]
468
-
469
- ## Context
470
- [CONTEXT block from Step 1]
471
-
472
- ## Conventions
473
- [.dev-vault/conventions.md or "Follow existing code conventions"]
474
-
475
- ## Stack
476
- [.dev-vault/stack.md — summary]
477
-
478
- ## Engineering Principles
479
- [PRINCIPLES block]
480
-
481
- ## Rules
482
- - Follow the plan. No changes outside the plan. Scope creep FORBIDDEN.
483
- - Follow project conventions: naming, error handling, file structure.
484
- - If plan has DEVIATION — implement as described.
485
- - git commit/push FORBIDDEN.
486
- - git checkout/reset/rebase FORBIDDEN.
487
- - Allowed bash: build, test, lint commands only.
488
-
489
- ## Implementation order (test-first)
490
- 1. Write test files FIRST (from Tests section of the plan)
491
- 2. Run tests — they MUST FAIL (proves tests are meaningful, not vacuous)
492
- 3. Write implementation code
493
- 4. Run tests — they MUST PASS
494
- 5. If a test passes before implementation exists — the test is wrong, rewrite it
495
-
496
- ## Production checklist (verify EVERY file before CODE_DONE)
497
- - [ ] Single responsibility: file/function does one thing
498
- - [ ] Error handling: every external call has error path with timeout
499
- - [ ] No TODO/FIXME/HACK in code
500
- - [ ] No console.log/print for debugging
501
- - [ ] No hardcoded values that should be config/constants
502
- - [ ] Types explicit (no `any`, no implicit `unknown`)
503
- - [ ] Edge cases handled: null, empty, boundary
504
- - [ ] File under 300 lines, functions under 30 lines
505
- - [ ] Names self-documenting: if you wrote a comment, rename or extract instead
506
-
507
- ## Output Format
508
- CODE_DONE:
509
- Files changed:
510
- - [file] — [what was done]
511
- Files created:
512
- - [file] — [purpose]
513
- Tests written:
514
- - [file] — [what it covers]
515
- Notes:
516
- - [notes if any]
517
- END_CODE_DONE
518
- ```
519
-
520
- Save CODE_DONE block. Display:
521
-
522
- ```
523
- ── CODER (iteration 1) ──
524
- Changed: [N], Created: [N], Tests: [N]
525
- ```
526
-
527
- ### Step 5: REVIEW (3 specialized reviewers in parallel)
528
-
529
- Before launching reviewers, orchestrator runs `git diff` to capture actual changes.
530
- Pass BOTH the CODE_DONE summary AND the real diff to each reviewer.
531
-
532
- Launch **3 Explore subagents in parallel** (one Agent call with 3 tool uses):
533
-
534
- **REVIEW:security** — Explore subagent:
535
-
536
- ```
537
- You are a SECURITY reviewer. NEVER modify code — only report issues.
538
- Focus EXCLUSIVELY on security. Ignore style, naming, structure.
539
-
540
- ## What coder did
541
- [CODE_DONE or CODE_FIX block — summary]
542
-
543
- ## Actual diff
544
- [git diff output — the real changes, not just coder's self-report]
545
-
546
- ## Security guidelines
547
- [.dev-vault/knowledge.md — Security section, or OWASP Top 10 defaults]
548
-
549
- ## Check (security ONLY)
550
- - Injection (SQL, command, path traversal)
551
- - XSS (unescaped user input)
552
- - Hardcoded secrets, API keys, credentials
553
- - Missing authentication/authorization
554
- - Insecure deserialization
555
- - Missing input validation at system boundaries
556
- - Timing attacks, race conditions
557
-
558
- ## Severity
559
- CRITICAL: vulnerability, data loss
560
- HIGH: missing auth, missing validation on boundary
561
- MEDIUM: defense-in-depth improvement
562
- LOW: theoretical risk
563
-
564
- ## Output Format
565
- REVIEW_SECURITY:
566
- Verdict: [PASS / FAIL]
567
- Issues:
568
- - [SEVERITY]: [file]:[line] — [issue + fix]
569
- END_REVIEW_SECURITY
33
+ READ yes no no Explore
34
+ PLAN yes no no Explore
35
+ PLAN_REVIEW yes no no Explore
36
+ CODER yes yes build/test Full
37
+ REVIEW x3 yes no no Explore
38
+ TEST no no build/test bash (orchestrator)
39
+ VERIFY yes no no Explore
40
+ COMMIT no no git only Full
570
41
  ```
571
42
 
572
- **REVIEW:quality** — Explore subagent:
43
+ ## Pipeline
573
44
 
574
- ```
575
- You are a QUALITY reviewer. NEVER modify code — only report issues.
576
- Focus EXCLUSIVELY on code quality and conventions. Ignore security.
577
-
578
- ## Plan
579
- [PLAN block]
580
-
581
- ## What coder did
582
- [CODE_DONE or CODE_FIX block — summary]
583
-
584
- ## Actual diff
585
- [git diff output — the real changes, not just coder's self-report]
586
-
587
- ## Conventions
588
- [.dev-vault/conventions.md if exists]
589
-
590
- ## Engineering Principles
591
- [PRINCIPLES block]
592
-
593
- ## Check (quality ONLY)
594
- - Plan adherence — everything implemented? Nothing extra?
595
- - Conventions — naming, error handling, structure per project
596
- - Architecture — single responsibility? correct layer? dependency direction inward?
597
- - God objects — does any file/class know too much or do too many things?
598
- - Abstractions — premature (interface with one impl)? missing (pattern repeated 3+ times)?
599
- - Production readiness — TODOs? debug logging? hardcoded config? missing timeouts?
600
- - Duplication — DRY violations
601
- - Complexity — unnecessary abstractions, over-engineering
602
- - Dead code — unused imports, unreachable branches
603
- - Edge cases — null/undefined, empty arrays, boundary values
604
-
605
- ## Severity
606
- CRITICAL: logic bug, data loss
607
- HIGH: convention violation, plan deviation
608
- MEDIUM: quality improvement
609
- LOW: style nit
610
-
611
- ## Output Format
612
- REVIEW_QUALITY:
613
- Verdict: [PASS / FAIL]
614
- Issues:
615
- - [SEVERITY]: [file]:[line] — [issue + fix]
616
- END_REVIEW_QUALITY
617
- ```
45
+ **IMPORTANT:** Before each step, READ the step file from `.claude/commands/workflow/steps/`. This gives you focused instructions for that specific step. Do NOT rely on memory of previous steps.
618
46
 
619
- **REVIEW:coverage** Explore subagent:
47
+ ### Normal mode
620
48
 
621
49
  ```
622
- You are a TEST COVERAGE reviewer. NEVER modify code — only report issues.
623
- Focus EXCLUSIVELY on test adequacy. Ignore security and style.
624
-
625
- ## Plan
626
- [PLAN block Tests section]
627
-
628
- ## What coder did
629
- [CODE_DONE or CODE_FIX block summary]
630
-
631
- ## Actual diff
632
- [git diff output the real changes, not just coder's self-report]
633
-
634
- ## Check (coverage ONLY)
635
- - All planned tests written?
636
- - Happy path covered?
637
- - Edge cases covered? (empty input, boundary values, null)
638
- - Error paths covered? (network failure, invalid input, permissions)
639
- - Assertions meaningful? (not just "no throw")
640
- - Test isolation? (no shared state between tests)
641
-
642
- ## Severity
643
- CRITICAL: core logic untested
644
- HIGH: missing edge case test for public API
645
- MEDIUM: missing error path test
646
- LOW: test could be more descriptive
647
-
648
- ## Output Format
649
- REVIEW_COVERAGE:
650
- Verdict: [PASS / FAIL]
651
- Issues:
652
- - [SEVERITY]: [file]:[line] — [issue + fix]
653
- END_REVIEW_COVERAGE
50
+ Step 0: Read steps/preflight.md → execute PREFLIGHT
51
+ Step 1: Read steps/read.md → launch Explore agent CONTEXT block
52
+ Step 2: Read steps/plan.md → launch Explore agent → PLAN block
53
+ Step 3: Read steps/plan-review.md → launch Explore agent → APPROVED / NEEDS_REVISION
54
+ Step 4: Read steps/coder.md → launch Full agent → CODE_DONE block
55
+ Step 5: Read steps/review.md → launch 3 Explore agents parallel → APPROVED / CHANGES_REQUESTED
56
+ Step 6: If CHANGES_REQUESTED → re-read steps/coder.md (fix mode) → re-read steps/review.md. Max 3.
57
+ Step 7: Read steps/test.md → run build + lint + tests
58
+ Step 8: Read steps/verify.md → launch Explore agent → COMPLETE / INCOMPLETE
59
+ Step 9: Read steps/commit.md → stage + commit (interactive or autonomous)
60
+ Step 9b: Read steps/vault-updates.md update daily log, task status
654
61
  ```
655
62
 
656
- **Aggregate results:**
657
-
658
- Merge all 3 REVIEW blocks into one verdict:
659
- - Any CRITICAL or HIGH from ANY reviewer → **CHANGES_REQUESTED**
660
- - All PASS with only MEDIUM/LOW → **APPROVED**
661
-
662
- **Extract vault-worthy findings** from review blocks. Orchestrator writes directly:
663
-
664
- - **Gotchas** (non-obvious behaviour discovered) → append to `.dev-vault/knowledge.md` section "Gotchas"
665
- - **Architecture concerns** (dependency violation, layer leak) → append to `.dev-vault/knowledge.md` section "Architecture"
666
- - **New convention** (pattern reviewer noticed is repeated) → append to `.dev-vault/conventions.md` section "Patterns"
667
-
668
- Only extract findings that are useful for **future sessions** — not CRITICAL/HIGH bugs (those get fixed by coder), not LOW style nits. Focus on gotchas, patterns, and architecture insights.
669
-
670
- If no vault-worthy findings — skip. Do not create noise.
671
-
672
- Display:
673
-
674
- ```
675
- ── REVIEW (iteration [N]) ──
676
- Security: ✅ PASS / ❌ FAIL [Critical: N, High: N]
677
- Quality: ✅ PASS / ❌ FAIL [Critical: N, High: N]
678
- Coverage: ✅ PASS / ❌ FAIL [Critical: N, High: N]
679
- Verdict: ✅ APPROVED / ❌ CHANGES_REQUESTED
680
- ```
681
-
682
- ### Step 6: CODER↔REVIEW loop
683
-
684
- **APPROVED** → Step 7.
685
-
686
- **CHANGES_REQUESTED** → launch CODER in fix mode (Full subagent):
687
-
688
- ```
689
- You are a coder agent in FIX mode. Fix review issues.
690
-
691
- ## Plan
692
- [PLAN block]
693
-
694
- ## Review issues
695
- [REVIEW block with Issues]
696
-
697
- ## Conventions
698
- [.dev-vault/conventions.md]
699
-
700
- ## Rules
701
- - CRITICAL and HIGH — fix required.
702
- - MEDIUM — fix if simple. If complex — explain in Skipped.
703
- - LOW — ignore.
704
- - Do NOT touch code outside review issues.
705
-
706
- ## Output Format
707
- CODE_FIX:
708
- Fixed:
709
- - [file]:[line] — [fix] — addresses [issue]
710
- Skipped:
711
- - [issue] — [reason]
712
- END_CODE_FIX
713
- ```
714
-
715
- Then re-run REVIEW (Step 5).
716
-
717
- **Limit: 3 iterations.**
718
-
719
- After limit:
720
-
721
- **Interactive:**
722
- ```
723
- ⚠️ Review iteration limit (3).
724
-
725
- Remaining issues:
726
- [list]
727
-
728
- 1. Accept and commit
729
- 2. Stop without commit
730
- ```
731
-
732
- **Autonomous:** stop without commit. Stash changes for recovery.
733
- ```
734
- 🛑 STOPPED: review limit reached with unresolved CRITICAL/HIGH issues.
735
- Changes stashed → git stash push -m "workflow:dev — stopped at review"
736
- ```
737
-
738
- **Rollback on pipeline stop (all stop points):**
739
- - **Interactive:** ask: keep changes / stash / discard (`git restore .`)
740
- - **Autonomous:** always stash (`git stash push -m "workflow:dev — stopped at [step]"`)
741
-
742
- ### Step 7: TEST (mandatory gate)
743
-
744
- Orchestrator runs build and test commands directly (no subagent):
745
-
746
- ```bash
747
- npm run build # or cargo build, go build — must pass
748
- npm run lint # if configured — must pass
749
- npm test # must pass
750
- ```
751
-
752
- Detect test command from `.dev-vault/stack.md` or `package.json` / `Cargo.toml` / `Makefile`.
753
-
754
- **Compare against BASELINE from Step 0:** if a test was already failing before pipeline started, it is NOT a new failure. Only count failures that are NOT in BASELINE as coder's responsibility.
755
-
756
- **If any command fails:**
757
-
758
- ```
759
- ── TEST ──
760
- ❌ FAIL: [command]
761
-
762
- [error output — last 50 lines]
763
-
764
- Sending to CODER for fix...
765
- ```
766
-
767
- Pass error output to CODER as a fix iteration (same as REVIEW CHANGES_REQUESTED).
768
- After CODER fix → re-run TEST. **Max 3 TEST iterations.**
769
-
770
- After limit:
771
- - **Interactive:** show error, ask user whether to commit anyway or stop
772
- - **Autonomous:** stop without commit. Failing tests = no commit.
773
-
774
- **If all pass:**
775
-
776
- ```
777
- ── TEST ──
778
- ✅ Build: passed
779
- ✅ Lint: passed (or skipped)
780
- ✅ Tests: passed (N tests)
781
- ```
782
-
783
- ### Step 8: VERIFY (task compliance check)
784
-
785
- Launch Explore subagent:
786
-
787
- ```
788
- You are a verification agent. Check if the implementation matches the ORIGINAL TASK.
789
- Do NOT check code quality or security — that was already done.
790
- Check ONLY: does the code do what was asked?
791
-
792
- ## Original task
793
- [task from user — the ORIGINAL request, not the plan]
794
-
795
- ## Plan
796
- [PLAN block]
797
-
798
- ## What was implemented
799
- [final CODE_DONE or CODE_FIX block]
800
-
801
- ## Check
802
- - Every requirement from the original task addressed?
803
- - Any requirement missed or partially implemented?
804
- - Any drift from the task? (implemented something not asked for)
805
- - Acceptance criteria met? (if task specifies them)
806
-
807
- ## Output Format
808
- VERIFY:
809
- Verdict: [COMPLETE / INCOMPLETE]
810
- Addressed:
811
- - [requirement] — ✅ implemented
812
- Missing:
813
- - [requirement not implemented — how to fix]
814
- Drift:
815
- - [implementation not in original task — flag for user]
816
- END_VERIFY
817
- ```
818
-
819
- **COMPLETE** → Step 9.
820
-
821
- **INCOMPLETE** → pass missing items to CODER. **Max 2 iterations.** After limit:
822
- - **Interactive:** show gaps, ask user whether to commit partial or stop
823
- - **Autonomous:** stop without commit. Incomplete implementation = no commit.
824
-
825
- Display:
826
-
827
- ```
828
- ── VERIFY ──
829
- Verdict: ✅ COMPLETE / ⚠️ INCOMPLETE
830
- [If incomplete:] Missing: [N] requirements
831
- ```
832
-
833
- ### Step 9: COMMIT
834
-
835
- Orchestrator forms commit message:
836
-
837
- ```
838
- [type](scope): [brief from PLAN Summary]
839
-
840
- [What was done from PLAN Summary]
841
-
842
- Files:
843
- [from CODE_DONE — file list]
844
- ```
845
-
846
- Stage changes and show diff.
847
-
848
- **Interactive mode (default):**
849
-
850
- ```
851
- ── COMMIT ──
852
-
853
- [commit message]
854
-
855
- Staged:
856
- [abbreviated diff]
857
-
858
- Commit? (yes / no / edit message)
859
- ```
860
-
861
- **"yes"** → `git add` relevant files, `git commit`
862
- **"no"** → cancel, changes remain staged
863
- **"edit"** → user edits, then commit
864
-
865
- **Autonomous mode (--auto-commit):**
63
+ ### Phase mode
866
64
 
867
65
  ```
868
- ── COMMIT (auto) ──
66
+ Step 0: Read steps/preflight.md → auto-create tasks + baseline
67
+ Step 1: Read steps/read.md → CONTEXT (full phase)
68
+ Step 2: Read steps/plan.md → PLAN with subtasks
69
+ Step 3: Read steps/plan-review.md → APPROVED → save plan
869
70
 
870
- [commit message]
71
+ For each subtask:
72
+ Step 4: Read steps/coder.md → CODE (subtask)
73
+ Step 5: Read steps/review.md → REVIEW x3 (subtask)
74
+ Step 6: Fix loop if needed
75
+ Step 7: Read steps/test.md → TEST (all tests, catches regressions)
76
+ Step 9b: Read steps/vault-updates.md → refresh vault for next subtask
871
77
 
872
- Staged:
873
- [abbreviated diff]
874
-
875
- ✅ Auto-committed: [hash]
78
+ Step 8: Read steps/verify.md → VERIFY (full phase)
79
+ Step 9: Read steps/commit.md → one commit for entire phase
80
+ Step 9b: Read steps/vault-updates.md → phase done, tasks done, gameplan updated
876
81
  ```
877
82
 
878
- `git add` relevant files, `git commit` immediately. No user prompt.
879
-
880
- **Autonomous safety — will NOT auto-commit if any of these occurred:**
881
- - TEST failed and fix limit reached
882
- - VERIFY incomplete and fix limit reached
883
- - Any unresolved CRITICAL review issue
83
+ ## Step file location
884
84
 
885
- In these cases the pipeline already stopped at the failing gate.
85
+ All step files are in: `.claude/commands/workflow/steps/`
886
86
 
887
- ### Step 9b: Vault updates (after commit)
888
-
889
- Orchestrator writes directly to vault after successful commit:
890
-
891
- **1. Daily log** — append to `.dev-vault/daily/<today>.md`:
892
87
  ```
893
- > workflow:dev completed at HH:MM — "<task summary>"
894
- > Commit: <hash> | Files: <N> changed, <N> created | Tests: <N>
895
- > [If review findings:] Gotchas recorded in knowledge.md
88
+ steps/
89
+ principles.md ← engineering principles (inlined in plan, coder, review)
90
+ preflight.md ← Step 0: baseline + phase task creation
91
+ read.md ← Step 1: context gathering
92
+ plan.md ← Step 2: architecture analysis + pseudo-code
93
+ plan-review.md ← Step 3: 9 criteria review
94
+ coder.md ← Step 4: test-first implementation + fix mode
95
+ review.md ← Step 5: 3 parallel reviewers + aggregate + fix loop
96
+ test.md ← Step 7: mandatory build/lint/test gate
97
+ verify.md ← Step 8: task compliance check
98
+ commit.md ← Step 9: interactive or autonomous commit
99
+ vault-updates.md ← Step 9b: daily log, status updates, vault refresh
896
100
  ```
897
101
 
898
- **2. Phase status** (phase mode only) — update frontmatter in phase file:
899
- ```yaml
900
- status: done # was: pending
901
- ```
102
+ ## Enforcement
902
103
 
903
- **3. Task status** (if task linked) update task file:
904
- ```yaml
905
- status: done # was: in-progress
906
- ```
104
+ | Agent | Subagent type | On violation |
105
+ |-------|--------------|--------------|
106
+ | READ | Explore | Write/Bash → ABORT |
107
+ | PLAN | Explore | Write/Bash → ABORT |
108
+ | PLAN_REVIEW | Explore | Write/Bash → ABORT |
109
+ | CODER | Full | git commit/push → ABORT |
110
+ | REVIEW x3 | Explore | Write/Bash → ABORT |
111
+ | TEST | bash (orchestrator) | N/A |
112
+ | VERIFY | Explore | Write/Bash → ABORT |
113
+ | COMMIT | Full | Read/Write/non-git → ABORT |
907
114
 
908
- **4. Gameplan progress** (phase mode only) — check off completed items in `.dev-vault/gameplan.md`:
909
- ```markdown
910
- - [x] <completed task> # was: - [ ]
911
- ```
115
+ ## Summary format
912
116
 
913
- ### Step 10: Summary
117
+ After pipeline completes:
914
118
 
915
119
  ```
916
120
  ═══════════════════════════════
@@ -922,53 +126,36 @@ Mode: [interactive / autonomous]
922
126
  Scope: [small / large]
923
127
 
924
128
  Agents:
925
- ✅ READ [Explore] — [N] files
926
- ✅ PLAN [Explore] — [N] files, pseudo-code
927
- ✅ PLAN_REVIEW [Explore] — [verdict]
928
- ✅ CODER [Full] — [N] changed, [N] created
929
- ✅ REVIEW:security [Explore] — [verdict]
930
- REVIEW:quality [Explore] — [verdict]
931
- REVIEW:coverage [Explore] — [verdict]
932
- TEST [bash] — [N] tests passed
933
- ✅ VERIFY [Explore] — [verdict]
934
- ✅ COMMIT [git] — [hash]
935
-
936
- [If deviations:] ⚠️ Convention deviations
937
- [If unresolved:] ⚠️ Known issues
938
- [If verify incomplete:] ⚠️ Missing requirements
129
+ PREFLIGHT [bash] — [baseline]
130
+ READ [Explore] — [N] files
131
+ PLAN [Explore] — [N] files, pseudo-code
132
+ PLAN_REVIEW [Explore] — [verdict]
133
+ CODER [Full] — [N] changed, [N] created
134
+ REVIEW:security [Explore] — [verdict]
135
+ REVIEW:quality [Explore] — [verdict]
136
+ REVIEW:coverage [Explore] — [verdict]
137
+ TEST [bash] — [N] tests passed
138
+ VERIFY [Explore] — [verdict]
139
+ COMMIT [git] — [hash]
140
+
141
+ [If review found gotchas:] Gotchas knowledge.md
142
+ [If architecture concerns:] Concerns knowledge.md
143
+
144
+ Vault records auto-created:
145
+ [If PLAN had deviations:] ADR → .dev-vault/architecture/<slug>.md
146
+ [If REVIEW CRITICAL/HIGH fixed:] Bug → .dev-vault/bugs/<slug>.md
147
+ [If CODER skipped MEDIUM:] Debt → .dev-vault/debt/<slug>.md
939
148
 
940
149
  ═══════════════════════════════
941
150
  ```
942
151
 
943
- ## Enforcement
944
-
945
- Before launching each subagent — verify type:
946
-
947
- | Agent | Subagent type | On violation |
948
- |-------|--------------|--------------|
949
- | READ | Explore | Write/Bash in response → ABORT |
950
- | PLAN | Explore | Write/Bash in response → ABORT |
951
- | PLAN_REVIEW | Explore | Write/Bash in response → ABORT |
952
- | CODER | Full | git commit/push in response → ABORT |
953
- | REVIEW×3 | Explore | Write/Bash in response → ABORT |
954
- | TEST | Orchestrator bash | N/A — orchestrator runs directly |
955
- | VERIFY | Explore | Write/Bash in response → ABORT |
956
- | COMMIT | Full | Read/Write/non-git bash → ABORT |
957
-
958
- ```
959
- 🚨 PERMISSION VIOLATION: [agent] attempted [action].
960
- Allowed: [permissions].
961
- Process stopped.
962
- ```
963
-
964
152
  ## Rules
965
153
 
966
- - Orchestrator reads vault files ONCE (Step 1), passes CONTENT (not paths) to agents
967
- - Placeholders like `[.dev-vault/conventions.md]` mean "insert file content here"
968
- - Context passes as arguments (CONTEXT, PLAN, CODE_DONE, REVIEW blocks)
969
- - Agent response blocks (CONTEXT, PLAN, CODE_DONE, REVIEW, PLAN_REVIEW) have mandatory format
970
- - No intermediate files — everything in orchestrator context
971
- - Permission matrix is law. Explore agents ONLY read
154
+ - Before each step: READ the step file, then execute. Fresh instructions each time.
155
+ - Orchestrator reads vault files ONCE (Step 1), passes CONTENT to agents
156
+ - Context passes as blocks (CONTEXT, PLAN, CODE_DONE, REVIEW)
157
+ - Permission matrix is law. Explore agents ONLY read.
972
158
  - CODER is the only one who touches files
973
159
  - REVIEWER never fixes code — only reports issues
974
160
  - COMMIT — git add + git diff + git commit, nothing else
161
+ - All vault writes use Edit tool (append), never Write tool (overwrite)