@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
@@ -0,0 +1,260 @@
1
+ ---
2
+ name: wz:codex-cli
3
+ description: How to use Codex CLI programmatically for reviews, execution, and sandbox operations within Wazir pipelines.
4
+ ---
5
+
6
+ # Codex CLI Integration
7
+
8
+ ## Command Routing
9
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
10
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
11
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
12
+ - If context-mode unavailable, fall back to native Bash with warning
13
+
14
+ ## Codebase Exploration
15
+ 1. Query `wazir index search-symbols <query>` first
16
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
17
+ 3. Fall back to direct file reads ONLY for files identified by index queries
18
+ 4. Maximum 10 direct file reads without a justifying index query
19
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
20
+
21
+ Reference for using the OpenAI Codex CLI in Wazir pipelines. Codex is a terminal-based coding agent that reads your codebase, suggests or implements changes, and executes commands with OS-level sandboxing.
22
+
23
+ ## Commands
24
+
25
+ ### codex (interactive)
26
+
27
+ Launch the interactive TUI. Default mode for ad-hoc work.
28
+
29
+ ```bash
30
+ codex "Fix the failing test in src/auth.ts"
31
+ ```
32
+
33
+ ### codex exec
34
+
35
+ Run Codex non-interactively (alias: `codex e`). Streams results to stdout or JSONL. This is the primary command for Wazir automation.
36
+
37
+ ```bash
38
+ # Basic non-interactive run
39
+ codex exec "Refactor the auth module to use async/await"
40
+
41
+ # Pipe a long prompt from stdin
42
+ cat prompt.md | codex exec -
43
+
44
+ # JSON event stream for programmatic consumption
45
+ codex exec --json "Add error handling to all API routes"
46
+
47
+ # Write final assistant message to a file
48
+ codex exec --output-file result.md "Summarize the codebase architecture"
49
+
50
+ # Enforce structured output with a JSON schema
51
+ codex exec --output-schema schema.json "List all exported functions"
52
+
53
+ # Ephemeral run (no session files persisted)
54
+ codex exec --ephemeral "Quick check: does this file import lodash?"
55
+ ```
56
+
57
+ **Key flags:**
58
+
59
+ | Flag | Description |
60
+ |------|-------------|
61
+ | `--model <MODEL>` | Override the configured model (e.g., `gpt-5.4`, `gpt-5.4-mini`) |
62
+ | `--json` | Emit newline-delimited JSON events (JSONL) instead of formatted text |
63
+ | `--output-file <PATH>` | Write the final assistant message to a file |
64
+ | `--output-schema <PATH>` | Enforce structured output conforming to a JSON schema |
65
+ | `--ephemeral` | Run without persisting session rollout files |
66
+ | `--full-auto` | Apply the low-friction automation preset (`workspace-write` sandbox + `on-request` approvals) |
67
+ | `--dangerously-bypass-approvals-and-sandbox` / `--yolo` | Bypass all approval prompts and sandboxing (use only inside isolated runners) |
68
+ | `-c key=value` | Set a config override (e.g., `-c model=gpt-5.4`) |
69
+
70
+ **JSONL event types:** `thread.started`, `turn.started`, `turn.completed`, `turn.failed`, `item.message`, `item.command`, `item.file_change`, `item.mcp_tool_call`.
71
+
72
+ ### codex review
73
+
74
+ Dedicated code review command. This is what Wazir uses for secondary review in the reviewer skill.
75
+
76
+ ```bash
77
+ # Review uncommitted changes (staged + unstaged + untracked)
78
+ codex review --uncommitted
79
+
80
+ # Review changes against a base branch
81
+ codex review --base main
82
+
83
+ # Review a specific commit
84
+ codex review --commit d5853d9
85
+
86
+ # Review with custom instructions
87
+ codex review --uncommitted "Check for security vulnerabilities and missing error handling"
88
+
89
+ # Review with model override
90
+ codex review --model gpt-5.4 --base main "Review against these acceptance criteria: ..."
91
+ ```
92
+
93
+ **Key flags:**
94
+
95
+ | Flag | Description |
96
+ |------|-------------|
97
+ | `--uncommitted` | Review staged, unstaged, and untracked changes |
98
+ | `--base <BRANCH>` | Review changes against a given base branch |
99
+ | `--commit <SHA>` | Review the changes introduced by a specific commit |
100
+ | `--model <MODEL>` | Override the model for this review |
101
+ | `[PROMPT]` | Optional custom review instructions (positional argument) |
102
+
103
+ ### codex resume
104
+
105
+ Resume a previous interactive session.
106
+
107
+ ```bash
108
+ # Open session picker
109
+ codex resume
110
+
111
+ # Resume most recent session in current directory
112
+ codex resume --last
113
+
114
+ # Resume most recent session from any directory
115
+ codex resume --last --all
116
+
117
+ # Resume a specific session by ID
118
+ codex resume <SESSION_ID>
119
+ ```
120
+
121
+ ### codex fork
122
+
123
+ Fork a previous session into a new thread, preserving the original transcript. Useful for exploring alternative approaches in parallel.
124
+
125
+ ### codex cloud
126
+
127
+ Browse or execute Codex Cloud tasks from the terminal without opening the TUI.
128
+
129
+ ### codex execpolicy
130
+
131
+ Evaluate execpolicy rule files and check whether a command would be allowed, prompted, or blocked.
132
+
133
+ ### codex auth
134
+
135
+ Authenticate Codex using ChatGPT OAuth, device auth, or an API key piped over stdin.
136
+
137
+ ### codex completion
138
+
139
+ Generate shell completion scripts for Bash, Zsh, Fish, or PowerShell.
140
+
141
+ ## Sandbox Modes
142
+
143
+ Codex provides OS-level sandboxing to protect your system.
144
+
145
+ | Sandbox Mode | Description |
146
+ |-------------|-------------|
147
+ | `read-only` | Codex can only read files, no writes or commands |
148
+ | `workspace-write` | Codex can write files in the workspace but external commands are sandboxed |
149
+ | `danger-full-access` | Full system access with no restrictions (use only in VMs/containers) |
150
+
151
+ ## Approval Policies
152
+
153
+ | Policy | Description |
154
+ |--------|-------------|
155
+ | `suggest` | Default. Every action requires explicit approval before execution |
156
+ | `auto-edit` | Auto-approves file edits but still requires approval for shell commands |
157
+ | `full-auto` | Autonomous mode; executes everything without confirmation |
158
+
159
+ **Preset shortcut:** `--full-auto` sets `sandbox_mode=workspace-write` + `approval_policy=on-request`.
160
+
161
+ **Granular control:** Set `approval_policy` to `"on-request"`, `"untrusted"`, or `"never"` in config. You can also define per-command allow/reject rules.
162
+
163
+ ## Model Selection
164
+
165
+ | Model | Best For | Notes |
166
+ |-------|----------|-------|
167
+ | `gpt-5.4` | Complex coding, reasoning, professional workflows | Recommended default |
168
+ | `gpt-5.4-mini` | Faster, lower-cost tasks, subagents | Uses ~30% of gpt-5.4 quota |
169
+ | `gpt-5.3-codex-spark` | Near-instant real-time coding iteration | Research preview, Pro subscribers |
170
+
171
+ Select via `--model <model>` flag or `-c model=<model>` config override.
172
+
173
+ ## Non-Interactive Usage
174
+
175
+ ### Piping prompts
176
+
177
+ ```bash
178
+ # Pipe from stdin
179
+ cat prompt.md | codex exec -
180
+
181
+ # Pipe a diff for review
182
+ git diff main | codex exec - "Review this diff for bugs"
183
+ ```
184
+
185
+ ### Structured output
186
+
187
+ ```bash
188
+ # JSONL event stream
189
+ codex exec --json "Analyze the test coverage"
190
+
191
+ # Schema-enforced output
192
+ codex exec --output-schema schema.json "List all API endpoints"
193
+ ```
194
+
195
+ ### Capturing output
196
+
197
+ ```bash
198
+ # Write final message to file
199
+ codex exec --output-file result.md "Summarize changes since v2.0"
200
+
201
+ # Tee for both display and capture
202
+ codex exec "Review this code" 2>&1 | tee review-output.md
203
+ ```
204
+
205
+ ## Wazir Integration Patterns
206
+
207
+ ### Secondary Review (used by wz:reviewer)
208
+
209
+ ```bash
210
+ CODEX_MODEL=$(jq -r '.multi_tool.codex.model // empty' .wazir/state/config.json 2>/dev/null)
211
+ CODEX_MODEL=${CODEX_MODEL:-gpt-5.4}
212
+
213
+ # Review uncommitted changes
214
+ codex review -c model="$CODEX_MODEL" --uncommitted \
215
+ "Review against these acceptance criteria: <criteria>" \
216
+ 2>&1 | tee .wazir/runs/latest/reviews/codex-review.md
217
+
218
+ # Review committed changes against a base branch
219
+ codex review -c model="$CODEX_MODEL" --base main \
220
+ "Review against these acceptance criteria: <criteria>" \
221
+ 2>&1 | tee .wazir/runs/latest/reviews/codex-review.md
222
+ ```
223
+
224
+ ### Non-Code Artifact Review
225
+
226
+ For reviewing specs, designs, and plans (not code diffs):
227
+
228
+ ```bash
229
+ cat artifact.md | codex exec -c model="$CODEX_MODEL" - \
230
+ "Review this spec against these criteria: <criteria>" \
231
+ 2>&1 | tee .wazir/runs/latest/reviews/codex-review.md
232
+ ```
233
+
234
+ ### Parallel Execution
235
+
236
+ Use Codex as an external validator alongside the primary Wazir review:
237
+
238
+ ```bash
239
+ # Run Codex review in background, merge findings later
240
+ codex review --uncommitted "Check for security issues" \
241
+ > .wazir/runs/latest/reviews/codex-security.md 2>&1 &
242
+ ```
243
+
244
+ ## Error Handling
245
+
246
+ | Error | Handling |
247
+ |-------|----------|
248
+ | **Non-zero exit** (auth/rate-limit/transport) | Log full stderr, mark pass as `codex-unavailable`, use self-review only for that pass. Next pass re-attempts Codex (transient failures may recover). |
249
+ | **Timeout** | Set reasonable timeouts via shell (`timeout 120 codex review ...`). If exceeded, treat as `codex-unavailable`. |
250
+ | **Model unavailable** | Fall back to `gpt-5.4-mini` if primary model is overloaded. |
251
+ | **Rate limiting** | Respect retry-after headers. Space sequential calls by at least 5 seconds. |
252
+
253
+ ## Configuration
254
+
255
+ Codex CLI reads configuration from:
256
+ - `~/.codex/config.yaml` or `~/.codex/config.json` (global)
257
+ - `.codex/config.yaml` in the project root (project-level)
258
+ - Command-line flags and `-c key=value` overrides (highest precedence)
259
+
260
+ Key config fields: `model`, `approval_policy`, `sandbox_mode`, `providers`.
@@ -5,6 +5,19 @@ description: Use when behavior is wrong or verification fails. Follow an observe
5
5
 
6
6
  # Debugging
7
7
 
8
+ ## Command Routing
9
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
10
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
11
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
12
+ - If context-mode unavailable, fall back to native Bash with warning
13
+
14
+ ## Codebase Exploration
15
+ 1. Query `wazir index search-symbols <query>` first
16
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
17
+ 3. Fall back to direct file reads ONLY for files identified by index queries
18
+ 4. Maximum 10 direct file reads without a justifying index query
19
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
20
+
8
21
  > **Note:** This skill uses Wazir CLI commands for symbol-first code
9
22
  > exploration. If the CLI index is unavailable, fall back to direct file reads —
10
23
  > the generic OBSERVE methodology (read files, inspect state, gather evidence)
@@ -7,6 +7,19 @@ description: Guide the designer role through open-pencil MCP workflow to produce
7
7
 
8
8
  Use open-pencil MCP tools to create visual designs from the approved spec.
9
9
 
10
+ ## Command Routing
11
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
12
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
13
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
14
+ - If context-mode unavailable, fall back to native Bash with warning
15
+
16
+ ## Codebase Exploration
17
+ 1. Query `wazir index search-symbols <query>` first
18
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
19
+ 3. Fall back to direct file reads ONLY for files identified by index queries
20
+ 4. Maximum 10 direct file reads without a justifying index query
21
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
22
+
10
23
  ## Prerequisites
11
24
 
12
25
  - open-pencil MCP server running (`openpencil-mcp` or `openpencil-mcp-http`)
@@ -5,6 +5,19 @@ description: Use when facing 2+ independent tasks that can be worked on without
5
5
 
6
6
  # Dispatching Parallel Agents
7
7
 
8
+ ## Command Routing
9
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
10
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
11
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
12
+ - If context-mode unavailable, fall back to native Bash with warning
13
+
14
+ ## Codebase Exploration
15
+ 1. Query `wazir index search-symbols <query>` first
16
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
17
+ 3. Fall back to direct file reads ONLY for files identified by index queries
18
+ 4. Maximum 10 direct file reads without a justifying index query
19
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
20
+
8
21
  ## Overview
9
22
 
10
23
  You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
@@ -5,6 +5,19 @@ description: Use when you have a written implementation plan to execute in a sep
5
5
 
6
6
  # Executing Plans
7
7
 
8
+ ## Command Routing
9
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
10
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
11
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
12
+ - If context-mode unavailable, fall back to native Bash with warning
13
+
14
+ ## Codebase Exploration
15
+ 1. Query `wazir index search-symbols <query>` first
16
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
17
+ 3. Fall back to direct file reads ONLY for files identified by index queries
18
+ 4. Maximum 10 direct file reads without a justifying index query
19
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
20
+
8
21
  ## Overview
9
22
 
10
23
  Load plan, review critically, execute all tasks with per-task review checkpoints, report when complete.
@@ -5,13 +5,53 @@ description: Run the execution phase — implement the approved plan with TDD, q
5
5
 
6
6
  # Executor
7
7
 
8
- Run Phase 2 (Execute) for the current project.
8
+ ## Model Annotation
9
+ When multi-model mode is enabled, the executor phase uses:
10
+ - **Sonnet** for per-task implementation (write-implementation)
11
+ - **Sonnet** for per-task review (task-review)
12
+ - **Sonnet** for test execution (run-tests)
13
+ - **Opus** for orchestration decisions
14
+
15
+ ## Command Routing
16
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
17
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
18
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
19
+ - If context-mode unavailable, fall back to native Bash with warning
20
+
21
+ ## Codebase Exploration
22
+ 1. Query `wazir index search-symbols <query>` first
23
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
24
+ 3. Fall back to direct file reads ONLY for files identified by index queries
25
+ 4. Maximum 10 direct file reads without a justifying index query
26
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
27
+
28
+ Run the Executor phase — implement the approved plan, then verify all claims.
29
+
30
+ ## Phase Prerequisites (Hard Gate)
31
+
32
+ Before proceeding, verify these artifacts exist. Check each file. If ANY file is missing, **STOP immediately** and report:
33
+
34
+ > **Cannot start Executor phase: missing prerequisite artifacts.**
35
+ >
36
+ > Missing:
37
+ > - [list missing files]
38
+ >
39
+ > Run `/wazir:clarifier` to produce the missing artifacts.
40
+
41
+ Required artifacts:
42
+ - [ ] `.wazir/runs/latest/clarified/clarification.md`
43
+ - [ ] `.wazir/runs/latest/clarified/spec-hardened.md`
44
+ - [ ] `.wazir/runs/latest/clarified/design.md`
45
+ - [ ] `.wazir/runs/latest/clarified/execution-plan.md`
46
+
47
+ **This is a hard gate. Do NOT proceed without all artifacts. Do NOT rationalize that the input is "clear enough" to skip phases. The existence of detailed input does NOT replace the pipeline's clarification, specification, design, and planning phases.**
48
+
49
+ **Standalone mode exception:** If `.wazir/runs/latest/` does not exist at all, operate in standalone mode (skip this check).
9
50
 
10
51
  ## Prerequisites
11
52
 
12
- 1. Check `.wazir/runs/latest/clarified/execution-plan.md` exists. If not, tell the user to run `/wazir:clarifier` first.
13
- 2. Read the execution plan and task specs from `.wazir/runs/latest/tasks/`.
14
- 3. Read `.wazir/state/config.json` for team_mode and depth settings.
53
+ 1. Read the execution plan from `.wazir/runs/latest/clarified/execution-plan.md`.
54
+ 2. Read `.wazir/state/config.json` for depth settings.
15
55
 
16
56
  ## Pre-Execution Validation
17
57
 
@@ -21,41 +61,54 @@ Run these checks before implementing:
21
61
 
22
62
  If either fails, surface the failure and do NOT proceed until resolved.
23
63
 
24
- ## Execution
64
+ ## Execute (execute workflow)
25
65
 
26
66
  Implement tasks in the order defined by the execution plan.
27
67
 
28
68
  For each task:
29
69
 
30
- 1. **Read** the task spec at `.wazir/runs/latest/tasks/task-NNN/spec.md`
70
+ 1. **Read** the task from the execution plan
31
71
  2. **Implement** using TDD (write test first, make it pass, refactor)
32
- 3. **Verify** — run tests, type checks, linting as appropriate
72
+ 3. **Verify locally** — run tests, type checks, linting as appropriate
33
73
  4. **Review BEFORE commit** (per-task review, NOT final review):
34
74
  - Reviewer runs task-review loop with `--mode task-review` using 5 task-execution dimensions (correctness, tests, wiring, drift, quality)
35
- - Reads the Codex model from config: `CODEX_MODEL=$(jq -r '.multi_tool.codex.model // empty' .wazir/state/config.json 2>/dev/null); CODEX_MODEL=${CODEX_MODEL:-gpt-5.4}`
75
+ - Reads Codex model from config: `CODEX_MODEL=$(jq -r '.multi_tool.codex.model // empty' .wazir/state/config.json 2>/dev/null); CODEX_MODEL=${CODEX_MODEL:-gpt-5.4}`
36
76
  - Uses `codex review -c model="$CODEX_MODEL" --uncommitted` for the current task's changes
37
- - Codex error handling: if codex exits non-zero, log error, mark pass as `codex-unavailable`, use self-review only for that pass. Do NOT treat a Codex failure as a clean review. Do NOT skip the pass. The next pass still attempts Codex (transient failures may recover).
77
+ - Codex error handling: if codex exits non-zero, log error, mark pass as `codex-unavailable`, use self-review only for that pass. Do NOT skip. Next pass still attempts Codex.
38
78
  - Executor resolves findings, reviewer re-reviews
39
79
  - Loop runs for `pass_counts[depth]` passes (quick=3, standard=5, deep=7). No extension.
40
80
  - Review logs: `.wazir/runs/latest/reviews/execute-task-<NNN>-review-pass-<N>.md`
41
- - Loop cap tracking: `wazir capture loop-check --task-id <NNN>` (each task has its own cap counter)
81
+ - Loop cap tracking: `wazir capture loop-check --task-id <NNN>`
42
82
  - See `docs/reference/review-loop-pattern.md` for full protocol
43
- - NOTE: this is the per-task review (5 dims), not the final scored review (7 dims) which runs later in `/wazir:reviewer --mode final`
83
+ - NOTE: this is the per-task review (5 dims), not the final scored review (7 dims) which runs in Phase 4
44
84
  5. **Commit** — only after review passes, commit with conventional commit format: `<type>(<scope>): <description>`
45
- 6. **CHANGELOG** — if the change is user-facing (new feature, behavior change, bug fix visible to users), update `CHANGELOG.md` `[Unreleased]` section. If not user-facing (refactor, internal tooling, tests), skip.
85
+ 6. **CHANGELOG** — if user-facing change, update `CHANGELOG.md` under `[Unreleased]` using keepachangelog types: Added, Changed, Fixed, Removed, Deprecated, Security.
46
86
  7. **Record** evidence at `.wazir/runs/latest/artifacts/task-NNN/`
47
87
 
48
- Review loops follow the pattern in `docs/reference/review-loop-pattern.md`. Code review scoping: review uncommitted changes before commit. If changes are already committed (subagent workflow), use `codex review -c model="$CODEX_MODEL" --base <pre-task-sha>`.
88
+ Review loops follow `docs/reference/review-loop-pattern.md`. Code review scoping: review uncommitted changes before commit. If changes are committed, use `--base <pre-task-sha>`.
89
+
90
+ Tasks always run sequentially.
91
+
92
+ **Standalone mode:** When no `.wazir/runs/latest/` exists, review logs go to `docs/plans/`.
93
+
94
+ ## Verify (verify workflow)
95
+
96
+ After all tasks are complete, run deterministic verification:
49
97
 
50
- If `team_mode: parallel` in config, spawn Agent Teams for independent tasks. Otherwise, tasks run sequentially.
98
+ 1. Run the full test suite
99
+ 2. Run type checks (if applicable)
100
+ 3. Run linters
101
+ 4. Verify all acceptance criteria from the spec have evidence
102
+ 5. Produce verification proof at `.wazir/runs/latest/artifacts/verification-proof.md`
51
103
 
52
- **Standalone mode:** When no `.wazir/runs/latest/` exists, review logs go to `docs/plans/` alongside the artifact.
104
+ This is NOT a review loop — it produces proof, not findings. If verification fails, report which criteria lack evidence and offer to fix.
53
105
 
54
106
  ## Context Retrieval
55
107
 
56
108
  - Use `wazir index search-symbols <query>` to locate relevant code before reading
57
109
  - Read full files directly when editing or verifying
58
110
  - Use `wazir recall file <path> --tier L1` for files you need to understand but not modify
111
+ - When dispatching subagents, include: "Use wazir index search-symbols before direct file reads."
59
112
 
60
113
  ## Escalation
61
114
 
@@ -66,11 +119,11 @@ Pause and ask the user when:
66
119
 
67
120
  ## Done
68
121
 
69
- When all tasks are complete, present:
122
+ When all tasks are complete and verified:
70
123
 
71
- > **Execution complete.**
124
+ > **Executor phase complete.**
72
125
  >
73
126
  > - Tasks: [completed]/[total] implemented
74
- > - Artifacts: `.wazir/runs/latest/artifacts/`
127
+ > - Verification: proof at `.wazir/runs/latest/artifacts/verification-proof.md`
75
128
  >
76
- > **Next:** Run `/wazir:reviewer --mode final` to review the changes, or `/wazir` for the full pipeline.
129
+ > **Next:** Run `/reviewer --mode final` to review against the original input.
@@ -5,6 +5,19 @@ description: Use when implementation is complete, all tests pass, and you need t
5
5
 
6
6
  # Finishing a Development Branch
7
7
 
8
+ ## Command Routing
9
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
10
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
11
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
12
+ - If context-mode unavailable, fall back to native Bash with warning
13
+
14
+ ## Codebase Exploration
15
+ 1. Query `wazir index search-symbols <query>` first
16
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
17
+ 3. Fall back to direct file reads ONLY for files identified by index queries
18
+ 4. Maximum 10 direct file reads without a justifying index query
19
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
20
+
8
21
  ## Overview
9
22
 
10
23
  Guide completion of development work by presenting clear options and handling chosen workflow.