pan-wizard 3.22.0 → 3.25.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 (135) hide show
  1. package/README.md +38 -24
  2. package/agents/pan-conductor.md +4 -4
  3. package/agents/pan-design-checker.md +83 -0
  4. package/agents/pan-designer.md +67 -0
  5. package/agents/pan-document_code.md +3 -2
  6. package/agents/pan-executor.md +2 -2
  7. package/agents/pan-plan-checker.md +19 -6
  8. package/agents/pan-planner.md +4 -1
  9. package/agents/pan-previewer.md +1 -1
  10. package/agents/pan-roadmapper.md +3 -1
  11. package/agents/pan-verifier.md +10 -10
  12. package/bin/install-lib.cjs +128 -17
  13. package/bin/install.js +480 -74
  14. package/commands/pan/army.md +34 -14
  15. package/commands/pan/audit-deployment.md +17 -14
  16. package/commands/pan/cost.md +2 -2
  17. package/commands/pan/debug.md +1 -1
  18. package/commands/pan/design-phase.md +77 -0
  19. package/commands/pan/exec-phase.md +2 -2
  20. package/commands/pan/experiment.md +18 -14
  21. package/commands/pan/focus-auto.md +5 -5
  22. package/commands/pan/focus-design.md +13 -1
  23. package/commands/pan/focus-exec.md +1 -1
  24. package/commands/pan/learn.md +1 -1
  25. package/commands/pan/links.md +3 -1
  26. package/commands/pan/map-codebase.md +4 -4
  27. package/commands/pan/mcp-bridge.md +1 -1
  28. package/commands/pan/milestone-new.md +3 -1
  29. package/commands/pan/optimize.md +2 -2
  30. package/commands/pan/patches.md +1 -1
  31. package/commands/pan/plan-phase.md +3 -1
  32. package/commands/pan/preview.md +3 -3
  33. package/commands/pan/profile.md +3 -3
  34. package/commands/pan/research-phase.md +1 -1
  35. package/commands/pan/retro.md +4 -1
  36. package/commands/pan/review-deep.md +1 -1
  37. package/commands/pan/settings.md +2 -2
  38. package/commands/pan/what-if.md +1 -1
  39. package/hooks/dist/pan-check-update.js +149 -38
  40. package/hooks/dist/pan-context-monitor.js +155 -81
  41. package/hooks/dist/pan-cost-logger.js +288 -13
  42. package/hooks/dist/pan-statusline.js +24 -8
  43. package/hooks/dist/pan-stop-guard.js +160 -0
  44. package/hooks/dist/pan-trace-logger.js +261 -19
  45. package/package.json +2 -2
  46. package/pan-wizard-core/bin/lib/bridge.cjs +1 -1
  47. package/pan-wizard-core/bin/lib/bus.cjs +19 -4
  48. package/pan-wizard-core/bin/lib/campaign.cjs +8 -3
  49. package/pan-wizard-core/bin/lib/codebase.cjs +15 -5
  50. package/pan-wizard-core/bin/lib/commands.cjs +88 -6
  51. package/pan-wizard-core/bin/lib/config.cjs +27 -2
  52. package/pan-wizard-core/bin/lib/constants.cjs +1 -0
  53. package/pan-wizard-core/bin/lib/core.cjs +113 -8
  54. package/pan-wizard-core/bin/lib/cost.cjs +61 -24
  55. package/pan-wizard-core/bin/lib/distill.cjs +22 -4
  56. package/pan-wizard-core/bin/lib/doc-lint.cjs +25 -7
  57. package/pan-wizard-core/bin/lib/experiment.cjs +25 -1
  58. package/pan-wizard-core/bin/lib/focus.cjs +42 -7
  59. package/pan-wizard-core/bin/lib/frontmatter.cjs +62 -31
  60. package/pan-wizard-core/bin/lib/git.cjs +51 -16
  61. package/pan-wizard-core/bin/lib/hud.cjs +17 -2
  62. package/pan-wizard-core/bin/lib/init.cjs +2 -5
  63. package/pan-wizard-core/bin/lib/knowledge.cjs +20 -1
  64. package/pan-wizard-core/bin/lib/learn-lint.cjs +50 -0
  65. package/pan-wizard-core/bin/lib/links.cjs +9 -6
  66. package/pan-wizard-core/bin/lib/lock.cjs +23 -4
  67. package/pan-wizard-core/bin/lib/memory-optimize.cjs +11 -6
  68. package/pan-wizard-core/bin/lib/milestone.cjs +11 -5
  69. package/pan-wizard-core/bin/lib/optimize.cjs +18 -7
  70. package/pan-wizard-core/bin/lib/phase-remove.cjs +41 -2
  71. package/pan-wizard-core/bin/lib/phase.cjs +82 -11
  72. package/pan-wizard-core/bin/lib/preview.cjs +23 -4
  73. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -6
  74. package/pan-wizard-core/bin/lib/roadmap.cjs +6 -2
  75. package/pan-wizard-core/bin/lib/runner.cjs +17 -7
  76. package/pan-wizard-core/bin/lib/squads.cjs +43 -11
  77. package/pan-wizard-core/bin/lib/state.cjs +32 -11
  78. package/pan-wizard-core/bin/lib/template.cjs +8 -3
  79. package/pan-wizard-core/bin/lib/verify-deploy.cjs +14 -2
  80. package/pan-wizard-core/bin/lib/verify-drift.cjs +15 -1
  81. package/pan-wizard-core/bin/lib/verify-preflight.cjs +9 -3
  82. package/pan-wizard-core/bin/lib/verify.cjs +84 -39
  83. package/pan-wizard-core/bin/lib/whatif.cjs +8 -1
  84. package/pan-wizard-core/bin/lib/worktree.cjs +98 -0
  85. package/pan-wizard-core/bin/pan-tools.cjs +45 -20
  86. package/pan-wizard-core/learnings/index.json +7 -7
  87. package/pan-wizard-core/learnings/universal/autonomous-loop.md +5 -3
  88. package/pan-wizard-core/learnings/universal/concurrency.md +1 -1
  89. package/pan-wizard-core/references/design-methodology.md +94 -0
  90. package/pan-wizard-core/references/git-integration.md +9 -9
  91. package/pan-wizard-core/references/guardrails.md +4 -1
  92. package/pan-wizard-core/references/model-profile-resolution.md +1 -1
  93. package/pan-wizard-core/references/model-profiles.md +44 -34
  94. package/pan-wizard-core/references/planning-config.md +5 -5
  95. package/pan-wizard-core/references/verification-patterns.md +67 -0
  96. package/pan-wizard-core/templates/codebase/architecture.md +1 -1
  97. package/pan-wizard-core/templates/codebase/concerns.md +1 -1
  98. package/pan-wizard-core/templates/codebase/conventions.md +1 -1
  99. package/pan-wizard-core/templates/codebase/integrations.md +1 -1
  100. package/pan-wizard-core/templates/codebase/stack.md +1 -1
  101. package/pan-wizard-core/templates/codebase/structure.md +1 -1
  102. package/pan-wizard-core/templates/codebase/testing.md +1 -1
  103. package/pan-wizard-core/templates/design.md +146 -0
  104. package/pan-wizard-core/templates/discovery.md +3 -3
  105. package/pan-wizard-core/templates/milestone-archive.md +2 -2
  106. package/pan-wizard-core/templates/playbook.md +1 -1
  107. package/pan-wizard-core/templates/uat.md +1 -1
  108. package/pan-wizard-core/workflows/diagnose-issues.md +9 -7
  109. package/pan-wizard-core/workflows/exec-phase.md +28 -8
  110. package/pan-wizard-core/workflows/execute-plan.md +2 -3
  111. package/pan-wizard-core/workflows/health.md +24 -1
  112. package/pan-wizard-core/workflows/help.md +5 -4
  113. package/pan-wizard-core/workflows/learn.md +5 -5
  114. package/pan-wizard-core/workflows/map-codebase.md +1 -1
  115. package/pan-wizard-core/workflows/milestone-audit.md +1 -1
  116. package/pan-wizard-core/workflows/milestone-new.md +4 -4
  117. package/pan-wizard-core/workflows/new-project.md +47 -32
  118. package/pan-wizard-core/workflows/optimize.md +8 -8
  119. package/pan-wizard-core/workflows/pause.md +1 -1
  120. package/pan-wizard-core/workflows/phase-tests.md +2 -2
  121. package/pan-wizard-core/workflows/plan-phase.md +4 -0
  122. package/pan-wizard-core/workflows/profile.md +13 -10
  123. package/pan-wizard-core/workflows/research-phase.md +1 -1
  124. package/pan-wizard-core/workflows/resume-project.md +1 -1
  125. package/pan-wizard-core/workflows/settings.md +9 -9
  126. package/pan-wizard-core/workflows/transition.md +24 -8
  127. package/pan-wizard-core/workflows/update.md +23 -20
  128. package/pan-wizard-core/workflows/verify-phase.md +7 -2
  129. package/pan-zcode/README.md +12 -2
  130. package/pan-zcode/bin/install-zcode.js +1 -1
  131. package/pan-zcode/mcp/native-tools.cjs +1 -1
  132. package/pan-zcode/mcp/server.cjs +76 -14
  133. package/scripts/build-hooks.js +2 -1
  134. package/scripts/generate-skills-docs.py +0 -4
  135. package/scripts/run-tests.cjs +11 -4
@@ -18,7 +18,7 @@ patterns:
18
18
 
19
19
  ## P-1204 — O_EXCL lockfile + retry with bounded backoff is enough for multi-process file writes in Node — no flock needed
20
20
 
21
- **Evidence:** whoocache lock.js + atomic-write.js: parallel-process tests with two child processes each calling set() 1000 times completed with consistent index, zero lost writes. P-1402 (whoocache 02-02 summary): 'O_EXCL lockfile + Windows rename retry' shipped Phase 2.
21
+ **Evidence:** whoocache lock.js + atomic-write.js: parallel-process tests with two child processes each calling set() 1000 times completed with consistent index, zero lost writes. The whoocache 02-02 summary records 'O_EXCL lockfile + Windows rename retry' shipped Phase 2.
22
22
 
23
23
  **Rule:** For multi-process safe writes (parallel CLI invocations sharing one cache/index/state file), use fs.openSync(lockPath, 'wx') as a 'try-acquire' (EEXIST means held). On failure, retry with random backoff 5-50ms, capped at ~10 attempts. Always wrap acquired work in try/finally and unlink the lockfile in finally. Cross-platform safe (no flock dependency). Combine with the atomic write-tmp-then-rename pattern (P-1201) so even if the lock holder is killed mid-write, recovery is automatic.
24
24
 
@@ -0,0 +1,94 @@
1
+ # Design Methodology (shared)
2
+
3
+ Single source of truth for how PAN designs a change **before** it is planned or
4
+ executed. Cited by `pan-designer` (main flow, via `/pan:design-phase`) and by
5
+ `focus-design` (the `/featureAI` feature pipeline). Both flows use the *same*
6
+ method at different **depth tiers** so design quality can't drift between them.
7
+
8
+ This reference defines: the depth tiers, what each tier must produce, and the
9
+ quality bar every design artifact is held to (the same bar `pan-design-checker`
10
+ verifies against). It does not prescribe a runtime — agents apply it with
11
+ whatever tools they have.
12
+
13
+ ---
14
+
15
+ ## Depth tiers
16
+
17
+ A tier selects which sections of the design artifact (`templates/design.md`) are
18
+ **mandatory**. Deeper tiers are supersets of shallower ones. Pick the shallowest
19
+ tier that fits the altitude of the work.
20
+
21
+ | Tier | Altitude | Mandatory sections | Skips | Typical entry point |
22
+ |------|----------|--------------------|-------|---------------------|
23
+ | `spike` | Throwaway PoC / trivial change | Problem · Scope · Minimal architecture | Everything else — flag as speculative | `/pan:design-phase --spike`, `focus-design --spike` |
24
+ | `phase` | One roadmap phase | Problem · Success criteria (≥2 machine-checkable) · Architecture assessment · Design synthesis · Phase-scoped ADR · Threat-lite · Test hooks | Demand validation, competitive intel, market/strategy | **`/pan:design-phase` (main-flow default)** |
25
+ | `feature` | A whole feature (internal) | `phase` + Demand validation · Error-handling design · Full STRIDE-lite threat model · Test plan · Feature ladder | Competitive intel, strategic (Blue Ocean/Wardley) | `focus-design --internal` |
26
+ | `full` | A market-facing feature | `feature` + Competitive intelligence · Strategic analysis (ERRC) · Adoption analysis | — (nothing) | `focus-design --full` (DEFAULT) |
27
+
28
+ **Altitude rule (why the tiers exist):** product/strategic design — *whether*
29
+ and *what* to build, with demand and competitive evidence — is decided **once**
30
+ at feature/milestone creation (`focus-design`, or the product-design pass in
31
+ `milestone-new`). Per-phase design (`phase` tier) covers only *how* to build an
32
+ already-scoped phase: architecture, ADR, threat, synthesis. This keeps the
33
+ frequently-run per-phase path cheap and stops the main flow re-litigating product
34
+ questions on every phase.
35
+
36
+ ---
37
+
38
+ ## What every tier produces
39
+
40
+ The artifact is `{scope}-design.md` from `templates/design.md`. Sections below are
41
+ ordered; a tier makes a contiguous prefix (plus its named additions) mandatory.
42
+
43
+ ### 1. Problem & scope (all tiers)
44
+ - **Problem statement** — what problem exists, why it matters, cost of inaction. Concrete, not a vague generality.
45
+ - **Scope** — in-scope / out-of-scope, and the fixed boundary this design must not exceed (a phase boundary from `roadmap.md`, or a feature boundary).
46
+
47
+ ### 2. Success criteria (`phase`+)
48
+ - 3–7 criteria, **at least 2 machine-checkable** (verifiable by an automated test, not manual inspection). State the check for each machine-checkable one.
49
+
50
+ ### 3. Architecture assessment & synthesis (`phase`+)
51
+ - **Conventions** — extract the project's actual conventions (module layout, error style, boundaries) from the codebase; do not assume.
52
+ - **Components & boundaries** — what modules are added/touched; confirm the design honors the discovered boundaries (no layer violations).
53
+ - **Interface contract** — exact invocation + input/output schema + status/exit codes, per project convention.
54
+ - **State & filesystem scope** — reads from / writes to (must stay within project root / `.planning/`), state mutations, side effects.
55
+ - **Design decisions** — each significant decision: what was decided, why, alternatives rejected.
56
+
57
+ ### 4. ADR (`phase`+)
58
+ - A right-sized Architecture Decision Record: Status · Date · Context (problem, forces, current state, requirements traceability) · Decision (summary + numbered sub-decisions with rationale + integration) · Consequences (positive **and** negative, every negative with a mitigation or explicit acceptance).
59
+ - `phase` tier: phase-scoped ADR (may be a section in `design.md`). `feature`/`full`: a standalone `docs/decisions/ADR-NNNN-*.md`.
60
+
61
+ ### 5. Threat model (`phase` = lite, `feature`+ = full)
62
+ - STRIDE-lite: for each realistic threat, its vector and its mitigation (or explicit acceptance). `phase` tier covers the change's own surface; `feature`+ covers the full feature.
63
+
64
+ ### 6. Error handling & diagnostics (`feature`+)
65
+ - Every error condition → output shape + handling style (validate args before side effects; safe reads return null; actionable messages).
66
+
67
+ ### 7. Test plan (`phase` = hooks, `feature`+ = full)
68
+ - How each success criterion is verified; which are unit vs scenario; the seed inputs for the machine-checkable ones.
69
+
70
+ ### 8. Demand & strategy (`feature`+ / `full`)
71
+ - `feature`: demand evidence (or an explicit "speculative" flag), feature ladder (v0 MVP → v1 → v2).
72
+ - `full`: competitive intelligence, strategic analysis (ERRC: eliminate/reduce/raise/create), adoption analysis.
73
+
74
+ ---
75
+
76
+ ## Quality bar (what `pan-design-checker` enforces)
77
+
78
+ A design artifact **passes** only when all of these hold at its tier. This is the
79
+ same checklist the independent checker verifies — designers should self-check
80
+ against it before handing off, but passing is decided by the checker, not the
81
+ author.
82
+
83
+ 1. **Requirement coverage** — every stated requirement maps to a design element; nothing is silently dropped.
84
+ 2. **Machine-checkable criteria** — ≥2 success criteria are automatable, and each names its check (`phase`+).
85
+ 3. **Architecture conformance** — the design matches conventions *discovered* from the codebase, and introduces no layer/boundary violation.
86
+ 4. **ADR honesty** — alternatives are real (not strawmen); every negative consequence has a mitigation or is explicitly accepted; no placeholder/skeleton sections (`phase`+).
87
+ 5. **Threat coverage** — each identified threat is mitigated or explicitly accepted; none is left open (`phase` lite / `feature`+ full).
88
+ 6. **Testability** — the test plan/hooks map to the success criteria (`phase`+).
89
+ 7. **Scope discipline** — the design stays within the fixed boundary; scope-expanding ideas are captured as "deferred", never designed in.
90
+
91
+ If any dimension fails, the checker returns structured gaps and the designer
92
+ revises. The reflexion loop is capped at **2 revision iterations** (design →
93
+ check → revise → check → final) to prevent over-revision — the same guardrail
94
+ `plan-phase` uses with `pan-plan-checker`.
@@ -14,9 +14,9 @@ The git log should read like a changelog of what shipped, not a diary of plannin
14
14
  | Event | Commit? | Why |
15
15
  | ----------------------- | ------- | ------------------------------------------------ |
16
16
  | BRIEF + ROADMAP created | YES | Project initialization |
17
- | PLAN.md created | NO | Intermediate - commit with plan completion |
18
- | RESEARCH.md created | NO | Intermediate |
19
- | DISCOVERY.md created | NO | Intermediate |
17
+ | plan.md created | NO | Intermediate - commit with plan completion |
18
+ | research.md created | NO | Intermediate |
19
+ | discovery.md created | NO | Intermediate |
20
20
  | **Task completed** | YES | Atomic unit of work (1 commit per task) |
21
21
  | **Plan completed** | YES | Metadata commit (SUMMARY + STATE + ROADMAP) |
22
22
  | Handoff created | YES | WIP state preserved |
@@ -123,13 +123,13 @@ Tasks completed: [N]/[N]
123
123
  - [Task 2 name]
124
124
  - [Task 3 name]
125
125
 
126
- SUMMARY: .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md
126
+ SUMMARY: .planning/phases/XX-name/{phase}-{plan}-summary.md
127
127
  ```
128
128
 
129
129
  What to commit:
130
130
 
131
131
  ```bash
132
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-PLAN.md .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/state.md .planning/roadmap.md
132
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-plan.md .planning/phases/XX-name/{phase}-{plan}-summary.md .planning/state.md .planning/roadmap.md
133
133
  ```
134
134
 
135
135
  **Note:** Code files NOT included - already committed per-task.
@@ -205,9 +205,9 @@ Each plan produces 2-4 commits (tasks + metadata). Clear, granular, bisectable.
205
205
  <anti_patterns>
206
206
 
207
207
  **Still don't commit (intermediate artifacts):**
208
- - PLAN.md creation (commit with plan completion)
209
- - RESEARCH.md (intermediate)
210
- - DISCOVERY.md (intermediate)
208
+ - plan.md creation (commit with plan completion)
209
+ - research.md (intermediate)
210
+ - discovery.md (intermediate)
211
211
  - Minor planning tweaks
212
212
  - "Fixed typo in roadmap"
213
213
 
@@ -228,7 +228,7 @@ Each plan produces 2-4 commits (tasks + metadata). Clear, granular, bisectable.
228
228
  - Git history becomes primary context source for future Claude sessions
229
229
  - `git log --grep="{phase}-{plan}"` shows all work for a plan
230
230
  - `git diff <hash>^..<hash>` shows exact changes per task
231
- - Less reliance on parsing SUMMARY.md = more context for actual work
231
+ - Less reliance on parsing summary.md = more context for actual work
232
232
 
233
233
  **Failure recovery:**
234
234
  - Task 1 committed ✅, Task 2 failed ❌
@@ -13,7 +13,10 @@ phase — context compaction may have dropped earlier sections.
13
13
  | "Phase tests passed locally, /pan:verify-phase isn't needed" | One run isn't validation. verify-phase checks state consistency, doc sync, blockers, and the full suite — not just the phase's own tests. | Always run `/pan:verify-phase` before marking a phase complete. |
14
14
  | "I'll skip /pan:focus-scan and pick the next item myself" | Manual selection ignores priority/budget logic in `focus.cjs`. You'll bias toward easy items and miss higher-priority work. | Use `/pan:focus-scan` → `/pan:focus-plan` → `/pan:focus-exec`. |
15
15
  | "I'll bump the model / add a flag / refactor while I'm here" | Scope creep. The user asked for one change; surrounding cleanup belongs in a separate item. | Do only the requested change. Note unrelated cleanup as a TODO for a future focus-scan. |
16
- | "I'll mark this phase complete; the docs can lag behind" | Doc/state drift compounds. By the next session, the agent reads stale docs and proceeds on false assumptions. | Run `/pan:sync` (or the equivalent doc-sync step) before phase completion. CHANGELOG and version bumps are part of the phase, not after it. |
16
+ | "I'll mark this phase complete; the docs can lag behind" | Doc/state drift compounds. By the next session, the agent reads stale docs and proceeds on false assumptions. | Run the doc-sync step (update CHANGELOG/state and commit via `pan-tools commit`) before phase completion. CHANGELOG and version bumps are part of the phase, not after it. |
17
+ | "The tests pass, so the code is portable" | Tests run on one Node version on one OS. Modern Node auto-detects ESM syntax, so `import`/`export` in a project with no `package.json` passes locally and fails under `"type": "commonjs"` or older Node. | Declare the module type explicitly whenever you emit `import`/`export` or `require` — `"type"` in `package.json`, or `.mjs`/`.cjs` extensions. Never rely on syntax detection. |
18
+ | "It rejects bad input — I wrapped the parser in try/catch" | That only rejects *unparseable* input. Valid JSON of the wrong shape passes through and surfaces as `undefined` in an unrelated caller. | Validate shape after parsing, not just parseability. Assert the expected type/keys and fall back or throw. See `references/verification-patterns.md` → Baseline Checks. |
19
+ | "I'll write the doc now and refine it as I go" | Skeleton-then-refine never converges: field transcripts show planning files rewritten 12-19× and re-read 6-16× in a single step, and every in-flight version of state.md is one a later step can read (P-1808). | Compose the complete document in memory, then issue exactly ONE Write per file per step. Don't re-read a file you wrote this step. Post-write corrections are targeted Edits for a verified defect, never a rewrite. |
17
20
 
18
21
  ## Code Preservation Principle
19
22
 
@@ -24,7 +24,7 @@ Task(
24
24
  )
25
25
  ```
26
26
 
27
- **Note:** Opus-tier agents resolve to `"inherit"` (not `"opus"`). This causes the agent to use the parent session's model, avoiding conflicts with organization policies that may block specific opus versions.
27
+ **Note:** Reasoning-tier agents resolve to `"inherit"` (not `"opus"`). This causes the agent to use the parent session's model, avoiding conflicts with organization policies that may block specific model versions.
28
28
 
29
29
  ## Usage
30
30
 
@@ -10,7 +10,7 @@ PAN uses three abstract tiers instead of hardcoded model names:
10
10
 
11
11
  | Tier | Purpose | Anthropic | OpenAI | Google |
12
12
  |------|---------|-----------|--------|--------|
13
- | `reasoning` | Architecture, planning, complex decisions | inherit (Fable/Opus) | inherit | inherit |
13
+ | `reasoning` | Architecture, planning, complex decisions | inherit (your session's top-tier model) | inherit | inherit |
14
14
  | `mid` | Execution, research, verification | Sonnet | mid | mid |
15
15
  | `fast` | Read-only extraction, budget tasks | Haiku | fast | fast |
16
16
 
@@ -28,55 +28,63 @@ For backward compatibility, legacy Anthropic model names still work:
28
28
 
29
29
  ---
30
30
 
31
- ## Recommended Models (Claude)
31
+ ## Choosing a Reasoning-Tier Model (Claude)
32
32
 
33
- PAN never selects your host model — it recommends one. Because the `reasoning` tier is `inherit`, whichever top-tier model you configure in your runtime (Claude Code, etc.) runs every reasoning-tier agent (planner, conductor, executor, hardener…). `mid` and `fast` agents stay on Sonnet/Haiku regardless, so the whole fleet is never on one expensive model.
33
+ PAN never selects your host model — it recommends a *class*. Because the `reasoning` tier is `inherit`, whichever top-tier model you configure in your runtime (Claude Code, etc.) runs the reasoning-tier agents (planner, conductor, executor…). Since the 2026-07 COST RESET that means *every* agent under `quality` and `balanced` (the default), except the ones that pin a model in their own frontmatter — `grep -l '^model: opus' agents/*.md` lists those, and the pin wins on Claude Code. Only the opt-in `budget` profile drops agents to `mid`/`fast`, which on Anthropic map to Sonnet/Haiku.
34
34
 
35
- | Model | Role in PAN | Context | Relative cost | Notes |
36
- |-------|-------------|---------|---------------|-------|
37
- | `claude-fable-5` | **Recommended flagship** — deepest long-horizon reasoning; best for the bot army's Mission Control + planning | 1M | ~2× Opus | Runs input safety classifiers (see caveat below); requires 30-day data retention |
38
- | `claude-opus-4-8` | **Cost-conscious default** — same 1M context + thinking, half the cost, no cyber classifier | 1M | 1× | The safe pick when you want Opus behavior without Fable's refusal surface |
35
+ The IDs below are *examples* of what you can configure in each class — not an exhaustive or only-valid list. A newer release in the same class behaves the same way here.
39
36
 
40
- **Why Fable is the recommended flagship.** It is Anthropic's most capable widely released model for demanding, long-horizon agentic work — exactly what PAN's hierarchical bot army (Mission Control → squads → workers) asks of its reasoning tier. Select it in your host runtime and `inherit` routes the reasoning-tier agents to it automatically.
37
+ At install time PAN also runs a **best-effort, advisory** capability check on the model ID you have configured (`detectModelCapabilities` in `bin/install-lib.cjs`). It recognizes the current Claude generations by name, and its forward threshold per family is the last reduced-capability release it records rather than the newest release it lists: any Claude ID newer than that boundary — a new major, or a later point release inside a major it already lists — inherits that family's modern profile instead of reporting no capabilities at all. "That family's profile" is the point: a newer Haiku inherits Haiku's, which is not a 1M-context/thinking profile. An ID resolves either by matching an explicit branch in the table or — for Claude names — by carrying a family plus a readable release number strictly newer than that family's last reduced-capability release; anything that resolves neither way reads as `tier: 'unknown'` with every capability flag false. It is a name-matching heuristic, not a live probe of the model, so it can still be imprecise about something released after this table — read it as a hint, not a contract. Either way it decides one thing only: whether the installer prints a capability *warning*. No routing, mode-selection, or feature gate in PAN reads it, so a wrong guess costs you a misleading install-time line and nothing else.
41
38
 
42
- **Fable caveat — the cyber-classifier refusal, and how PAN handles it.** Fable is the only current Claude model that runs input safety classifiers targeting cybersecurity and biology content, and benign *defensive* security tooling can trigger false positives — a successful response with `stop_reason: "refusal"` and `stop_details.category: "cyber"`. In PAN this hits every security path: `/pan:review-deep`, `exec-phase --deep-review`, **and the `focus-auto`/army `security` category** (which was observed refusing in a real project). Two mitigations, in order of reliability:
39
+ | Class | Example model IDs | Role in PAN | Context | Relative cost | Notes |
40
+ |-------|-------------------|-------------|---------|---------------|-------|
41
+ | Fable / Mythos | `claude-fable-5` | **Recommended flagship** — deepest long-horizon reasoning; best for the bot army's Mission Control + planning | 1M | ~2× Opus | Runs input safety classifiers (see caveat below); requires 30-day data retention |
42
+ | Opus | `claude-opus-5`, `claude-opus-4-8` | **Cost-conscious pick** — same 1M context + thinking, about half the cost, no cyber classifier | 1M | 1× | The safe pick when you want Opus behavior without Fable's refusal surface |
43
43
 
44
- 1. **Opus pin (the durable fix).** `pan-hardener`, `pan-reviewer`, and `pan-meta-reviewer` carry `model: opus` in their frontmatter, so on **Claude Code** they run on Opus 4.8 regardless of your session model and never reach Fable's classifier. The `focus-auto` security category routes its vulnerability *assessment* through the Opus-pinned `pan-hardener` for the same reason. This pin is **Claude-Code-only** — it is stripped from the Gemini/OpenCode/Codex/Copilot outputs by the installer, so on the other runtimes run security campaigns on a non-Fable model.
44
+ **Why the Fable class is the recommended flagship.** It is Anthropic's deepest class for demanding, long-horizon agentic work — exactly what PAN's hierarchical bot army (Mission Control → squads → workers) asks of its reasoning tier. Select the current release in that class in your host runtime and `inherit` routes the reasoning-tier agents to it automatically.
45
+
46
+ **Fable caveat — the cyber-classifier refusal, and how PAN handles it.** Fable-class models run input safety classifiers targeting cybersecurity and biology content, and benign *defensive* security tooling can trigger false positives — a successful response with `stop_reason: "refusal"` and `stop_details.category: "cyber"`. In PAN this hits every security path: `/pan:review-deep`, `exec-phase --deep-review`, **and the `focus-auto`/army `security` category** (which was observed refusing in a real project). Two mitigations, in order of reliability:
47
+
48
+ 1. **Opus pin (the durable fix).** PAN's security-review agents carry `model: opus` in their frontmatter — `grep -l '^model: opus' agents/*.md` lists the current set — so on **Claude Code** they run on the default Opus model regardless of your session model and never reach Fable's classifier. The `focus-auto` security category routes its vulnerability *assessment* through the Opus-pinned `pan-hardener` for the same reason. This pin is **Claude-Code-only** — it is stripped from the Gemini/OpenCode/Codex/Copilot outputs by the installer, so on the other runtimes run security campaigns on a non-Fable model.
45
49
  2. **Defensive framing.** Those agents and the `focus-auto` security prose are written as *authorized, defensive review* (no exploit-path narration), which lowers the trigger rate but cannot eliminate it — a security scanner must name injection, auth bypass, and RCE by definition. Framing is the backstop; the Opus pin is the fix.
46
50
 
47
51
  **Fable data-retention requirement.** Fable is not available under zero data retention; an org whose retention is below 30 days gets a hard `400` on every request. If Fable 400s on every call with an otherwise-valid request, check the org's retention setting before debugging anything else.
48
52
 
49
- **Prompting note for Fable.** Fable prefers *less-prescriptive* prompts than earlier models and runs longer per turn. PAN's autonomous-loop guidance (anti-overplanning, grounded progress claims, act-when-you-have-enough) already aligns with this; avoid piling on `CRITICAL: YOU MUST` scaffolding, which can reduce Fable's output quality.
53
+ **Prompting note for Fable.** Fable-class models prefer *less-prescriptive* prompts than earlier generations and run longer per turn. PAN's autonomous-loop guidance (anti-overplanning, grounded progress claims, act-when-you-have-enough) already aligns with this; avoid piling on `CRITICAL: YOU MUST` scaffolding, which can reduce Fable's output quality.
50
54
 
51
55
  ---
52
56
 
53
57
  ## Profile Definitions
54
58
 
59
+ Since the 2026-07 **COST RESET**, `quality` and `balanced` are identical — both route every agent to the `reasoning` tier. Only the opt-in `budget` profile steps agents below reasoning (to `mid`/`fast` per the last column). The table below is illustrative; `core.cjs` `MODEL_PROFILES` is the source of truth and covers the full agent roster.
60
+
55
61
  | Agent | `quality` | `balanced` | `budget` |
56
62
  |-------|-----------|------------|----------|
57
63
  | pan-planner | reasoning | reasoning | mid |
58
- | pan-roadmapper | reasoning | mid | mid |
59
- | pan-executor | reasoning | mid | mid |
60
- | pan-phase-researcher | reasoning | mid | fast |
61
- | pan-project-researcher | reasoning | mid | fast |
62
- | pan-research-synthesizer | reasoning | mid | fast |
63
- | pan-debugger | reasoning | mid | mid |
64
- | pan-document_code | reasoning | fast | fast |
65
- | pan-verifier | reasoning | mid | fast |
66
- | pan-plan-checker | reasoning | mid | fast |
67
- | pan-integration-checker | reasoning | mid | fast |
68
- | pan-reviewer | reasoning | fast | fast |
64
+ | pan-roadmapper | reasoning | reasoning | mid |
65
+ | pan-executor | reasoning | reasoning | mid |
66
+ | pan-phase-researcher | reasoning | reasoning | fast |
67
+ | pan-project-researcher | reasoning | reasoning | fast |
68
+ | pan-research-synthesizer | reasoning | reasoning | fast |
69
+ | pan-debugger | reasoning | reasoning | mid |
70
+ | pan-document_code | reasoning | reasoning | fast |
71
+ | pan-verifier | reasoning | reasoning | fast |
72
+ | pan-plan-checker | reasoning | reasoning | fast |
73
+ | pan-integration-checker | reasoning | reasoning | fast |
74
+ | pan-reviewer | reasoning | reasoning | fast |
69
75
 
70
76
  ### Profile Philosophy
71
77
 
78
+ Post-COST-RESET, `quality` and `balanced` are the same profile in practice — both give every agent the `reasoning` tier. Cost savings come only from opting into `budget`.
79
+
72
80
  **quality** — Maximum reasoning power
73
81
  - Reasoning tier for ALL agents. Use when quota is available, critical architecture work, or maximum quality is desired.
74
82
 
75
- **balanced** (default) — Smart allocation
76
- - Reasoning only for planning (where architecture decisions happen). Mid for execution. Fast for read-only tasks. Good balance of quality and cost.
83
+ **balanced** (default) — Reasoning everywhere
84
+ - Identical to `quality` since the COST RESET: reasoning tier for every agent. It remains the default so new projects get full reasoning power out of the box. Switch to `budget` when you need to cut token spend.
77
85
 
78
86
  **budget** — Minimal token spend
79
- - Mid for anything that writes code. Fast for research and verification. Use for high-volume work or less critical phases.
87
+ - The only profile that steps agents below reasoning: mid for anything that writes code, fast for research and verification (see the `budget` column). Use for high-volume work or less critical phases.
80
88
 
81
89
  ### Cost Multipliers
82
90
 
@@ -246,17 +254,19 @@ Runtime: `/pan:profile <profile>`
246
254
 
247
255
  ## Design Rationale
248
256
 
249
- **Why reasoning for pan-planner?**
250
- Planning involves architecture decisions, goal decomposition, and task design. This is where model quality has the highest impact.
257
+ Since the 2026-07 COST RESET, `quality` and `balanced` put every agent on the `reasoning` tier — so the notes below explain the tier each agent *steps down to* under `budget`, the only profile that now drops below reasoning.
258
+
259
+ **Why reasoning for pan-planner (and every agent under quality/balanced)?**
260
+ Planning involves architecture decisions, goal decomposition, and task design — where model quality has the highest impact. Post-COST-RESET the reasoning tier is inexpensive enough that every agent stays on it unless you opt into budget.
251
261
 
252
- **Why mid for pan-executor?**
253
- Executors follow explicit PLAN.md instructions. The plan already contains the reasoning; execution is implementation.
262
+ **Why mid for pan-executor under budget?**
263
+ Executors follow explicit PLAN.md instructions. The plan already contains the reasoning; execution is implementation, so `budget` can safely step them to mid.
254
264
 
255
- **Why mid (not fast) for verifiers in balanced?**
256
- Verification requires goal-backward reasoning — checking if code *delivers* what the phase promised, not just pattern matching.
265
+ **Why fast for verifiers under budget?**
266
+ Verification ideally uses goal-backward reasoning, but under `budget` the check degrades gracefully to fast pattern-matching to save tokens.
257
267
 
258
- **Why fast for pan-document_code?**
268
+ **Why fast for pan-document_code under budget?**
259
269
  Read-only exploration and pattern extraction. No reasoning required, just structured output from file contents.
260
270
 
261
- **Why fast for pan-reviewer in balanced?**
262
- Code review is pattern-matching against known conventions and security rules. Fast handles checklist-style verification efficiently.
271
+ **Why fast for pan-reviewer under budget?**
272
+ Code review is pattern-matching against known conventions and security rules. Fast handles checklist-style verification efficiently when budget is engaged.
@@ -101,7 +101,7 @@ To use uncommitted mode:
101
101
  git commit -m "chore: stop tracking planning docs"
102
102
  ```
103
103
 
104
- 4. **Branch merges:** When using `branching_strategy: phase` or `milestone`, the `complete-milestone` workflow automatically strips `.planning/` files from staging before merge commits when `commit_docs: false`.
104
+ 4. **Branch merges:** When using `branching_strategy: phase` or `milestone`, the `milestone-done` workflow automatically strips `.planning/` files from staging before merge commits when `commit_docs: false`.
105
105
 
106
106
  </setup_uncommitted_mode>
107
107
 
@@ -113,7 +113,7 @@ To use uncommitted mode:
113
113
  |----------|---------------------|--------------|-------------|
114
114
  | `none` | Never | N/A | N/A |
115
115
  | `phase` | At `execute-phase` start | Single phase | User merges after phase |
116
- | `milestone` | At first `execute-phase` of milestone | Entire milestone | At `complete-milestone` |
116
+ | `milestone` | At first `execute-phase` of milestone | Entire milestone | At `milestone-done` |
117
117
 
118
118
  **When `git.branching_strategy: "none"` (default):**
119
119
  - All work commits to current branch
@@ -124,13 +124,13 @@ To use uncommitted mode:
124
124
  - Branch name from `phase_branch_template` (e.g., `pan/phase-03-authentication`)
125
125
  - All plan commits go to that branch
126
126
  - User merges branches manually after phase completion
127
- - `complete-milestone` offers to merge all phase branches
127
+ - `milestone-done` offers to merge all phase branches
128
128
 
129
129
  **When `git.branching_strategy: "milestone"`:**
130
130
  - First `execute-phase` of milestone creates the milestone branch
131
131
  - Branch name from `milestone_branch_template` (e.g., `pan/v1.0-mvp`)
132
132
  - All phases in milestone commit to same branch
133
- - `complete-milestone` offers to merge milestone branch to main
133
+ - `milestone-done` offers to merge milestone branch to main
134
134
 
135
135
  **Template variables:**
136
136
 
@@ -172,7 +172,7 @@ if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
172
172
  fi
173
173
  ```
174
174
 
175
- **Merge options at complete-milestone:**
175
+ **Merge options at milestone-done:**
176
176
 
177
177
  | Option | Git command | Result |
178
178
  |--------|-------------|--------|
@@ -556,6 +556,73 @@ Run these checks against each must-have artifact. Aggregate results into VERIFIC
556
556
 
557
557
  </automated_verification_script>
558
558
 
559
+ <criteria_independent_baseline>
560
+
561
+ ## Baseline Checks That Ignore the Success Criteria
562
+
563
+ Criterion-driven verification only sees what someone wrote down. A defect that sits
564
+ outside a phase's stated success criteria is invisible to a verifier that walks the
565
+ criteria list — the phase passes, and the bug ships. Run the checks below on every
566
+ phase regardless of what the criteria say.
567
+
568
+ ### Module system is declared, not inferred
569
+
570
+ Node 20.19+ and 22+ auto-detect ESM syntax in `.js` files with no `package.json`.
571
+ Code that only runs because of that detection breaks under an explicit
572
+ `"type": "commonjs"`, on older Node, and in any bundler that trusts the manifest:
573
+
574
+ ```
575
+ SyntaxError: Cannot use import statement outside a module
576
+ ```
577
+
578
+ Tests do not catch it — they run on the same forgiving Node that hid it.
579
+
580
+ ```bash
581
+ # If any shipped source uses ESM syntax...
582
+ grep -rlE '^\s*(import|export)\s' src/ --include='*.js'
583
+
584
+ # ...then a package.json must exist and declare the module type.
585
+ test -f package.json && grep -q '"type"' package.json || echo "FAIL: ESM emitted with no declared module type"
586
+ ```
587
+
588
+ Verify the declaration matches the syntax in use: `"type": "module"` for
589
+ `import`/`export`, `"type": "commonjs"` for `require`/`module.exports`, or the
590
+ `.mjs`/`.cjs` extensions to opt individual files out. A project claiming
591
+ cross-platform or multi-Node support has not met that claim until this is explicit.
592
+
593
+ ### Input validation checks shape, not just parseability
594
+
595
+ "Rejects malformed input" is routinely implemented as a `try`/`catch` around a
596
+ parser. That catches unparseable bytes and nothing else — valid JSON of the wrong
597
+ shape passes straight through, and the caller gets `undefined` two frames later:
598
+
599
+ ```js
600
+ // Passes a parseability test; returns [] for a file containing "[]",
601
+ // leaving .todos undefined for every downstream caller.
602
+ function load(file) {
603
+ try { return JSON.parse(fs.readFileSync(file, 'utf-8')); }
604
+ catch { return { todos: [] }; }
605
+ }
606
+ ```
607
+
608
+ For every function that reads external input (file, network, env, CLI argument),
609
+ confirm both halves:
610
+
611
+ | Check | Weak version | What to require |
612
+ |---|---|---|
613
+ | Unparseable input | `try`/`catch` around the parser | Same — this half is usually right |
614
+ | Wrong-shape input | *(absent)* | Assert the expected type/keys after parsing, then fall back or throw |
615
+
616
+ ```bash
617
+ # Parsers that return their result unchecked are the pattern to look for
618
+ grep -rnE 'JSON\.parse\([^)]*\)' src/ | grep -v -E 'typeof|Array\.isArray|schema|validate'
619
+ ```
620
+
621
+ Fixture the wrong-shape case explicitly: feed the loader `[]`, `null`, `{}`, and
622
+ `{"todos": "not-an-array"}`, and assert the caller still gets a usable value.
623
+
624
+ </criteria_independent_baseline>
625
+
559
626
  <human_verification_triggers>
560
627
 
561
628
  ## Verifiable Signals Beat Prose Judgment (P-RES-006)
@@ -1,6 +1,6 @@
1
1
  # Architecture Template
2
2
 
3
- Template for `.planning/codebase/ARCHITECTURE.md` - captures conceptual code organization.
3
+ Template for `.planning/codebase/architecture.md` - captures conceptual code organization.
4
4
 
5
5
  **Purpose:** Document how the code is organized at a conceptual level. Complements STRUCTURE.md (which shows physical file locations).
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Codebase Concerns Template
2
2
 
3
- Template for `.planning/codebase/CONCERNS.md` - captures known issues and areas requiring care.
3
+ Template for `.planning/codebase/concerns.md` - captures known issues and areas requiring care.
4
4
 
5
5
  **Purpose:** Surface actionable warnings about the codebase. Focused on "what to watch out for when making changes."
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Coding Conventions Template
2
2
 
3
- Template for `.planning/codebase/CONVENTIONS.md` - captures coding style and patterns.
3
+ Template for `.planning/codebase/conventions.md` - captures coding style and patterns.
4
4
 
5
5
  **Purpose:** Document how code is written in this codebase. Prescriptive guide for Claude to match existing style.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # External Integrations Template
2
2
 
3
- Template for `.planning/codebase/INTEGRATIONS.md` - captures external service dependencies.
3
+ Template for `.planning/codebase/integrations.md` - captures external service dependencies.
4
4
 
5
5
  **Purpose:** Document what external systems this codebase communicates with. Focused on "what lives outside our code that we depend on."
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Technology Stack Template
2
2
 
3
- Template for `.planning/codebase/STACK.md` - captures the technology foundation.
3
+ Template for `.planning/codebase/stack.md` - captures the technology foundation.
4
4
 
5
5
  **Purpose:** Document what technologies run this codebase. Focused on "what executes when you run the code."
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Structure Template
2
2
 
3
- Template for `.planning/codebase/STRUCTURE.md` - captures physical file organization.
3
+ Template for `.planning/codebase/structure.md` - captures physical file organization.
4
4
 
5
5
  **Purpose:** Document where things physically live in the codebase. Answers "where do I put X?"
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Testing Patterns Template
2
2
 
3
- Template for `.planning/codebase/TESTING.md` - captures test framework and patterns.
3
+ Template for `.planning/codebase/testing.md` - captures test framework and patterns.
4
4
 
5
5
  **Purpose:** Document how tests are written and run. Guide for adding tests that match existing patterns.
6
6