pan-wizard 3.36.0 → 3.37.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.
- package/CHANGELOG.md +3645 -0
- package/README.md +36 -48
- package/agents/pan-conductor.md +2 -3
- package/agents/pan-counterfactual.md +1 -2
- package/agents/pan-debugger.md +14 -3
- package/agents/pan-design-checker.md +1 -2
- package/agents/pan-designer.md +1 -2
- package/agents/pan-document_code.md +1 -2
- package/agents/pan-hardener.md +2 -3
- package/agents/pan-integration-checker.md +1 -2
- package/agents/pan-knowledge.md +1 -2
- package/agents/pan-meta-reviewer.md +3 -3
- package/agents/pan-optimizer.md +4 -4
- package/agents/pan-phase-researcher.md +79 -488
- package/agents/pan-plan-checker.md +12 -2
- package/agents/pan-planner.md +10 -6
- package/agents/pan-previewer.md +1 -2
- package/agents/pan-project-researcher.md +70 -499
- package/agents/pan-release.md +1 -1
- package/agents/pan-reviewer.md +9 -3
- package/agents/pan-roadmapper.md +12 -7
- package/agents/pan-verifier.md +7 -2
- package/bin/install-lib.cjs +134 -14
- package/bin/install.js +59 -12
- package/commands/pan/army.md +1 -1
- package/commands/pan/autodev.md +76 -0
- package/commands/pan/exec-phase.md +3 -4
- package/commands/pan/focus-auto.md +14 -7
- package/commands/pan/focus-design.md +4 -5
- package/commands/pan/focus-docs.md +24 -0
- package/commands/pan/learn.md +13 -6
- package/commands/pan/milestone-audit.md +8 -1
- package/commands/pan/milestone-done.md +10 -5
- package/commands/pan/milestone-new.md +2 -2
- package/commands/pan/new-project.md +15 -12
- package/commands/pan/plan-phase.md +15 -9
- package/commands/pan/quick.md +1 -1
- package/commands/pan/review-deep.md +11 -5
- package/commands/pan/settings.md +6 -0
- package/commands/pan/verify-phase.md +6 -2
- package/docs/AGENTS.md +917 -0
- package/docs/ARCHITECTURE.md +1054 -0
- package/docs/CLI-REFERENCE.md +4582 -0
- package/docs/COMPARISON.md +116 -0
- package/docs/DEVELOPMENT.md +490 -0
- package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
- package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
- package/docs/EXAMPLES.md +584 -0
- package/docs/FAQ.md +254 -0
- package/docs/FIELD-HARVEST-2026-07.md +88 -0
- package/docs/FIELD-REPORT-army-2026-06.md +121 -0
- package/docs/HOOKS.md +638 -0
- package/docs/IMPROVEMENT-TODO.md +246 -0
- package/docs/INTERNALS.md +485 -0
- package/docs/MIGRATION-v2-to-v3.md +258 -0
- package/docs/SECURITY-HARDENING.md +230 -0
- package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
- package/docs/SKILLS-FULL-TEXT.md +9685 -0
- package/docs/SKILLS-REFERENCE.md +1037 -0
- package/docs/TROUBLESHOOTING.md +1084 -0
- package/docs/USER-GUIDE.md +1437 -0
- package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
- package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
- package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
- package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
- package/docs/audits/OUTSTANDING-2026-08.md +275 -0
- package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
- package/docs/branding/README-brand-draft.md +119 -0
- package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
- package/docs/branding/handoff/README-brand-draft.md +119 -0
- package/docs/branding/handoff/image-prompts.md +46 -0
- package/docs/branding/image-prompts.md +46 -0
- package/docs/branding/nano-banana-prompts.txt +60 -0
- package/docs/context-monitor.md +13 -0
- package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
- package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
- package/docs/decisions/ADR-0003-smart-execution.md +84 -0
- package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
- package/docs/decisions/ADR-0005-command-naming.md +80 -0
- package/docs/decisions/ADR-0006-focus-commands.md +101 -0
- package/docs/decisions/ADR-0007-ship-v1.md +73 -0
- package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
- package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
- package/docs/decisions/ADR-0010-standards-integration.md +79 -0
- package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
- package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
- package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
- package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
- package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
- package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
- package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
- package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
- package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
- package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
- package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
- package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
- package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
- package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
- package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
- package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
- package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
- package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
- package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
- package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
- package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
- package/docs/decisions/ADR-0032-squad-model.md +64 -0
- package/docs/decisions/ADR-0033-army-campaign.md +40 -0
- package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
- package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
- package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
- package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
- package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
- package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
- package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
- package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
- package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
- package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
- package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
- package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
- package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
- package/docs/decisions/ADR-0047-pan-harness.md +76 -0
- package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
- package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
- package/docs/specs/ai_drift_prevention_featureai.md +286 -0
- package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
- package/docs/specs/command_naming_optimization_featureai.md +930 -0
- package/docs/specs/comp_analysis_markdown_v1.md +149 -0
- package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
- package/docs/specs/contributors_attribution_index_featureai.md +476 -0
- package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
- package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
- package/docs/specs/custom-skills-assessment.md +461 -0
- package/docs/specs/deployment_audit_findings_featureai.md +243 -0
- package/docs/specs/doc_code_link_graph_featureai.md +253 -0
- package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
- package/docs/specs/e2e_visual_testing_featureai.md +615 -0
- package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
- package/docs/specs/evidence-loop-plan.md +76 -0
- package/docs/specs/evidence_loop_featureai.md +497 -0
- package/docs/specs/focus-auto-optimize-category.md +449 -0
- package/docs/specs/focus-auto-optimize-superplan.md +188 -0
- package/docs/specs/focus_auto_runner_featureai.md +1102 -0
- package/docs/specs/focus_design_v2_featureai.md +197 -0
- package/docs/specs/focus_sync_v2_featureai.md +202 -0
- package/docs/specs/git_integration_overhaul_featureai.md +326 -0
- package/docs/specs/glm_zai_provider_featureai.md +200 -0
- package/docs/specs/googlecli_adoption_featureai.md +661 -0
- package/docs/specs/help_commands_rewrite_featureai.md +860 -0
- package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
- package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
- package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
- package/docs/specs/investigations/README.md +31 -0
- package/docs/specs/investigations/digests/2026-09-28.md +47 -0
- package/docs/specs/investigations/digests/2026-10-08.md +62 -0
- package/docs/specs/investigations/digests/2026-10-10.md +61 -0
- package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
- package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
- package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
- package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
- package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
- package/docs/specs/lifecycle_completeness_featureai.md +754 -0
- package/docs/specs/local-first-ci.md +42 -0
- package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
- package/docs/specs/market-delta-2026-09-superplan.md +310 -0
- package/docs/specs/market-ideas-2026-09.md +131 -0
- package/docs/specs/market-ideas-2026-10.md +428 -0
- package/docs/specs/market-ideas-ledger.md +177 -0
- package/docs/specs/memory-optimization-2026-10.md +285 -0
- package/docs/specs/multi-track-planning-roots.md +143 -0
- package/docs/specs/multi_model_routing_featureai.md +687 -0
- package/docs/specs/multi_model_routing_superplan.md +197 -0
- package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
- package/docs/specs/opus_47_extended_features_featureai.md +363 -0
- package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
- package/docs/specs/pan_focus_commands_featureai.md +2336 -0
- package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
- package/docs/specs/product-excellence-superplan.md +315 -0
- package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
- package/docs/specs/production_deployment_readiness_featureai.md +433 -0
- package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
- package/docs/specs/real_test_enforcement_featureai.md +213 -0
- package/docs/specs/reality-check-2026-09-superplan.md +362 -0
- package/docs/specs/right-sized-ceremony.md +74 -0
- package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
- package/docs/specs/self_improvement_loop_featureai.md +875 -0
- package/docs/specs/skill-aligned-decomposition.md +155 -0
- package/docs/specs/standards_integration_featureai.md +833 -0
- package/docs/specs/testing-system-redesign-2026-09.md +267 -0
- package/docs/specs/user_reality_testing_system_featureai.md +788 -0
- package/docs/specs/watch-triggers.json +22 -0
- package/docs/specs/workflow-integration-redesign.md +742 -0
- package/docs/specs/workflow_state_consistency_featureai.md +183 -0
- package/hooks/dist/pan-context-monitor.js +9 -2
- package/hooks/dist/pan-cost-logger.js +5 -0
- package/hooks/dist/pan-guard.js +28 -5
- package/hooks/dist/pan-stop-guard.js +9 -9
- package/hooks/dist/pan-trace-logger.js +5 -0
- package/package.json +10 -2
- package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
- package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
- package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
- package/pan-wizard-core/bin/lib/ci.cjs +143 -0
- package/pan-wizard-core/bin/lib/commands.cjs +1 -1
- package/pan-wizard-core/bin/lib/config.cjs +31 -2
- package/pan-wizard-core/bin/lib/constants.cjs +27 -1
- package/pan-wizard-core/bin/lib/core.cjs +22 -10
- package/pan-wizard-core/bin/lib/cost.cjs +14 -4
- package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
- package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
- package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
- package/pan-wizard-core/bin/lib/findings.cjs +34 -4
- package/pan-wizard-core/bin/lib/focus.cjs +1 -1
- package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
- package/pan-wizard-core/bin/lib/init.cjs +7 -2
- package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
- package/pan-wizard-core/bin/lib/merge.cjs +50 -0
- package/pan-wizard-core/bin/lib/mutate.cjs +16 -5
- package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
- package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
- package/pan-wizard-core/bin/lib/phase.cjs +48 -4
- package/pan-wizard-core/bin/lib/plan-lint.cjs +150 -1
- package/pan-wizard-core/bin/lib/preview.cjs +23 -4
- package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
- package/pan-wizard-core/bin/lib/research-lint.cjs +150 -3
- package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
- package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
- package/pan-wizard-core/bin/lib/runner.cjs +2 -16
- package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
- package/pan-wizard-core/bin/lib/squads.cjs +1 -1
- package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
- package/pan-wizard-core/bin/lib/uat.cjs +149 -0
- package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
- package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
- package/pan-wizard-core/bin/lib/verify-red.cjs +37 -1
- package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
- package/pan-wizard-core/bin/lib/verify.cjs +59 -4
- package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
- package/pan-wizard-core/bin/pan-tools.cjs +168 -27
- package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
- package/pan-wizard-core/references/continuation-format.md +3 -3
- package/pan-wizard-core/references/guardrails.md +1 -1
- package/pan-wizard-core/references/model-profiles.md +2 -3
- package/pan-wizard-core/references/questioning.md +24 -0
- package/pan-wizard-core/references/ui-brand.md +4 -6
- package/pan-wizard-core/references/verdict-contract.md +2 -1
- package/pan-wizard-core/templates/config.json +5 -1
- package/pan-wizard-core/templates/debug.md +1 -0
- package/pan-wizard-core/templates/discovery.md +2 -2
- package/pan-wizard-core/templates/requirements.md +9 -0
- package/pan-wizard-core/workflows/add-phase.md +4 -6
- package/pan-wizard-core/workflows/assumptions.md +19 -1
- package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
- package/pan-wizard-core/workflows/discuss-phase.md +4 -2
- package/pan-wizard-core/workflows/exec-lean.md +69 -0
- package/pan-wizard-core/workflows/exec-phase.md +36 -8
- package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
- package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
- package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
- package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
- package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
- package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
- package/pan-wizard-core/workflows/health.md +6 -0
- package/pan-wizard-core/workflows/help.md +31 -53
- package/pan-wizard-core/workflows/insert-phase.md +4 -6
- package/pan-wizard-core/workflows/learn.md +3 -3
- package/pan-wizard-core/workflows/milestone-audit.md +2 -2
- package/pan-wizard-core/workflows/milestone-new.md +38 -95
- package/pan-wizard-core/workflows/new-project.md +96 -258
- package/pan-wizard-core/workflows/optimize.md +107 -5
- package/pan-wizard-core/workflows/phase-tests.md +10 -0
- package/pan-wizard-core/workflows/plan-phase.md +86 -43
- package/pan-wizard-core/workflows/profile.md +50 -0
- package/pan-wizard-core/workflows/progress.md +10 -0
- package/pan-wizard-core/workflows/quick.md +34 -43
- package/pan-wizard-core/workflows/research-phase.md +118 -40
- package/pan-wizard-core/workflows/resume-project.md +18 -2
- package/pan-wizard-core/workflows/settings.md +21 -24
- package/pan-wizard-core/workflows/todo-check.md +6 -2
- package/pan-wizard-core/workflows/transition.md +22 -4
- package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
- package/pan-wizard-core/workflows/update.md +1 -1
- package/pan-wizard-core/workflows/verify-phase.md +2 -2
- package/scripts/build-agent-plugin.js +35 -15
- package/scripts/build-plugin.js +10 -1
- package/scripts/deprecate-old-versions.js +70 -3
- package/scripts/generate-skills-docs.py +1 -1
- package/scripts/git-hooks/pre-push +27 -0
- package/scripts/install-git-hooks.js +7 -5
- package/scripts/install-pre-push.cjs +38 -0
- package/scripts/land.cjs +151 -0
- package/scripts/local-ci.cjs +501 -0
- package/scripts/local-schedule.cjs +277 -0
- package/scripts/prompt-lint.cjs +32 -0
- package/scripts/prompt-rules.cjs +156 -0
- package/scripts/run-tests.cjs +7 -1
- package/scripts/test-quality-lint.cjs +3 -3
- package/scripts/test-surface.cjs +9 -2
- package/agents/pan-research-synthesizer.md +0 -246
- package/commands/pan/audit-deployment.md +0 -386
- package/commands/pan/dashboard.md +0 -22
- package/commands/pan/discord.md +0 -19
- package/commands/pan/mcp-bridge.md +0 -143
- package/commands/pan/milestone-cleanup.md +0 -19
- package/commands/pan/milestone-gaps.md +0 -35
- package/commands/pan/optimize.md +0 -115
- package/commands/pan/profile.md +0 -76
- package/commands/pan/research-phase.md +0 -189
- package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
- package/pan-wizard-core/templates/research-project/architecture.md +0 -210
- package/pan-wizard-core/templates/research-project/features.md +0 -153
- package/pan-wizard-core/templates/research-project/pitfalls.md +0 -206
- package/pan-wizard-core/templates/research-project/stack.md +0 -126
- package/pan-wizard-core/templates/research-project/summary.md +0 -170
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# PAN Wizard Work Plan — Multi-Model Routing
|
|
2
|
+
|
|
3
|
+
**Generated:** 2026-03-21 · **Source:** `docs/specs/multi_model_routing_featureai.md`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Baseline
|
|
8
|
+
|
|
9
|
+
| Metric | Value |
|
|
10
|
+
|--------|-------|
|
|
11
|
+
| Version | 2.8.1 |
|
|
12
|
+
| Tests passing | 1658/1658 |
|
|
13
|
+
| Test files | 71 (46 unit + 25 scenario) |
|
|
14
|
+
| Commands shipped | 42 |
|
|
15
|
+
| Agents shipped | 12 |
|
|
16
|
+
| Core modules | 16 |
|
|
17
|
+
| Open TODOs | 64 |
|
|
18
|
+
| Hooks | 3 |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Items
|
|
23
|
+
|
|
24
|
+
| ID | Priority | Size | Pts | Title | Files | Status |
|
|
25
|
+
|----|----------|------|-----|-------|-------|--------|
|
|
26
|
+
| 1 | P5 | S | 2 | Add PROVIDER_MODELS constant | core.cjs | Done |
|
|
27
|
+
| 2 | P5 | XS | 1 | Add LEGACY_ALIASES constant (opus→reasoning, sonnet→mid, haiku→fast) | core.cjs | Done |
|
|
28
|
+
| 3 | P5 | M | 4 | Update MODEL_PROFILES to use tier aliases (reasoning/mid/fast) | core.cjs | Done |
|
|
29
|
+
| 4 | P5 | S | 2 | Add detectProvider(cwd, config) function | core.cjs | Done |
|
|
30
|
+
| 5 | P5 | S | 2 | Add resolveTierToModel(tier, provider) function | core.cjs | Done |
|
|
31
|
+
| 6 | P5 | M | 4 | Add resolveComplexityTier(baseTier, taskMetadata) function | core.cjs | Done |
|
|
32
|
+
| 7 | P5 | M | 4 | Update resolveModelInternal() — add provider detection, tier resolution, routing strategy support, optional taskMetadata param | core.cjs | Done |
|
|
33
|
+
| 8 | P5 | S | 2 | Add estimateCostMultiplier(profile) function + COST_MULTIPLIERS constant | core.cjs | Done |
|
|
34
|
+
| 9 | P5 | XS | 1 | Export new functions and constants from core.cjs module.exports | core.cjs | Done |
|
|
35
|
+
| 10 | P5 | S | 2 | Update buildConfigDefaults() — add routing section (strategy, provider, cascade_quality_gate, complexity_thresholds) | config.cjs | Done |
|
|
36
|
+
| 11 | P5 | S | 2 | Update config merge to deep-merge routing section | config.cjs | Done |
|
|
37
|
+
| 12 | P5 | M | 4 | Update cmdResolveModel() — accept optional metadataJson param, pass to resolveModelInternal, include strategy in output | commands.cjs | Done |
|
|
38
|
+
| 13 | P5 | S | 2 | Add cmdEstimateCost(cwd, raw) command | commands.cjs | Done |
|
|
39
|
+
| 14 | P5 | S | 2 | Wire estimate-cost case in pan-tools.cjs dispatcher | pan-tools.cjs | Done |
|
|
40
|
+
| 15 | P5 | XS | 1 | Update resolve-model case in pan-tools.cjs to pass metadata arg | pan-tools.cjs | Done |
|
|
41
|
+
| 16 | P3 | M | 4 | Tests: PROVIDER_MODELS structure, tier alias resolution (6 tests) | tests/core.test.cjs | Done |
|
|
42
|
+
| 17 | P3 | M | 4 | Tests: Legacy backward compat — opus/sonnet/haiku still resolve (3 tests) | tests/core.test.cjs | Done |
|
|
43
|
+
| 18 | P3 | M | 4 | Tests: detectProvider() — config, env var, directory, fallback (4 tests) | tests/core.test.cjs | Done |
|
|
44
|
+
| 19 | P3 | M | 4 | Tests: resolveComplexityTier — downgrade, maintain, upgrade, edge cases (6 tests) | tests/core.test.cjs | Done |
|
|
45
|
+
| 20 | P3 | S | 2 | Tests: resolveModelInternal with strategy=static (backward compat) | tests/core.test.cjs | Done |
|
|
46
|
+
| 21 | P3 | S | 2 | Tests: resolveModelInternal with strategy=complexity + metadata | tests/core.test.cjs | Done |
|
|
47
|
+
| 22 | P3 | S | 2 | Tests: Per-agent override precedence over routing strategy | tests/core.test.cjs | Done |
|
|
48
|
+
| 23 | P3 | S | 2 | Tests: estimateCostMultiplier returns valid numbers for all profiles | tests/core.test.cjs | Done |
|
|
49
|
+
| 24 | P3 | S | 2 | Tests: Config — routing defaults present, user override merging (3 tests) | tests/config.test.cjs | Done |
|
|
50
|
+
| 25 | P3 | S | 2 | Tests: Commands — resolve-model with/without metadata, estimate-cost output (4 tests) | tests/commands.test.cjs | Done |
|
|
51
|
+
| 26 | P6 | L | 10 | Rewrite model-profiles.md reference — tier aliases, provider mapping, routing strategies, config examples | references/model-profiles.md | Done |
|
|
52
|
+
| 27 | P6 | S | 2 | Update profile.md command — add cost estimation display after profile switch | commands/pan/profile.md | Done |
|
|
53
|
+
| 28 | P6 | S | 2 | Update profile.md workflow — add cost multiplier output step | workflows/profile.md | Done |
|
|
54
|
+
| 29 | P6 | S | 2 | Update settings.md workflow — add routing strategy question | workflows/settings.md | Done |
|
|
55
|
+
| 30 | P6 | M | 4 | Update USER-GUIDE.md — Model Profiles section with routing, cost estimation, per-phase override | docs/USER-GUIDE.md | Done |
|
|
56
|
+
| 31 | P6 | S | 2 | Update AGENTS.md — Model Profiles section with tier aliases | docs/AGENTS.md | Done |
|
|
57
|
+
| 32 | P6 | S | 2 | Update COMPARISON.md — Model Flexibility row, Where PAN Leads section | docs/COMPARISON.md | Done |
|
|
58
|
+
| 33 | P6 | S | 2 | Update INTERNALS.md — document routing pipeline | docs/INTERNALS.md | Done |
|
|
59
|
+
| 34 | P5 | M | 4 | Per-phase model override — parse `<!-- model_tier: X -->` from roadmap phase sections in resolveModelInternal | core.cjs | Done |
|
|
60
|
+
| 35 | P3 | S | 2 | Tests: Per-phase model override precedence | tests/core.test.cjs | Done |
|
|
61
|
+
| 36 | P3 | S | 2 | Tests: Installer deploys updated model-profiles.md to all 5 runtimes | tests/e2e-install.test.cjs | Done |
|
|
62
|
+
|
|
63
|
+
**Total: 36 items · 96 points**
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Dependency Graph
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Items 1-2 (constants) ← Item 3 (profiles update) ← Item 7 (resolveModelInternal update)
|
|
71
|
+
Items 4-5 (detect/resolve functions) ← Item 7
|
|
72
|
+
Item 6 (complexity fn) ← Item 7
|
|
73
|
+
Item 8 (cost fn) ← Item 13 (cmdEstimateCost)
|
|
74
|
+
Items 7,9 (core exports) ← Items 12-15 (CLI wiring)
|
|
75
|
+
Items 1-9 (all core) ← Items 16-23 (core tests)
|
|
76
|
+
Items 10-11 (config) ← Item 24 (config tests)
|
|
77
|
+
Items 12-15 (commands) ← Item 25 (command tests)
|
|
78
|
+
Item 34 (per-phase override) ← Item 35 (per-phase tests)
|
|
79
|
+
All code ← Items 26-33 (documentation)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Session Plan
|
|
85
|
+
|
|
86
|
+
### Session 1: Core Routing Engine + Backward Compat (38 pts)
|
|
87
|
+
|
|
88
|
+
**Goal:** All core functions working, existing tests still pass, new core tests green.
|
|
89
|
+
|
|
90
|
+
| Order | IDs | Title | Pts |
|
|
91
|
+
|-------|-----|-------|-----|
|
|
92
|
+
| 1 | 1, 2 | PROVIDER_MODELS + LEGACY_ALIASES constants | 3 |
|
|
93
|
+
| 2 | 3 | Update MODEL_PROFILES to tier aliases | 4 |
|
|
94
|
+
| 3 | 4, 5 | detectProvider() + resolveTierToModel() | 4 |
|
|
95
|
+
| 4 | 6 | resolveComplexityTier() | 4 |
|
|
96
|
+
| 5 | 7 | Update resolveModelInternal() with provider + strategy | 4 |
|
|
97
|
+
| 6 | 8 | estimateCostMultiplier() + COST_MULTIPLIERS | 2 |
|
|
98
|
+
| 7 | 9 | Export new functions from module.exports | 1 |
|
|
99
|
+
| 8 | 16, 17 | Tests: tier alias resolution + backward compat (9 tests) | 8 |
|
|
100
|
+
| 9 | 18 | Tests: detectProvider() (4 tests) | 4 |
|
|
101
|
+
| 10 | 20 | Tests: resolveModelInternal static backward compat | 2 |
|
|
102
|
+
| 11 | 22 | Tests: Per-agent override precedence | 2 |
|
|
103
|
+
|
|
104
|
+
**Verification gate:** `npm run test:all` — 1658 existing + ~15 new tests all pass. No regression in resolve-model output. Legacy opus/sonnet/haiku still work.
|
|
105
|
+
|
|
106
|
+
**Risk:** Item 3 (MODEL_PROFILES change) touches the constant that ~6 existing test files assert against. Must update test expectations atomically with the constant change. Run tests after each sub-step.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Session 2: Config + CLI Integration (16 pts)
|
|
111
|
+
|
|
112
|
+
**Goal:** CLI commands wired, config defaults updated, full pipeline testable end-to-end.
|
|
113
|
+
|
|
114
|
+
| Order | IDs | Title | Pts |
|
|
115
|
+
|-------|-----|-------|-----|
|
|
116
|
+
| 1 | 10, 11 | Config defaults — routing section + deep-merge | 4 |
|
|
117
|
+
| 2 | 12 | Update cmdResolveModel() with metadata support | 4 |
|
|
118
|
+
| 3 | 13 | Add cmdEstimateCost() command | 2 |
|
|
119
|
+
| 4 | 14, 15 | Wire pan-tools.cjs — estimate-cost + resolve-model metadata | 3 |
|
|
120
|
+
| 5 | 24 | Tests: config routing defaults (3 tests) | 2 |
|
|
121
|
+
| 6 | 25 | Tests: commands — resolve-model metadata + estimate-cost (4 tests) | 2 |
|
|
122
|
+
|
|
123
|
+
**Verification gate:** `npm run test:all` all pass. `pan-tools.cjs resolve-model pan-executor` returns expected value. `pan-tools.cjs estimate-cost` returns JSON with all 3 profiles.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### Session 3: Complexity Routing + Per-Phase Override (16 pts)
|
|
128
|
+
|
|
129
|
+
**Goal:** Complexity routing adjusts tiers based on task metadata. Per-phase override works from roadmap frontmatter.
|
|
130
|
+
|
|
131
|
+
| Order | IDs | Title | Pts |
|
|
132
|
+
|-------|-----|-------|-----|
|
|
133
|
+
| 1 | 19 | Tests: resolveComplexityTier — all 6 edge cases | 4 |
|
|
134
|
+
| 2 | 21 | Tests: resolveModelInternal complexity strategy | 2 |
|
|
135
|
+
| 3 | 23 | Tests: estimateCostMultiplier valid output | 2 |
|
|
136
|
+
| 4 | 34 | Per-phase model override (parse `<!-- model_tier -->`) | 4 |
|
|
137
|
+
| 5 | 35 | Tests: per-phase override precedence | 2 |
|
|
138
|
+
| 6 | 36 | Tests: installer deploys updated reference | 2 |
|
|
139
|
+
|
|
140
|
+
**Verification gate:** `npm run test:all` all pass. Complexity routing demonstrably up/downgrades based on fileCount, waveCount, requirementCount, isArchitectural metadata.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### Session 4: Documentation (26 pts)
|
|
145
|
+
|
|
146
|
+
**Goal:** All documentation updated to reflect new routing capabilities. Reference doc rewritten.
|
|
147
|
+
|
|
148
|
+
| Order | IDs | Title | Pts |
|
|
149
|
+
|-------|-----|-------|-----|
|
|
150
|
+
| 1 | 26 | Rewrite model-profiles.md reference (major) | 10 |
|
|
151
|
+
| 2 | 27, 28 | profile.md command + workflow — cost display | 4 |
|
|
152
|
+
| 3 | 29 | settings.md workflow — routing strategy question | 2 |
|
|
153
|
+
| 4 | 30 | USER-GUIDE.md — Model Profiles + routing section | 4 |
|
|
154
|
+
| 5 | 31, 32 | AGENTS.md + COMPARISON.md updates | 4 |
|
|
155
|
+
| 6 | 33 | INTERNALS.md — routing pipeline docs | 2 |
|
|
156
|
+
|
|
157
|
+
**Verification gate:** `npm run test:all` all pass (doc changes don't affect code). Spot-check that model-profiles.md is picked up by installer manifest.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Session Summary
|
|
162
|
+
|
|
163
|
+
| Session | Focus | Items | Points | Cumulative |
|
|
164
|
+
|---------|-------|-------|--------|------------|
|
|
165
|
+
| 1 | Core routing engine + backward compat | 1-9, 16-18, 20, 22 | 38 | 38 |
|
|
166
|
+
| 2 | Config + CLI integration | 10-15, 24-25 | 16 | 54 |
|
|
167
|
+
| 3 | Complexity routing + per-phase override + remaining tests | 19, 21, 23, 34-36 | 16 | 70 |
|
|
168
|
+
| 4 | Documentation | 26-33 | 26 | 96 |
|
|
169
|
+
|
|
170
|
+
**Total: 4 sessions · 36 items · 96 points**
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Risk Register
|
|
175
|
+
|
|
176
|
+
| # | Risk | Impact | Mitigation |
|
|
177
|
+
|---|------|--------|------------|
|
|
178
|
+
| R1 | MODEL_PROFILES change breaks existing tests | High | Update test expectations atomically; run tests after each file |
|
|
179
|
+
| R2 | resolveModelInternal signature change breaks callers | High | New param is optional; zero-arg path identical to current behavior |
|
|
180
|
+
| R3 | detectProvider() filesystem checks slow on network drives | Low | Cached per-session; only called once per resolve |
|
|
181
|
+
| R4 | Legacy model_overrides with "opus" stop working | High | LEGACY_ALIASES maps opus→reasoning→inherit; explicit test coverage |
|
|
182
|
+
| R5 | Config deep-merge drops existing user routing overrides | Medium | Follow existing pattern (spread hardcoded + user); test merge behavior |
|
|
183
|
+
| R6 | Per-phase override parsing fragile with HTML comments | Medium | Strict regex; fallback to profile default on parse failure |
|
|
184
|
+
| R7 | Cost estimation numbers misleading (no real token counts) | Low | Label as "relative multiplier", not dollar amounts; document limitations |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Cut Line
|
|
189
|
+
|
|
190
|
+
**Recommended MVP:** Sessions 1-3 (70 pts) — full working routing engine with tests.
|
|
191
|
+
|
|
192
|
+
**Recommended full:** Sessions 1-4 (96 pts) — including all documentation.
|
|
193
|
+
|
|
194
|
+
**Deferred (not in this plan):**
|
|
195
|
+
- **Cascade routing** (try cheaper → escalate on failure) — XL complexity, requires quality gate heuristics, double-execution latency. Spec designed but implementation deferred until routing engine proves value in static + complexity modes.
|
|
196
|
+
- **Real-time cost tracking** — out of scope per spec; PAN delegates execution to host runtimes.
|
|
197
|
+
- **Non-Anthropic runtime testing** — only Claude Code currently consumes resolve-model output; other runtimes need integration work first.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Opus 4.7 Existing Feature Enhancements
|
|
3
|
+
type: feature-spec
|
|
4
|
+
status: draft
|
|
5
|
+
created: 2026-04-18
|
|
6
|
+
owner: oharms
|
|
7
|
+
related: [multi_model_routing_featureai.md, focus_auto_runner_featureai.md, lifecycle_completeness_featureai.md]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Spec A — Opus 4.7 Enhancements to Existing PAN Features
|
|
11
|
+
|
|
12
|
+
**Scope:** Fix and enhance what already exists. No new commands, no new agents. Every change maps to an existing file in `commands/pan/`, `agents/`, `pan-wizard-core/bin/lib/`, or `bin/`.
|
|
13
|
+
|
|
14
|
+
**Guiding principle:** the installed surface stays identical (same commands, same agents, same CLI). Behavior gets faster, cheaper, and smarter by leveraging Opus 4.7 primitives (1M context, prompt caching, extended thinking, skills discovery, tool-use-first orchestration, memory).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## E-1. Prompt Caching Layer (Cross-Agent Cost Reduction)
|
|
19
|
+
|
|
20
|
+
**Problem.** Every agent spawn re-sends project.md + requirements.md + roadmap.md + CLAUDE.md (~15-50K input tokens) per call. In a single `/pan:exec-phase` wave that spawns 6 executors + 1 reviewer + 1 verifier, that's ~300K repeated input tokens. Opus 4.7 supports `cache_control` blocks with a 5-minute TTL.
|
|
21
|
+
|
|
22
|
+
**Change surface.**
|
|
23
|
+
- `pan-wizard-core/bin/lib/core.cjs` — add `buildCachedContext(cwd)` helper returning an ordered list of `{path, content, cache: true}` blocks for project.md, requirements.md, roadmap.md, state.md, standards.md (stable across agent calls in a phase).
|
|
24
|
+
- `pan-wizard-core/bin/lib/constants.cjs` — `CACHEABLE_CONTEXT_FILES` array.
|
|
25
|
+
- `agents/*.md` — each agent's preamble changes from inlined "## Project Context" dumps to a system-level cache-controlled block the host runtime injects.
|
|
26
|
+
- `commands/pan/exec-phase.md`, `plan-phase.md`, `verify-phase.md`, `focus-exec.md` — add a `## Cache Priming` stage that runs once per command invocation to warm the cache, then all sub-agent calls within 5 minutes read from cache.
|
|
27
|
+
|
|
28
|
+
**Runtime compatibility.**
|
|
29
|
+
- Claude runtime: uses `cache_control` natively.
|
|
30
|
+
- Codex/Gemini/OpenCode/Copilot: each host has its own cache semantics or none. Shipped agent/command files declare cacheable blocks via a `<!-- cache:stable -->` marker the installer strips/translates per runtime.
|
|
31
|
+
|
|
32
|
+
**Expected impact.** 40-60% input-token reduction across exec-phase. Measured via new `pan-tools stats cache-savings --phase N`.
|
|
33
|
+
|
|
34
|
+
**Test additions.**
|
|
35
|
+
- `tests/cache-priming.test.cjs` — verify buildCachedContext returns stable SHA of all context files.
|
|
36
|
+
- `tests/scenarios/cache-warm-cold.test.cjs` — simulate two agent calls within TTL, assert second call's input-token counter is lower.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## E-2. Whole-Project Ingest in `map-codebase`
|
|
41
|
+
|
|
42
|
+
**Problem.** `/pan:map-codebase` today spawns 6 parallel `pan-document_code` agents each with a 200K budget, each covering a slice of the repo. Outputs are stitched post-hoc and often contradict each other (one says "React 18", another says "React 19" because they read different lockfiles). With Opus 4.7's 1M context, medium codebases (≤800K tokens) fit in a single agent.
|
|
43
|
+
|
|
44
|
+
**Change surface.**
|
|
45
|
+
- `pan-wizard-core/bin/lib/codebase.cjs` — add `estimateRepoTokenSize(cwd, opts)` using the existing CHARS_PER_TOKEN constant + gitignore-aware walk.
|
|
46
|
+
- `agents/pan-document_code.md` — add a `## Mode` section: `single-shot` (repo fits in 1M) vs `sharded` (current 6-way parallel). Threshold at 700K tokens (leaves headroom).
|
|
47
|
+
- `commands/pan/map-codebase.md` — new Stage 0 that calls `pan-tools codebase estimate-size` and picks mode.
|
|
48
|
+
|
|
49
|
+
**Runtime compatibility.** Opus 4.7 only for single-shot. Sonnet/Haiku and non-Claude runtimes always take the sharded path.
|
|
50
|
+
|
|
51
|
+
**Expected impact.** On the typical PAN-sized project (~400K tokens), replaces 6 agent calls with 1 — 6× cost reduction and zero stitching artifacts. For large monorepos, falls back to current behavior.
|
|
52
|
+
|
|
53
|
+
**Test additions.**
|
|
54
|
+
- `tests/codebase.test.cjs` — `estimateRepoTokenSize()` returns under-estimate within 20% of actual.
|
|
55
|
+
- `tests/scenarios/map-codebase-single-shot.test.cjs` — small temp repo, assert mode=single-shot.
|
|
56
|
+
- `tests/scenarios/map-codebase-sharded-fallback.test.cjs` — simulated large repo, mode=sharded.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## E-3. Extended Thinking for Verification-Heavy Agents
|
|
61
|
+
|
|
62
|
+
**Problem.** `pan-plan-checker`, `pan-verifier`, `pan-integration-checker`, `pan-reviewer` all do *judgment* work. They benefit most from Opus 4.7's interleaved thinking (reasoning before tool calls). Today they answer inline without reflection, leading to rubber-stamp verifications (the v2.8.0 retrospective flagged this as a recurring pattern).
|
|
63
|
+
|
|
64
|
+
**Change surface.**
|
|
65
|
+
- `agents/pan-plan-checker.md`, `pan-verifier.md`, `pan-integration-checker.md`, `pan-reviewer.md` — add `thinking: enabled` and a `thinking_budget: 8000` field in frontmatter. Each agent's opening instruction changes from "Analyze this plan" to "Think step-by-step, then report".
|
|
66
|
+
- `pan-wizard-core/bin/lib/constants.cjs` — `THINKING_BUDGETS` map per agent type.
|
|
67
|
+
- `bin/install-lib.cjs` — add `translateThinkingDirective(runtime, budget)` converting the frontmatter field into runtime-specific syntax (Claude: native; Codex: `<thinking>` block prompt; Gemini: system prompt prefix).
|
|
68
|
+
|
|
69
|
+
**Runtime compatibility.** Claude native; others use prompt-level "think step by step" fallback.
|
|
70
|
+
|
|
71
|
+
**Expected impact.** Targeted: plan-checker catches ≥30% more logic gaps pre-execution (measured by comparing pre-exec vs post-exec rework rates). Verifier false-positives drop.
|
|
72
|
+
|
|
73
|
+
**Test additions.**
|
|
74
|
+
- `tests/frontmatter.test.cjs` — `thinking` field round-trips.
|
|
75
|
+
- `tests/install-lib.test.cjs` — translateThinkingDirective() per runtime.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## E-4. Agent Memory Layer (Cross-Phase Learning)
|
|
80
|
+
|
|
81
|
+
**Problem.** PAN's only cross-agent memory today is state.md + phase summaries. Every planner starts from zero. Opus 4.7 has native memory; PAN should register persistent memory per agent scope.
|
|
82
|
+
|
|
83
|
+
**Change surface.**
|
|
84
|
+
- New module: `pan-wizard-core/bin/lib/memory.cjs` (sibling to state.cjs). Exports: `readMemory(cwd, agent)`, `appendMemory(cwd, agent, entry)`, `compactMemory(cwd, agent, maxEntries)`.
|
|
85
|
+
- New directory: `.planning/memory/<agent-name>.md` — one file per agent, append-only log of "learned patterns" with timestamps.
|
|
86
|
+
- Each agent's prompt reads `.planning/memory/<self>.md` at start and is instructed to append a single-line "lesson" at end (via a new `pan-tools memory append <agent> <text>` CLI path).
|
|
87
|
+
- `commands/pan/retro.md` — after milestone, extract top-N lessons per agent and write to memory.
|
|
88
|
+
|
|
89
|
+
**Runtime compatibility.** All 5 runtimes — this is a file-based mechanism, not an API-level memory.
|
|
90
|
+
|
|
91
|
+
**Expected impact.** Planner references "we decided on pattern X in phase 4" in phase 9's plan without a human restating it.
|
|
92
|
+
|
|
93
|
+
**Test additions.**
|
|
94
|
+
- `tests/memory.test.cjs` — 10 test cases covering append/read/compact + schema validation.
|
|
95
|
+
- `tests/scenarios/memory-across-phases.test.cjs` — E2E: run 2 phases, verify second phase's planner reads first phase's memory.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## E-5. Native Skills Registration (Claude Code Host Integration)
|
|
100
|
+
|
|
101
|
+
**Problem.** Claude Code 1.x now loads skills from `.claude/skills/` (per the in-conversation skill list we observe at session start). PAN installs commands to `.claude/commands/pan/`, which Claude Code treats as slash commands — but doesn't expose them as skills-with-descriptions to other agents or to the user's available-skills list.
|
|
102
|
+
|
|
103
|
+
**Change surface.**
|
|
104
|
+
- `bin/install.js` — when target is `--claude`, also write a shim `.claude/skills/pan-<cmd>.md` for each command with the `name:`, `description:`, `trigger:` frontmatter matching Claude Code's skill schema. The shim body delegates to the existing `commands/pan/<cmd>.md`.
|
|
105
|
+
- `bin/install-lib.cjs` — new exported function `buildClaudeSkillShim(commandFrontmatter)`.
|
|
106
|
+
- For Copilot runtime: already uses `.github/skills/` — re-use identical shim generator.
|
|
107
|
+
|
|
108
|
+
**Runtime compatibility.** Claude + Copilot only (both use skills dir). Codex/Gemini/OpenCode use their own command model — unchanged.
|
|
109
|
+
|
|
110
|
+
**Expected impact.** PAN commands appear in Claude Code's skill list with descriptions, making auto-invocation possible ("when the user asks X, invoke pan:focus-scan").
|
|
111
|
+
|
|
112
|
+
**Test additions.**
|
|
113
|
+
- `tests/install-lib.test.cjs` — buildClaudeSkillShim() produces valid YAML frontmatter with name/description/trigger.
|
|
114
|
+
- `tests/scenarios/claude-skills-installed.test.cjs` — after install, `.claude/skills/pan-*.md` count equals `commands/pan/*.md` count.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## E-6. Parallel-Tool Plan Execution in `focus-exec`
|
|
119
|
+
|
|
120
|
+
**Problem.** `focus-exec`'s 6-stage pipeline runs stages sequentially even when stages are independent (Stage 3 prep + Stage 4 wave-1 planning can overlap). Opus 4.7 is markedly better at emitting parallel tool calls in a single assistant turn.
|
|
121
|
+
|
|
122
|
+
**Change surface.**
|
|
123
|
+
- `commands/pan/focus-exec.md` — rewrite Stage 3-4 section to explicitly instruct "emit all independent read/analyze tools in one turn".
|
|
124
|
+
- `pan-wizard-core/bin/lib/focus.cjs` — new helper `classifyStageDependencies(items)` returns a DAG so the command template can generate the right instructions.
|
|
125
|
+
- `agents/pan-executor.md` — add explicit parallel-tool-use encouragement block.
|
|
126
|
+
|
|
127
|
+
**Runtime compatibility.** Claude Code + Opus: full benefit. Others: instructions are harmless prose.
|
|
128
|
+
|
|
129
|
+
**Expected impact.** `focus-exec` wall-clock latency drops ~25% on multi-item batches.
|
|
130
|
+
|
|
131
|
+
**Test additions.**
|
|
132
|
+
- `tests/focus.test.cjs` — `classifyStageDependencies()` returns correct DAG for mixed-tier batches.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## E-7. Model Routing Extension — Cache & Think Tiers
|
|
137
|
+
|
|
138
|
+
**Problem.** The v2.9.0 multi-model router has tiers (reasoning/mid/fast) but doesn't factor in *cache warmth* or *thinking-required*. A planner call with warm cache + thinking is a different cost/quality profile than a cold mid-tier call.
|
|
139
|
+
|
|
140
|
+
**Change surface.**
|
|
141
|
+
- `pan-wizard-core/bin/lib/core.cjs` — extend `resolveModel(task, opts)` with new opts: `cache_warm: bool`, `needs_thinking: bool`, `context_estimate: number`.
|
|
142
|
+
- Logic:
|
|
143
|
+
- `context_estimate > 700K` → Opus 4.7 (only model with 1M).
|
|
144
|
+
- `needs_thinking` → Opus 4.7 or Sonnet 4.6 with extended-thinking.
|
|
145
|
+
- `cache_warm && !needs_thinking && context_estimate < 50K` → Haiku 4.5.
|
|
146
|
+
- `.planning/config.json` — new `model_routing.tiers` section with defaults.
|
|
147
|
+
- `commands/pan/profile.md` — extend to show tier decision tree.
|
|
148
|
+
|
|
149
|
+
**Runtime compatibility.** Routing happens in core.cjs — runtime-agnostic. Non-Claude runtimes use their own tier aliases (already plumbed in v2.9.0).
|
|
150
|
+
|
|
151
|
+
**Test additions.**
|
|
152
|
+
- `tests/core.test.cjs` — `resolveModel()` truth table: 12 combinations of (ctx, thinking, cache).
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## E-8. `pan-statusline` — Cache & Thinking Indicators
|
|
157
|
+
|
|
158
|
+
**Problem.** The statusline shows `model | task | dir | context %` today. Opus 4.7 workflows have two new signals users should see: cache-hit rate and whether an agent is currently thinking.
|
|
159
|
+
|
|
160
|
+
**Change surface.**
|
|
161
|
+
- `hooks/pan-statusline.js` — read two new fields from stdin JSON: `cache_hit_rate_pct`, `thinking_active`. Render as `🧠` when thinking, `⚡N%` for cache hits.
|
|
162
|
+
- `pan-wizard-core/bin/lib/context-budget.cjs` — extend health report to include cache metrics.
|
|
163
|
+
|
|
164
|
+
**Runtime compatibility.** Claude only (other runtimes don't run hooks).
|
|
165
|
+
|
|
166
|
+
**Test additions.**
|
|
167
|
+
- `tests/statusline.test.cjs` — 4 new test cases for the new fields.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## E-9. Installer — Opus 4.7 Detection & Warnings
|
|
172
|
+
|
|
173
|
+
**Problem.** Features E-1, E-2, E-3, E-6 give materially better results on Opus 4.7 vs older models. The installer should detect the user's default model and warn if they're on an older one for features that require it.
|
|
174
|
+
|
|
175
|
+
**Change surface.**
|
|
176
|
+
- `bin/install.js` — after settings.json is written, detect current `model` field. If set to an older Opus/Sonnet and user didn't pass `--skip-warnings`, print a yellow notice: "PAN 2.10+ is tuned for Opus 4.7. You're on X. Features E-1,E-2,E-3,E-6 degrade gracefully but benefit from upgrade."
|
|
177
|
+
- `bin/install-lib.cjs` — new `detectModelCapabilities(modelName)` pure function returning `{has_1m_ctx, has_thinking, has_cache}`.
|
|
178
|
+
|
|
179
|
+
**Test additions.**
|
|
180
|
+
- `tests/install-lib.test.cjs` — 6 cases across model strings.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## E-10. Focus-Auto — Interleaved Thinking Between Cycles
|
|
185
|
+
|
|
186
|
+
**Problem.** `focus-auto` loops scan→plan→exec. Between cycles it consults hardcoded stop-reason rules (max_cycles, zero_completed, regression). Opus 4.7's thinking mode can evaluate *whether the next cycle will be productive* before committing to it.
|
|
187
|
+
|
|
188
|
+
**Change surface.**
|
|
189
|
+
- `pan-wizard-core/bin/lib/focus.cjs` — new `determineContinuation(run, cycle, proposedNextBatch)` that emits a reasoning prompt consumed by the orchestrator agent before it calls `focus-plan` again.
|
|
190
|
+
- `commands/pan/focus-auto.md` — new Stage between cycle-N-complete and cycle-N+1-start: "Reflection gate" with thinking.
|
|
191
|
+
- `pan-wizard-core/bin/lib/constants.cjs` — `REFLECTION_THRESHOLD` (default: enabled on Opus, disabled otherwise).
|
|
192
|
+
|
|
193
|
+
**Test additions.**
|
|
194
|
+
- `tests/focus.test.cjs` — `determineContinuation()` emits valid prompt, respects threshold.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## E-11. `pan-debugger` — Chain-of-Thought Hypothesis Trees
|
|
199
|
+
|
|
200
|
+
**Problem.** The debugger agent today uses the scientific method but emits hypotheses linearly. With thinking mode, it can explore a hypothesis tree in a single turn (generate 3, rank, test top).
|
|
201
|
+
|
|
202
|
+
**Change surface.**
|
|
203
|
+
- `agents/pan-debugger.md` — restructure the `## Investigation Protocol` section: replace "form hypothesis → test → refine" linear flow with "think through 3 hypotheses → rank by Bayesian prior → attack top 2 in parallel (parallel tool calls)".
|
|
204
|
+
|
|
205
|
+
**Test additions.** Behavioral test via scenario: `tests/scenarios/debugger-parallel-hypotheses.test.cjs`.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## E-12. Fix: Oldest-Batch-First in `focus-exec` (shipped in this branch)
|
|
210
|
+
|
|
211
|
+
Already applied: `readLatestBatch()` now sorts ascending. Kept here for completeness — this is a bugfix that fits Spec A's "fix existing features" mandate.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Files to Create/Modify Summary (Spec A)
|
|
216
|
+
|
|
217
|
+
| Category | Files | Count |
|
|
218
|
+
|----------|-------|-------|
|
|
219
|
+
| Core modules modified | core.cjs, codebase.cjs, focus.cjs, context-budget.cjs, constants.cjs | 5 |
|
|
220
|
+
| Core modules new | memory.cjs | 1 |
|
|
221
|
+
| Agents modified | all 12 | 12 |
|
|
222
|
+
| Commands modified | exec-phase, plan-phase, verify-phase, focus-exec, focus-auto, map-codebase, retro, profile | 8 |
|
|
223
|
+
| Hooks modified | pan-statusline.js | 1 |
|
|
224
|
+
| Installer | install.js, install-lib.cjs | 2 |
|
|
225
|
+
| Tests new | 11 new test files | 11 |
|
|
226
|
+
| Docs | ARCHITECTURE.md, USER-GUIDE.md, new ADR-0023 (Opus 4.7 adoption) | 3 |
|
|
227
|
+
|
|
228
|
+
**Estimated test count delta:** +90 to +110 tests.
|
|
229
|
+
|
|
230
|
+
**Estimated LOC impact:** ~800 LOC added (core + tests), ~200 LOC deleted (redundant context-dumping in agents).
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Implementation Order (Recommended)
|
|
235
|
+
|
|
236
|
+
1. E-1 (caching — foundation, biggest cost win)
|
|
237
|
+
2. E-4 (memory — foundation, unlocks learning)
|
|
238
|
+
3. E-3 (thinking — highest quality impact per LOC)
|
|
239
|
+
4. E-7 (routing extension — glues E-1+E-3 into model choice)
|
|
240
|
+
5. E-2 (single-shot map-codebase)
|
|
241
|
+
6. E-5 (skills registration — Claude Code integration)
|
|
242
|
+
7. E-10, E-11 (focus-auto reflection, debugger hypotheses)
|
|
243
|
+
8. E-6 (parallel-tool execution)
|
|
244
|
+
9. E-8, E-9 (UX polish)
|
|
245
|
+
10. E-12 (already shipped)
|
|
246
|
+
|
|
247
|
+
Each item is 1-3 days of focused work. Full Spec A ~6 weeks calendar.
|