@engramm/dev-workflow 0.1.3 → 0.1.5

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