pan-wizard 2.8.1 → 2.9.1

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 (35) hide show
  1. package/README.md +4 -2
  2. package/bin/install.js +23 -0
  3. package/commands/pan/assumptions.md +38 -3
  4. package/commands/pan/audit-deployment.md +6 -0
  5. package/commands/pan/debug.md +71 -2
  6. package/commands/pan/exec-phase.md +90 -0
  7. package/commands/pan/focus-auto.md +181 -18
  8. package/commands/pan/focus-design.md +302 -14
  9. package/commands/pan/focus-doc-audit.md +530 -0
  10. package/commands/pan/focus-drift-walking.md +525 -0
  11. package/commands/pan/focus-exec.md +168 -46
  12. package/commands/pan/focus-plan.md +204 -12
  13. package/commands/pan/focus-scan.md +17 -5
  14. package/commands/pan/map-codebase.md +32 -6
  15. package/commands/pan/milestone-audit.md +23 -0
  16. package/commands/pan/new-project.md +64 -0
  17. package/commands/pan/pause.md +42 -1
  18. package/commands/pan/plan-phase.md +84 -0
  19. package/commands/pan/profile.md +2 -1
  20. package/commands/pan/quick.md +15 -0
  21. package/commands/pan/resume.md +62 -2
  22. package/commands/pan/verify-phase.md +42 -0
  23. package/package.json +1 -1
  24. package/pan-wizard-core/bin/lib/commands.cjs +29 -7
  25. package/pan-wizard-core/bin/lib/config.cjs +10 -0
  26. package/pan-wizard-core/bin/lib/constants.cjs +3 -1
  27. package/pan-wizard-core/bin/lib/core.cjs +168 -21
  28. package/pan-wizard-core/bin/lib/focus.cjs +5 -0
  29. package/pan-wizard-core/bin/lib/verify.cjs +283 -4
  30. package/pan-wizard-core/bin/pan-tools.cjs +11 -2
  31. package/pan-wizard-core/references/model-profiles.md +191 -62
  32. package/pan-wizard-core/workflows/help.md +11 -1
  33. package/pan-wizard-core/workflows/profile.md +8 -1
  34. package/pan-wizard-core/workflows/settings.md +14 -0
  35. package/scripts/generate-skills-docs.py +560 -0
@@ -1,52 +1,142 @@
1
- # Model Profiles
1
+ # Model Profiles & Routing
2
2
 
3
- Model profiles control which Claude model each PAN agent uses. This allows balancing quality vs token spend.
3
+ Model profiles control which model tier each PAN agent uses. The routing system maps abstract tiers to provider-specific models, allowing PAN to work across Anthropic, OpenAI, and Google providers.
4
+
5
+ ---
6
+
7
+ ## Tier System
8
+
9
+ PAN uses three abstract tiers instead of hardcoded model names:
10
+
11
+ | Tier | Purpose | Anthropic | OpenAI | Google |
12
+ |------|---------|-----------|--------|--------|
13
+ | `reasoning` | Architecture, planning, complex decisions | inherit (Opus) | inherit | inherit |
14
+ | `mid` | Execution, research, verification | Sonnet | mid | mid |
15
+ | `fast` | Read-only extraction, budget tasks | Haiku | fast | fast |
16
+
17
+ **Why `inherit` for reasoning?** Host runtimes map "opus" to a specific model version. PAN returns `inherit` for reasoning-tier agents, so they use whatever top-tier model the user has configured. This avoids version conflicts and silent fallbacks.
18
+
19
+ ### Legacy Aliases
20
+
21
+ For backward compatibility, legacy Anthropic model names still work:
22
+
23
+ | Legacy Name | Maps To | Tier |
24
+ |-------------|---------|------|
25
+ | `opus` | `reasoning` | Top-tier |
26
+ | `sonnet` | `mid` | Mid-tier |
27
+ | `haiku` | `fast` | Budget |
28
+
29
+ ---
4
30
 
5
31
  ## Profile Definitions
6
32
 
7
33
  | Agent | `quality` | `balanced` | `budget` |
8
34
  |-------|-----------|------------|----------|
9
- | pan-planner | opus | opus | sonnet |
10
- | pan-roadmapper | opus | sonnet | sonnet |
11
- | pan-executor | opus | sonnet | sonnet |
12
- | pan-phase-researcher | opus | sonnet | haiku |
13
- | pan-project-researcher | opus | sonnet | haiku |
14
- | pan-research-synthesizer | opus | sonnet | haiku |
15
- | pan-debugger | opus | sonnet | sonnet |
16
- | pan-document_code | opus | haiku | haiku |
17
- | pan-verifier | opus | sonnet | haiku |
18
- | pan-plan-checker | opus | sonnet | haiku |
19
- | pan-integration-checker | opus | sonnet | haiku |
20
- | pan-reviewer | opus | haiku | haiku |
21
-
22
- ## Profile Philosophy
23
-
24
- **quality** - Maximum reasoning power (Opus 4.6 for everything)
25
- - Opus for ALL agents no exceptions
26
- - Use when: quota available, critical architecture work, maximum quality desired
27
-
28
- **balanced** (default) - Smart allocation
29
- - Opus only for planning (where architecture decisions happen)
30
- - Sonnet for execution and research (follows explicit instructions)
31
- - Sonnet for verification (needs reasoning, not just pattern matching)
32
- - Use when: normal development, good balance of quality and cost
33
-
34
- **budget** - Minimal Opus usage
35
- - Sonnet for anything that writes code
36
- - Haiku for research and verification
37
- - Use when: conserving quota, high-volume work, less critical phases
38
-
39
- ## Resolution Logic
40
-
41
- Orchestrators resolve model before spawning:
35
+ | pan-planner | reasoning | reasoning | mid |
36
+ | pan-roadmapper | reasoning | mid | mid |
37
+ | pan-executor | reasoning | mid | mid |
38
+ | pan-phase-researcher | reasoning | mid | fast |
39
+ | pan-project-researcher | reasoning | mid | fast |
40
+ | pan-research-synthesizer | reasoning | mid | fast |
41
+ | pan-debugger | reasoning | mid | mid |
42
+ | pan-document_code | reasoning | fast | fast |
43
+ | pan-verifier | reasoning | mid | fast |
44
+ | pan-plan-checker | reasoning | mid | fast |
45
+ | pan-integration-checker | reasoning | mid | fast |
46
+ | pan-reviewer | reasoning | fast | fast |
47
+
48
+ ### Profile Philosophy
49
+
50
+ **quality** Maximum reasoning power
51
+ - Reasoning tier for ALL agents. Use when quota is available, critical architecture work, or maximum quality is desired.
52
+
53
+ **balanced** (default) — Smart allocation
54
+ - Reasoning only for planning (where architecture decisions happen). Mid for execution. Fast for read-only tasks. Good balance of quality and cost.
55
+
56
+ **budget** Minimal token spend
57
+ - Mid for anything that writes code. Fast for research and verification. Use for high-volume work or less critical phases.
58
+
59
+ ### Cost Multipliers
60
+
61
+ Relative cost per tier (fast = 1× baseline):
62
+
63
+ | Tier | Multiplier |
64
+ |------|------------|
65
+ | reasoning | 15× |
66
+ | mid | 3× |
67
+ | fast | |
68
+
69
+ Use `/pan:profile <profile>` to see estimated cost differences before switching.
42
70
 
71
+ ---
72
+
73
+ ## Routing Pipeline
74
+
75
+ Model resolution follows this priority chain:
76
+
77
+ ```
78
+ 1. Per-agent override (model_overrides in config.json) ← highest priority
79
+ 2. Per-phase override (<!-- model_tier: X --> in roadmap)
80
+ 3. Complexity routing (if strategy = "complexity")
81
+ 4. Profile lookup (MODEL_PROFILES[agent][profile]) ← lowest priority
82
+ ```
83
+
84
+ ### Provider Detection
85
+
86
+ PAN auto-detects the LLM provider to map tiers to the right model names:
87
+
88
+ 1. **Explicit config** — `routing.provider` in config.json (if not `"auto"`)
89
+ 2. **Environment variable** — `PAN_PROVIDER` env var
90
+ 3. **Runtime directory** — `.claude/` → Anthropic, `.codex/` → OpenAI, `.gemini/` → Google
91
+ 4. **Fallback** — Default provider map (Anthropic-style names)
92
+
93
+ ---
94
+
95
+ ## Routing Strategies
96
+
97
+ Set in `.planning/config.json` under the `routing` section:
98
+
99
+ ### Static (default)
100
+
101
+ ```json
102
+ {
103
+ "routing": {
104
+ "strategy": "static"
105
+ }
106
+ }
43
107
  ```
44
- 1. Read .planning/config.json
45
- 2. Check model_overrides for agent-specific override
46
- 3. If no override, look up agent in profile table
47
- 4. Pass model parameter to Task call
108
+
109
+ Every agent always gets the tier assigned by its profile. Predictable and simple.
110
+
111
+ ### Complexity
112
+
113
+ ```json
114
+ {
115
+ "routing": {
116
+ "strategy": "complexity",
117
+ "complexity_thresholds": {
118
+ "downgrade_max": 2,
119
+ "upgrade_min": 6
120
+ }
121
+ }
122
+ }
48
123
  ```
49
124
 
125
+ Adjusts tiers up or down based on task metadata:
126
+
127
+ | Factor | Score 0 | Score 1 | Score 2 | Score 3 |
128
+ |--------|---------|---------|---------|---------|
129
+ | fileCount | ≤5 | 6–15 | >15 | — |
130
+ | waveCount | ≤1 | 2–3 | >3 | — |
131
+ | requirementCount | ≤2 | 3–5 | >5 | — |
132
+ | isArchitectural | false | — | — | true |
133
+
134
+ - Score ≤ `downgrade_max` (default 2): tier steps down one level (e.g., mid → fast)
135
+ - Score ≥ `upgrade_min` (default 6): tier steps up one level (e.g., mid → reasoning)
136
+ - Otherwise: tier stays as assigned by profile
137
+
138
+ ---
139
+
50
140
  ## Per-Agent Overrides
51
141
 
52
142
  Override specific agents without changing the entire profile:
@@ -61,51 +151,90 @@ Override specific agents without changing the entire profile:
61
151
  }
62
152
  ```
63
153
 
64
- Overrides take precedence over the profile. Valid values: `opus`, `sonnet`, `haiku`.
154
+ Overrides accept tier names (`reasoning`, `mid`, `fast`) or legacy names (`opus`, `sonnet`, `haiku`). They take highest priority — above per-phase overrides, complexity routing, and profile lookup.
65
155
 
66
- ## Switching Profiles
156
+ ---
67
157
 
68
- Runtime: `/pan:profile <profile>`
158
+ ## Per-Phase Overrides
159
+
160
+ Override the model tier for all agents within a specific roadmap phase by adding an HTML comment to the phase section:
161
+
162
+ ```markdown
163
+ ## Phase 3: Quick UI polish
164
+ **Goal:** Style cleanup
165
+ <!-- model_tier: fast -->
166
+ ```
167
+
168
+ When an orchestrator passes `phaseNum` in task metadata, the routing pipeline checks the roadmap phase for a `model_tier` comment. This lets you use a cheaper tier for simple phases without changing the global profile.
169
+
170
+ Valid values: `reasoning`, `mid`, `fast`, `opus`, `sonnet`, `haiku`.
171
+
172
+ ---
173
+
174
+ ## Configuration Reference
175
+
176
+ Full routing config in `.planning/config.json`:
69
177
 
70
- Per-project default: Set in `.planning/config.json`:
71
178
  ```json
72
179
  {
73
- "model_profile": "balanced"
180
+ "model_profile": "balanced",
181
+ "model_overrides": {
182
+ "pan-executor": "opus"
183
+ },
184
+ "routing": {
185
+ "strategy": "static",
186
+ "provider": "auto",
187
+ "cascade_quality_gate": true,
188
+ "complexity_thresholds": {
189
+ "downgrade_max": 2,
190
+ "upgrade_min": 6
191
+ }
192
+ }
74
193
  }
75
194
  ```
76
195
 
77
- ### Downgrade Confirmation
196
+ | Field | Values | Default | Description |
197
+ |-------|--------|---------|-------------|
198
+ | `model_profile` | `quality`, `balanced`, `budget` | `balanced` | Base tier assignment for all agents |
199
+ | `model_overrides` | `{ agent: tier }` | `{}` | Per-agent tier override |
200
+ | `routing.strategy` | `static`, `complexity` | `static` | How tiers are adjusted at runtime |
201
+ | `routing.provider` | `auto`, `anthropic`, `openai`, `google` | `auto` | LLM provider for tier→model mapping |
202
+ | `routing.cascade_quality_gate` | `true`, `false` | `true` | Reserved for future cascade routing |
203
+ | `routing.complexity_thresholds.downgrade_max` | number | `2` | Max complexity score to downgrade tier |
204
+ | `routing.complexity_thresholds.upgrade_min` | number | `6` | Min complexity score to upgrade tier |
205
+
206
+ ---
207
+
208
+ ## Switching Profiles
78
209
 
79
- When switching to a **lower-tier** profile, PAN asks for confirmation:
210
+ Runtime: `/pan:profile <profile>`
211
+
212
+ ### Downgrade Confirmation
80
213
 
81
214
  | Direction | Example | Behavior |
82
215
  |-----------|---------|----------|
83
- | Downgrade | quality → balanced | ⚠️ Confirmation required |
84
- | Downgrade | balanced → budget | ⚠️ Confirmation required |
85
- | Upgrade | budget → balanced | Proceeds silently |
86
- | Upgrade | balanced → quality | Proceeds silently |
87
- | Same | balanced → balanced | ✓ Proceeds silently |
216
+ | Downgrade | quality → balanced | Confirmation required |
217
+ | Downgrade | balanced → budget | Confirmation required |
218
+ | Upgrade | budget → balanced | Proceeds silently |
219
+ | Same | balanced → balanced | Proceeds silently |
88
220
 
89
221
  **Tier Order:** `quality` (3) > `balanced` (2) > `budget` (1)
90
222
 
91
- This prevents accidental quality reductions. Upgrades proceed without prompting since higher quality is always safe.
223
+ ---
92
224
 
93
225
  ## Design Rationale
94
226
 
95
- **Why Opus for pan-planner?**
227
+ **Why reasoning for pan-planner?**
96
228
  Planning involves architecture decisions, goal decomposition, and task design. This is where model quality has the highest impact.
97
229
 
98
- **Why Sonnet for pan-executor?**
230
+ **Why mid for pan-executor?**
99
231
  Executors follow explicit PLAN.md instructions. The plan already contains the reasoning; execution is implementation.
100
232
 
101
- **Why Sonnet (not Haiku) for verifiers in balanced?**
102
- Verification requires goal-backward reasoning - checking if code *delivers* what the phase promised, not just pattern matching. Sonnet handles this well; Haiku may miss subtle gaps.
233
+ **Why mid (not fast) for verifiers in balanced?**
234
+ Verification requires goal-backward reasoning checking if code *delivers* what the phase promised, not just pattern matching.
103
235
 
104
- **Why Haiku for pan-document_code?**
236
+ **Why fast for pan-document_code?**
105
237
  Read-only exploration and pattern extraction. No reasoning required, just structured output from file contents.
106
238
 
107
- **Why Haiku for pan-reviewer in balanced?**
108
- Code review is pattern-matching against known conventions and security rules. Haiku handles checklist-style verification efficiently. Quality profile uses Sonnet for nuanced review when accuracy matters most.
109
-
110
- **Why `inherit` instead of passing `opus` directly?**
111
- Claude Code's `"opus"` alias maps to a specific model version. Organizations may block older opus versions while allowing newer ones. PAN returns `"inherit"` for opus-tier agents, causing them to use whatever opus version the user has configured in their session. This avoids version conflicts and silent fallbacks to Sonnet.
239
+ **Why fast for pan-reviewer in balanced?**
240
+ Code review is pattern-matching against known conventions and security rules. Fast handles checklist-style verification efficiently.
@@ -52,6 +52,12 @@ Best for: existing projects, ongoing maintenance, iterative improvement, batch w
52
52
  /pan:focus-scan # Re-scan to pick up new tasks
53
53
  ```
54
54
 
55
+ **Documentation quality commands:**
56
+ ```
57
+ /pan:focus-drift-walking # Walk project tree, detect doc-code drift
58
+ /pan:focus-doc-audit # Deep document audit with quality scoring
59
+ ```
60
+
55
61
  ---
56
62
 
57
63
  ## Brownfield Quick-Start (Adding Features to an Existing Project)
@@ -202,7 +208,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
202
208
 
203
209
  ---
204
210
 
205
- ## All Commands (37)
211
+ ## All Commands (42)
206
212
 
207
213
  ### Getting Started
208
214
  | Command | Description |
@@ -255,7 +261,10 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
255
261
  | `/pan:focus-plan` | Step 2: Budget items into an execution batch |
256
262
  | `/pan:focus-exec` | Step 3: Implement, test, verify, commit |
257
263
  | `/pan:focus-sync` | Step 4: Synchronize documentation after changes |
264
+ | `/pan:focus-auto` | Continuous scan→plan→exec loop with safety harness |
258
265
  | `/pan:focus-design <desc>` | Standalone: Deep feature investigation and spec |
266
+ | `/pan:focus-drift-walking` | Walk project tree, detect doc-code drift, auto-repair |
267
+ | `/pan:focus-doc-audit` | Deep document audit with quality scoring |
259
268
 
260
269
  ### System
261
270
  | Command | Description |
@@ -267,6 +276,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
267
276
  | `/pan:debug` | Systematic debugging with persistent state |
268
277
  | `/pan:todo-add` | Capture idea as todo |
269
278
  | `/pan:todo-check` | List and select pending todos |
279
+ | `/pan:audit-deployment <dir>` | Audit a PAN installation for integrity and health |
270
280
 
271
281
  ### Community
272
282
  | Command | Description |
@@ -79,7 +79,7 @@ Write updated config back to `.planning/config.json`.
79
79
  </step>
80
80
 
81
81
  <step name="confirm">
82
- Display confirmation with model table for selected profile:
82
+ Display confirmation with model table and cost estimate for selected profile:
83
83
 
84
84
  ```
85
85
  ✓ Model profile set to: $ARGUMENTS.profile
@@ -96,6 +96,13 @@ Example:
96
96
  | pan-verifier | haiku |
97
97
  | ... | ... |
98
98
 
99
+ Cost estimate:
100
+ [Run: node ~/.claude/pan-wizard-core/bin/pan-tools.cjs estimate-cost]
101
+ Show the average cost multiplier for each profile (quality/balanced/budget)
102
+ and highlight the selected profile. Example:
103
+ quality: 15.0× avg | balanced: 4.3× avg | budget: 2.2× avg
104
+ ^^^^^^^^^^^^^^^^ selected
105
+
99
106
  Next spawned agents will use the new profile.
100
107
  ```
101
108
 
@@ -30,6 +30,7 @@ Parse current values (default to `true` if not present):
30
30
  - `workflow.verifier` — spawn verifier during execute-phase
31
31
  - `workflow.nyquist_validation` — validation architecture research during plan-phase
32
32
  - `model_profile` — which model each agent uses (default: `balanced`)
33
+ - `routing.strategy` — how model tiers are adjusted at runtime (default: `static`)
33
34
  - `git.branching_strategy` — branching approach (default: `"none"`)
34
35
  </step>
35
36
 
@@ -102,6 +103,15 @@ AskUserQuestion([
102
103
  { label: "Per Phase", description: "Create branch for each phase (pan/phase-{N}-{name})" },
103
104
  { label: "Per Milestone", description: "Create branch for entire milestone (pan/{version}-{name})" }
104
105
  ]
106
+ },
107
+ {
108
+ question: "Model routing strategy?",
109
+ header: "Routing",
110
+ multiSelect: false,
111
+ options: [
112
+ { label: "Static (Recommended)", description: "Profile assigns fixed tiers to each agent. Predictable and simple." },
113
+ { label: "Complexity", description: "Adjust tiers up/down based on task complexity (file count, requirements, architecture). Saves tokens on simple phases." }
114
+ ]
105
115
  }
106
116
  ])
107
117
  ```
@@ -123,6 +133,9 @@ Merge new settings into existing config.json:
123
133
  },
124
134
  "git": {
125
135
  "branching_strategy": "none" | "phase" | "milestone"
136
+ },
137
+ "routing": {
138
+ "strategy": "static" | "complexity"
126
139
  }
127
140
  }
128
141
  ```
@@ -190,6 +203,7 @@ Display:
190
203
  | Auto-Advance | {On/Off} |
191
204
  | Nyquist Validation | {On/Off} |
192
205
  | Git Branching | {None/Per Phase/Per Milestone} |
206
+ | Routing Strategy | {Static/Complexity} |
193
207
  | Saved as Defaults | {Yes/No} |
194
208
 
195
209
  These settings apply to future /pan:plan-phase and /pan:exec-phase runs.