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
@@ -8,6 +8,21 @@ Read all files referenced by the invoking prompt's execution_context before star
8
8
  @~/.claude/pan-wizard-core/references/guardrails.md
9
9
  </required_reading>
10
10
 
11
+ <planning_write_policy>
12
+
13
+ **P-1808 — compose once, write once.** Every planning document this workflow produces (`project.md`, `requirements.md`, `roadmap.md`, `state.md`) is composed **in full, in memory, then written exactly once**. Field transcripts (PanLoop, 2026-08-08) counted `state.md` rewritten up to **12 times inside a single step**, `roadmap.md` and `project.md` 3× each, the same files re-read up to 6× — an agent failing to converge on a document it authored moments earlier. Every in-flight version of `state.md` is a chance for a later step to read a partial write, and the rewrite churn is why this workflow's duration varied 7× on similar briefs.
14
+
15
+ Rules, for this orchestrator and every subagent it spawns:
16
+
17
+ 1. **Gather everything, then emit.** Do not write a skeleton and refine it in place. Not ready to write the final document = still in the gathering step.
18
+ 2. **One Write per file per step.** Preparing a second Write to the same file in the same step means the first was premature — stop, finish composing, write once.
19
+ 3. **Do not re-read a file you wrote this step.** You know what it says; re-reading your own output to "check" it is the non-convergence loop starting.
20
+ 4. **Post-write corrections are targeted Edits for a verified defect** (wrong value, broken parse) — never a rewrite for restructuring you should have composed the first time.
21
+
22
+ "Write files first, then return" — the persistence rule — is unchanged: it orders writes **before the return**; it does not license early drafts.
23
+
24
+ </planning_write_policy>
25
+
11
26
  ## Phase 0 — Clarify (MANDATORY, do not skip)
12
27
 
13
28
  Before scaffolding or coding anything, confirm with the user:
@@ -63,7 +78,7 @@ The document should describe what you want to build.
63
78
  **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
64
79
 
65
80
  ```bash
66
- INIT=$(node ./.claude/pan-wizard-core/bin/pan-tools.cjs init new-project)
81
+ INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init new-project)
67
82
  ```
68
83
 
69
84
  Parse JSON for: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `project_exists`, `has_codebase_map`, `planning_exists`, `has_existing_code`, `has_package_file`, `is_brownfield`, `needs_codebase_map`, `has_git`, `project_path`.
@@ -154,13 +169,13 @@ Create `.planning/config.json` with mode set to "yolo":
154
169
 
155
170
  ```bash
156
171
  mkdir -p .planning
157
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "chore: add project config" --files .planning/config.json
172
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "chore: add project config" --files .planning/config.json
158
173
  ```
159
174
 
160
175
  **Persist auto-advance to config (survives context compaction):**
161
176
 
162
177
  ```bash
163
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advance true
178
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advance true
164
179
  ```
165
180
 
166
181
  Proceed to Step 4 (skip Steps 3 and 5).
@@ -304,19 +319,19 @@ Do not compress. Capture everything gathered.
304
319
 
305
320
  ```bash
306
321
  mkdir -p .planning
307
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: initialize project" --files .planning/project.md
322
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: initialize project" --files .planning/project.md
308
323
  ```
309
324
 
310
325
  ## 5. Workflow Preferences
311
326
 
312
327
  **If auto mode:** Skip — config was collected in Step 2a. Proceed to Step 5.5.
313
328
 
314
- **Check for global defaults** at `~/.pan-wizard-core/defaults.json`. If the file exists, offer to use saved defaults:
329
+ **Check for global defaults** at `~/.pan-wizard/defaults.json`. If the file exists, offer to use saved defaults:
315
330
 
316
331
  ```
317
332
  AskUserQuestion([
318
333
  {
319
- question: "Use your saved default settings? (from ~/.pan-wizard-core/defaults.json)",
334
+ question: "Use your saved default settings? (from ~/.pan-wizard/defaults.json)",
320
335
  header: "Defaults",
321
336
  multiSelect: false,
322
337
  options: [
@@ -327,9 +342,9 @@ AskUserQuestion([
327
342
  ])
328
343
  ```
329
344
 
330
- If "Yes": read `~/.pan-wizard-core/defaults.json`, use those values for config.json, and skip directly to **Commit config.json** below.
345
+ If "Yes": read `~/.pan-wizard/defaults.json`, use those values for config.json, and skip directly to **Commit config.json** below.
331
346
 
332
- If "No" or `~/.pan-wizard-core/defaults.json` doesn't exist: proceed with the questions below.
347
+ If "No" or `~/.pan-wizard/defaults.json` doesn't exist: proceed with the questions below.
333
348
 
334
349
  **Round 1 — Core workflow settings (4 questions):**
335
350
 
@@ -421,9 +436,9 @@ questions: [
421
436
  question: "Which AI models for planning agents?",
422
437
  multiSelect: false,
423
438
  options: [
424
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
425
- { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
426
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
439
+ { label: "Balanced (Recommended)", description: "reasoning tier for every agent — the default (identical to quality post-COST-RESET)" },
440
+ { label: "Quality", description: "reasoning tier for every agent — identical to balanced, so switching between the two changes nothing" },
441
+ { label: "Budget", description: "mid tier for writing, fast tier for research/verification — fastest, lowest cost" }
427
442
  ]
428
443
  }
429
444
  ]
@@ -456,7 +471,7 @@ Create `.planning/config.json` with all settings:
456
471
  **Commit config.json:**
457
472
 
458
473
  ```bash
459
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "chore: add project config" --files .planning/config.json
474
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "chore: add project config" --files .planning/config.json
460
475
  ```
461
476
 
462
477
  **Note:** Run `/pan:settings` anytime to update these preferences.
@@ -510,7 +525,7 @@ Display spawning indicator:
510
525
  Spawn 4 parallel pan-project-researcher agents with path references:
511
526
 
512
527
  ```
513
- Task(prompt="First, read ./.claude/agents/pan-project-researcher.md for your role and instructions.
528
+ Task(prompt="First, read ~/.claude/agents/pan-project-researcher.md for your role and instructions.
514
529
 
515
530
  <research_type>
516
531
  Project Research — Stack dimension for [domain].
@@ -546,11 +561,11 @@ Your stack.md feeds into roadmap creation. Be prescriptive:
546
561
 
547
562
  <output>
548
563
  Write to: .planning/research/stack.md
549
- Use template: ./.claude/pan-wizard-core/templates/research-project/stack.md
564
+ Use template: ~/.claude/pan-wizard-core/templates/research-project/stack.md
550
565
  </output>
551
566
  ", subagent_type="general-purpose", model="{researcher_model}", description="Stack research")
552
567
 
553
- Task(prompt="First, read ./.claude/agents/pan-project-researcher.md for your role and instructions.
568
+ Task(prompt="First, read ~/.claude/agents/pan-project-researcher.md for your role and instructions.
554
569
 
555
570
  <research_type>
556
571
  Project Research — Features dimension for [domain].
@@ -586,11 +601,11 @@ Your features.md feeds into requirements definition. Categorize clearly:
586
601
 
587
602
  <output>
588
603
  Write to: .planning/research/features.md
589
- Use template: ./.claude/pan-wizard-core/templates/research-project/features.md
604
+ Use template: ~/.claude/pan-wizard-core/templates/research-project/features.md
590
605
  </output>
591
606
  ", subagent_type="general-purpose", model="{researcher_model}", description="Features research")
592
607
 
593
- Task(prompt="First, read ./.claude/agents/pan-project-researcher.md for your role and instructions.
608
+ Task(prompt="First, read ~/.claude/agents/pan-project-researcher.md for your role and instructions.
594
609
 
595
610
  <research_type>
596
611
  Project Research — Architecture dimension for [domain].
@@ -626,11 +641,11 @@ Your architecture.md informs phase structure in roadmap. Include:
626
641
 
627
642
  <output>
628
643
  Write to: .planning/research/architecture.md
629
- Use template: ./.claude/pan-wizard-core/templates/research-project/architecture.md
644
+ Use template: ~/.claude/pan-wizard-core/templates/research-project/architecture.md
630
645
  </output>
631
646
  ", subagent_type="general-purpose", model="{researcher_model}", description="Architecture research")
632
647
 
633
- Task(prompt="First, read ./.claude/agents/pan-project-researcher.md for your role and instructions.
648
+ Task(prompt="First, read ~/.claude/agents/pan-project-researcher.md for your role and instructions.
634
649
 
635
650
  <research_type>
636
651
  Project Research — Pitfalls dimension for [domain].
@@ -666,7 +681,7 @@ Your pitfalls.md prevents mistakes in roadmap/planning. For each pitfall:
666
681
 
667
682
  <output>
668
683
  Write to: .planning/research/pitfalls.md
669
- Use template: ./.claude/pan-wizard-core/templates/research-project/pitfalls.md
684
+ Use template: ~/.claude/pan-wizard-core/templates/research-project/pitfalls.md
670
685
  </output>
671
686
  ", subagent_type="general-purpose", model="{researcher_model}", description="Pitfalls research")
672
687
  ```
@@ -688,7 +703,7 @@ Synthesize research outputs into summary.md.
688
703
 
689
704
  <output>
690
705
  Write to: .planning/research/summary.md
691
- Use template: ./.claude/pan-wizard-core/templates/research-project/summary.md
706
+ Use template: ~/.claude/pan-wizard-core/templates/research-project/summary.md
692
707
  Commit after writing.
693
708
  </output>
694
709
  ", subagent_type="pan-research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
@@ -727,7 +742,7 @@ Read project.md and extract:
727
742
  - Stated constraints (budget, timeline, tech limitations)
728
743
  - Any explicit scope boundaries
729
744
 
730
- **If research exists:** Read research/FEATURES.md and extract feature categories.
745
+ **If research exists:** Read research/features.md and extract feature categories.
731
746
 
732
747
  **If auto mode:**
733
748
  - Auto-include all table stakes features (users expect these)
@@ -853,7 +868,7 @@ If "adjust": Return to scoping.
853
868
  **Commit requirements:**
854
869
 
855
870
  ```bash
856
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: define v1 requirements" --files .planning/requirements.md
871
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: define v1 requirements" --files .planning/requirements.md
857
872
  ```
858
873
 
859
874
  ## 8. Create Roadmap
@@ -888,10 +903,10 @@ Create roadmap:
888
903
  2. Map every v1 requirement to exactly one phase
889
904
  3. Derive 2-5 success criteria per phase (observable user behaviors)
890
905
  4. Validate 100% coverage
891
- 5. Write files immediately (roadmap.md, state.md, update requirements.md traceability)
906
+ 5. Compose each file in full, then write each exactly once — one Write per file, no draft-then-refine (P-1808): roadmap.md, state.md, update requirements.md traceability
892
907
  6. Return ROADMAP CREATED with summary
893
908
 
894
- Write files first, then return. This ensures artifacts persist even if context is lost.
909
+ Write files first, then return — before the return, not early and often. One complete Write per file persists the artifacts without the rewrite churn (P-1808).
895
910
  </instructions>
896
911
  ", subagent_type="pan-roadmapper", model="{roadmapper_model}", description="Create roadmap")
897
912
  ```
@@ -983,7 +998,7 @@ Use AskUserQuestion:
983
998
  **Commit roadmap (after approval or auto mode):**
984
999
 
985
1000
  ```bash
986
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: create roadmap ([N] phases)" --files .planning/roadmap.md .planning/state.md .planning/requirements.md
1001
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: create roadmap ([N] phases)" --files .planning/roadmap.md .planning/state.md .planning/requirements.md
987
1002
  ```
988
1003
 
989
1004
  ## 8.5. Standards Recommendation
@@ -991,7 +1006,7 @@ node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: create roadmap ([
991
1006
  **After roadmap is committed, offer standards selection based on project type.**
992
1007
 
993
1008
  ```bash
994
- RECOMMEND=$(node ./.claude/pan-wizard-core/bin/pan-tools.cjs standards recommend)
1009
+ RECOMMEND=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs standards recommend)
995
1010
  ```
996
1011
 
997
1012
  If the command succeeds (project.md exists and project types detected):
@@ -1004,9 +1019,9 @@ Parse JSON for `project_types` and `recommendations` arrays.
1004
1019
  HIGH_IDS=$(echo "$RECOMMEND" | jq -r '.recommendations[] | select(.priority=="high") | .id')
1005
1020
  if [ -n "$HIGH_IDS" ]; then
1006
1021
  for id in $HIGH_IDS; do
1007
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs standards select "$id"
1022
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs standards select "$id"
1008
1023
  done
1009
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: add recommended standards" --files .planning/standards.md
1024
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: add recommended standards" --files .planning/standards.md
1010
1025
  fi
1011
1026
  ```
1012
1027
 
@@ -1036,12 +1051,12 @@ Use AskUserQuestion:
1036
1051
 
1037
1052
  For each selected standard:
1038
1053
  ```bash
1039
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs standards select [id]
1054
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs standards select [id]
1040
1055
  ```
1041
1056
 
1042
1057
  If any selected, commit:
1043
1058
  ```bash
1044
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: add project standards" --files .planning/standards.md
1059
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: add project standards" --files .planning/standards.md
1045
1060
  ```
1046
1061
 
1047
1062
  Display:
@@ -1058,7 +1073,7 @@ Run /pan:health --standards to check compliance anytime.
1058
1073
 
1059
1074
  ```bash
1060
1075
  if [ "$(git status --porcelain .planning/ 2>/dev/null)" ]; then
1061
- node ./.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: bundle remaining .planning artifacts (safety-net)" --files .planning/
1076
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: bundle remaining .planning artifacts (safety-net)" --files .planning/
1062
1077
  fi
1063
1078
  ```
1064
1079
 
@@ -12,7 +12,7 @@ Manage the circular optimization loop — apply reports, check stats, control tr
12
12
  | `stats` | Show cumulative stats |
13
13
  | `trace init` | Start a new trace session |
14
14
  | `trace end` | Finalize current session |
15
- | `trace status` | Show active session |
15
+ | `trace current` | Show active session |
16
16
  | `trace list` | List all sessions |
17
17
 
18
18
  ---
@@ -23,7 +23,7 @@ Manage the circular optimization loop — apply reports, check stats, control tr
23
23
 
24
24
  Run:
25
25
  ```
26
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize list
26
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize list
27
27
  ```
28
28
 
29
29
  Use the most recent `.md` report (the full opt-report, not the `-analysis.json`).
@@ -33,7 +33,7 @@ If `--report <filename>` was specified, use that file from `.planning/optimizati
33
33
  ### Step 2 — Run apply
34
34
 
35
35
  ```
36
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize apply [--report <path>]
36
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize apply [--report <path>]
37
37
  ```
38
38
 
39
39
  ### Step 3 — Present results
@@ -63,7 +63,7 @@ If `--description "..."` was provided, extract it from the args.
63
63
  ### Step 2 — Initialize session
64
64
 
65
65
  ```
66
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init [--description "..."]
66
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init [--description "..."]
67
67
  ```
68
68
 
69
69
  Show the user the session ID and confirm that:
@@ -76,17 +76,17 @@ Show the user the session ID and confirm that:
76
76
  ## trace end
77
77
 
78
78
  ```
79
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end
79
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end
80
80
  ```
81
81
 
82
82
  Show: session ID, event count, agent count, type breakdown.
83
83
 
84
84
  ---
85
85
 
86
- ## trace status
86
+ ## trace current
87
87
 
88
88
  ```
89
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize trace current
89
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace current
90
90
  ```
91
91
 
92
92
  If active: show session ID and instruct how to view events.
@@ -97,7 +97,7 @@ If none: tell user to run `/pan:optimize trace init` before their next build.
97
97
  ## stats
98
98
 
99
99
  ```
100
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize stats
100
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize stats
101
101
  ```
102
102
 
103
103
  Present as a summary table:
@@ -13,7 +13,7 @@ Find current phase directory from most recently modified files:
13
13
 
14
14
  ```bash
15
15
  # Find most recent phase directory with work
16
- ls -lt .planning/phases/*/plan.md 2>/dev/null | head -1 | grep -oP 'phases/\K[^/]+'
16
+ ls -lt .planning/phases/*/*-plan.md 2>/dev/null | head -1 | sed -n 's#.*phases/\([^/]*\)/.*#\1#p'
17
17
  ```
18
18
 
19
19
  If no active phase detected, ask user which phase they're pausing work on.
@@ -47,7 +47,7 @@ Exit.
47
47
 
48
48
  Read the phase artifacts (in order of priority):
49
49
  1. `${phase_dir}/*-summary.md` — what was implemented, files changed
50
- 2. `${phase_dir}/context.md` — acceptance criteria, decisions
50
+ 2. `${phase_dir}/*-context.md` — acceptance criteria, decisions
51
51
  3. `${phase_dir}/*-verification.md` — user-verified scenarios (if UAT was done)
52
52
 
53
53
  If no summary.md exists:
@@ -341,7 +341,7 @@ If there are passing tests to commit:
341
341
 
342
342
  ```bash
343
343
  git add {test files}
344
- git commit -m "test(phase-${phase_number}): add unit and E2E tests from add-tests command"
344
+ git commit -m "test(phase-${phase_number}): add unit and E2E tests from phase-tests command"
345
345
  ```
346
346
 
347
347
  Present next steps:
@@ -542,6 +542,10 @@ Check for auto-advance trigger:
542
542
  ```bash
543
543
  AUTO_CFG=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
544
544
  ```
545
+ 3. **If `--auto` flag present AND `AUTO_CFG` is not true — persist it** (same as discuss-phase's auto_advance step), so the rest of the chain and the P-1809 stop guard see the run as autonomous on disk (P-1810):
546
+ ```bash
547
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advance true
548
+ ```
545
549
 
546
550
  **If `--auto` flag present OR `AUTO_CFG` is true:**
547
551
 
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Switch the model profile used by PAN agents. Controls which Claude model each agent uses, balancing quality vs token spend.
2
+ Switch the model profile used by PAN agents. Controls which model tier each agent uses, balancing quality vs token spend.
3
3
  </purpose>
4
4
 
5
5
  <required_reading>
@@ -88,20 +88,23 @@ Agents will now use:
88
88
 
89
89
  [Show table from MODEL_PROFILES in pan-tools.cjs for selected profile]
90
90
 
91
- Example:
92
- | Agent | Model |
93
- |-------|-------|
94
- | pan-planner | opus |
95
- | pan-executor | sonnet |
96
- | pan-verifier | haiku |
91
+ Example (`budget` — the only profile that steps agents below the reasoning
92
+ tier; `quality` and `balanced` put every agent on `reasoning`):
93
+ | Agent | Tier |
94
+ |-------|------|
95
+ | pan-planner | mid |
96
+ | pan-executor | mid |
97
+ | pan-verifier | fast |
97
98
  | ... | ... |
98
99
 
99
100
  Cost estimate:
100
101
  [Run: node ~/.claude/pan-wizard-core/bin/pan-tools.cjs estimate-cost]
101
102
  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
103
+ and highlight the selected profile — read the numbers from the command output,
104
+ don't hardcode them (`quality` and `balanced` report the same multiplier).
105
+ Example shape:
106
+ quality: <n>× avg | balanced: <n>× avg | budget: <n>× avg
107
+ ^^^^^^^^^^^^^^^^ selected
105
108
 
106
109
  Next spawned agents will use the new profile.
107
110
  ```
@@ -26,7 +26,7 @@ If `found` is false: Error and exit.
26
26
  ## Step 2: Check Existing Research
27
27
 
28
28
  ```bash
29
- ls .planning/phases/${PHASE}-*/research.md 2>/dev/null
29
+ ls .planning/phases/*/*-research.md 2>/dev/null | grep -E "/0*${PHASE}-[^/]*/"
30
30
  ```
31
31
 
32
32
  If exists: Offer update/view/skip options.
@@ -67,7 +67,7 @@ ls .planning/phases/*/.continue-here*.md 2>/dev/null
67
67
 
68
68
  # Check for plans without summaries (incomplete execution)
69
69
  for plan in .planning/phases/*/*-plan.md; do
70
- summary="${plan/PLAN/SUMMARY}"
70
+ summary="${plan%-plan.md}-summary.md"
71
71
  [ ! -f "$summary" ] && echo "Incomplete: $plan"
72
72
  done 2>/dev/null
73
73
 
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Interactive configuration of PAN workflow agents (research, plan_check, verifier) and model profile selection via multi-question prompt. Updates .planning/config.json with user preferences. Optionally saves settings as global defaults (~/.pan-wizard-core/defaults.json) for future projects.
2
+ Interactive configuration of PAN workflow agents (research, plan_check, verifier) and model profile selection via multi-question prompt. Updates .planning/config.json with user preferences. Optionally saves settings as global defaults (~/.pan-wizard/defaults.json) for future projects.
3
3
  </purpose>
4
4
 
5
5
  <required_reading>
@@ -44,9 +44,9 @@ AskUserQuestion([
44
44
  header: "Model",
45
45
  multiSelect: false,
46
46
  options: [
47
- { label: "Quality", description: "Opus everywhere except verification (highest cost)" },
48
- { label: "Balanced (Recommended)", description: "Opus for planning, Sonnet for execution/verification" },
49
- { label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost)" }
47
+ { label: "Quality", description: "reasoning tier for every agent — identical to balanced, so switching between the two changes nothing" },
48
+ { label: "Balanced (Recommended)", description: "reasoning tier for every agent (quality and balanced are identical post-COST-RESET); use budget to step down" },
49
+ { label: "Budget", description: "mid tier for writing, fast tier for research/verification (lowest cost)" }
50
50
  ]
51
51
  },
52
52
  {
@@ -153,20 +153,20 @@ AskUserQuestion([
153
153
  header: "Defaults",
154
154
  multiSelect: false,
155
155
  options: [
156
- { label: "Yes", description: "New projects start with these settings (saved to ~/.pan-wizard-core/defaults.json)" },
156
+ { label: "Yes", description: "New projects start with these settings (saved to ~/.pan-wizard/defaults.json)" },
157
157
  { label: "No", description: "Only apply to this project" }
158
158
  ]
159
159
  }
160
160
  ])
161
161
  ```
162
162
 
163
- If "Yes": write the same config object (minus project-specific fields like `brave_search`) to `~/.pan-wizard-core/defaults.json`:
163
+ If "Yes": write the same config object (minus project-specific fields like `brave_search`) to `~/.pan-wizard/defaults.json`:
164
164
 
165
165
  ```bash
166
- mkdir -p ~/.gsd
166
+ mkdir -p ~/.pan-wizard
167
167
  ```
168
168
 
169
- Write `~/.pan-wizard-core/defaults.json` with:
169
+ Write `~/.pan-wizard/defaults.json` with:
170
170
  ```json
171
171
  {
172
172
  "mode": <current>,
@@ -222,6 +222,6 @@ Quick commands:
222
222
  - [ ] Current config read
223
223
  - [ ] User presented with 7 settings (profile + 5 workflow toggles + git branching)
224
224
  - [ ] Config updated with model_profile, workflow, and git sections
225
- - [ ] User offered to save as global defaults (~/.pan-wizard-core/defaults.json)
225
+ - [ ] User offered to save as global defaults (~/.pan-wizard/defaults.json)
226
226
  - [ ] Changes confirmed to user
227
227
  </success_criteria>
@@ -76,9 +76,20 @@ cat .planning/config.json 2>/dev/null
76
76
 
77
77
  </config-check>
78
78
 
79
+ **Detect AUTO mode (P-1807 — gate parity with the rest of the chain):**
80
+
81
+ ```bash
82
+ HAS_AUTO_FLAG=$(echo "$ARGUMENTS" | grep -c -- '--auto' || true)
83
+ AUTO_CFG=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
84
+ ```
85
+
86
+ **AUTO is active** when `HAS_AUTO_FLAG` > 0 (the `--auto` flag exec-phase passes through), OR `AUTO_CFG` is `true`, OR config `mode` is `yolo`. Every `<if auto>` gate in this workflow keys on this condition — the same trigger `exec-phase.md` (offer_next), `plan-phase.md` (step 14) and `discuss-phase.md` (auto_advance) use.
87
+
88
+ **P-1807 (2026-08, PanLoop finding 0):** these gates were previously `mode: yolo` alone. This file never read `--auto` or `workflow.auto_advance`, so on the template-default `mode: interactive`, exec-phase would announce "AUTO-ADVANCING → TRANSITION", this workflow would update state to the next phase, then route to the interactive "Next Up" menu and exit cleanly — the P-1801 Task spawn below was unreachable, and every autonomous run built exactly one phase while reporting success. Do not narrow these gates back to `mode` alone.
89
+
79
90
  **If all plans complete:**
80
91
 
81
- <if mode="yolo">
92
+ <if auto (HAS_AUTO_FLAG > 0, or AUTO_CFG true, or mode yolo)>
82
93
 
83
94
  ```
84
95
  ⚡ Auto-approved: Transition Phase [X] → Phase [X+1]
@@ -91,7 +102,7 @@ Proceed directly to cleanup_handoff step.
91
102
 
92
103
  </if>
93
104
 
94
- <if mode="interactive" OR="custom with gates.confirm_transition true">
105
+ <if NOT auto — mode="interactive" OR="custom with gates.confirm_transition true">
95
106
 
96
107
  Ask: "Phase [X] complete — all [Y] plans finished. Ready to mark done and move to Phase [X+1]?"
97
108
 
@@ -157,8 +168,9 @@ Extract from result: `completed_phase`, `plans_executed`, `next_phase`, `next_ph
157
168
 
158
169
  <step name="archive_prompts">
159
170
 
160
- If prompts were generated for the phase, they stay in place.
161
- The `completed/` subfolder pattern from create-meta-prompts handles archival.
171
+ If prompts were generated for the phase, they stay in place — plans and
172
+ summaries remain in the phase directory as the durable record. No separate
173
+ archival step is performed.
162
174
 
163
175
  </step>
164
176
 
@@ -361,6 +373,8 @@ Resume file: None
361
373
 
362
374
  <step name="offer_next_phase">
363
375
 
376
+ **AUTO-mode terminal contract (P-1807):** when AUTO is active (the condition from `verify_completion`), this step has exactly two valid endings — **Route A ends with a `Task(...)` call actually issued** (not described, not deferred: issued), or **Route B reaches the milestone boundary**. Updating state.md and presenting a "Next Up" menu is NOT a valid AUTO ending — field runs (PanLoop, 2026-08-08) show that exact exit four times in five even with the gates fixed. If you notice you are composing a menu while AUTO is active, stop and execute the Route A spawn. Do not end your turn between the state update and the spawn.
377
+
364
378
  **MANDATORY: Verify milestone status before presenting next steps.**
365
379
 
366
380
  **Use the transition result from `pan-tools phase complete`:**
@@ -392,10 +406,12 @@ ls .planning/phases/*[X+1]*/*-context.md 2>/dev/null
392
406
 
393
407
  **If next phase exists:**
394
408
 
395
- <if mode="yolo">
409
+ <if auto (HAS_AUTO_FLAG > 0, or AUTO_CFG true, or mode yolo — the P-1807 condition from verify_completion)>
396
410
 
397
411
  **P-1801 fix (v3.7.6):** In auto mode, **spawn the next phase as a Task subagent** — same pattern as `plan-phase.md`'s auto-advance to exec-phase. Prose-based "DO NOT exit. Read X" instructions (the v3.7.4 P-1701 attempt) were not behaviorally binding: the orchestrator returned from sub-agent calls and exited cleanly at the phase boundary. A `Task(...)` invocation is a tool call the orchestrator cannot ignore — control flow is forced into the next phase's workflow.
398
412
 
413
+ **P-1807 (2026-08):** this gate was `mode: yolo` alone, which made the P-1801 spawn unreachable for `--auto` / `workflow.auto_advance` runs on interactive-mode projects — the exact symptom P-1801 fixed, reintroduced one gate higher. If exec-phase announced AUTO-ADVANCING, this branch MUST run and MUST end in the `Task(...)` call below; exiting after the state update is the regression.
414
+
399
415
  Cost trade-off: each Task spawn restarts context (loses the cumulative cache reads from the previous phase). Acceptable because: (1) cross-phase cache value is low — phase N's plan/research is mostly irrelevant to phase N+1's executor — and (2) reliability beats marginal cost optimization for autonomous runs.
400
416
 
401
417
  **If context.md exists for the next phase:**
@@ -489,7 +505,7 @@ Task(
489
505
 
490
506
  </if>
491
507
 
492
- <if mode="interactive" OR="custom with gates.confirm_transition true">
508
+ <if NOT auto — mode="interactive" OR="custom with gates.confirm_transition true">
493
509
 
494
510
  **If context.md does NOT exist:**
495
511
 
@@ -551,7 +567,7 @@ Task(
551
567
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advance false
552
568
  ```
553
569
 
554
- <if mode="yolo">
570
+ <if auto (HAS_AUTO_FLAG > 0, or AUTO_CFG true, or mode yolo — the P-1807 condition from verify_completion)>
555
571
 
556
572
  ```
557
573
  Phase {X} marked complete.
@@ -565,7 +581,7 @@ Exit skill and invoke SlashCommand("/pan:milestone-done {version}")
565
581
 
566
582
  </if>
567
583
 
568
- <if mode="interactive" OR="custom with gates.confirm_transition true">
584
+ <if NOT auto — mode="interactive" OR="custom with gates.confirm_transition true">
569
585
 
570
586
  ```
571
587
  ## ✓ Phase {X}: {Phase Name} Complete
@@ -12,28 +12,31 @@ Read all files referenced by the invoking prompt's execution_context before star
12
12
  Detect whether PAN is installed locally or globally by checking both locations and validating install integrity:
13
13
 
14
14
  ```bash
15
- # Check local first (takes priority only if valid)
16
- # Paths templated at install time for runtime compatibility
17
- LOCAL_VERSION_FILE="./.claude/pan-wizard-core/VERSION"
18
- LOCAL_MARKER_FILE="./.claude/pan-wizard-core/workflows/update.md"
19
- GLOBAL_VERSION_FILE="$HOME/.claude/pan-wizard-core/VERSION"
20
- GLOBAL_MARKER_FILE="$HOME/.claude/pan-wizard-core/workflows/update.md"
21
-
22
- if [ -f "$LOCAL_VERSION_FILE" ] && [ -f "$LOCAL_MARKER_FILE" ] && grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+' "$LOCAL_VERSION_FILE"; then
23
- cat "$LOCAL_VERSION_FILE"
24
- echo "LOCAL"
25
- elif [ -f "$GLOBAL_VERSION_FILE" ] && [ -f "$GLOBAL_MARKER_FILE" ] && grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+' "$GLOBAL_VERSION_FILE"; then
26
- cat "$GLOBAL_VERSION_FILE"
27
- echo "GLOBAL"
15
+ # There is ONE install location per install. The installer templates the
16
+ # canonical ~/.claude/ prefix to this install's real path, and the SHAPE of that
17
+ # templated prefix reveals the scope: a --local install is cwd-relative ("./…"),
18
+ # a --global install is an absolute path. Deriving scope from the single
19
+ # templated path avoids the collapsed dual-path detection that mis-ran every
20
+ # global update as --local (N2 regression fix, ADR audit 2026-08).
21
+ VERSION_FILE="~/.claude/pan-wizard-core/VERSION"
22
+ MARKER_FILE="~/.claude/pan-wizard-core/workflows/update.md"
23
+ case "$VERSION_FILE" in
24
+ ./*) SCOPE="LOCAL" ;;
25
+ *) SCOPE="GLOBAL" ;;
26
+ esac
27
+
28
+ if [ -f "$VERSION_FILE" ] && [ -f "$MARKER_FILE" ] && grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+' "$VERSION_FILE"; then
29
+ cat "$VERSION_FILE"
30
+ echo "$SCOPE"
28
31
  else
29
32
  echo "UNKNOWN"
30
33
  fi
31
34
  ```
32
35
 
33
- Parse output:
34
- - If last line is "LOCAL": local install is valid; installed version is first line; use `--local`
35
- - If last line is "GLOBAL": local missing/invalid, global install is valid; installed version is first line; use `--global`
36
- - If "UNKNOWN": proceed to install step (treat as version 0.0.0)
36
+ Parse output (there is ONE install; scope is derived from the shape of the single templated prefix):
37
+ - If last line is "LOCAL": this install is local-scoped (templated prefix is `./`-relative); installed version is first line; use `--local`
38
+ - If last line is "GLOBAL": this install is global-scoped (templated prefix is an absolute path); installed version is first line; use `--global`
39
+ - If "UNKNOWN": the VERSION/marker files are missing or invalid; proceed to install step (treat as version 0.0.0)
37
40
 
38
41
  **If VERSION file missing:**
39
42
  ```
@@ -166,7 +169,7 @@ Clear the update cache so statusline indicator disappears:
166
169
 
167
170
  **If LOCAL install:**
168
171
  ```bash
169
- rm -f ./.claude/cache/pan-update-check.json
172
+ rm -f ~/.claude/cache/pan-update-check.json
170
173
  ```
171
174
 
172
175
  **If GLOBAL install:**
@@ -184,9 +187,9 @@ Format completion message (changelog was already shown in confirmation step):
184
187
  ║ PAN Updated: v1.5.10 → v1.5.15 ║
185
188
  ╚═══════════════════════════════════════════════════════════╝
186
189
 
187
- ⚠️ Restart Claude Code to pick up the new commands.
190
+ ⚠️ Restart your AI coding tool to pick up the new commands.
188
191
 
189
- [View full changelog](https://github.com/pan-wizard-core/blob/main/CHANGELOG.md)
192
+ [View full changelog](https://github.com/oharms/PanWizard/blob/main/CHANGELOG.md)
190
193
  ```
191
194
  </step>
192
195