@wazir-dev/cli 1.0.0 → 1.2.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 (163) hide show
  1. package/CHANGELOG.md +100 -2
  2. package/README.md +6 -6
  3. package/docs/concepts/architecture.md +1 -1
  4. package/docs/concepts/roles-and-workflows.md +2 -0
  5. package/docs/concepts/why-wazir.md +59 -0
  6. package/docs/decisions/2026-03-19-deferred-items.md +564 -0
  7. package/docs/decisions/2026-03-19-enhancement-decisions.md +300 -0
  8. package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +1 -1
  9. package/docs/readmes/INDEX.md +21 -5
  10. package/docs/readmes/features/expertise/README.md +2 -2
  11. package/docs/readmes/features/exports/README.md +2 -2
  12. package/docs/readmes/features/schemas/README.md +3 -0
  13. package/docs/readmes/features/skills/README.md +17 -0
  14. package/docs/readmes/features/skills/clarifier.md +5 -0
  15. package/docs/readmes/features/skills/claude-cli.md +5 -0
  16. package/docs/readmes/features/skills/codex-cli.md +5 -0
  17. package/docs/readmes/features/skills/dispatching-parallel-agents.md +5 -0
  18. package/docs/readmes/features/skills/executing-plans.md +5 -0
  19. package/docs/readmes/features/skills/executor.md +5 -0
  20. package/docs/readmes/features/skills/finishing-a-development-branch.md +5 -0
  21. package/docs/readmes/features/skills/gemini-cli.md +5 -0
  22. package/docs/readmes/features/skills/humanize.md +5 -0
  23. package/docs/readmes/features/skills/init-pipeline.md +5 -0
  24. package/docs/readmes/features/skills/receiving-code-review.md +5 -0
  25. package/docs/readmes/features/skills/requesting-code-review.md +5 -0
  26. package/docs/readmes/features/skills/reviewer.md +5 -0
  27. package/docs/readmes/features/skills/subagent-driven-development.md +5 -0
  28. package/docs/readmes/features/skills/using-git-worktrees.md +5 -0
  29. package/docs/readmes/features/skills/wazir.md +5 -0
  30. package/docs/readmes/features/skills/writing-skills.md +5 -0
  31. package/docs/readmes/features/workflows/prepare-next.md +1 -1
  32. package/docs/reference/configuration-reference.md +47 -6
  33. package/docs/reference/launch-checklist.md +4 -4
  34. package/docs/reference/review-loop-pattern.md +538 -0
  35. package/docs/reference/roles-reference.md +1 -0
  36. package/docs/reference/skill-tiers.md +147 -0
  37. package/docs/reference/tooling-cli.md +5 -1
  38. package/docs/truth-claims.yaml +18 -0
  39. package/expertise/antipatterns/process/ai-coding-antipatterns.md +97 -1
  40. package/exports/hosts/claude/.claude/agents/clarifier.md +3 -0
  41. package/exports/hosts/claude/.claude/agents/designer.md +3 -0
  42. package/exports/hosts/claude/.claude/agents/executor.md +2 -0
  43. package/exports/hosts/claude/.claude/agents/planner.md +3 -0
  44. package/exports/hosts/claude/.claude/agents/researcher.md +2 -0
  45. package/exports/hosts/claude/.claude/agents/reviewer.md +5 -1
  46. package/exports/hosts/claude/.claude/agents/specifier.md +3 -0
  47. package/exports/hosts/claude/.claude/commands/clarify.md +4 -0
  48. package/exports/hosts/claude/.claude/commands/design-review.md +4 -0
  49. package/exports/hosts/claude/.claude/commands/design.md +4 -0
  50. package/exports/hosts/claude/.claude/commands/discover.md +4 -0
  51. package/exports/hosts/claude/.claude/commands/execute.md +4 -0
  52. package/exports/hosts/claude/.claude/commands/plan-review.md +4 -0
  53. package/exports/hosts/claude/.claude/commands/plan.md +4 -0
  54. package/exports/hosts/claude/.claude/commands/spec-challenge.md +4 -0
  55. package/exports/hosts/claude/.claude/commands/specify.md +4 -0
  56. package/exports/hosts/claude/.claude/commands/verify.md +4 -0
  57. package/exports/hosts/claude/.claude/settings.json +9 -0
  58. package/exports/hosts/claude/CLAUDE.md +1 -1
  59. package/exports/hosts/claude/export.manifest.json +22 -20
  60. package/exports/hosts/claude/host-package.json +3 -1
  61. package/exports/hosts/codex/AGENTS.md +1 -1
  62. package/exports/hosts/codex/export.manifest.json +22 -20
  63. package/exports/hosts/codex/host-package.json +3 -1
  64. package/exports/hosts/cursor/.cursor/hooks.json +4 -0
  65. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +1 -1
  66. package/exports/hosts/cursor/export.manifest.json +22 -20
  67. package/exports/hosts/cursor/host-package.json +3 -1
  68. package/exports/hosts/gemini/GEMINI.md +1 -1
  69. package/exports/hosts/gemini/export.manifest.json +22 -20
  70. package/exports/hosts/gemini/host-package.json +3 -1
  71. package/hooks/context-mode-router +191 -0
  72. package/hooks/definitions/context_mode_router.yaml +19 -0
  73. package/hooks/definitions/loop_cap_guard.yaml +1 -1
  74. package/hooks/hooks.json +43 -0
  75. package/hooks/protected-path-write-guard +8 -0
  76. package/hooks/routing-matrix.json +45 -0
  77. package/hooks/session-start +62 -1
  78. package/llms-full.txt +905 -132
  79. package/package.json +3 -3
  80. package/roles/clarifier.md +3 -0
  81. package/roles/designer.md +3 -0
  82. package/roles/executor.md +2 -0
  83. package/roles/planner.md +3 -0
  84. package/roles/researcher.md +2 -0
  85. package/roles/reviewer.md +5 -1
  86. package/roles/specifier.md +3 -0
  87. package/schemas/hook.schema.json +2 -1
  88. package/schemas/phase-report.schema.json +80 -0
  89. package/schemas/usage.schema.json +25 -1
  90. package/schemas/wazir-manifest.schema.json +19 -0
  91. package/skills/brainstorming/SKILL.md +20 -56
  92. package/skills/clarifier/SKILL.md +243 -0
  93. package/skills/claude-cli/SKILL.md +320 -0
  94. package/skills/codex-cli/SKILL.md +260 -0
  95. package/skills/debugging/SKILL.md +24 -1
  96. package/skills/design/SKILL.md +13 -0
  97. package/skills/dispatching-parallel-agents/SKILL.md +13 -0
  98. package/skills/executing-plans/SKILL.md +28 -2
  99. package/skills/executor/SKILL.md +129 -0
  100. package/skills/finishing-a-development-branch/SKILL.md +13 -0
  101. package/skills/gemini-cli/SKILL.md +260 -0
  102. package/skills/humanize/SKILL.md +13 -0
  103. package/skills/init-pipeline/SKILL.md +76 -78
  104. package/skills/prepare-next/SKILL.md +81 -10
  105. package/skills/receiving-code-review/SKILL.md +21 -0
  106. package/skills/requesting-code-review/SKILL.md +38 -5
  107. package/skills/reviewer/SKILL.md +423 -0
  108. package/skills/run-audit/SKILL.md +13 -0
  109. package/skills/scan-project/SKILL.md +13 -0
  110. package/skills/self-audit/SKILL.md +197 -16
  111. package/skills/subagent-driven-development/SKILL.md +38 -2
  112. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +2 -0
  113. package/skills/subagent-driven-development/implementer-prompt.md +8 -0
  114. package/skills/subagent-driven-development/spec-reviewer-prompt.md +7 -0
  115. package/skills/tdd/SKILL.md +21 -0
  116. package/skills/using-git-worktrees/SKILL.md +13 -0
  117. package/skills/using-skills/SKILL.md +13 -0
  118. package/skills/verification/SKILL.md +13 -0
  119. package/skills/wazir/SKILL.md +286 -262
  120. package/skills/writing-plans/SKILL.md +44 -4
  121. package/skills/writing-skills/SKILL.md +13 -0
  122. package/templates/artifacts/implementation-plan.md +3 -0
  123. package/templates/artifacts/tasks-template.md +133 -0
  124. package/templates/examples/phase-report.example.json +48 -0
  125. package/templates/examples/wazir-manifest.example.yaml +1 -1
  126. package/tooling/src/adapters/composition-engine.js +256 -0
  127. package/tooling/src/adapters/model-router.js +84 -0
  128. package/tooling/src/capture/command.js +111 -2
  129. package/tooling/src/capture/run-config.js +23 -0
  130. package/tooling/src/capture/store.js +24 -0
  131. package/tooling/src/capture/usage.js +106 -0
  132. package/tooling/src/checks/ac-matrix.js +256 -0
  133. package/tooling/src/checks/brand-truth.js +3 -6
  134. package/tooling/src/checks/command-registry.js +13 -0
  135. package/tooling/src/checks/docs-truth.js +1 -1
  136. package/tooling/src/checks/runtime-surface.js +3 -7
  137. package/tooling/src/checks/skills.js +111 -0
  138. package/tooling/src/cli.js +17 -3
  139. package/tooling/src/commands/stats.js +161 -0
  140. package/tooling/src/commands/validate.js +5 -1
  141. package/tooling/src/export/compiler.js +33 -37
  142. package/tooling/src/gating/agent.js +145 -0
  143. package/tooling/src/guards/phase-prerequisite-guard.js +127 -0
  144. package/tooling/src/hooks/routing-logic.js +69 -0
  145. package/tooling/src/init/auto-detect.js +260 -0
  146. package/tooling/src/init/command.js +161 -0
  147. package/tooling/src/input/scanner.js +46 -0
  148. package/tooling/src/reports/command.js +103 -0
  149. package/tooling/src/reports/phase-report.js +323 -0
  150. package/tooling/src/state/command.js +160 -0
  151. package/tooling/src/state/db.js +287 -0
  152. package/tooling/src/status/command.js +53 -1
  153. package/wazir.manifest.yaml +26 -17
  154. package/workflows/clarify.md +4 -0
  155. package/workflows/design-review.md +4 -0
  156. package/workflows/design.md +4 -0
  157. package/workflows/discover.md +4 -0
  158. package/workflows/execute.md +4 -0
  159. package/workflows/plan-review.md +4 -0
  160. package/workflows/plan.md +4 -0
  161. package/workflows/spec-challenge.md +4 -0
  162. package/workflows/specify.md +4 -0
  163. package/workflows/verify.md +4 -0
@@ -9,6 +9,19 @@ The user typed `/wazir <their request>`. Run the entire pipeline end-to-end, han
9
9
 
10
10
  All questions use **numbered interactive options** — one question at a time, defaults marked "(Recommended)", wait for user response before proceeding.
11
11
 
12
+ ## Command Routing
13
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
14
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
15
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
16
+ - If context-mode unavailable, fall back to native Bash with warning
17
+
18
+ ## Codebase Exploration
19
+ 1. Query `wazir index search-symbols <query>` first
20
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
21
+ 3. Fall back to direct file reads ONLY for files identified by index queries
22
+ 4. Maximum 10 direct file reads without a justifying index query
23
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
24
+
12
25
  ## Subcommand Detection
13
26
 
14
27
  Before anything else, check if the request starts with a known subcommand:
@@ -18,11 +31,24 @@ Before anything else, check if the request starts with a known subcommand:
18
31
  | `/wazir audit ...` | Jump to **Audit Mode** (see below) |
19
32
  | `/wazir prd [run-id]` | Jump to **PRD Mode** (see below) |
20
33
  | `/wazir init` | Invoke the `init-pipeline` skill directly, then stop |
21
- | Anything else | Continue to Step 1 (normal pipeline) |
34
+ | Anything else | Continue to Phase 1 (Init) |
35
+
36
+ ---
37
+
38
+ # 4-Phase Pipeline
39
+
40
+ The pipeline has 4 phases. Each phase groups related workflows. Individual workflows within a phase can be enabled/disabled via `workflow_policy` in run-config.
41
+
42
+ | Phase | Contains | Owner Skill | Key Output |
43
+ |-------|----------|-------------|------------|
44
+ | **Init** | Setup, prereqs, run directory, input scan | `wz:wazir` (inline) | `run-config.yaml` |
45
+ | **Clarifier** | Research, clarify, specify, brainstorm, plan | `wz:clarifier` | Approved spec + design + plan |
46
+ | **Executor** | Implement, verify | `wz:executor` | Code + verification proof |
47
+ | **Final Review** | Review vs original input, learn, prepare next | `wz:reviewer` | Verdict + learnings + handoff |
22
48
 
23
49
  ---
24
50
 
25
- # Normal Pipeline Mode
51
+ # Phase 1: Init
26
52
 
27
53
  ## Step 1: Capture the Request
28
54
 
@@ -37,13 +63,22 @@ If the user provided no text after `/wazir`, ask:
37
63
 
38
64
  Save their answer as the briefing, then continue.
39
65
 
66
+ ### Scan Input Directory
67
+
68
+ Scan both `input/` (project-level) and `.wazir/input/` (state-level) for existing briefing materials. If files exist beyond `briefing.md`, list them:
69
+
70
+ > **Found input files:**
71
+ > - `input/2026-03-19-deferred-items.md`
72
+ > - `.wazir/input/briefing.md`
73
+ >
74
+ > Using all found input as context for clarification.
75
+
40
76
  ### Inline Modifiers
41
77
 
42
- Parse the request for inline modifiers before the main text. These skip the corresponding interview question:
78
+ Parse the request for inline modifiers before the main text:
43
79
 
44
80
  - `/wazir quick fix the login redirect` → depth = quick, intent = bugfix
45
81
  - `/wazir deep design a new onboarding flow` → depth = deep, intent = feature
46
- - `/wazir feature add CSV export` → intent = feature, depth = standard (default)
47
82
 
48
83
  Recognized modifiers:
49
84
  - **Depth:** `quick`, `deep` (standard is default when omitted)
@@ -61,233 +96,310 @@ Run `which wazir` to check if the CLI is installed.
61
96
  >
62
97
  > **How would you like to install it?**
63
98
  >
64
- > 1. **npm** (Recommended) — `npm install -g wazir`
99
+ > 1. **npm** (Recommended) — `npm install -g @wazir-dev/cli`
65
100
  > 2. **Local link** — `npm link` from the Wazir project root
66
- > 3. **Skip** — Continue without the CLI (some features will be unavailable)
67
101
 
68
- If the user picks 1, run `npm install -g wazir` and verify with `wazir --version`.
69
- If the user picks 2, run `npm link` from the project root and verify.
70
- If the user picks 3, warn that `wazir capture`, `wazir validate`, and `wazir index` commands will not work, then continue.
102
+ The CLI is **required** — the pipeline uses `wazir capture`, `wazir validate`, `wazir index`, and `wazir doctor` throughout execution.
103
+
104
+ **If installed**, run `wazir doctor --json` to verify repo health. Stop if unhealthy.
105
+
106
+ ### Branch Check
107
+
108
+ Run `wazir validate branches` to check the current git branch.
109
+
110
+ - If on `main` or `develop`:
111
+ > You're on **[branch]**. The pipeline requires a feature branch.
112
+ >
113
+ > 1. **Create feat/<slug>** (Recommended) — branch from current
114
+ > 2. **Continue on [branch]** — not recommended for feature/refactor work
115
+
116
+ ### Index Check
71
117
 
72
- **If installed**, run `wazir doctor --json` to verify repo health.
118
+ ```bash
119
+ INDEX_STATS=$(wazir index stats --json 2>/dev/null)
120
+ FILE_COUNT=$(echo "$INDEX_STATS" | jq -r '.file_count // 0')
121
+ if [ "$FILE_COUNT" -eq 0 ]; then
122
+ wazir index build && wazir index summarize --tier all
123
+ else
124
+ wazir index refresh
125
+ fi
126
+ ```
73
127
 
74
128
  ### Pipeline Init Check
75
129
 
76
130
  Check if `.wazir/state/config.json` exists.
77
131
 
78
- - **If missing** — invoke the `init-pipeline` skill. This will ask the user interactive questions to set up the config.
79
- - **If exists** — continue to Step 2.5.
132
+ - **If missing** — invoke the `init-pipeline` skill.
133
+ - **If exists** — continue.
80
134
 
81
- ## Step 2.5: Create Run Directory
135
+ ## Step 3: Create Run Directory
82
136
 
83
137
  Generate a run ID using the current timestamp: `run-YYYYMMDD-HHMMSS`
84
138
 
85
139
  ```bash
86
- mkdir -p .wazir/runs/run-YYYYMMDD-HHMMSS/{sources,tasks,artifacts,reviews}
140
+ mkdir -p .wazir/runs/run-YYYYMMDD-HHMMSS/{sources,tasks,artifacts,reviews,clarified}
87
141
  ln -sfn run-YYYYMMDD-HHMMSS .wazir/runs/latest
88
142
  ```
89
143
 
90
- If a previous completed run exists (check for a `completed_at` field in the previous `latest` run's `run-config.yaml`), record its `run_id` as `parent_run_id` in the new run's config.
144
+ Initialize event capture:
145
+
146
+ ```bash
147
+ wazir capture init --run <run-id> --phase init --status starting
148
+ ```
91
149
 
92
- ## Step 3: Pre-Flight Configuration
150
+ ### Resume Detection
93
151
 
94
- Build the run configuration. Skip questions that were answered via inline modifiers.
152
+ Check if a previous incomplete run exists (via `latest` symlink pointing to a run without `completed_at`).
95
153
 
96
- ### Question 1: Depth (if not set via modifier)
154
+ **If previous incomplete run found**, present:
97
155
 
98
- > **How thorough should this run be?**
156
+ > **A previous incomplete run was detected:** `<previous-run-id>`
99
157
  >
100
- > 1. **Quick** — Minimal research, single-pass review, fast execution. Good for small fixes and config changes.
101
- > 2. **Standard** (Recommended) Balanced research, multi-pass hardening, full review. Good for most features.
102
- > 3. **Deep** — Extended research, thorough hardening, strict review thresholds. Good for complex or security-critical work.
158
+ > 1. **Resume** (Recommended) continue from the last completed phase
159
+ > 2. **Start fresh** — create a new empty run
103
160
 
104
- ### Question 2: Intent (if not set via modifier and not obvious from the request)
161
+ **If Resume:**
162
+ - Copy `clarified/` from previous run into new run, EXCEPT `user-feedback.md`.
163
+ - Detect last completed phase by checking which artifacts exist.
164
+ - **Staleness check:** If input files are newer than copied artifacts, warn and offer to re-run clarification.
105
165
 
106
- Only ask this if the request is ambiguous. If the intent is clear from the text (e.g., "fix the bug" → bugfix), infer it and skip.
166
+ ## Step 4: Build Run Config
107
167
 
108
- > **What kind of work is this?**
109
- >
110
- > 1. **Feature** (Recommended) — New functionality or enhancement
111
- > 2. **Bugfix** — Fix broken behavior
112
- > 3. **Refactor** — Restructure without changing behavior
113
- > 4. **Docs** — Documentation only
114
- > 5. **Spike** — Research and exploration, no production code
168
+ **No questions asked.** Depth, intent, and mode are all inferred or defaulted.
115
169
 
116
- ### Question 3: Agent Teams (conditional)
170
+ ### Intent Inference
117
171
 
118
- Only ask this if ALL of these are true:
119
- - The host is Claude Code (not Codex/Gemini/Cursor)
120
- - Depth is `standard` or `deep`
121
- - Intent is `feature` or `refactor` (not bugfix/docs/spike)
172
+ Infer intent from the request text using keyword matching:
122
173
 
123
- > **Would you like to use Agent Teams for parallel execution?**
124
- >
125
- > 1. **No** (Recommended) Tasks run sequentially. Predictable, lower cost.
126
- > 2. **Yes** Spawns parallel teammates for independent tasks. Potentially faster and richer output.
127
- >
128
- > *Agent Teams is experimental from Claude's side. Requires Opus model. Higher token consumption.*
174
+ | Keywords in request | Inferred Intent |
175
+ |-------------------|-----------------|
176
+ | fix, bug, broken, crash, error, issue, wrong | `bugfix` |
177
+ | refactor, clean, restructure, reorganize, rename, simplify | `refactor` |
178
+ | doc, document, readme, guide, explain | `docs` |
179
+ | research, spike, explore, investigate, prototype | `spike` |
180
+ | (anything else) | `feature` |
181
+
182
+ Depth defaults to `standard`. Override only via inline modifiers (`/wazir quick ...`, `/wazir deep ...`).
129
183
 
130
184
  ### Write Run Config
131
185
 
132
- Save all decisions to `.wazir/runs/<run-id>/run-config.yaml`:
186
+ Save to `.wazir/runs/<run-id>/run-config.yaml`:
133
187
 
134
188
  ```yaml
135
- # Identity
136
- run_id: run-20260317-143000
137
- parent_run_id: null # set if resuming/continuing from a prior run
138
- continuation_reason: null # e.g. "review found minor fixes"
189
+ run_id: run-YYYYMMDD-HHMMSS
190
+ parent_run_id: null
191
+ continuation_reason: null
139
192
 
140
- # User request
141
193
  request: "the original user request"
142
- request_summary: "short summary of intent"
143
- parsed_intent: feature # feature | bugfix | refactor | docs | spike
144
- entry_point: "/wazir" # how the user entered the pipeline
145
-
146
- # Configuration
147
- depth: standard # quick | standard | deep
148
- team_mode: sequential # sequential | parallel
149
- parallel_backend: none # none | claude_teams (future: subagents, worktrees)
150
-
151
- # Phase policy (system-decided, not user-facing)
152
- phase_policy:
153
- discover: { enabled: true, reason: "feature intent requires research" }
154
- design: { enabled: true, reason: "new UI component" }
155
- spec-challenge: { enabled: true, passes: 2, reason: "standard depth" }
156
- author: { enabled: false, reason: "no i18n or seed data needed" }
157
- plan-review: { enabled: true, passes: 1 }
158
-
159
- # Research
160
- research_topics: [] # populated by researcher phase
161
-
162
- # Timestamps
163
- created_at: 2026-03-17T14:30:00Z
194
+ request_summary: "short summary"
195
+ parsed_intent: feature
196
+ entry_point: "/wazir"
197
+
198
+ depth: standard
199
+ team_mode: sequential
200
+ parallel_backend: none
201
+
202
+ # Workflow policy — individual workflows within each phase
203
+ workflow_policy:
204
+ # Clarifier phase workflows
205
+ discover: { enabled: true, loop_cap: 10 }
206
+ clarify: { enabled: true, loop_cap: 10 }
207
+ specify: { enabled: true, loop_cap: 10 }
208
+ spec-challenge: { enabled: true, loop_cap: 10 }
209
+ author: { enabled: false, loop_cap: 10 }
210
+ design: { enabled: true, loop_cap: 10 }
211
+ design-review: { enabled: true, loop_cap: 10 }
212
+ plan: { enabled: true, loop_cap: 10 }
213
+ plan-review: { enabled: true, loop_cap: 10 }
214
+ # Executor phase workflows
215
+ execute: { enabled: true, loop_cap: 10 }
216
+ verify: { enabled: true, loop_cap: 5 }
217
+ # Final Review phase workflows
218
+ review: { enabled: true, loop_cap: 10 }
219
+ learn: { enabled: true, loop_cap: 5 }
220
+ prepare_next: { enabled: true, loop_cap: 5 }
221
+ run_audit: { enabled: false, loop_cap: 10 }
222
+
223
+ research_topics: []
224
+
225
+ created_at: "YYYY-MM-DDTHH:MM:SSZ"
164
226
  completed_at: null
165
227
  ```
166
228
 
167
- Mutable execution state (current phase, task progress, error counts) lives in `.wazir/runs/<run-id>/status.json`, NOT in `run-config.yaml`. The run config captures setup decisions only.
168
-
169
- ### Phase Policy
229
+ ### Workflow Skip Rules
170
230
 
171
- Map intent + depth to applicable phases. The system decides — the user does NOT pick phases.
231
+ Map intent + depth to applicable workflows. The system decides — the user does NOT pick.
172
232
 
173
- **Phase classes:**
174
-
175
- | Class | Phases | Rules |
176
- |-------|--------|-------|
177
- | **Core** (always run) | `clarify`, `verify`, `review` | Never skipped |
233
+ | Class | Workflows | Rules |
234
+ |-------|-----------|-------|
235
+ | **Core** (always run) | `clarify`, `execute`, `verify`, `review` | Never skipped |
178
236
  | **Adaptive** (run when evidence says so) | `discover`, `design`, `author`, `specify` | Skipped for bugfix/docs/spike at quick depth |
179
- | **Scale** (intensity varies) | `spec-challenge`, `plan-review`, `design-review` | Single-pass at quick, multi-pass at deep |
180
-
181
- Log skip decisions to the run's `run-config.yaml` with reasons:
237
+ | **Scale** (intensity varies) | `spec-challenge`, `plan-review`, `design-review` | Loop cap controls iteration depth |
238
+ | **Post-run** (always run) | `learn`, `prepare_next` | Part of Final Review phase |
182
239
 
183
- ```yaml
184
- phase_policy:
185
- discover: { enabled: true }
186
- design: { enabled: false, reason: "bugfix intent — no design needed" }
187
- spec-challenge: { enabled: true, passes: 1, reason: "quick depth" }
188
- ```
240
+ Log skip decisions with reasons in `workflow_policy`.
189
241
 
190
242
  ### Confidence Gate
191
243
 
192
- After building the run config, evaluate confidence:
244
+ After building run config:
193
245
 
194
- - **High confidence** (clear intent, depth set, no ambiguity) show a one-line summary and proceed:
195
- > **Running: standard depth, feature, sequential. 11 of 14 phases. Proceeding...**
246
+ - **High confidence** — one-line summary and proceed:
247
+ > **Running: standard depth, feature, sequential. Proceeding...**
196
248
 
197
- - **Low confidence** (ambiguous intent, unclear scope) — show the full plan and ask:
198
- > **Here's the run plan:**
199
- > - Depth: standard
200
- > - Intent: feature
201
- > - Phases: [list enabled phases]
202
- > - Skipped: [list skipped with reasons]
203
- >
249
+ - **Low confidence** — show plan and ask:
204
250
  > **Does this look right?**
205
251
  > 1. **Yes, proceed** (Recommended)
206
252
  > 2. **No, let me adjust**
207
253
 
208
- ## Step 4: Run Clarifier
209
-
210
- ### Source Capture
211
-
212
- Before invoking the clarifier, instruct the researcher to capture all referenced sources locally:
213
-
214
- - Fetch all URLs referenced in `.wazir/input/` briefing files
215
- - Save fetched content to `.wazir/runs/<run-id>/sources/`
216
- - Name files as `src-NNN-<slug>.md` (fetched content) or `src-NNN-fetch-failed.json` (failures)
217
- - Create `.wazir/runs/<run-id>/sources/manifest.json` indexing all captures:
218
-
219
- ```json
220
- [
221
- {
222
- "id": "src-001",
223
- "origin_url": "https://...",
224
- "fetch_time": "2026-03-17T14:30:00Z",
225
- "content_hash": "sha256:abc...",
226
- "status": "captured",
227
- "local_path": "src-001-github-readme.md"
228
- },
229
- {
230
- "id": "src-002",
231
- "origin_url": "https://...",
232
- "status": "failed",
233
- "error": "403 Forbidden",
234
- "fetch_time": "2026-03-17T14:30:01Z"
235
- }
236
- ]
254
+ ```bash
255
+ wazir capture event --run <run-id> --event phase_exit --phase init --status completed
237
256
  ```
238
257
 
239
- Research briefs produced by the researcher must reference local paths (`sources/src-001-...`) instead of live URLs. The original URL is preserved in the manifest for provenance. Failures are recorded explicitly — never silently skipped.
258
+ ---
259
+
260
+ # Phase 2: Clarifier
261
+
262
+ ```bash
263
+ wazir capture event --run <run-id> --event phase_enter --phase clarifier --status in_progress
264
+ ```
265
+
266
+ Invoke the `wz:clarifier` skill. It handles all sub-workflows internally:
267
+
268
+ 1. **Source Capture** — fetch URLs from input
269
+ 2. **Research** (discover workflow) — codebase + external research
270
+ 3. **Clarify** (clarify workflow) — scope, constraints, assumptions
271
+ 4. **Spec Harden** (specify + spec-challenge workflows) — measurable spec
272
+ 5. **Brainstorm** (design + design-review workflows) — design approaches
273
+ 6. **Plan** (plan + plan-review workflows) — execution plan
274
+
275
+ Each sub-workflow has its own review loop. User checkpoints between major steps.
276
+
277
+ ### Scope Invariant
278
+
279
+ **Hard rule:** `items_in_plan >= items_in_input` unless the user explicitly approves scope reduction. The clarifier MUST NOT autonomously tier, defer, or drop items from the user's input. It can suggest prioritization, but the decision belongs to the user.
280
+
281
+ Output: approved spec + design + execution plan in `.wazir/runs/latest/clarified/`.
282
+
283
+ ```bash
284
+ wazir capture event --run <run-id> --event phase_exit --phase clarifier --status completed
285
+ ```
286
+
287
+ ---
240
288
 
241
- ### Clarifier Invocation
289
+ # Phase 3: Executor
242
290
 
243
- Invoke the `clarifier` skill.
291
+ ## Phase Gate (Hard Gate)
244
292
 
245
- This runs the full Phase 0 + Phase 1 pipeline:
246
- - Phase 0: Research (autonomous — skipped if depth=quick and intent=bugfix)
247
- - Phase 1A: Clarify (autonomous)
248
- - Phase 1A+: Spec Harden (passes determined by depth)
249
- - Phase 1B: Brainstorm (interactive — **will pause for user approval**. If `team_mode: parallel`, uses structured dialogue with Free Thinker + Grounder + Synthesizer agents)
250
- - Phase 1C: Plan (task generation)
293
+ Before entering the Executor phase, verify ALL clarifier artifacts exist:
251
294
 
252
- **Resume detection:** If `.wazir/runs/latest/clarified/` already has task specs and an execution plan, ask:
295
+ - [ ] `.wazir/runs/latest/clarified/clarification.md`
296
+ - [ ] `.wazir/runs/latest/clarified/spec-hardened.md`
297
+ - [ ] `.wazir/runs/latest/clarified/design.md`
298
+ - [ ] `.wazir/runs/latest/clarified/execution-plan.md`
253
299
 
254
- > **Clarification was already completed. What would you like to do?**
300
+ If ANY file is missing, **STOP**:
301
+
302
+ > **Cannot enter Executor phase: missing prerequisite artifacts from Clarifier.**
303
+ >
304
+ > Missing: [list missing files]
255
305
  >
256
- > 1. **Skip to execution** (Recommended) Use existing task specs
257
- > 2. **Re-run clarifier** — Start fresh
306
+ > The Clarifier phase must complete before execution can begin. Run `/wazir:clarifier` first.
307
+
308
+ **Do NOT skip this check. Do NOT rationalize that the input is "clear enough" to bypass clarification. Every pipeline run must produce these artifacts.**
309
+
310
+ ```bash
311
+ wazir capture event --run <run-id> --event phase_enter --phase executor --status in_progress
312
+ ```
313
+
314
+ **Pre-execution gate:**
315
+
316
+ ```bash
317
+ wazir validate manifest && wazir validate hooks
318
+ # Hard gate — stop if either fails.
319
+ ```
320
+
321
+ Invoke the `wz:executor` skill. It handles:
322
+
323
+ 1. **Execute** (execute workflow) — per-task TDD cycle with review before each commit
324
+ 2. **Verify** (verify workflow) — deterministic verification of all claims
325
+
326
+ Per-task review: `--mode task-review`, 5 task-execution dimensions.
327
+ Tasks always run sequentially.
328
+
329
+ Output: code changes + verification proof in `.wazir/runs/latest/artifacts/`.
330
+
331
+ ```bash
332
+ wazir capture event --run <run-id> --event phase_exit --phase executor --status completed
333
+ ```
334
+
335
+ ---
258
336
 
259
- ## Step 5: Run Executor
337
+ # Phase 4: Final Review
260
338
 
261
- Invoke the `executor` skill.
339
+ ## Phase Gate (Hard Gate)
262
340
 
263
- This runs Phase 2: autonomous execution with the composition engine, TDD, and quality gates.
341
+ Before entering the Final Review phase, verify the Executor produced its proof:
264
342
 
265
- If `team_mode: parallel` in run-config, the executor spawns Agent Teams for independent tasks. Otherwise, tasks run sequentially.
343
+ - [ ] `.wazir/runs/latest/artifacts/verification-proof.md`
266
344
 
267
- **Resume detection:** If `.wazir/runs/latest/artifacts/` has completed artifacts, ask:
345
+ If missing, **STOP**:
268
346
 
269
- > **Some tasks are already completed. What would you like to do?**
347
+ > **Cannot enter Final Review: missing verification proof from Executor.**
270
348
  >
271
- > 1. **Resume** (Recommended) Continue from where it left off
272
- > 2. **Start fresh** — Re-run all tasks from scratch
349
+ > The Executor phase must complete and produce `verification-proof.md` before final review. Run `/wazir:executor` first.
350
+
351
+ ```bash
352
+ wazir capture event --run <run-id> --event phase_enter --phase final_review --status in_progress
353
+ ```
354
+
355
+ This phase validates the implementation against the **ORIGINAL INPUT** (not the task specs — the executor's per-task reviewer already covered that).
356
+
357
+ ### 4a: Review (reviewer role in final mode)
358
+
359
+ Invoke `wz:reviewer --mode final`.
360
+ 7-dimension scored review comparing implementation against the original user input.
361
+ Score 0-70. Verdicts: PASS (56+), NEEDS MINOR FIXES (42-55), NEEDS REWORK (28-41), FAIL (0-27).
362
+
363
+ ### 4b: Learn (learner role)
364
+
365
+ Extract durable learnings from the completed run:
366
+ - Scan all review findings (internal + Codex)
367
+ - Propose learnings to `memory/learnings/proposed/`
368
+ - Findings that recur across 2+ runs → auto-proposed as learnings
369
+ - Learnings require explicit scope tags (roles, stacks, concerns)
370
+
371
+ ### 4c: Prepare Next (planner role)
372
+
373
+ Prepare context and handoff for the next run:
374
+ - Write handoff document
375
+ - Compress/archive unneeded files
376
+ - Record what's left to do
377
+
378
+ ```bash
379
+ wazir capture event --run <run-id> --event phase_exit --phase final_review --status completed
380
+ ```
381
+
382
+ ---
383
+
384
+ ## Step 5: CHANGELOG + Gitflow Validation (Hard Gates)
273
385
 
274
- ## Step 6: Run Reviewer
386
+ Before presenting results:
275
387
 
276
- Invoke the `reviewer` skill.
388
+ ```bash
389
+ wazir validate changelog --require-entries --base main
390
+ wazir validate commits --base main
391
+ ```
277
392
 
278
- This runs Phase 3: final scoring across 7 dimensions, produces a verdict.
393
+ Both must pass before PR. These are not warnings.
279
394
 
280
- ## Step 7: Present Results
395
+ ## Step 6: Present Results
281
396
 
282
- After the reviewer completes, present the verdict and offer next steps with numbered options:
397
+ After the reviewer completes, present verdict with numbered options:
283
398
 
284
399
  ### If PASS (score 56+):
285
400
 
286
401
  > **Result: PASS (score/70)**
287
402
  >
288
- > [score breakdown]
289
- >
290
- > **What would you like to do?**
291
403
  > 1. **Create a PR** (Recommended)
292
404
  > 2. **Merge directly**
293
405
  > 3. **Review the changes first**
@@ -296,9 +408,6 @@ After the reviewer completes, present the verdict and offer next steps with numb
296
408
 
297
409
  > **Result: NEEDS MINOR FIXES (score/70)**
298
410
  >
299
- > [findings list]
300
- >
301
- > **What would you like to do?**
302
411
  > 1. **Auto-fix and re-review** (Recommended)
303
412
  > 2. **Fix manually**
304
413
  > 3. **Accept as-is**
@@ -307,9 +416,6 @@ After the reviewer completes, present the verdict and offer next steps with numb
307
416
 
308
417
  > **Result: NEEDS REWORK (score/70)**
309
418
  >
310
- > [findings list with affected tasks]
311
- >
312
- > **What would you like to do?**
313
419
  > 1. **Re-run affected tasks** (Recommended)
314
420
  > 2. **Review findings in detail**
315
421
  > 3. **Abandon this run**
@@ -318,53 +424,42 @@ After the reviewer completes, present the verdict and offer next steps with numb
318
424
 
319
425
  > **Result: FAIL (score/70)**
320
426
  >
321
- > [full findings]
322
- >
323
- > Something fundamental went wrong. Review the findings above and decide how to proceed.
427
+ > Something fundamental went wrong. Review the findings above.
324
428
 
325
- ## Error Handling
429
+ ### Run Summary
430
+
431
+ ```bash
432
+ wazir capture summary --run <run-id>
433
+ wazir status --run <run-id> --json
434
+ ```
326
435
 
327
- If any phase fails or the user cancels:
436
+ ## Error Handling
328
437
 
329
- 1. Report which phase failed and why
330
- 2. Present recovery options:
438
+ If any phase fails:
331
439
 
332
440
  > **Phase [name] failed: [reason]**
333
441
  >
334
- > **What would you like to do?**
335
442
  > 1. **Retry this phase** (Recommended)
336
- > 2. **Skip and continue** (only if phase is adaptive, not core)
443
+ > 2. **Skip and continue** (only if workflows within phase are adaptive)
337
444
  > 3. **Abort the run**
338
445
 
339
- The run config persists, so running `/wazir` again will detect the partial state and offer to resume.
340
-
341
446
  ---
342
447
 
343
448
  # Audit Mode
344
449
 
345
450
  Triggered by `/wazir audit` or `/wazir audit <focus>`.
346
451
 
347
- Runs a structured codebase audit. Invokes the `run-audit` skill with the interactive question flow.
452
+ Runs a structured codebase audit. Invokes the `run-audit` skill.
348
453
 
349
- ## Inline Audit Modifiers
454
+ Parse inline audit types: `/wazir audit security` → skip Question 1.
350
455
 
351
- Parse for known audit types after `audit`:
456
+ After audit:
352
457
 
353
- - `/wazir audit security` → audit type = security, skip Question 1
354
- - `/wazir audit deps` → audit type = dependencies, skip Question 1
355
- - `/wazir audit` → ask Question 1
356
-
357
- Then let the `run-audit` skill handle the rest (scope, output mode). All its questions already follow the interactive numbered pattern.
358
-
359
- After the audit completes:
360
-
361
- > **Audit complete. What would you like to do?**
362
- >
363
458
  > 1. **Review the findings** (Recommended)
364
- > 2. **Generate a fix plan** — turn findings into implementation tasks
365
- > 3. **Run the pipeline on the fix plan** — generate plan, then execute and review fixes
459
+ > 2. **Generate a fix plan**
460
+ > 3. **Run the pipeline on the fix plan**
366
461
 
367
- If the user picks option 3, save the findings as the briefing and run the normal pipeline (Steps 3-7) with intent = `bugfix`.
462
+ If option 3, save findings as briefing and run pipeline with intent = `bugfix`.
368
463
 
369
464
  ---
370
465
 
@@ -372,79 +467,10 @@ If the user picks option 3, save the findings as the briefing and run the normal
372
467
 
373
468
  Triggered by `/wazir prd` or `/wazir prd <run-id>`.
374
469
 
375
- Generates a Product Requirements Document from a completed pipeline run.
376
-
377
- ## Pre-Flight
378
-
379
- 1. If a `<run-id>` was provided, use that run's directory. Otherwise, use `.wazir/runs/latest`.
380
- 2. Verify the run has completed artifacts:
381
- - Design doc in the run's tasks or in `docs/plans/`
382
- - Task specs in the run's `clarified/`
383
- - Review results in the run's `reviews/` (if available)
384
- 3. If the run is incomplete or has no artifacts:
385
-
386
- > **No completed run found. Run `/wazir <your request>` first to create a pipeline run, then use `/wazir prd` to generate the PRD.**
387
-
388
- ## Inputs (read-only)
389
-
390
- Read these artifacts from the completed run:
391
- - Approved design document
392
- - Task specs (all `spec.md` files in `clarified/`)
393
- - Execution plan
394
- - Review results and verification proofs (if available)
395
- - Run config (for context on depth, intent, decisions)
396
-
397
- ## Output
398
-
399
- Generate a PRD and save to `docs/prd/YYYY-MM-DD-<topic>-prd.md`.
400
-
401
- ### PRD Template
402
-
403
- ```markdown
404
- # Product Requirements Document — <Topic>
405
-
406
- **Generated from run:** `<run-id>`
407
- **Date:** YYYY-MM-DD
408
-
409
- ## Vision & Core Thesis
410
-
411
- [1-2 paragraphs synthesized from the design document's core approach]
470
+ Generates a PRD from a completed run. Reads approved design, task specs, execution plan, review results. Saves to `docs/prd/YYYY-MM-DD-<topic>-prd.md`.
412
471
 
413
- ## What We're Building
472
+ After generation:
414
473
 
415
- ### Feature Area 1: <name>
416
-
417
- **What:** [description from task specs]
418
- **Why:** [rationale from design doc]
419
- **Requirements:**
420
- - [ ] [from task spec acceptance criteria]
421
- - [ ] ...
422
-
423
- ### Feature Area 2: <name>
424
- ...
425
-
426
- ## Success Criteria
427
-
428
- [From review results and verification proofs — what was tested and confirmed]
429
-
430
- ## Technical Constraints
431
-
432
- [From architecture decisions, run config, and design trade-offs]
433
-
434
- ## What's NOT in Scope
435
-
436
- [From design doc's rejected alternatives and explicit exclusions]
437
-
438
- ## Open Questions
439
-
440
- [From design doc's open questions and review findings]
441
- ```
442
-
443
- ## After Generation
444
-
445
- > **PRD generated at `docs/prd/YYYY-MM-DD-<topic>-prd.md`.**
446
- >
447
- > **What would you like to do?**
448
474
  > 1. **Review the PRD** (Recommended)
449
475
  > 2. **Commit it**
450
476
  > 3. **Edit before committing**
@@ -453,8 +479,6 @@ Generate a PRD and save to `docs/prd/YYYY-MM-DD-<topic>-prd.md`.
453
479
 
454
480
  ## Interaction Rules
455
481
 
456
- These rules apply to ALL questions in the pipeline, including those asked by sub-skills (clarifier, executor, reviewer) and audit modes:
457
-
458
482
  - **One question at a time** — never combine multiple questions
459
483
  - **Numbered options** — always present choices as numbered lists
460
484
  - **Mark defaults** — always show "(Recommended)" on the suggested option