pan-wizard 3.21.1 → 3.24.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 (136) hide show
  1. package/README.md +38 -24
  2. package/agents/pan-conductor.md +3 -3
  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 +20 -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 +101 -17
  68. package/pan-wizard-core/bin/lib/memory-rebuild.cjs +26 -2
  69. package/pan-wizard-core/bin/lib/milestone.cjs +11 -5
  70. package/pan-wizard-core/bin/lib/optimize.cjs +18 -7
  71. package/pan-wizard-core/bin/lib/phase-remove.cjs +41 -2
  72. package/pan-wizard-core/bin/lib/phase.cjs +82 -11
  73. package/pan-wizard-core/bin/lib/preview.cjs +23 -4
  74. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -6
  75. package/pan-wizard-core/bin/lib/roadmap.cjs +6 -2
  76. package/pan-wizard-core/bin/lib/runner.cjs +17 -7
  77. package/pan-wizard-core/bin/lib/squads.cjs +43 -11
  78. package/pan-wizard-core/bin/lib/state.cjs +32 -11
  79. package/pan-wizard-core/bin/lib/template.cjs +8 -3
  80. package/pan-wizard-core/bin/lib/verify-deploy.cjs +14 -2
  81. package/pan-wizard-core/bin/lib/verify-drift.cjs +15 -1
  82. package/pan-wizard-core/bin/lib/verify-preflight.cjs +9 -3
  83. package/pan-wizard-core/bin/lib/verify.cjs +84 -39
  84. package/pan-wizard-core/bin/lib/whatif.cjs +8 -1
  85. package/pan-wizard-core/bin/pan-tools.cjs +42 -19
  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/KNOWN-BETA-RISKS.md +8 -0
  130. package/pan-zcode/README.md +14 -2
  131. package/pan-zcode/bin/install-zcode.js +1 -1
  132. package/pan-zcode/mcp/native-tools.cjs +1 -1
  133. package/pan-zcode/mcp/server.cjs +76 -14
  134. package/scripts/build-hooks.js +2 -1
  135. package/scripts/generate-skills-docs.py +0 -4
  136. package/scripts/run-tests.cjs +11 -4
@@ -536,15 +536,38 @@ function convertClaudeToCopilotAgent(content) {
536
536
  if (frontmatter) {
537
537
  name = extractFrontmatterField(frontmatter, 'name') || '';
538
538
  description = extractFrontmatterField(frontmatter, 'description') || '';
539
- const toolsMatch = frontmatter.match(/allowed_tools:\s*\n((?:\s*-\s*.+\n?)*)/);
540
- if (toolsMatch) {
541
- const toolLines = toolsMatch[1].match(/^\s*-\s*(.+)$/gm) || [];
542
- for (const line of toolLines) {
543
- const toolName = line.replace(/^\s*-\s*/, '').trim();
544
- const copilotTool = convertCopilotToolName(toolName);
545
- if (copilotTool && !copilotTools.includes(copilotTool)) {
546
- copilotTools.push(copilotTool);
539
+ // Parse the same frontmatter shapes the Gemini/OpenCode converters handle:
540
+ // an inline `tools:` comma list AND an `allowed-tools:` YAML block list.
541
+ // (No PAN agent uses the legacy `allowed_tools:` block, so the previous
542
+ // regex left every Copilot agent with no tool restrictions.)
543
+ const lines = frontmatter.split('\n');
544
+ let inAllowedTools = false;
545
+ const rawTools = [];
546
+ for (const line of lines) {
547
+ const trimmed = line.trim();
548
+ if (trimmed.startsWith('allowed-tools:')) { inAllowedTools = true; continue; }
549
+ if (trimmed.startsWith('tools:')) {
550
+ const toolsValue = trimmed.substring(6).trim();
551
+ if (toolsValue) {
552
+ rawTools.push(...toolsValue.split(',').map(t => t.trim()).filter(t => t));
553
+ } else {
554
+ inAllowedTools = true;
547
555
  }
556
+ continue;
557
+ }
558
+ if (inAllowedTools) {
559
+ if (trimmed.startsWith('- ')) {
560
+ rawTools.push(trimmed.substring(2).trim());
561
+ continue;
562
+ } else if (trimmed && !trimmed.startsWith('-')) {
563
+ inAllowedTools = false;
564
+ }
565
+ }
566
+ }
567
+ for (const toolName of rawTools) {
568
+ const copilotTool = convertCopilotToolName(toolName);
569
+ if (copilotTool && !copilotTools.includes(copilotTool)) {
570
+ copilotTools.push(copilotTool);
548
571
  }
549
572
  }
550
573
  }
@@ -996,16 +1019,25 @@ function geminiTransitionNotice() {
996
1019
  ].join('\n');
997
1020
  }
998
1021
 
999
- // ─── Opus 4.7 Capability Detection ──────────────────────────────────────────
1022
+ // ─── Model capability detection ─────────────────────────────────────────────
1000
1023
 
1001
1024
  /**
1002
1025
  * Detect model capabilities from a model name string.
1003
- * Used by installer to warn users when their default model lacks features
1004
- * PAN 2.10+ relies on (1M context, extended thinking, prompt caching).
1005
1026
  *
1006
- * Capability data refreshed 2026-06: Fable 5 and Opus 4.8/4.7/4.6 plus
1007
- * Sonnet 4.6 all carry a 1M context window; only the legacy Opus/Sonnet
1008
- * 4.0–4.5 generations are 200K.
1027
+ * Consumer: the installer's ADVISORY model-capability notice, which warns when
1028
+ * the configured default model lacks features PAN's multi-agent workflows are
1029
+ * tuned for (1M context, extended thinking, prompt caching). It gates no
1030
+ * feature — every workflow runs regardless of what this returns.
1031
+ *
1032
+ * This is a hardcoded substring table, NOT a live capability probe. The
1033
+ * explicit branches carry the per-generation facts (capability data refreshed
1034
+ * 2026-06: Fable/Mythos 5, Opus 5/4.8/4.7/4.6 and Sonnet 5/4.6 all carry a 1M
1035
+ * context window; only the legacy Opus/Sonnet 4.0–4.5 generations are 200K).
1036
+ * Below them sits a family-level fallback so a Claude release newer than the
1037
+ * newest LEGACY release of its family — a future major (`opus-6`) or a point
1038
+ * release inside an already-tabled major (`opus-4-9`) alike — degrades to that
1039
+ * family's modern profile instead of to an all-false `unknown`. Read that
1040
+ * comment before adding another single-model branch.
1009
1041
  *
1010
1042
  * @param {string} modelName - e.g. "claude-fable-5", "claude-opus-4-8", "gpt-5"
1011
1043
  * @returns {{has_1m_ctx: boolean, has_thinking: boolean, has_cache: boolean, tier: string}}
@@ -1019,6 +1051,33 @@ function detectModelCapabilities(modelName) {
1019
1051
  if (n.includes('fable') || n.includes('mythos')) {
1020
1052
  return { has_1m_ctx: true, has_thinking: true, has_cache: true, tier: 'reasoning' };
1021
1053
  }
1054
+ // ─── Claude family + generation, parsed once ───────────────────────────────
1055
+ //
1056
+ // Read twice below: it BOUNDS the greedy legacy branches (`n.includes('opus-4')`
1057
+ // matches every Opus 4.x point release, including ones NEWER than anything this
1058
+ // table knows) and it drives the family-level fallback at the end of the
1059
+ // function. One parse feeds both on purpose — two independent parses could
1060
+ // disagree, and a name that escaped the legacy branch with nothing left to
1061
+ // catch it would fall out as the all-false `unknown`.
1062
+ //
1063
+ // Generations compare as major*1000 + point, NEVER as a float: Number('4.10')
1064
+ // === 4.1 would sort Opus 4.10 BELOW Opus 4.8. The point group takes at most
1065
+ // two digits and must not be followed by another digit, so the date suffix in
1066
+ // `claude-opus-4-20250514` is not misread as point release 20 (that id is
1067
+ // Opus 4.0 and must keep the legacy mapping).
1068
+ const genKey = (major, point) => Number(major) * 1000 + Number(point || 0);
1069
+ const famMatch = /\b(opus|sonnet|haiku)[-._]?(\d+)(?:[-.](\d{1,2})(?!\d))?/.exec(n);
1070
+ const family = famMatch ? famMatch[1] : null;
1071
+ const generation = famMatch ? genKey(famMatch[2], famMatch[3]) : -1;
1072
+
1073
+ // Newest generation of each family whose REAL capabilities are lower than the
1074
+ // current flagship's: Opus/Sonnet 4.0–4.5 at 200K context, Haiku 4.x without
1075
+ // extended thinking. A release strictly newer than this is a forward release:
1076
+ // it must not inherit the legacy mapping, so the legacy branches below skip it
1077
+ // and the fallback at the end gives it its family's modern profile.
1078
+ const LEGACY_NEWEST = { opus: genKey(4, 5), sonnet: genKey(4, 5), haiku: genKey(4, 5) };
1079
+ const isForwardRelease = family !== null && generation > LEGACY_NEWEST[family];
1080
+
1022
1081
  // Claude 5 family (Opus 5, Sonnet 5) — 1M context, extended thinking, prompt caching.
1023
1082
  // Without this, `claude-opus-5` falls through to `unknown` and the installer prints
1024
1083
  // a FALSE "your model lacks 1M context / extended thinking" warning on the flagship.
@@ -1033,16 +1092,25 @@ function detectModelCapabilities(modelName) {
1033
1092
  || n.includes('opus-4-6') || n.includes('opus-4.6')) {
1034
1093
  return { has_1m_ctx: true, has_thinking: true, has_cache: true, tier: 'reasoning' };
1035
1094
  }
1036
- if (n.includes('opus-4')) { // legacy Opus 4.0 / 4.1 / 4.5 — 200K context
1095
+ // Legacy Opus 4.0 / 4.1 / 4.5 — 200K context. `!isForwardRelease` is what stops
1096
+ // this branch swallowing a point release newer than the ones tabled above:
1097
+ // without it `claude-opus-4-9` / `claude-opus-4-10` reach here and get told
1098
+ // they lack 1M context.
1099
+ if (n.includes('opus-4') && !isForwardRelease) {
1037
1100
  return { has_1m_ctx: false, has_thinking: true, has_cache: true, tier: 'reasoning' };
1038
1101
  }
1039
1102
  if (n.includes('sonnet-4-6') || n.includes('sonnet-4.6')) {
1040
1103
  return { has_1m_ctx: true, has_thinking: true, has_cache: true, tier: 'mid' };
1041
1104
  }
1042
- if (n.includes('sonnet-4')) { // legacy Sonnet 4.0 / 4.5 — 200K context
1105
+ // Legacy Sonnet 4.0 / 4.5 — 200K context (same forward-release guard).
1106
+ if (n.includes('sonnet-4') && !isForwardRelease) {
1043
1107
  return { has_1m_ctx: false, has_thinking: true, has_cache: true, tier: 'mid' };
1044
1108
  }
1045
- if (n.includes('haiku-4-5') || n.includes('haiku-4.5') || n.includes('haiku-4')) {
1109
+ // Haiku 4.x — fast tier, no extended thinking. Guarded for the same reason,
1110
+ // though today it is behavior-neutral: the fallback's Haiku profile is
1111
+ // identical to this one, so a forward Haiku release lands on the same answer
1112
+ // either way. The guard is here so that stops being true only deliberately.
1113
+ if ((n.includes('haiku-4-5') || n.includes('haiku-4.5') || n.includes('haiku-4')) && !isForwardRelease) {
1046
1114
  return { has_1m_ctx: false, has_thinking: false, has_cache: true, tier: 'fast' };
1047
1115
  }
1048
1116
  // Older Claude 3.x — no thinking, no 1M context.
@@ -1076,6 +1144,49 @@ function detectModelCapabilities(modelName) {
1076
1144
  return { has_1m_ctx: has1m, has_thinking: hasThinking, has_cache: true, tier };
1077
1145
  }
1078
1146
 
1147
+ // ─── Claude family-level fallback (forward compatibility) ─────────────────
1148
+ //
1149
+ // Everything above is a hardcoded substring table, so a model released AFTER
1150
+ // this file was last touched matches nothing and lands on the all-false
1151
+ // `unknown` result — at which point the installer tells the user their
1152
+ // flagship model "lacks 1M context / extended thinking", which is false and
1153
+ // actively misleading. That is the same bug the `opus-5` branch above was
1154
+ // added to fix, and fixing it one model id at a time guarantees it returns
1155
+ // with the next generation.
1156
+ //
1157
+ // POLICY — do not re-special-case a single id down here. When the name carries
1158
+ // a known Claude family AND a release strictly NEWER than that family's newest
1159
+ // LEGACY release (`LEGACY_NEWEST` at the top of this function), inherit the
1160
+ // family's modern capability profile. Rationale: a newer release of a family
1161
+ // does not ship with fewer capabilities than the one it replaces, so
1162
+ // inheriting is the safe default — under-claiming produces a false warning,
1163
+ // while inheriting at worst repeats what the previous release already had.
1164
+ //
1165
+ // The comparison is on the FULL release number, major AND point, which is what
1166
+ // makes it reach point releases inside an already-tabled major: a bare
1167
+ // major-only threshold left `opus-4-9` and `opus-4-10` to the greedy
1168
+ // `n.includes('opus-4')` branch above, and they inherited the 200K legacy
1169
+ // mapping — the exact false warning this fallback exists to prevent, on a
1170
+ // NEWER model than the flagship. Genuinely older releases (Opus/Sonnet
1171
+ // 4.0–4.5, Haiku 4.x, Claude 3.x) are at or below the threshold and keep their
1172
+ // explicit mappings untouched. Non-Claude vendors are deliberately not guessed
1173
+ // at: their branches return above, and an unmatched vendor id still yields
1174
+ // `unknown`.
1175
+ //
1176
+ // This is a safety net, not a substitute for the table: still add an explicit
1177
+ // branch above once a new release's real capabilities are known.
1178
+ //
1179
+ // `fable`/`mythos` are absent by design — their branch at the top matches the
1180
+ // family name alone, with no version in it, so it is already generation-proof.
1181
+ if (isForwardRelease) {
1182
+ const MODERN = {
1183
+ opus: { has_1m_ctx: true, has_thinking: true, has_cache: true, tier: 'reasoning' },
1184
+ sonnet: { has_1m_ctx: true, has_thinking: true, has_cache: true, tier: 'mid' },
1185
+ haiku: { has_1m_ctx: false, has_thinking: false, has_cache: true, tier: 'fast' },
1186
+ };
1187
+ return { ...MODERN[family] };
1188
+ }
1189
+
1079
1190
  return result;
1080
1191
  }
1081
1192