@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
@@ -1,119 +1,117 @@
1
1
  ---
2
2
  name: wz:init-pipeline
3
- description: Initialize the Wazir pipeline with interactive setup. Creates project directories, selects mode, and configures the pipeline.
3
+ description: Initialize the Wazir pipeline zero-config by default, auto-detects host and project stack. No mandatory questions.
4
4
  ---
5
5
 
6
6
  # Initialize Pipeline
7
7
 
8
- Set up the Wazir pipeline for this project. All questions use numbered interactive options one question at a time.
8
+ Set up the Wazir pipeline for this project. **Zero-config by default** everything is auto-detected and sensibly defaulted. No questions unless the user explicitly asks for interactive mode.
9
9
 
10
- ## Step 0: Check Wazir CLI
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
+
23
+ ## Zero-Config Flow (Default)
24
+
25
+ ### Step 1: Check Wazir CLI
11
26
 
12
27
  Run `which wazir` to check if the CLI is installed.
13
28
 
14
29
  **If not installed**, present:
15
30
 
16
- > **The Wazir CLI is not installed. It's required for event capture, validation, and indexing.**
31
+ > **The Wazir CLI is not installed. Install with:**
17
32
  >
18
- > **How would you like to install it?**
19
- >
20
- > 1. **npm** (Recommended) — `npm install -g wazir`
33
+ > 1. **npm** (Recommended) `npm install -g @wazir-dev/cli`
21
34
  > 2. **Local link** — `npm link` from the Wazir project root
22
- > 3. **Skip** — Continue without the CLI (some features will be unavailable)
23
-
24
- If the user picks 1, run `npm install -g wazir` and verify with `wazir --version`.
25
- If the user picks 2, run `npm link` from the project root and verify.
26
- If the user picks 3, warn that `wazir capture`, `wazir validate`, and `wazir index` commands will not work, then continue.
27
35
 
28
- **If installed**, run `wazir doctor --json` to verify repo health and continue.
36
+ ### Step 2: Auto-Initialize
29
37
 
30
- ## Step 1: Create Project Directories
38
+ Run `wazir init` (default: auto mode). This automatically:
31
39
 
32
- ```bash
33
- mkdir -p .wazir/input .wazir/state .wazir/runs
34
- ```
40
+ 1. **Creates directories:** `.wazir/input/`, `.wazir/state/`, `.wazir/runs/`
41
+ 2. **Detects host:** Claude Code / Codex / Gemini / Cursor from environment variables and file markers
42
+ 3. **Detects project stack:** Language, framework, and stack from package files
43
+ 4. **Detects context-mode MCP:** Checks for core tools (`execute`, `fetch_and_index`, `search`)
44
+ 5. **Writes config** with sensible defaults:
45
+ - `model_mode: "claude-only"` (override: `wazir config set model_mode multi-model`)
46
+ - `default_depth: "standard"` (override per-run: `/wazir deep ...`)
47
+ - `default_intent: "feature"` (inferred per-run from request text)
48
+ - `team_mode: "sequential"` (always)
49
+ 6. **Auto-exports** for the detected host
35
50
 
36
- ## Step 2: Choose Pipeline Mode
51
+ **No questions asked.** The pipeline is ready to use immediately.
37
52
 
38
- Present this question:
53
+ ### Step 3: Confirm
39
54
 
40
- > **How should Wazir run in this project?**
55
+ > **Wazir initialized.**
41
56
  >
42
- > 1. **Claude only** (Recommended) Everything runs in Claude Code. Single model, slash commands only.
43
- > 2. **Multi-model** — Still Claude Code, but routes tasks by complexity (Haiku for micro, Sonnet for standard, Opus for complex).
44
- > 3. **Multi-tool** — Claude Code + external tools for reviews.
45
-
46
- Wait for the user to answer before continuing.
47
-
48
- ## Step 3: If Multi-Tool, Choose Tools
49
-
50
- Only ask this if the user selected option 3:
51
-
52
- > **Which external tools should Wazir use for reviews?**
57
+ > Host: [detected host] | Stack: [detected language/framework]
53
58
  >
54
- > 1. **Codex** Send reviews to OpenAI Codex
55
- > 2. **Gemini** — Send reviews to Google Gemini
56
- > 3. **Both** — Use Codex and Gemini as secondary reviewers
57
-
58
- Wait for the user to answer before continuing.
59
+ > Next: `/wazir <what you want to build>`
59
60
 
60
- ## Step 4: Write Config
61
+ ---
61
62
 
62
- Create/update `.wazir/state/config.json`:
63
+ ## Interactive Flow (Power Users)
63
64
 
64
- - Set `model_mode` to the selected mode (`claude-only`, `multi-model`, or `multi-tool`)
65
- - If `multi-tool`, set `multi_tool.tools` to the selected tools (e.g. `["codex"]`, `["gemini"]`, or `["codex", "gemini"]`)
65
+ Triggered by `wazir init --interactive`. For users who want manual control.
66
66
 
67
- Example for claude-only:
68
- ```json
69
- {
70
- "model_mode": "claude-only"
71
- }
72
- ```
67
+ ### Pipeline Mode
73
68
 
74
- Example for multi-tool with codex:
75
- ```json
76
- {
77
- "model_mode": "multi-tool",
78
- "multi_tool": {
79
- "tools": ["codex"]
80
- }
81
- }
82
- ```
69
+ > **How should Wazir run in this project?**
70
+ >
71
+ > 1. **Single model** (Recommended) — slash commands only
72
+ > 2. **Multi-model** — routes sub-tasks to cheapest capable model (Haiku/Sonnet/Opus)
73
+ > 3. **Multi-tool** — current model + external tools for reviews
83
74
 
84
- ## Step 5: Runtime-Specific Setup
75
+ **If multi-model selected:** The model router (`tooling/src/adapters/model-router.js`) assigns automatically:
76
+ - **Haiku** for mechanical tasks (URL fetching, file ops, compression)
77
+ - **Sonnet** for comprehension tasks (implementation, reviews, learning extraction)
78
+ - **Opus** for judgment tasks (orchestration, design, spec hardening, final review)
85
79
 
86
- Based on `multi_tool.tools`:
80
+ Override via `model_overrides` in config.
87
81
 
88
- - If **codex** is selected: Create `AGENTS.md` in project root:
89
- ```
90
- # Wazir Pipeline
82
+ ### External Tools (if multi-tool)
91
83
 
92
- Agent protocols are at `~/.claude/agents/` (global).
84
+ > **Which external tools for reviews?**
85
+ >
86
+ > 1. **Codex** (Recommended)
87
+ > 2. **Gemini**
88
+ > 3. **Both**
93
89
 
94
- ## Running the Pipeline
95
- 1. Clarifier: read and follow `~/.claude/agents/clarifier.md` — tasks are in `.wazir/input/`
96
- 2. Orchestrator: read and follow `~/.claude/agents/orchestrator.md` — start from task 1
97
- 3. Opus Reviewer: read and follow `~/.claude/agents/opus-reviewer.md`run all phases
90
+ If Codex selected:
91
+ > **Codex model?**
92
+ >
93
+ > 1. **gpt-5.3-codex-spark** (Recommended) Fast review loops
94
+ > 2. **gpt-5.4** — Deeper analysis
98
95
 
99
- ## Review Mode
100
- This project uses Codex as a secondary reviewer. Review artifacts are in `.wazir/reviews/`.
101
- ```
96
+ ---
102
97
 
103
- - If **gemini** is selected: Create `GEMINI.md` in project root with the same content adapted for Gemini.
98
+ ## Install Paths
104
99
 
105
- - If **both**: Create both files.
100
+ | Path | Command | Who |
101
+ |------|---------|-----|
102
+ | Plugin marketplace | `/plugin install wazir` | Claude Code users |
103
+ | npx (zero install) | `npx @wazir-dev/cli` | Any Node project |
104
+ | Global install | `npm i -g @wazir-dev/cli` | Power users |
105
+ | Clone + link | `git clone && npm link` | Contributors |
106
106
 
107
- ## Step 6: Confirm
107
+ ## Deep When You Need It
108
108
 
109
- List all files created and show the selected mode. Then present:
109
+ - `wazir config set <key> <value>` override any default
110
+ - `wazir doctor` — see what's configured
111
+ - `wazir stats` — see what Wazir saved you
112
+ - `wazir init --interactive` — full manual setup
110
113
 
111
- > **Pipeline initialized. You can now use:**
112
- >
113
- > - `/wazir <your request>` — Run the full pipeline end-to-end
114
- > - `/clarifier` — Run Phase 0 + Phase 1 only (research, clarify, plan)
115
- > - `/executor` — Run Phase 2 only (autonomous execution)
116
- > - `/reviewer` — Run Phase 3 only (final review and scoring)
114
+ **Principle:** Like git — `git init` is one command, `git config` is deep. Instant start, deep when you need it.
117
115
 
118
116
  ## Interaction Rules
119
117
 
@@ -5,16 +5,87 @@ description: Use after a run or execution slice completes to produce a clean nex
5
5
 
6
6
  # Prepare Next
7
7
 
8
- Create a next-run handoff that captures:
8
+ ## Model Annotation
9
+ When multi-model mode is enabled:
10
+ - **Haiku** for file operations (write-handoff, compress-archive)
11
+ - **Sonnet** for learning extraction (extract-learnings)
9
12
 
10
- - current status
11
- - completed work
12
- - unresolved blockers
13
- - required approvals
14
- - explicitly accepted learnings only
13
+ ## Command Routing
14
+ Follow the Canonical Command Matrix in `hooks/routing-matrix.json`.
15
+ - Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
16
+ - Small commands (git status, ls, pwd, wazir CLI) → native Bash
17
+ - If context-mode unavailable, fall back to native Bash with warning
15
18
 
16
- Rules:
19
+ ## Codebase Exploration
20
+ 1. Query `wazir index search-symbols <query>` first
21
+ 2. Use `wazir recall file <path> --tier L1` for targeted reads
22
+ 3. Fall back to direct file reads ONLY for files identified by index queries
23
+ 4. Maximum 10 direct file reads without a justifying index query
24
+ 5. If no index exists: `wazir index build && wazir index summarize --tier all`
17
25
 
18
- - do not mutate `input/`
19
- - do not auto-load proposed or unreviewed learnings into the next run
20
- - write the handoff using the `templates/artifacts/next-run-handoff.md` structure
26
+ Create a next-run handoff that captures the run outcome and sets up the next session.
27
+
28
+ ## When to Run
29
+
30
+ One of:
31
+
32
+ 1. **Full completion** — All 4 phases are done, review is accepted, learnings are proposed. Prepare the next feature's starting point.
33
+ 2. **Partial completion** — The session is ending before the pipeline finishes. Prepare a mid-pipeline handoff so the next session can resume.
34
+ 3. **Slice boundary** — The approved plan is being executed in multiple slices. Prepare the handoff between slices.
35
+
36
+ ## Step 1: Gather Run State
37
+
38
+ Read from the current run directory:
39
+
40
+ - `run-config.yaml` — run identity, intent, depth
41
+ - `reviews/review.md` — final review verdict and score (if complete)
42
+ - `reviews/` — all review pass logs
43
+ - `artifacts/` — task completion evidence
44
+ - `clarified/` — spec, design, plan artifacts
45
+ - Git log since branch creation: `git log --oneline main..HEAD`
46
+
47
+ ## Step 2: Write Handoff
48
+
49
+ Write to `.wazir/runs/<run-id>/handoff.md` using this structure:
50
+
51
+ ```markdown
52
+ # Handoff — <run-id>
53
+
54
+ **Status:** [Completed | Partial | Slice N of M]
55
+ **Branch:** <branch-name>
56
+ **Date:** YYYY-MM-DD
57
+
58
+ ## What Was Done
59
+ [List of completed tasks with commit hashes]
60
+
61
+ ## Commits
62
+ [git log --oneline of all commits in this run]
63
+
64
+ ## Test Results
65
+ [Test count, pass/fail, validator status]
66
+
67
+ ## Review Score
68
+ [Verdict, score, key findings if applicable]
69
+
70
+ ## What's Next
71
+ [Pending items, deferred work, follow-up tasks]
72
+
73
+ ## Open Bugs
74
+ [Any known issues discovered during this run]
75
+
76
+ ## Learnings From This Run
77
+ [Key insights — what worked, what didn't]
78
+ ```
79
+
80
+ ## Step 3: Run Summary
81
+
82
+ ```bash
83
+ wazir capture summary --run <run-id>
84
+ ```
85
+
86
+ ## Rules
87
+
88
+ - Do NOT mutate `input/` — it belongs to the user
89
+ - Do NOT auto-load proposed or unreviewed learnings into the next run
90
+ - Do NOT carry forward stale context — each new run reads fresh state
91
+ - Do NOT compress or delete files the user might need — only archive verbose intermediate logs
@@ -5,12 +5,33 @@ description: Use when receiving code review feedback, before implementing sugges
5
5
 
6
6
  # Code Review Reception
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
  Code review requires technical evaluation, not emotional performance.
11
24
 
12
25
  **Core principle:** Verify before implementing. Ask before assuming. Technical correctness over social comfort.
13
26
 
27
+ ## Loop Tracking
28
+
29
+ When receiving review findings, the fix-and-re-review cycle follows the review loop pattern:
30
+ - **Pipeline mode** (`.wazir/runs/latest/` exists): track iterations via `wazir capture loop-check`. If the cap is reached (exit 43), escalate to the user with current state and evidence.
31
+ - **Standalone mode** (no `.wazir/runs/latest/`): the loop runs for `pass_counts[depth]` passes (quick=3, standard=5, deep=7) with no cap guard. Track iteration count manually.
32
+
33
+ Reference `docs/reference/review-loop-pattern.md` for the full loop contract.
34
+
14
35
  ## The Response Pattern
15
36
 
16
37
  ```
@@ -5,9 +5,22 @@ description: Use when completing tasks, implementing major features, or before m
5
5
 
6
6
  # Requesting Code Review
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
  Dispatch wz:code-reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history. This keeps the reviewer focused on the work product, not your thought process, and preserves your own context for continued work.
9
22
 
10
- **Core principle:** Review early, review often.
23
+ **Core principle:** Review early, review often. Review follows the loop pattern in `docs/reference/review-loop-pattern.md`. Dispatch the reviewer with explicit `--mode` and depth-aware loop parameters.
11
24
 
12
25
  ## When to Request Review
13
26
 
@@ -23,22 +36,36 @@ Dispatch wz:code-reviewer subagent to catch issues before they cascade. The revi
23
36
 
24
37
  ## How to Request
25
38
 
26
- **1. Get git SHAs:**
39
+ **1. Get git SHAs and scope the review:**
40
+
41
+ Use `--uncommitted` for uncommitted changes, `--base <sha>` for committed changes.
42
+
27
43
  ```bash
44
+ # For committed changes:
28
45
  BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
29
46
  HEAD_SHA=$(git rev-parse HEAD)
47
+ codex review --base $BASE_SHA
48
+
49
+ # For uncommitted changes:
50
+ codex review --uncommitted
30
51
  ```
31
52
 
32
- **2. Dispatch code-reviewer subagent:**
53
+ **2. Dispatch code-reviewer subagent with loop config:**
33
54
 
34
55
  Use Task tool with wz:code-reviewer type, fill template at `./code-reviewer.md`
35
56
 
57
+ Include explicit loop parameters:
58
+ - `--mode` (e.g., `task-review`, `final`)
59
+ - Depth-aware dimensions and cap from `phase_policy`
60
+ - Review pass number (for log filenames)
61
+
36
62
  **Placeholders:**
37
63
  - `{WHAT_WAS_IMPLEMENTED}` - What you just built
38
64
  - `{PLAN_OR_REQUIREMENTS}` - What it should do
39
65
  - `{BASE_SHA}` - Starting commit
40
66
  - `{HEAD_SHA}` - Ending commit
41
67
  - `{DESCRIPTION}` - Brief summary
68
+ - `{REVIEW_MODE}` - Explicit review mode (e.g., task-review)
42
69
 
43
70
  **3. Act on feedback:**
44
71
  - Fix Critical issues immediately
@@ -46,6 +73,10 @@ Use Task tool with wz:code-reviewer type, fill template at `./code-reviewer.md`
46
73
  - Note Minor issues for later
47
74
  - Push back if reviewer is wrong (with reasoning)
48
75
 
76
+ ### Codex Error Handling
77
+
78
+ If codex exits non-zero during review, log the error, mark the pass as codex-unavailable, and use self-review findings only. Do not treat a Codex failure as a clean pass.
79
+
49
80
  ## Example
50
81
 
51
82
  ```
@@ -56,12 +87,13 @@ You: Let me request code review before proceeding.
56
87
  BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
57
88
  HEAD_SHA=$(git rev-parse HEAD)
58
89
 
59
- [Dispatch wz:code-reviewer subagent]
90
+ [Dispatch wz:code-reviewer subagent with --mode task-review]
60
91
  WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
61
92
  PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
62
93
  BASE_SHA: a7981ec
63
94
  HEAD_SHA: 3df7661
64
95
  DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
96
+ REVIEW_MODE: task-review
65
97
 
66
98
  [Subagent returns]:
67
99
  Strengths: Clean architecture, real tests
@@ -82,7 +114,7 @@ You: [Fix progress indicators]
82
114
  - Fix before moving to next task
83
115
 
84
116
  **Executing Plans:**
85
- - Review after each batch (3 tasks)
117
+ - Review after each task (per-task review checkpoint)
86
118
  - Get feedback, apply, continue
87
119
 
88
120
  **Ad-Hoc Development:**
@@ -96,6 +128,7 @@ You: [Fix progress indicators]
96
128
  - Ignore Critical issues
97
129
  - Proceed with unfixed Important issues
98
130
  - Argue with valid technical feedback
131
+ - Dispatch review without explicit `--mode`
99
132
 
100
133
  **If reviewer wrong:**
101
134
  - Push back with technical reasoning