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
@@ -27,13 +27,13 @@
27
27
  * config-get <key> Get a config.json value
28
28
  * history-digest Aggregate all summary.md data
29
29
  * summary-extract <path> [--fields] Extract structured data from summary.md
30
- * state-snapshot Structured parse of state.md
30
+ * state-snapshot Structured parse of state.md (alias: state snapshot)
31
31
  * phase-plan-index <phase> Index plans with waves and status
32
32
  * websearch <query> Search web via Brave API (if configured)
33
33
  * [--limit N] [--freshness day|week|month]
34
34
  *
35
35
  * Phase Listing:
36
- * phases list [--type plan|summary] List phases with optional type filter
36
+ * phases list [--type plans|summaries] List phases with optional type filter
37
37
  * [--phase N] [--include-archived]
38
38
  *
39
39
  * Phase Operations:
@@ -282,8 +282,20 @@ async function main() {
282
282
 
283
283
  const command = args[0];
284
284
 
285
+ const USAGE = 'Usage: pan-tools <command> [args] [--raw] [--cwd <path>]\nCommands: state, resolve-model, estimate-cost, find-phase, git, distill, experiment, commit, verify-summary, template, frontmatter, verify, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, config-set, config-get, history-digest, phases, roadmap, requirements, phase, milestone, validate, progress, context-budget, todo, scaffold, init, phase-plan-index, state-snapshot, summary-extract, rollback-snapshot, batch-commit, websearch, focus, preflight, dashboard, hud, report, learnings, deps, drift-check, memory, bridge, whatif, knowledge, skills, hygiene, review-deep, preview, cost, models, squad, worktree, campaign, bus, cache, retro, codebase, standards, optimize, doc-lint, learn, links';
286
+
285
287
  if (!command) {
286
- error('Usage: pan-tools <command> [args] [--raw] [--cwd <path>]\nCommands: state, state-snapshot, resolve-model, find-phase, commit, verify-summary, verify, frontmatter, template, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, config-set, config-get, history-digest, phases, roadmap, requirements, phase, milestone, validate, progress, context-budget, todo, scaffold, init, phase-plan-index, summary-extract, rollback-snapshot, websearch, focus, preflight, dashboard, learnings, deps, standards');
288
+ error(USAGE);
289
+ }
290
+
291
+ // P-1814 (PanLoop finding 11): `--help` was the single most frequent failed
292
+ // probe in field transcripts — 26 sightings across 10 command docs. It is
293
+ // the most predictable thing any agent or human tries, so it works: print
294
+ // the usage and exit 0. A missing command stays exit 1 (the error contract);
295
+ // an explicit request for help is a success.
296
+ if (command === '--help' || command === '-h' || command === 'help') {
297
+ console.log(USAGE);
298
+ process.exit(0);
287
299
  }
288
300
 
289
301
  switch (command) {
@@ -337,10 +349,16 @@ async function main() {
337
349
  stopped_at: getArgValue(args, '--stopped-at'),
338
350
  resume_file: getArgValue(args, '--resume-file', 'None'),
339
351
  }, raw);
352
+ } else if (subcommand === 'snapshot') {
353
+ // Alias for the top-level `state-snapshot` (P-1813). The hyphenated
354
+ // command reads exactly like a `state` subcommand, and a field agent
355
+ // guessed the spaced form by analogy (PanLoop finding 10). The guess
356
+ // is semantically right, so it lands on the real handler.
357
+ state.cmdStateSnapshot(cwd, raw);
340
358
  } else if (subcommand === 'load' || !subcommand) {
341
359
  state.cmdStateLoad(cwd, raw);
342
360
  } else {
343
- error(`Unknown state subcommand: ${subcommand}. Available: json, update, get, patch, advance-plan, record-metric, update-progress, add-decision, add-blocker, resolve-blocker, record-session, load`);
361
+ error(`Unknown state subcommand: ${subcommand}. Available: json, update, get, patch, advance-plan, record-metric, update-progress, add-decision, add-blocker, resolve-blocker, record-session, load, snapshot`);
344
362
  }
345
363
  break;
346
364
  }
@@ -530,7 +548,7 @@ async function main() {
530
548
  } else if (subcommand === 'stubs') {
531
549
  verify.cmdVerifyStubs(cwd, { gate: args.includes('--gate') }, raw);
532
550
  } else {
533
- error('Unknown verify subcommand. Available: plan-structure, phase-completeness, references, commits, artifacts, key-links');
551
+ error('Unknown verify subcommand. Available: plan-structure, phase-completeness, references, commits, artifacts, key-links, reconcile, stubs');
534
552
  }
535
553
  break;
536
554
  }
@@ -786,8 +804,12 @@ async function main() {
786
804
 
787
805
  case 'batch-commit': {
788
806
  const itemsJson = args[1];
789
- let items = [];
790
- try { items = JSON.parse(itemsJson); } catch { /* empty */ }
807
+ // Report a malformed payload rather than silently reporting 'no_items':
808
+ // a caller whose JSON was garbled (e.g. shell-stripped quotes) must not be
809
+ // told there was nothing to commit. Absent arg → genuine empty batch.
810
+ const items = itemsJson === undefined || itemsJson === ''
811
+ ? []
812
+ : parseJsonOrError(itemsJson, 'batch-commit');
791
813
  commands.cmdBatchCommit(cwd, items, raw);
792
814
  break;
793
815
  }
@@ -1295,6 +1317,7 @@ async function main() {
1295
1317
  const subcommand = args[1];
1296
1318
  if (subcommand === 'trace') {
1297
1319
  const traceSub = args[2];
1320
+ const tokensWasted = getArgValue(args, '--tokens-wasted');
1298
1321
  optimize.cmdOptimizeTrace(cwd, traceSub, {
1299
1322
  sessionId: getArgValue(args, '--session'),
1300
1323
  all: args.includes('--all'),
@@ -1306,9 +1329,8 @@ async function main() {
1306
1329
  type: getArgValue(args, '--type'),
1307
1330
  category: getArgValue(args, '--category'),
1308
1331
  impact: getArgValue(args, '--impact'),
1309
- description: getArgValue(args, '--description'),
1310
1332
  correction: getArgValue(args, '--correction'),
1311
- tokens_wasted: getArgValue(args, '--tokens-wasted') ? Number(getArgValue(args, '--tokens-wasted')) : null,
1333
+ tokens_wasted: tokensWasted ? Number(tokensWasted) : null,
1312
1334
  context: (() => { const v = getArgValue(args, '--context'); if (!v) return null; try { return JSON.parse(v); } catch { return null; } })(),
1313
1335
  }, raw);
1314
1336
  } else if (subcommand === 'learn') {
@@ -1382,7 +1404,7 @@ async function main() {
1382
1404
  const sourceExperiments = sourceExpsCsv
1383
1405
  ? sourceExpsCsv.split(',').map(s => s.trim()).filter(Boolean)
1384
1406
  : [];
1385
- const sourceRoot = getArgValue(args, '--source-root') || cwd;
1407
+ const sourceRoot = getArgValue(args, '--source-root') || learnLint.resolveLearningsRoot();
1386
1408
 
1387
1409
  const result = optimize.promotePattern(
1388
1410
  { id: patternId, summary, evidence, rule, applies_in: appliesIn, source_experiments: sourceExperiments },
@@ -1396,7 +1418,7 @@ async function main() {
1396
1418
  const patternId = getArgValue(args, '--pattern');
1397
1419
  const scope = getArgValue(args, '--scope');
1398
1420
  const topic = getArgValue(args, '--topic');
1399
- const sourceRoot = getArgValue(args, '--source-root') || cwd;
1421
+ const sourceRoot = getArgValue(args, '--source-root') || learnLint.resolveLearningsRoot();
1400
1422
  if (!patternId || !scope || !topic) {
1401
1423
  error('learn unpromote requires --pattern <id> --scope <s> --topic <t>');
1402
1424
  }
@@ -1406,14 +1428,14 @@ async function main() {
1406
1428
  }
1407
1429
 
1408
1430
  if (subcommand === 'list-promoted') {
1409
- const sourceRoot = getArgValue(args, '--source-root') || cwd;
1431
+ const sourceRoot = getArgValue(args, '--source-root') || learnLint.resolveLearningsRoot();
1410
1432
  const result = optimize.listPromotedPatterns({ sourceRoot });
1411
1433
  output(result, raw);
1412
1434
  break;
1413
1435
  }
1414
1436
 
1415
1437
  if (subcommand === 'build-index') {
1416
- const sourceRoot = getArgValue(args, '--source-root') || cwd;
1438
+ const sourceRoot = getArgValue(args, '--source-root') || learnLint.resolveLearningsRoot();
1417
1439
  const result = learnIndex.cmdBuildIndex(sourceRoot);
1418
1440
  if (raw) {
1419
1441
  output(result, true,
@@ -1428,7 +1450,7 @@ async function main() {
1428
1450
  }
1429
1451
 
1430
1452
  if (subcommand === 'topics-for') {
1431
- const sourceRoot = getArgValue(args, '--source-root') || cwd;
1453
+ const sourceRoot = getArgValue(args, '--source-root') || learnLint.resolveLearningsRoot();
1432
1454
  const agent = getArgValue(args, '--agent');
1433
1455
  if (!agent) { error('learn topics-for requires --agent <name>'); }
1434
1456
  const minRelevance = getArgValue(args, '--min-relevance', 'medium');
@@ -1451,7 +1473,7 @@ async function main() {
1451
1473
  }
1452
1474
 
1453
1475
  if (subcommand === 'lint') {
1454
- const sourceRoot = getArgValue(args, '--source-root') || cwd;
1476
+ const sourceRoot = getArgValue(args, '--source-root') || learnLint.resolveLearningsRoot();
1455
1477
  const scope = getArgValue(args, '--scope');
1456
1478
  const strict = args.includes('--strict');
1457
1479
  const result = learnLint.cmdLearnLint(sourceRoot, { scope, strict });
@@ -1466,11 +1488,12 @@ async function main() {
1466
1488
  for (const v of result.violations) {
1467
1489
  lines.push(`[${v.severity.toUpperCase()}] ${v.code} ${v.pattern_id}: ${v.message}`);
1468
1490
  }
1469
- output(result, true, lines.join('\n'));
1491
+ output(result, true, lines.join('\n'), result.summary.status === 'fail' ? 1 : 0);
1470
1492
  } else {
1471
- output(result, false);
1493
+ output(result, false, undefined, result.summary.status === 'fail' ? 1 : 0);
1472
1494
  }
1473
- if (result.summary.status === 'fail') process.exit(1);
1495
+ // exit code carried through output() above (it used to hard-exit 0
1496
+ // before this check, so `learn lint` never gated — M32, ADR audit 2026-08).
1474
1497
  break;
1475
1498
  }
1476
1499
 
@@ -1504,7 +1527,7 @@ async function main() {
1504
1527
  }
1505
1528
 
1506
1529
  default:
1507
- error(`Unknown command: ${command}. Run pan-tools without arguments to see available commands.`);
1530
+ error(`Unknown command: ${command}. Run pan-tools --help to see available commands.`);
1508
1531
  }
1509
1532
  }
1510
1533
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "generated_at": "2026-07-09T15:40:55.203Z",
3
+ "generated_at": "2026-08-07T13:36:47.532Z",
4
4
  "topics": [
5
5
  {
6
6
  "name": "experiment-runner",
@@ -152,8 +152,8 @@
152
152
  "P-350",
153
153
  "P-360"
154
154
  ],
155
- "size_bytes": 10667,
156
- "size_tokens_est": 2667,
155
+ "size_bytes": 11837,
156
+ "size_tokens_est": 2960,
157
157
  "agent_relevance": {
158
158
  "planner": "low",
159
159
  "executor": "medium",
@@ -218,8 +218,8 @@
218
218
  "P-1204",
219
219
  "P-NPRS-003"
220
220
  ],
221
- "size_bytes": 3400,
222
- "size_tokens_est": 850,
221
+ "size_bytes": 3402,
222
+ "size_tokens_est": 851,
223
223
  "agent_relevance": {
224
224
  "planner": "medium",
225
225
  "executor": "high",
@@ -804,7 +804,7 @@
804
804
  "totals": {
805
805
  "topics": 47,
806
806
  "patterns": 93,
807
- "size_bytes": 148954,
808
- "size_tokens_est": 37255
807
+ "size_bytes": 150126,
808
+ "size_tokens_est": 37549
809
809
  }
810
810
  }
@@ -37,12 +37,14 @@ patterns:
37
37
 
38
38
  ## P-330 — Scale agents into a coordinated army with squads, worktree isolation, and a human-gated ship
39
39
 
40
- **Evidence:** The bot-army model (ADR-0032/0033) showed the durable shape for running a whole-project goal across many agents: a delegation-only coordinator (never codes) fans work to role-scoped *squads* (architecture/build/quality/release), the build squad parallelizes by giving each agent its own branch + git worktree (so concurrent builders never touch the same file), quality is adversarial and read-only, and the path to a protected branch is a human-approved gate, not a bot merge.
40
+ **Evidence:** The bot-army model (ADR-0032/0033) showed the durable shape for running a whole-project goal across many agents: a coordinator that routes rather than implements fans work to role-scoped *squads* (architecture/build/quality/release), the build squad parallelizes by giving each agent its own branch + git worktree (which is why concurrent builders cannot land in the same working file), quality is adversarial and reads more than it writes, and the path to a protected branch is a human-approved gate, not a bot merge.
41
+
42
+ **Where the enforcement actually lives, and where it does not.** Worktree isolation is real isolation — separate directories, separate branches, enforced by git. The *role* labels are not: a coordinator that can spawn agents generally also holds file and shell tools, and a squad's `read-only` label is a contract its prompt is told to honour rather than a sandbox the runtime imposes. Both were written as absolutes here ("delegation-only", "never codes") and both were wrong; the guidance below survived the correction unchanged, because instructing the split is still right — claiming it is enforced is what was not.
41
43
 
42
44
  **Rule:** When scaling beyond a single agent:
43
45
 
44
- 1. **Coordinator delegates, never codes** — its tools are delegation-only; it plans, decomposes, and routes to squads, then aggregates tight summaries.
45
- 2. **Group agents into role-scoped squads with least-privilege tools** — design read-only, build read/write, quality read-only/adversarial, release always-ask. Resolve the roster from data, not hardcoded prompt lists.
46
+ 1. **Instruct the coordinator to delegate rather than implement** — it plans, decomposes, and routes to squads, then aggregates tight summaries. Treat that as prompt discipline and verify the grant instead of assuming it: read the coordinator's own `tools:` frontmatter, and if it holds write or shell tools, the split is instructed, not enforced. Say which of the two your prompt is relying on wherever you describe the design to a user.
47
+ 2. **Group agents into role-scoped squads with a declared least-privilege contract** — design read-only, build read/write, quality read-only/adversarial, release always-ask. Resolve the roster from data, not hardcoded prompt lists. A label is a contract until a per-agent grant matches it; a registry that maps agents to role labels changes no execution path on its own, so publish those labels as advisory rather than as guarantees.
46
48
  3. **Parallelize by isolation, not by hope** — one branch + worktree per concurrent builder; never two agents in one tree. Serialize builds only where the build tree corrupts under concurrency (a per-project opt-in).
47
49
  4. **The mutating boundary is human-gated** — merging to a protected branch is `always-ask`; recovery is revert / previous tag, never force-push or history rewrite.
48
50
  5. **The harness scales with the army, not after it** — depth caps, spawn/budget ceilings, and an abort kill-switch checked before every spawn are mandatory; a longer loop must not relax a single cap. Power and safety are the same investment.
@@ -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
  |--------|-------------|--------|