@wazir-dev/cli 1.1.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 (124) hide show
  1. package/CHANGELOG.md +73 -4
  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/readmes/INDEX.md +21 -5
  9. package/docs/readmes/features/expertise/README.md +2 -2
  10. package/docs/readmes/features/exports/README.md +2 -2
  11. package/docs/readmes/features/schemas/README.md +3 -0
  12. package/docs/readmes/features/skills/README.md +17 -0
  13. package/docs/readmes/features/skills/clarifier.md +5 -0
  14. package/docs/readmes/features/skills/claude-cli.md +5 -0
  15. package/docs/readmes/features/skills/codex-cli.md +5 -0
  16. package/docs/readmes/features/skills/dispatching-parallel-agents.md +5 -0
  17. package/docs/readmes/features/skills/executing-plans.md +5 -0
  18. package/docs/readmes/features/skills/executor.md +5 -0
  19. package/docs/readmes/features/skills/finishing-a-development-branch.md +5 -0
  20. package/docs/readmes/features/skills/gemini-cli.md +5 -0
  21. package/docs/readmes/features/skills/humanize.md +5 -0
  22. package/docs/readmes/features/skills/init-pipeline.md +5 -0
  23. package/docs/readmes/features/skills/receiving-code-review.md +5 -0
  24. package/docs/readmes/features/skills/requesting-code-review.md +5 -0
  25. package/docs/readmes/features/skills/reviewer.md +5 -0
  26. package/docs/readmes/features/skills/subagent-driven-development.md +5 -0
  27. package/docs/readmes/features/skills/using-git-worktrees.md +5 -0
  28. package/docs/readmes/features/skills/wazir.md +5 -0
  29. package/docs/readmes/features/skills/writing-skills.md +5 -0
  30. package/docs/readmes/features/workflows/prepare-next.md +1 -1
  31. package/docs/reference/configuration-reference.md +47 -6
  32. package/docs/reference/launch-checklist.md +4 -4
  33. package/docs/reference/review-loop-pattern.md +117 -8
  34. package/docs/reference/roles-reference.md +1 -0
  35. package/docs/reference/skill-tiers.md +147 -0
  36. package/docs/reference/tooling-cli.md +3 -1
  37. package/docs/truth-claims.yaml +12 -0
  38. package/expertise/antipatterns/process/ai-coding-antipatterns.md +97 -1
  39. package/exports/hosts/claude/.claude/settings.json +9 -0
  40. package/exports/hosts/claude/CLAUDE.md +1 -1
  41. package/exports/hosts/claude/export.manifest.json +4 -2
  42. package/exports/hosts/claude/host-package.json +3 -1
  43. package/exports/hosts/codex/AGENTS.md +1 -1
  44. package/exports/hosts/codex/export.manifest.json +4 -2
  45. package/exports/hosts/codex/host-package.json +3 -1
  46. package/exports/hosts/cursor/.cursor/hooks.json +4 -0
  47. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +1 -1
  48. package/exports/hosts/cursor/export.manifest.json +4 -2
  49. package/exports/hosts/cursor/host-package.json +3 -1
  50. package/exports/hosts/gemini/GEMINI.md +1 -1
  51. package/exports/hosts/gemini/export.manifest.json +4 -2
  52. package/exports/hosts/gemini/host-package.json +3 -1
  53. package/hooks/context-mode-router +191 -0
  54. package/hooks/definitions/context_mode_router.yaml +19 -0
  55. package/hooks/hooks.json +31 -6
  56. package/hooks/protected-path-write-guard +8 -0
  57. package/hooks/routing-matrix.json +45 -0
  58. package/hooks/session-start +62 -1
  59. package/llms-full.txt +905 -132
  60. package/package.json +2 -3
  61. package/schemas/hook.schema.json +2 -1
  62. package/schemas/phase-report.schema.json +80 -0
  63. package/schemas/usage.schema.json +25 -1
  64. package/schemas/wazir-manifest.schema.json +19 -0
  65. package/skills/brainstorming/SKILL.md +18 -155
  66. package/skills/clarifier/SKILL.md +122 -98
  67. package/skills/claude-cli/SKILL.md +320 -0
  68. package/skills/codex-cli/SKILL.md +260 -0
  69. package/skills/debugging/SKILL.md +13 -0
  70. package/skills/design/SKILL.md +13 -0
  71. package/skills/dispatching-parallel-agents/SKILL.md +13 -0
  72. package/skills/executing-plans/SKILL.md +13 -0
  73. package/skills/executor/SKILL.md +72 -19
  74. package/skills/finishing-a-development-branch/SKILL.md +13 -0
  75. package/skills/gemini-cli/SKILL.md +260 -0
  76. package/skills/humanize/SKILL.md +13 -0
  77. package/skills/init-pipeline/SKILL.md +73 -164
  78. package/skills/prepare-next/SKILL.md +81 -10
  79. package/skills/receiving-code-review/SKILL.md +13 -0
  80. package/skills/requesting-code-review/SKILL.md +13 -0
  81. package/skills/reviewer/SKILL.md +287 -15
  82. package/skills/run-audit/SKILL.md +13 -0
  83. package/skills/scan-project/SKILL.md +13 -0
  84. package/skills/self-audit/SKILL.md +197 -16
  85. package/skills/subagent-driven-development/SKILL.md +13 -0
  86. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +2 -0
  87. package/skills/subagent-driven-development/implementer-prompt.md +8 -0
  88. package/skills/subagent-driven-development/spec-reviewer-prompt.md +7 -0
  89. package/skills/tdd/SKILL.md +13 -0
  90. package/skills/using-git-worktrees/SKILL.md +13 -0
  91. package/skills/using-skills/SKILL.md +13 -0
  92. package/skills/verification/SKILL.md +13 -0
  93. package/skills/wazir/SKILL.md +194 -377
  94. package/skills/writing-plans/SKILL.md +14 -1
  95. package/skills/writing-skills/SKILL.md +13 -0
  96. package/templates/artifacts/implementation-plan.md +3 -0
  97. package/templates/artifacts/tasks-template.md +133 -0
  98. package/templates/examples/phase-report.example.json +48 -0
  99. package/tooling/src/adapters/composition-engine.js +256 -0
  100. package/tooling/src/adapters/model-router.js +84 -0
  101. package/tooling/src/capture/command.js +24 -1
  102. package/tooling/src/capture/run-config.js +3 -1
  103. package/tooling/src/capture/store.js +24 -0
  104. package/tooling/src/capture/usage.js +106 -0
  105. package/tooling/src/checks/ac-matrix.js +256 -0
  106. package/tooling/src/checks/command-registry.js +12 -0
  107. package/tooling/src/checks/docs-truth.js +1 -1
  108. package/tooling/src/checks/skills.js +111 -0
  109. package/tooling/src/cli.js +9 -0
  110. package/tooling/src/commands/stats.js +161 -0
  111. package/tooling/src/commands/validate.js +5 -1
  112. package/tooling/src/export/compiler.js +33 -37
  113. package/tooling/src/gating/agent.js +145 -0
  114. package/tooling/src/guards/phase-prerequisite-guard.js +127 -0
  115. package/tooling/src/hooks/routing-logic.js +69 -0
  116. package/tooling/src/init/auto-detect.js +260 -0
  117. package/tooling/src/init/command.js +95 -135
  118. package/tooling/src/input/scanner.js +46 -0
  119. package/tooling/src/reports/command.js +103 -0
  120. package/tooling/src/reports/phase-report.js +323 -0
  121. package/tooling/src/state/command.js +160 -0
  122. package/tooling/src/state/db.js +287 -0
  123. package/tooling/src/status/command.js +53 -1
  124. package/wazir.manifest.yaml +26 -14
@@ -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)
@@ -64,18 +99,9 @@ Run `which wazir` to check if the CLI is installed.
64
99
  > 1. **npm** (Recommended) — `npm install -g @wazir-dev/cli`
65
100
  > 2. **Local link** — `npm link` from the Wazir project root
66
101
 
67
- If the user picks 1, run `npm install -g @wazir-dev/cli` and verify with `wazir --version`.
68
- If the user picks 2, run `npm link` from the project root and verify.
69
-
70
- The CLI is **required** — the pipeline uses `wazir capture`, `wazir validate`, `wazir index`, and `wazir doctor` throughout execution. There is no skip option.
71
-
72
- **If installed**, run `wazir doctor --json` to verify repo health.
102
+ The CLI is **required** — the pipeline uses `wazir capture`, `wazir validate`, `wazir index`, and `wazir doctor` throughout execution.
73
103
 
74
- If doctor reports unhealthy:
75
- > **Repo health check failed:** [details from doctor output]
76
- > Fix issues before running the pipeline.
77
-
78
- Stop. Do NOT continue the pipeline until the health check passes.
104
+ **If installed**, run `wazir doctor --json` to verify repo health. Stop if unhealthy.
79
105
 
80
106
  ### Branch Check
81
107
 
@@ -87,10 +113,6 @@ Run `wazir validate branches` to check the current git branch.
87
113
  > 1. **Create feat/<slug>** (Recommended) — branch from current
88
114
  > 2. **Continue on [branch]** — not recommended for feature/refactor work
89
115
 
90
- Wait for the user to answer before continuing.
91
-
92
- - If branch name is invalid (not `feat/`, `fix/`, `chore/`, etc.): warn but continue.
93
-
94
116
  ### Index Check
95
117
 
96
118
  ```bash
@@ -107,87 +129,79 @@ fi
107
129
 
108
130
  Check if `.wazir/state/config.json` exists.
109
131
 
110
- - **If missing** — invoke the `init-pipeline` skill. This will ask the user interactive questions to set up the config.
111
- - **If exists** — continue to Step 2.5.
132
+ - **If missing** — invoke the `init-pipeline` skill.
133
+ - **If exists** — continue.
112
134
 
113
- ## Step 2.5: Create Run Directory
135
+ ## Step 3: Create Run Directory
114
136
 
115
137
  Generate a run ID using the current timestamp: `run-YYYYMMDD-HHMMSS`
116
138
 
117
139
  ```bash
118
- mkdir -p .wazir/runs/run-YYYYMMDD-HHMMSS/{sources,tasks,artifacts,reviews}
140
+ mkdir -p .wazir/runs/run-YYYYMMDD-HHMMSS/{sources,tasks,artifacts,reviews,clarified}
119
141
  ln -sfn run-YYYYMMDD-HHMMSS .wazir/runs/latest
120
142
  ```
121
143
 
122
- 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.
123
-
124
- After creating the run directory, initialize event capture:
144
+ Initialize event capture:
125
145
 
126
146
  ```bash
127
- wazir capture init --run <run-id> --phase clarify --status starting
147
+ wazir capture init --run <run-id> --phase init --status starting
128
148
  ```
129
149
 
130
- ## Step 3: Pre-Flight Configuration
150
+ ### Resume Detection
131
151
 
132
- 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`).
133
153
 
134
- ### Question 1: Depth (if not set via modifier)
154
+ **If previous incomplete run found**, present:
135
155
 
136
- > **How thorough should this run be?**
156
+ > **A previous incomplete run was detected:** `<previous-run-id>`
137
157
  >
138
- > 1. **Quick** — Minimal research, single-pass review, fast execution. Good for small fixes and config changes.
139
- > 2. **Standard** (Recommended) Balanced research, multi-pass hardening, full review. Good for most features.
140
- > 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
141
160
 
142
- ### 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.
143
165
 
144
- 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
145
167
 
146
- > **What kind of work is this?**
147
- >
148
- > 1. **Feature** (Recommended) — New functionality or enhancement
149
- > 2. **Bugfix** — Fix broken behavior
150
- > 3. **Refactor** — Restructure without changing behavior
151
- > 4. **Docs** — Documentation only
152
- > 5. **Spike** — Research and exploration, no production code
168
+ **No questions asked.** Depth, intent, and mode are all inferred or defaulted.
153
169
 
154
- ### Question 3: Agent Teams (conditional)
170
+ ### Intent Inference
155
171
 
156
- Only ask this if ALL of these are true:
157
- - The host is Claude Code (not Codex/Gemini/Cursor)
158
- - Depth is `standard` or `deep`
159
- - Intent is `feature` or `refactor` (not bugfix/docs/spike)
172
+ Infer intent from the request text using keyword matching:
160
173
 
161
- > **Would you like to use Agent Teams for parallel execution?**
162
- >
163
- > 1. **No** (Recommended) Tasks run sequentially. Predictable, lower cost.
164
- > 2. **Yes** Spawns parallel teammates for independent tasks. Potentially faster and richer output.
165
- >
166
- > *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 ...`).
167
183
 
168
184
  ### Write Run Config
169
185
 
170
- Save all decisions to `.wazir/runs/<run-id>/run-config.yaml`:
186
+ Save to `.wazir/runs/<run-id>/run-config.yaml`:
171
187
 
172
188
  ```yaml
173
- # Identity
174
- run_id: run-20260317-143000
175
- parent_run_id: null # set if resuming/continuing from a prior run
176
- continuation_reason: null # e.g. "review found minor fixes"
189
+ run_id: run-YYYYMMDD-HHMMSS
190
+ parent_run_id: null
191
+ continuation_reason: null
177
192
 
178
- # User request
179
193
  request: "the original user request"
180
- request_summary: "short summary of intent"
181
- parsed_intent: feature # feature | bugfix | refactor | docs | spike
182
- entry_point: "/wazir" # how the user entered the pipeline
194
+ request_summary: "short summary"
195
+ parsed_intent: feature
196
+ entry_point: "/wazir"
183
197
 
184
- # Configuration
185
- depth: standard # quick | standard | deep
186
- team_mode: sequential # sequential | parallel
187
- parallel_backend: none # none | claude_teams (future: subagents, worktrees)
198
+ depth: standard
199
+ team_mode: sequential
200
+ parallel_backend: none
188
201
 
189
- # Phase policy (system-decided, not user-facing)
190
- phase_policy:
202
+ # Workflow policy individual workflows within each phase
203
+ workflow_policy:
204
+ # Clarifier phase workflows
191
205
  discover: { enabled: true, loop_cap: 10 }
192
206
  clarify: { enabled: true, loop_cap: 10 }
193
207
  specify: { enabled: true, loop_cap: 10 }
@@ -197,295 +211,195 @@ phase_policy:
197
211
  design-review: { enabled: true, loop_cap: 10 }
198
212
  plan: { enabled: true, loop_cap: 10 }
199
213
  plan-review: { enabled: true, loop_cap: 10 }
214
+ # Executor phase workflows
200
215
  execute: { enabled: true, loop_cap: 10 }
201
216
  verify: { enabled: true, loop_cap: 5 }
217
+ # Final Review phase workflows
202
218
  review: { enabled: true, loop_cap: 10 }
203
- learn: { enabled: false, loop_cap: 5 }
204
- prepare_next: { enabled: false, loop_cap: 5 }
219
+ learn: { enabled: true, loop_cap: 5 }
220
+ prepare_next: { enabled: true, loop_cap: 5 }
205
221
  run_audit: { enabled: false, loop_cap: 10 }
206
222
 
207
- # Research
208
- research_topics: [] # populated by researcher phase
223
+ research_topics: []
209
224
 
210
- # Timestamps
211
- created_at: 2026-03-17T14:30:00Z
225
+ created_at: "YYYY-MM-DDTHH:MM:SSZ"
212
226
  completed_at: null
213
227
  ```
214
228
 
215
- 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.
216
-
217
- ### Phase Policy
229
+ ### Workflow Skip Rules
218
230
 
219
- 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.
220
232
 
221
- **Phase classes:**
222
-
223
- | Class | Phases | Rules |
224
- |-------|--------|-------|
225
- | **Core** (always run) | `clarify`, `verify`, `review` | Never skipped |
233
+ | Class | Workflows | Rules |
234
+ |-------|-----------|-------|
235
+ | **Core** (always run) | `clarify`, `execute`, `verify`, `review` | Never skipped |
226
236
  | **Adaptive** (run when evidence says so) | `discover`, `design`, `author`, `specify` | Skipped for bugfix/docs/spike at quick depth |
227
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 |
228
239
 
229
- Log skip decisions to the run's `run-config.yaml` with reasons:
230
-
231
- ```yaml
232
- phase_policy:
233
- discover: { enabled: true, loop_cap: 10 }
234
- design: { enabled: false, loop_cap: 10, reason: "bugfix intent — no design needed" }
235
- spec-challenge: { enabled: true, loop_cap: 10 }
236
- ```
240
+ Log skip decisions with reasons in `workflow_policy`.
237
241
 
238
242
  ### Confidence Gate
239
243
 
240
- After building the run config, evaluate confidence:
244
+ After building run config:
241
245
 
242
- - **High confidence** (clear intent, depth set, no ambiguity) show a one-line summary and proceed:
243
- > **Running: standard depth, feature, sequential. 11 of 15 phases. Proceeding...**
246
+ - **High confidence** — one-line summary and proceed:
247
+ > **Running: standard depth, feature, sequential. Proceeding...**
244
248
 
245
- - **Low confidence** (ambiguous intent, unclear scope) — show the full plan and ask:
246
- > **Here's the run plan:**
247
- > - Depth: standard
248
- > - Intent: feature
249
- > - Phases: [list enabled phases]
250
- > - Skipped: [list skipped with reasons]
251
- >
249
+ - **Low confidence** — show plan and ask:
252
250
  > **Does this look right?**
253
251
  > 1. **Yes, proceed** (Recommended)
254
252
  > 2. **No, let me adjust**
255
253
 
256
- ## Step 4: Run Pipeline Phases
257
-
258
- The full pipeline runs these phases in order. Each phase produces an artifact that must pass its review loop before flowing to the next phase. Review mode is always passed explicitly (`--mode`) -- no auto-detection.
259
-
260
- ### 4a: Source Capture
261
-
262
- Before invoking the clarifier, capture all referenced sources locally:
263
-
264
- - Fetch all URLs referenced in `.wazir/input/` briefing files
265
- - Save fetched content to `.wazir/runs/<run-id>/sources/`
266
- - Name files as `src-NNN-<slug>.md` (fetched content) or `src-NNN-fetch-failed.json` (failures)
267
- - Create `.wazir/runs/<run-id>/sources/manifest.json` indexing all captures:
268
-
269
- ```json
270
- [
271
- {
272
- "id": "src-001",
273
- "origin_url": "https://...",
274
- "fetch_time": "2026-03-17T14:30:00Z",
275
- "content_hash": "sha256:abc...",
276
- "status": "captured",
277
- "local_path": "src-001-github-readme.md"
278
- },
279
- {
280
- "id": "src-002",
281
- "origin_url": "https://...",
282
- "status": "failed",
283
- "error": "403 Forbidden",
284
- "fetch_time": "2026-03-17T14:30:01Z"
285
- }
286
- ]
254
+ ```bash
255
+ wazir capture event --run <run-id> --event phase_exit --phase init --status completed
287
256
  ```
288
257
 
289
- 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
+ ---
290
259
 
291
- ### 4b: Clarify (clarifier role)
260
+ # Phase 2: Clarifier
292
261
 
293
262
  ```bash
294
- wazir capture event --run <run-id> --event phase_enter --phase clarify --status in_progress
263
+ wazir capture event --run <run-id> --event phase_enter --phase clarifier --status in_progress
295
264
  ```
296
265
 
297
- Invoke the clarifier skill for Phase 1A.
298
- Produces clarification artifact.
299
- Review: clarification-review loop (`--mode clarification-review`, spec/clarification dimensions).
300
- Pass count: quick=3, standard=5, deep=7. No extension.
301
- Checkpoint: user approves clarification.
266
+ Invoke the `wz:clarifier` skill. It handles all sub-workflows internally:
302
267
 
303
- ```bash
304
- wazir capture event --run <run-id> --event phase_exit --phase clarify --status completed
305
- ```
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
306
274
 
307
- ### 4c: Research (researcher role via discover workflow)
308
-
309
- ```bash
310
- wazir capture event --run <run-id> --event phase_enter --phase discover --status in_progress
311
- ```
275
+ Each sub-workflow has its own review loop. User checkpoints between major steps.
312
276
 
313
- Clarifier delegates to discover workflow (researcher role).
314
- Produces research artifact.
315
- Review: research-review loop (`--mode research-review`, research dimensions).
316
- Pass count: quick=3, standard=5, deep=7. No extension.
317
- Skip condition: depth=quick AND intent=bugfix.
277
+ ### Scope Invariant
318
278
 
319
- ```bash
320
- wazir capture event --run <run-id> --event phase_exit --phase discover --status completed
321
- ```
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.
322
280
 
323
- ### 4d: Specify (specifier role)
281
+ Output: approved spec + design + execution plan in `.wazir/runs/latest/clarified/`.
324
282
 
325
283
  ```bash
326
- wazir capture event --run <run-id> --event phase_enter --phase specify --status in_progress
284
+ wazir capture event --run <run-id> --event phase_exit --phase clarifier --status completed
327
285
  ```
328
286
 
329
- Delegate to specify workflow.
330
- Specifier produces measurable spec from clarification + research.
331
- Review: spec-challenge loop (`--mode spec-challenge`, spec/clarification dimensions).
332
- Pass count: quick=3, standard=5, deep=7. No extension.
333
- Checkpoint: user approves spec.
334
-
335
- ```bash
336
- wazir capture event --run <run-id> --event phase_exit --phase specify --status completed
337
- ```
287
+ ---
338
288
 
339
- ### 4d.5: Author (content-author role) [ADAPTIVE]
289
+ # Phase 3: Executor
340
290
 
341
- ```bash
342
- wazir capture event --run <run-id> --event phase_enter --phase author --status in_progress
343
- ```
291
+ ## Phase Gate (Hard Gate)
344
292
 
345
- Enabled when `phase_policy.author.enabled = true` (default: false).
346
- Content-author writes non-code content artifacts.
347
- Approval gate: human approval required (not a review loop).
348
- Skip condition: disabled by default. Enable for content-heavy projects.
293
+ Before entering the Executor phase, verify ALL clarifier artifacts exist:
349
294
 
350
- ```bash
351
- wazir capture event --run <run-id> --event phase_exit --phase author --status completed
352
- ```
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`
353
299
 
354
- ### 4e: Brainstorm (designer role)
300
+ If ANY file is missing, **STOP**:
355
301
 
356
- ```bash
357
- wazir capture event --run <run-id> --event phase_enter --phase design --status in_progress
358
- ```
302
+ > **Cannot enter Executor phase: missing prerequisite artifacts from Clarifier.**
303
+ >
304
+ > Missing: [list missing files]
305
+ >
306
+ > The Clarifier phase must complete before execution can begin. Run `/wazir:clarifier` first.
359
307
 
360
- Invoke brainstorming skill for Phase 1B.
361
- Interactive -- pauses for user approval of design concept.
362
- After user approval: design-review loop (`--mode design-review`,
363
- canonical design-review dimensions: spec coverage, design-spec consistency,
364
- accessibility, visual consistency, exported-code fidelity).
365
- Pass count: quick=3, standard=5, deep=7. No extension.
366
- Skip condition: intent=bugfix/docs.
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.**
367
309
 
368
310
  ```bash
369
- wazir capture event --run <run-id> --event phase_exit --phase design --status completed
311
+ wazir capture event --run <run-id> --event phase_enter --phase executor --status in_progress
370
312
  ```
371
313
 
372
- ### 4f: Plan (planner role via wz:writing-plans)
314
+ **Pre-execution gate:**
373
315
 
374
316
  ```bash
375
- wazir capture event --run <run-id> --event phase_enter --phase plan --status in_progress
317
+ wazir validate manifest && wazir validate hooks
318
+ # Hard gate — stop if either fails.
376
319
  ```
377
320
 
378
- Delegate to `wz:writing-plans`.
379
- Planner produces execution plan and task specs.
380
- Review: plan-review loop (`--mode plan-review`, plan dimensions).
381
- Pass count: quick=3, standard=5, deep=7. No extension.
382
- Checkpoint: user approves plan.
321
+ Invoke the `wz:executor` skill. It handles:
383
322
 
384
- ```bash
385
- wazir capture event --run <run-id> --event phase_exit --phase plan --status completed
386
- ```
323
+ 1. **Execute** (execute workflow) — per-task TDD cycle with review before each commit
324
+ 2. **Verify** (verify workflow) deterministic verification of all claims
387
325
 
388
- ### 4g: Execute (executor role)
326
+ Per-task review: `--mode task-review`, 5 task-execution dimensions.
327
+ Tasks always run sequentially.
389
328
 
390
- ```bash
391
- wazir capture event --run <run-id> --event phase_enter --phase execute --status in_progress
392
- ```
393
-
394
- **Pre-execution gate** — run before the first task:
329
+ Output: code changes + verification proof in `.wazir/runs/latest/artifacts/`.
395
330
 
396
331
  ```bash
397
- wazir validate manifest && wazir validate hooks
398
- # If either fails, stop and report the failure. Do NOT proceed to task execution.
332
+ wazir capture event --run <run-id> --event phase_exit --phase executor --status completed
399
333
  ```
400
334
 
401
- Invoke executor skill for Phase 2.
402
- Per-task review: task-review loop (`--mode task-review --task-id <NNN>`,
403
- 5 task-execution dimensions) before each commit.
404
- Review logs: `execute-task-<NNN>-review-pass-<N>.md`
405
- Cap tracking: `wazir capture loop-check --task-id <NNN>`
406
- Codex error handling: non-zero exit -> codex-unavailable, self-review only.
407
- NOTE: per-task review is NOT the final review.
408
-
409
- If `team_mode: parallel` in run-config, the executor spawns Agent Teams for independent tasks. Otherwise, tasks run sequentially.
335
+ ---
410
336
 
411
- ```bash
412
- wazir capture event --run <run-id> --event phase_exit --phase execute --status completed
413
- ```
337
+ # Phase 4: Final Review
414
338
 
415
- ### 4h: Verify (verifier role)
339
+ ## Phase Gate (Hard Gate)
416
340
 
417
- ```bash
418
- wazir capture event --run <run-id> --event phase_enter --phase verify --status in_progress
419
- ```
341
+ Before entering the Final Review phase, verify the Executor produced its proof:
420
342
 
421
- Deterministic verification of execution claims.
422
- Not a review loop -- produces proof, not findings.
343
+ - [ ] `.wazir/runs/latest/artifacts/verification-proof.md`
423
344
 
424
- ```bash
425
- wazir capture event --run <run-id> --event phase_exit --phase verify --status completed
426
- ```
345
+ If missing, **STOP**:
427
346
 
428
- ### 4i: Final Review (reviewer role in final mode)
347
+ > **Cannot enter Final Review: missing verification proof from Executor.**
348
+ >
349
+ > The Executor phase must complete and produce `verification-proof.md` before final review. Run `/wazir:executor` first.
429
350
 
430
351
  ```bash
431
- wazir capture event --run <run-id> --event phase_enter --phase review --status in_progress
352
+ wazir capture event --run <run-id> --event phase_enter --phase final_review --status in_progress
432
353
  ```
433
354
 
434
- Invoke reviewer skill with `--mode final`.
435
- 7-dimension scored review (correctness, completeness, wiring, verification,
436
- drift, quality, documentation). Score 0-70.
437
- This IS the scored final review gate.
355
+ This phase validates the implementation against the **ORIGINAL INPUT** (not the task specs — the executor's per-task reviewer already covered that).
438
356
 
439
- ```bash
440
- wazir capture event --run <run-id> --event phase_exit --phase review --status completed
441
- ```
357
+ ### 4a: Review (reviewer role in final mode)
442
358
 
443
- ### 4j: Learn (learner role) [ADAPTIVE]
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).
444
362
 
445
- Enabled when `phase_policy.learn.enabled = true` (default: false).
446
- Extract durable learnings from the completed run.
447
- No review loop. Learnings require explicit scope tags.
448
- Skip condition: disabled by default. Enable for retrospective runs.
363
+ ### 4b: Learn (learner role)
449
364
 
450
- ### 4k: Prepare Next (planner role) [ADAPTIVE]
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)
451
370
 
452
- Enabled when `phase_policy.prepare_next.enabled = true` (default: false).
453
- Prepare context and handoff for the next run.
454
- No review loop. No implicit carry-forward of unapproved learnings.
455
- Skip condition: disabled by default.
371
+ ### 4c: Prepare Next (planner role)
456
372
 
457
- `run_audit` is NOT part of the pipeline flow -- it is an on-demand standalone phase invoked separately.
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
458
377
 
459
- ### Resume Detection
378
+ ```bash
379
+ wazir capture event --run <run-id> --event phase_exit --phase final_review --status completed
380
+ ```
460
381
 
461
- If the run has partial progress, detect the latest completed phase and resume:
382
+ ---
462
383
 
463
- - If clarification exists but no spec: resume at 4d (specify)
464
- - If spec exists but no design: resume at 4e (brainstorm)
465
- - If design exists but no plan: resume at 4f (plan)
466
- - If plan exists but no task artifacts: resume at 4g (execute)
467
- - If task artifacts exist but no verification: resume at 4h (verify)
468
- - If verification exists: resume at 4i (final review)
384
+ ## Step 5: CHANGELOG + Gitflow Validation (Hard Gates)
469
385
 
470
- Present resume options:
386
+ Before presenting results:
471
387
 
472
- > **Previous progress detected (completed through [phase]).**
473
- >
474
- > **What would you like to do?**
475
- > 1. **Resume from [next phase]** (Recommended)
476
- > 2. **Start fresh** — Re-run all phases from scratch
388
+ ```bash
389
+ wazir validate changelog --require-entries --base main
390
+ wazir validate commits --base main
391
+ ```
392
+
393
+ Both must pass before PR. These are not warnings.
477
394
 
478
- ## Step 5: Present Results
395
+ ## Step 6: Present Results
479
396
 
480
- After the reviewer completes, present the verdict and offer next steps with numbered options:
397
+ After the reviewer completes, present verdict with numbered options:
481
398
 
482
399
  ### If PASS (score 56+):
483
400
 
484
401
  > **Result: PASS (score/70)**
485
402
  >
486
- > [score breakdown]
487
- >
488
- > **What would you like to do?**
489
403
  > 1. **Create a PR** (Recommended)
490
404
  > 2. **Merge directly**
491
405
  > 3. **Review the changes first**
@@ -494,9 +408,6 @@ After the reviewer completes, present the verdict and offer next steps with numb
494
408
 
495
409
  > **Result: NEEDS MINOR FIXES (score/70)**
496
410
  >
497
- > [findings list]
498
- >
499
- > **What would you like to do?**
500
411
  > 1. **Auto-fix and re-review** (Recommended)
501
412
  > 2. **Fix manually**
502
413
  > 3. **Accept as-is**
@@ -505,9 +416,6 @@ After the reviewer completes, present the verdict and offer next steps with numb
505
416
 
506
417
  > **Result: NEEDS REWORK (score/70)**
507
418
  >
508
- > [findings list with affected tasks]
509
- >
510
- > **What would you like to do?**
511
419
  > 1. **Re-run affected tasks** (Recommended)
512
420
  > 2. **Review findings in detail**
513
421
  > 3. **Abandon this run**
@@ -516,14 +424,10 @@ After the reviewer completes, present the verdict and offer next steps with numb
516
424
 
517
425
  > **Result: FAIL (score/70)**
518
426
  >
519
- > [full findings]
520
- >
521
- > Something fundamental went wrong. Review the findings above and decide how to proceed.
427
+ > Something fundamental went wrong. Review the findings above.
522
428
 
523
429
  ### Run Summary
524
430
 
525
- After presenting results (regardless of verdict), capture the run summary:
526
-
527
431
  ```bash
528
432
  wazir capture summary --run <run-id>
529
433
  wazir status --run <run-id> --json
@@ -531,47 +435,31 @@ wazir status --run <run-id> --json
531
435
 
532
436
  ## Error Handling
533
437
 
534
- If any phase fails or the user cancels:
535
-
536
- 1. Report which phase failed and why
537
- 2. Present recovery options:
438
+ If any phase fails:
538
439
 
539
440
  > **Phase [name] failed: [reason]**
540
441
  >
541
- > **What would you like to do?**
542
442
  > 1. **Retry this phase** (Recommended)
543
- > 2. **Skip and continue** (only if phase is adaptive, not core)
443
+ > 2. **Skip and continue** (only if workflows within phase are adaptive)
544
444
  > 3. **Abort the run**
545
445
 
546
- The run config persists, so running `/wazir` again will detect the partial state and offer to resume.
547
-
548
446
  ---
549
447
 
550
448
  # Audit Mode
551
449
 
552
450
  Triggered by `/wazir audit` or `/wazir audit <focus>`.
553
451
 
554
- Runs a structured codebase audit. Invokes the `run-audit` skill with the interactive question flow.
555
-
556
- ## Inline Audit Modifiers
557
-
558
- Parse for known audit types after `audit`:
559
-
560
- - `/wazir audit security` → audit type = security, skip Question 1
561
- - `/wazir audit deps` → audit type = dependencies, skip Question 1
562
- - `/wazir audit` → ask Question 1
452
+ Runs a structured codebase audit. Invokes the `run-audit` skill.
563
453
 
564
- Then let the `run-audit` skill handle the rest (scope, output mode). All its questions already follow the interactive numbered pattern.
454
+ Parse inline audit types: `/wazir audit security` skip Question 1.
565
455
 
566
- After the audit completes:
456
+ After audit:
567
457
 
568
- > **Audit complete. What would you like to do?**
569
- >
570
458
  > 1. **Review the findings** (Recommended)
571
- > 2. **Generate a fix plan** — turn findings into implementation tasks
572
- > 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**
573
461
 
574
- If the user picks option 3, save the findings as the briefing and run the normal pipeline (Steps 3-5) with intent = `bugfix`.
462
+ If option 3, save findings as briefing and run pipeline with intent = `bugfix`.
575
463
 
576
464
  ---
577
465
 
@@ -579,79 +467,10 @@ If the user picks option 3, save the findings as the briefing and run the normal
579
467
 
580
468
  Triggered by `/wazir prd` or `/wazir prd <run-id>`.
581
469
 
582
- Generates a Product Requirements Document from a completed pipeline run.
583
-
584
- ## Pre-Flight
585
-
586
- 1. If a `<run-id>` was provided, use that run's directory. Otherwise, use `.wazir/runs/latest`.
587
- 2. Verify the run has completed artifacts:
588
- - Design doc in the run's tasks or in `docs/plans/`
589
- - Task specs in the run's `clarified/`
590
- - Review results in the run's `reviews/` (if available)
591
- 3. If the run is incomplete or has no artifacts:
592
-
593
- > **No completed run found. Run `/wazir <your request>` first to create a pipeline run, then use `/wazir prd` to generate the PRD.**
594
-
595
- ## Inputs (read-only)
596
-
597
- Read these artifacts from the completed run:
598
- - Approved design document
599
- - Task specs (all `spec.md` files in `clarified/`)
600
- - Execution plan
601
- - Review results and verification proofs (if available)
602
- - Run config (for context on depth, intent, decisions)
603
-
604
- ## Output
605
-
606
- Generate a PRD and save to `docs/prd/YYYY-MM-DD-<topic>-prd.md`.
607
-
608
- ### PRD Template
609
-
610
- ```markdown
611
- # Product Requirements Document — <Topic>
612
-
613
- **Generated from run:** `<run-id>`
614
- **Date:** YYYY-MM-DD
615
-
616
- ## Vision & Core Thesis
617
-
618
- [1-2 paragraphs synthesized from the design document's core approach]
619
-
620
- ## What We're Building
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`.
621
471
 
622
- ### Feature Area 1: <name>
472
+ After generation:
623
473
 
624
- **What:** [description from task specs]
625
- **Why:** [rationale from design doc]
626
- **Requirements:**
627
- - [ ] [from task spec acceptance criteria]
628
- - [ ] ...
629
-
630
- ### Feature Area 2: <name>
631
- ...
632
-
633
- ## Success Criteria
634
-
635
- [From review results and verification proofs — what was tested and confirmed]
636
-
637
- ## Technical Constraints
638
-
639
- [From architecture decisions, run config, and design trade-offs]
640
-
641
- ## What's NOT in Scope
642
-
643
- [From design doc's rejected alternatives and explicit exclusions]
644
-
645
- ## Open Questions
646
-
647
- [From design doc's open questions and review findings]
648
- ```
649
-
650
- ## After Generation
651
-
652
- > **PRD generated at `docs/prd/YYYY-MM-DD-<topic>-prd.md`.**
653
- >
654
- > **What would you like to do?**
655
474
  > 1. **Review the PRD** (Recommended)
656
475
  > 2. **Commit it**
657
476
  > 3. **Edit before committing**
@@ -660,8 +479,6 @@ Generate a PRD and save to `docs/prd/YYYY-MM-DD-<topic>-prd.md`.
660
479
 
661
480
  ## Interaction Rules
662
481
 
663
- These rules apply to ALL questions in the pipeline, including those asked by sub-skills (clarifier, executor, reviewer) and audit modes:
664
-
665
482
  - **One question at a time** — never combine multiple questions
666
483
  - **Numbered options** — always present choices as numbered lists
667
484
  - **Mark defaults** — always show "(Recommended)" on the suggested option