@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:gemini-cli
3
+ description: How to use Gemini CLI programmatically for headless reviews, automation, and sandbox operations within Wazir pipelines.
4
+ ---
5
+
6
+ # Gemini 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 Google Gemini CLI in Wazir pipelines. Gemini CLI is an open-source AI agent that uses a ReAct (reason and act) loop with built-in tools and MCP servers to complete tasks directly in your terminal.
22
+
23
+ ## Commands
24
+
25
+ ### gemini (interactive)
26
+
27
+ Launch the interactive TUI for ad-hoc work.
28
+
29
+ ```bash
30
+ gemini
31
+ ```
32
+
33
+ ### Headless Mode (non-interactive)
34
+
35
+ Headless mode is the primary mode for Wazir automation. It is triggered when providing a prompt with the `-p` (or `--prompt`) flag, or when the CLI runs in a non-TTY environment.
36
+
37
+ ```bash
38
+ # Basic headless prompt
39
+ gemini -p "Explain the architecture of this project"
40
+
41
+ # Pipe data from stdin
42
+ git diff main | gemini -p "Review this diff for bugs and security issues"
43
+
44
+ # Chain with other tools
45
+ gemini -p "List all exported functions" | jq '.response'
46
+
47
+ # Save output to file
48
+ gemini -p "Summarize the test coverage" > summary.md
49
+ ```
50
+
51
+ **Key flags:**
52
+
53
+ | Flag | Description |
54
+ |------|-------------|
55
+ | `-p, --prompt <PROMPT>` | Run in headless mode; print response to stdout and exit |
56
+ | `-m, --model <MODEL>` | Specify the model to use (alias or full name) |
57
+ | `--output-format json` | Output a single structured JSON object with the complete result |
58
+ | `--output-format stream-json` | Stream real-time JSONL events as they occur |
59
+ | `-s, --sandbox` | Enable sandboxed execution for shell commands and file modifications |
60
+ | `-y, --yolo` | Auto-approve all operations (enables sandbox by default) |
61
+ | `--approval-mode <MODE>` | Set approval mode: `default`, `auto_edit`, `plan`, `yolo` |
62
+ | `--checkpoint` | Enable checkpoint mode for long-running tasks |
63
+
64
+ **Headless mode limitations:**
65
+ - No follow-up questions or continued conversation
66
+ - Cannot authorize tools (including WriteFile) or run shell commands unless `--yolo` is used
67
+ - For tool-using automation, combine `-p` with `--yolo` or `--approval-mode auto_edit`
68
+
69
+ ## Slash Commands
70
+
71
+ | Command | Description |
72
+ |---------|-------------|
73
+ | `/model` | Switch model (Pro, Flash, Auto, or Manual selection) |
74
+ | `/yolo` | Toggle YOLO mode (auto-approve all tool calls) |
75
+ | `/stats` | Show token usage and session statistics |
76
+ | `/export` | Export conversation to Markdown or JSON |
77
+ | `/help` | Display available commands |
78
+ | `/settings` | Open settings editor |
79
+
80
+ ## Approval Modes
81
+
82
+ | Mode | Description |
83
+ |------|-------------|
84
+ | `default` | Prompts for approval on every tool use |
85
+ | `auto_edit` | Auto-approves file reads/writes, still prompts for shell commands |
86
+ | `plan` | Read-only mode; no writes or commands executed |
87
+ | `yolo` | Auto-approves everything; enables sandbox by default |
88
+
89
+ **Enable YOLO mode:**
90
+ - CLI flag: `--yolo` or `-y`
91
+ - Interactive toggle: `Ctrl+Y`
92
+ - Slash command: `/yolo`
93
+ - Environment variable: `GEMINI_YOLO=1`
94
+
95
+ **Granular command auto-approval:** Configure specific commands to run without prompts:
96
+ ```json
97
+ {
98
+ "tools": {
99
+ "shell": {
100
+ "autoApprove": ["git ", "npm test", "ls "]
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ ## Sandbox Mode
107
+
108
+ Sandboxing isolates shell commands and file modifications from your host system. Disabled by default except when using YOLO mode.
109
+
110
+ **Enable sandbox:**
111
+ - CLI flag: `--sandbox` or `-s`
112
+ - Environment variable: `GEMINI_SANDBOX=1`
113
+ - Automatic with `--yolo` or `--approval-mode=yolo`
114
+
115
+ Sandbox uses a pre-built `gemini-cli-sandbox` Docker image for isolation.
116
+
117
+ **Safety configuration:** Set `requireApprovals: true` in settings to disallow YOLO mode and "Always allow" options entirely.
118
+
119
+ ## Model Selection
120
+
121
+ | Model | Best For | Notes |
122
+ |-------|----------|-------|
123
+ | `gemini-3-pro` | Complex reasoning, coding, multi-step tasks | Latest Pro model |
124
+ | `gemini-3-flash` | Fast responses, lighter tasks | Lower latency |
125
+ | `gemini-3.1-pro-preview` | Cutting-edge features | Rolling preview access |
126
+ | `gemini-2.5-pro` | Legacy stable | Still available |
127
+ | `gemini-2.5-flash` | Legacy fast | Still available |
128
+ | `auto` | Recommended; CLI picks best model per task | Default with Google login |
129
+
130
+ **Select via:**
131
+ - CLI flag: `-m <model>` or `--model <model>`
132
+ - Environment variable: `export GEMINI_MODEL="gemini-3-pro"`
133
+ - Interactive: `/model` slash command
134
+ - Config: `settings.json` model field
135
+
136
+ **Note:** With a Google login (not API key), the CLI may auto-blend Pro and Flash models based on task complexity and system capacity.
137
+
138
+ ## Non-Interactive Usage
139
+
140
+ ### Piping data
141
+
142
+ ```bash
143
+ # Pipe a diff for review
144
+ git diff main | gemini -p "Review this diff for correctness and security"
145
+
146
+ # Pipe file content
147
+ cat src/auth.ts | gemini -p "Find potential bugs in this code"
148
+
149
+ # Multi-file context
150
+ cat src/types.ts src/auth.ts | gemini -p "Are these types used correctly in auth?"
151
+ ```
152
+
153
+ ### Structured output
154
+
155
+ ```bash
156
+ # JSON output (single object)
157
+ gemini -p "List all API endpoints" --output-format json | jq '.response'
158
+
159
+ # Streaming JSONL (real-time events)
160
+ gemini -p "Analyze codebase" --output-format stream-json
161
+ ```
162
+
163
+ ### Output in scripts
164
+
165
+ ```bash
166
+ # Capture to variable
167
+ RESULT=$(gemini -p "What does this function do?" --output-format json | jq -r '.response')
168
+
169
+ # Save to file
170
+ gemini -p "Generate a test plan" > test-plan.md
171
+ ```
172
+
173
+ ## MCP Server Integration
174
+
175
+ Gemini CLI supports MCP servers for extended tool capabilities.
176
+
177
+ **Configuration in `settings.json`:**
178
+ ```json
179
+ {
180
+ "mcpServers": {
181
+ "my-server": {
182
+ "command": "npx",
183
+ "args": ["-y", "@my-org/mcp-server"],
184
+ "env": { "API_KEY": "..." }
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ **Extensions:** Gemini CLI extensions package prompts, MCP servers, and custom commands into installable bundles via `gemini-extension.json`. Extensions use a secure tool-merge approach where exclusions are combined and inclusions are intersected (most restrictive policy wins).
191
+
192
+ **Tool control:**
193
+ - `includeTools` / `excludeTools` in extension or settings config
194
+ - MCP tools appear alongside built-in tools once configured
195
+
196
+ ## Built-in Tools
197
+
198
+ Gemini CLI includes these tools out of the box:
199
+ - **Google Search grounding** (web search)
200
+ - **File operations** (read, write, list)
201
+ - **Shell commands** (subject to approval mode)
202
+ - **Web fetching** (retrieve URL content)
203
+
204
+ ## Wazir Integration Patterns
205
+
206
+ ### Secondary Review (used by wz:reviewer)
207
+
208
+ ```bash
209
+ GEMINI_MODEL=$(jq -r '.multi_tool.gemini.model // empty' .wazir/state/config.json 2>/dev/null)
210
+ GEMINI_MODEL=${GEMINI_MODEL:-gemini-3-pro}
211
+
212
+ # Review uncommitted changes
213
+ git diff | gemini -m "$GEMINI_MODEL" -p \
214
+ "Review this diff against these acceptance criteria: <criteria>" \
215
+ 2>&1 | tee .wazir/runs/latest/reviews/gemini-review.md
216
+
217
+ # Review a spec or design artifact
218
+ cat artifact.md | gemini -m "$GEMINI_MODEL" -p \
219
+ "Review this spec against these criteria: <criteria>" \
220
+ 2>&1 | tee .wazir/runs/latest/reviews/gemini-review.md
221
+ ```
222
+
223
+ ### Automation with Tool Access
224
+
225
+ When the review needs tool access (e.g., reading additional files for context):
226
+
227
+ ```bash
228
+ gemini -m "$GEMINI_MODEL" --yolo -p \
229
+ "Review the changes in src/auth/ for security issues. Read related test files for context." \
230
+ 2>&1 | tee .wazir/runs/latest/reviews/gemini-review.md
231
+ ```
232
+
233
+ ### Structured Review Output
234
+
235
+ ```bash
236
+ gemini -m "$GEMINI_MODEL" -p \
237
+ "Review this code and return JSON with fields: findings (array), severity, summary" \
238
+ --output-format json | jq '.response' \
239
+ > .wazir/runs/latest/reviews/gemini-review.json
240
+ ```
241
+
242
+ ## Error Handling
243
+
244
+ | Error | Handling |
245
+ |-------|----------|
246
+ | **Non-zero exit** (auth/quota/transport) | Log full stderr, mark pass as `gemini-unavailable`, use self-review only. Next pass re-attempts. |
247
+ | **Timeout** | Wrap with `timeout 120 gemini -p ...`. Treat timeout as `gemini-unavailable`. |
248
+ | **Model unavailable** | Fall back to `gemini-3-flash` if Pro model is overloaded. |
249
+ | **Rate limiting** | Respect backoff. Free-tier users share capacity; API key users have dedicated quota. |
250
+ | **Headless tool denial** | If a headless prompt needs tool access, re-run with `--yolo` or `--approval-mode auto_edit`. |
251
+
252
+ ## Configuration
253
+
254
+ Gemini CLI reads configuration from:
255
+ - `~/.gemini/settings.json` (global)
256
+ - `.gemini/settings.json` in the project root (project-level)
257
+ - Environment variables (`GEMINI_MODEL`, `GEMINI_SANDBOX`, `GEMINI_YOLO`, `GOOGLE_API_KEY`)
258
+ - CLI flags (highest precedence)
259
+
260
+ Key config fields: `model`, `approvalMode`, `sandbox`, `mcpServers`, `tools`, `requireApprovals`.
@@ -7,6 +7,19 @@ description: Use when reviewing or editing any text artifact (specs, plans, code
7
7
 
8
8
  Remove AI writing patterns from text artifacts using a 4-phase corrective pipeline. This skill operates on text that has already been generated. For rules that prevent AI patterns during generation, the composition engine loads expertise modules from `expertise/humanize/` into role context automatically.
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
  ## Phase 1: Scan
11
24
 
12
25
  Detect the domain and scan for AI patterns.
@@ -1,208 +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.
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
11
15
 
12
- Run `which wazir` to check if the CLI is installed.
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
13
26
 
14
- **If installed** — run `wazir init` and let it handle the interactive setup (arrow-key selection). If the pipeline was already initialized, use `wazir init --force` to reinitialize. Once it completes, skip to Step 9 (Confirm).
27
+ Run `which wazir` to check if the CLI is installed.
15
28
 
16
29
  **If not installed**, present:
17
30
 
18
- > **The Wazir CLI is not installed. It's required for event capture, validation, and indexing.**
19
- >
20
- > **How would you like to install it?**
31
+ > **The Wazir CLI is not installed. Install with:**
21
32
  >
22
33
  > 1. **npm** (Recommended) — `npm install -g @wazir-dev/cli`
23
34
  > 2. **Local link** — `npm link` from the Wazir project root
24
- > 3. **Skip** — Continue without the CLI (some features will be unavailable)
25
-
26
- Wait for the user to answer before continuing.
27
35
 
28
- If the user picks 1, run `npm install -g @wazir-dev/cli` and verify with `wazir --version`.
29
- If the user picks 2, run `npm link` from the project root and verify.
30
- If the user picks 3, warn that `wazir capture`, `wazir validate`, and `wazir index` commands will not work, then continue to the manual steps below.
36
+ ### Step 2: Auto-Initialize
31
37
 
32
- After installing, run `wazir init` and let it handle the rest. Skip to Step 9.
38
+ Run `wazir init` (default: auto mode). This automatically:
33
39
 
34
- ---
35
-
36
- **The steps below are the manual fallback — only used when the CLI is not installed and the user chose to skip installation.**
37
-
38
- ## Step 1: Create Project Directories
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
39
50
 
40
- ```bash
41
- mkdir -p .wazir/input .wazir/state .wazir/runs
42
- ```
51
+ **No questions asked.** The pipeline is ready to use immediately.
43
52
 
44
- ## Step 2: Choose Pipeline Mode
53
+ ### Step 3: Confirm
45
54
 
46
- Present this question:
47
-
48
- > **How should Wazir run in this project?**
55
+ > **Wazir initialized.**
49
56
  >
50
- > 1. **Single model** (Recommended) Everything runs in the current model. Single model, slash commands only.
51
- > 2. **Multi-model** — Still the current model, but routes tasks by complexity (Haiku for micro, Sonnet for standard, Opus for complex).
52
- > 3. **Multi-tool** — Current model + external tools for reviews.
53
-
54
- Wait for the user to answer before continuing.
55
-
56
- ## Step 3: If Multi-Tool, Choose Tools
57
-
58
- Only ask this if the user selected option 3:
59
-
60
- > **Which external tools should Wazir use for reviews?**
57
+ > Host: [detected host] | Stack: [detected language/framework]
61
58
  >
62
- > 1. **Codex** (Recommended) Send reviews to OpenAI Codex
63
- > 2. **Gemini** — Send reviews to Google Gemini
64
- > 3. **Both** — Use Codex and Gemini as secondary reviewers
65
-
66
- Wait for the user to answer before continuing.
67
-
68
- ## Step 3.5: Codex Model (conditional)
69
-
70
- Only ask this if Codex was selected in Step 3:
59
+ > Next: `/wazir <what you want to build>`
71
60
 
72
- > **Which Codex model should Wazir use?**
73
- >
74
- > 1. **gpt-5.3-codex-spark** (Recommended) — Fast, good for review loops and grounder work
75
- > 2. **gpt-5.4** — Slower, deeper analysis for complex reviews
76
- >
77
- > *You can change this later in `.wazir/state/config.json` under `multi_tool.codex.model`.*
61
+ ---
78
62
 
79
- Wait for the user to answer before continuing.
63
+ ## Interactive Flow (Power Users)
80
64
 
81
- ## Step 4: Default Depth
65
+ Triggered by `wazir init --interactive`. For users who want manual control.
82
66
 
83
- > **What default depth should runs use?**
84
- >
85
- > 1. **Quick** — Minimal research, single-pass review, fast execution. Good for small fixes and config changes.
86
- > 2. **Standard** (Recommended) — Balanced research, multi-pass hardening, full review. Good for most features.
87
- > 3. **Deep** — Extended research, thorough hardening, strict review thresholds. Good for complex or security-critical work.
88
- >
89
- > *This sets the project default. Individual runs can override via inline modifiers (e.g. `/wazir quick ...`).*
67
+ ### Pipeline Mode
90
68
 
91
- Wait for the user to answer before continuing.
92
-
93
- ## Step 5: Default Intent
94
-
95
- > **What kind of work does this project mostly involve?**
96
- >
97
- > 1. **Feature** (Recommended) — New functionality or enhancement
98
- > 2. **Bugfix** — Fix broken behavior
99
- > 3. **Refactor** — Restructure without changing behavior
100
- > 4. **Docs** — Documentation only
101
- > 5. **Spike** — Research and exploration, no production code
69
+ > **How should Wazir run in this project?**
102
70
  >
103
- > *This sets the project default. Individual runs can override via inline modifiers or when intent is obvious from the request.*
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
104
74
 
105
- Wait for the user to answer before continuing.
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)
106
79
 
107
- ## Step 6: Agent Teams (conditional)
80
+ Override via `model_overrides` in config.
108
81
 
109
- Only ask this if ALL of these are true:
110
- - The host is Claude Code (not Codex/Gemini/Cursor)
111
- - Default depth is `standard` or `deep`
112
- - Default intent is `feature` or `refactor` (not bugfix/docs/spike)
82
+ ### External Tools (if multi-tool)
113
83
 
114
- > **Would you like to use Agent Teams for parallel execution?**
115
- >
116
- > 1. **No** (Recommended) — Tasks run sequentially. Predictable, lower cost.
117
- > 2. **Yes** — Spawns parallel teammates for independent tasks. Potentially faster and richer output.
84
+ > **Which external tools for reviews?**
118
85
  >
119
- > *Agent Teams is experimental from Claude's side. Requires Opus model. Higher token consumption.*
120
-
121
- If the conditions above are NOT met, silently default to `team_mode: sequential`.
122
-
123
- If the user selects **Yes**, enable the Agent Teams experimental feature:
124
-
125
- ```bash
126
- claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1
127
- ```
128
-
129
- Then inform the user they need to restart their Claude Code session for it to take effect.
130
-
131
- Wait for the user to answer before continuing.
132
-
133
- ## Step 7: Write Config
86
+ > 1. **Codex** (Recommended)
87
+ > 2. **Gemini**
88
+ > 3. **Both**
134
89
 
135
- Create/update `.wazir/state/config.json`:
136
-
137
- - Set `model_mode` to the selected mode (`claude-only`, `multi-model`, or `multi-tool`)
138
- - If `multi-tool`, set `multi_tool.tools` to the selected tools (e.g. `["codex"]`, `["gemini"]`, or `["codex", "gemini"]`)
139
- - Set `default_depth` to the selected depth (`quick`, `standard`, or `deep`)
140
- - Set `default_intent` to the selected intent (`feature`, `bugfix`, `refactor`, `docs`, or `spike`)
141
- - Set `team_mode` to the selected mode (`sequential` or `parallel`)
142
- - If `team_mode` is `parallel`, set `parallel_backend` to `claude_teams`
143
- - If Codex selected, set `multi_tool.codex.model` to the chosen model
144
-
145
- Example for claude-only with defaults:
146
- ```json
147
- {
148
- "model_mode": "claude-only",
149
- "default_depth": "standard",
150
- "default_intent": "feature",
151
- "team_mode": "sequential",
152
- "parallel_backend": "none"
153
- }
154
- ```
155
-
156
- Example for multi-tool with teams enabled:
157
- ```json
158
- {
159
- "model_mode": "multi-tool",
160
- "multi_tool": {
161
- "tools": ["codex"],
162
- "codex": {
163
- "model": "gpt-5.3-codex-spark"
164
- }
165
- },
166
- "default_depth": "deep",
167
- "default_intent": "feature",
168
- "team_mode": "parallel",
169
- "parallel_backend": "claude_teams"
170
- }
171
- ```
172
-
173
- ## Step 8: Runtime-Specific Setup
174
-
175
- Based on `multi_tool.tools`:
176
-
177
- - If **codex** is selected: Create `AGENTS.md` in project root:
178
- ```
179
- # Wazir Pipeline
180
-
181
- Agent protocols are at `~/.claude/agents/` (global).
182
-
183
- ## Running the Pipeline
184
- 1. Clarifier: read and follow `~/.claude/agents/clarifier.md` — tasks are in `.wazir/input/`
185
- 2. Orchestrator: read and follow `~/.claude/agents/orchestrator.md` — start from task 1
186
- 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
187
95
 
188
- ## Review Mode
189
- This project uses Codex as a secondary reviewer. Review artifacts are in `.wazir/reviews/`.
190
- ```
96
+ ---
191
97
 
192
- - If **gemini** is selected: Create `GEMINI.md` in project root with the same content adapted for Gemini.
98
+ ## Install Paths
193
99
 
194
- - 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 |
195
106
 
196
- ## Step 9: Confirm
107
+ ## Deep When You Need It
197
108
 
198
- 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
199
113
 
200
- > **Pipeline initialized. You can now use:**
201
- >
202
- > - `/wazir <your request>` — Run the full pipeline end-to-end
203
- > - `/clarifier` — Run Phase 0 + Phase 1 only (research, clarify, plan)
204
- > - `/executor` — Run Phase 2 only (autonomous execution)
205
- > - `/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.
206
115
 
207
116
  ## Interaction Rules
208
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,6 +5,19 @@ 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.