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
|
@@ -1,4 +1,106 @@
|
|
|
1
|
-
|
|
1
|
+
<usage>
|
|
2
|
+
# /pan:learn --optimize
|
|
3
|
+
|
|
4
|
+
Manage the circular optimization loop: record a report's suggestions, view stats, list reports.
|
|
5
|
+
|
|
6
|
+
**Usage:**
|
|
7
|
+
```
|
|
8
|
+
/pan:learn --optimize apply
|
|
9
|
+
/pan:learn --optimize apply --report <filename>
|
|
10
|
+
/pan:learn --optimize revert <apply_id>
|
|
11
|
+
/pan:learn --optimize revert --last
|
|
12
|
+
/pan:learn --optimize list
|
|
13
|
+
/pan:learn --optimize stats
|
|
14
|
+
/pan:learn --optimize trace init [--description "what you're building"]
|
|
15
|
+
/pan:learn --optimize trace end
|
|
16
|
+
/pan:learn --optimize trace current
|
|
17
|
+
/pan:learn --optimize trace list
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Subcommands:**
|
|
21
|
+
|
|
22
|
+
### apply
|
|
23
|
+
Record the suggestions from the most recent (or specified) optimization report.
|
|
24
|
+
|
|
25
|
+
Recorded automatically:
|
|
26
|
+
- Suggestions appended to `.planning/optimization/suggestions.md`: lessons, prompt changes and workflow changes, each naming where it belongs
|
|
27
|
+
- Config notes appended to `.planning/optimization/config-suggestions.md`
|
|
28
|
+
- An older report's memory actions (`memory_entry`, `memory`, `memory_append`) still write to `.planning/memory/`, a `memory_entry` only if it passes the checks of the `memory record` command. The result warns that PAN's workflows do not load that folder into agents
|
|
29
|
+
|
|
30
|
+
A person makes every change the suggestions describe (never auto-applied):
|
|
31
|
+
- Lessons, written into the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, or a comment at the cited code
|
|
32
|
+
- Agent prompt changes
|
|
33
|
+
- Workflow step additions
|
|
34
|
+
- Structural changes to commands
|
|
35
|
+
|
|
36
|
+
After applying, the report lists what was applied and what still needs review, plus the `apply_id` that undoes it. Every apply is recorded action by action in `.planning/optimization/applied.jsonl`: the path, whether the file was created or appended to, the exact text, and a hash of the file after the write. Applying the same report a second time writes nothing: each action names the apply that already wrote it.
|
|
37
|
+
|
|
38
|
+
### revert
|
|
39
|
+
Undo one apply exactly: delete the files it created and cut the text it appended (`revert --last` for the newest).
|
|
40
|
+
|
|
41
|
+
Revert never destroys work someone did since:
|
|
42
|
+
- It refuses a file whose content changed after the apply. The comparison ignores line endings, so a CRLF checkout still matches.
|
|
43
|
+
- It refuses a file that a later apply also wrote. Revert that later apply first.
|
|
44
|
+
- It says which files it refused, and why.
|
|
45
|
+
|
|
46
|
+
A CRLF file comes back CRLF. Applies logged before apply records existed cannot be reverted. After a revert, the same report can be applied again.
|
|
47
|
+
|
|
48
|
+
### list
|
|
49
|
+
List all optimization reports in `.planning/optimization/reports/`, most recent first.
|
|
50
|
+
|
|
51
|
+
### stats
|
|
52
|
+
Show cumulative optimization statistics:
|
|
53
|
+
- Total trace sessions run
|
|
54
|
+
- Total events traced
|
|
55
|
+
- Total errors seen (`total_errors_traced`; gaps and redundancies are not totalled)
|
|
56
|
+
- Total optimizations applied across all runs, the apply runs, the reverted runs, and the last `apply_id`
|
|
57
|
+
- Current active trace session (if any)
|
|
58
|
+
|
|
59
|
+
### trace init
|
|
60
|
+
Start a trace session before running a build — or join the active one: `trace init` reuses an unended session started within the last hour (`reused: true`, keeping that session's description) instead of opening a new one. The hook fires automatically on SubagentStop, but calling `trace init` first lets you attach a description to a new session.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
/pan:learn --optimize trace init --description "building express web server"
|
|
64
|
+
/pan:exec-phase 1
|
|
65
|
+
/pan:learn
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### trace end
|
|
69
|
+
Finalize the current trace session (writes summary stats to session.json).
|
|
70
|
+
|
|
71
|
+
### trace current
|
|
72
|
+
Show the active trace session ID (`optimize trace current` returns only `session_id` and `active`; `trace list` carries each session's event count).
|
|
73
|
+
|
|
74
|
+
### trace list
|
|
75
|
+
List all trace sessions, most recent first.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
**The circular loop:**
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
┌─────────────────────────────────────────────────────┐
|
|
83
|
+
│ │
|
|
84
|
+
│ /pan:learn --optimize trace init │
|
|
85
|
+
│ ↓ │
|
|
86
|
+
│ /pan:exec-phase N ← agents run, hook traces │
|
|
87
|
+
│ ↓ │
|
|
88
|
+
│ /pan:learn ← analyze + report │
|
|
89
|
+
│ ↓ │
|
|
90
|
+
│ /pan:learn --optimize apply ← record suggestions │
|
|
91
|
+
│ ↓ │
|
|
92
|
+
│ You make the changes ← instructions, tests, code │
|
|
93
|
+
│ ↑ │
|
|
94
|
+
│ └──────────────────────────────────────────┘
|
|
95
|
+
└─────────────────────────────────────────────────────┘
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each iteration puts what the last run lacked where the next run's agents read it: fewer repeated errors and gaps.
|
|
99
|
+
|
|
100
|
+
**See also:** `/pan:learn`, `/pan:exec-phase`
|
|
101
|
+
</usage>
|
|
102
|
+
|
|
103
|
+
# Workflow: /pan:learn --optimize
|
|
2
104
|
|
|
3
105
|
Manage the circular optimization loop — apply reports, check stats, control trace sessions.
|
|
4
106
|
|
|
@@ -43,7 +145,7 @@ Show the user:
|
|
|
43
145
|
- **Applied** — each item that was recorded (suggestions, config notes)
|
|
44
146
|
- **Skipped** — items that already exist, that an earlier apply already wrote, or that had unknown types
|
|
45
147
|
- **Still needs a person** — every suggestion in `suggestions.md`
|
|
46
|
-
- **The `apply_id`**, and how to undo the apply: `/pan:optimize revert <apply_id>`
|
|
148
|
+
- **The `apply_id`**, and how to undo the apply: `/pan:learn --optimize revert <apply_id>`
|
|
47
149
|
|
|
48
150
|
If an applied item carries a `warning`, pass it on. An older report's memory actions write to `.planning/memory/`, which PAN's workflows do not load into agents.
|
|
49
151
|
|
|
@@ -82,7 +184,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init [--descript
|
|
|
82
184
|
Show the user the session ID and confirm that:
|
|
83
185
|
- The hook will automatically log agent completions to this session
|
|
84
186
|
- To log a specific decision/error manually: `pan-tools optimize trace log --type <type> --description "..."`
|
|
85
|
-
- To end the session explicitly: `/pan:optimize trace end`
|
|
187
|
+
- To end the session explicitly: `/pan:learn --optimize trace end`
|
|
86
188
|
|
|
87
189
|
---
|
|
88
190
|
|
|
@@ -103,7 +205,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace current
|
|
|
103
205
|
```
|
|
104
206
|
|
|
105
207
|
If active: show session ID and instruct how to view events.
|
|
106
|
-
If none: tell user to run `/pan:optimize trace init` before their next build.
|
|
208
|
+
If none: tell user to run `/pan:learn --optimize trace init` before their next build.
|
|
107
209
|
|
|
108
210
|
---
|
|
109
211
|
|
|
@@ -142,7 +244,7 @@ Every agent spawn → hook logs completion event
|
|
|
142
244
|
↓
|
|
143
245
|
.planning/optimization/reports/{session}-opt-report.md
|
|
144
246
|
↓
|
|
145
|
-
/pan:optimize apply → records suggestions
|
|
247
|
+
/pan:learn --optimize apply → records suggestions
|
|
146
248
|
↓
|
|
147
249
|
A person writes each one where the agents read it
|
|
148
250
|
↓
|
|
@@ -370,6 +370,16 @@ Present next steps:
|
|
|
370
370
|
```
|
|
371
371
|
</step>
|
|
372
372
|
|
|
373
|
+
<step name="prove_red">
|
|
374
|
+
Prove the tests you wrote test what the phase built. Each changed test file runs on its own at the phase's base, where it must fail, and at HEAD, where it must pass:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify red "${PHASE_ARG}"
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
A `not_red` test passes without the phase's code: rewrite it to assert the new behaviour, or drop it. Report the result with the test plan.
|
|
381
|
+
</step>
|
|
382
|
+
|
|
373
383
|
</process>
|
|
374
384
|
|
|
375
385
|
<success_criteria>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Create executable phase prompts (plan.md files) for a roadmap phase with
|
|
2
|
+
Create executable phase prompts (plan.md files) for a roadmap phase with verification, and research only when asked for. Default flow: Plan -> Verify -> Done; research (opt-in: `--research` or `workflow.research: true`) answers at most five blocking questions first. Orchestrates pan-phase-researcher, pan-planner, and pan-plan-checker agents with a revision loop (at most 2 revisions, up to 3 checks).
|
|
3
3
|
</purpose>
|
|
4
4
|
|
|
5
5
|
<required_reading>
|
|
@@ -48,6 +48,18 @@ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_
|
|
|
48
48
|
|
|
49
49
|
**If `planning_exists` is false:** Error — run `/pan:new-project` first.
|
|
50
50
|
|
|
51
|
+
**Size the ceremony** (the engine decides; pass `--quality` or `--full` through when `$ARGUMENTS` has them):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
SIZING=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs size phase "$PHASE" [--quality] [--full])
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`SIZING.path` is `lean` or `full`, and `SIZING.mode` is `auto` or `full`. Show it in one line: `Ceremony: {path} ({reasons joined by "; "})`.
|
|
58
|
+
|
|
59
|
+
- **`lean`** (a small phase whose requirements say precisely what to build): no research (step 5), and the engine plans the phase (step 8: one task per requirement, checked and recorded in code). A planner and the plan-checker run only if the engine declines.
|
|
60
|
+
- **`full`**: the whole path below.
|
|
61
|
+
- **`mode` `auto`** (any profile but `quality`, and `workflow.ceremony` not `full`): the plan-checker gets an output budget (step 10) and the revision loop stops after one revision (step 12). **`mode` `full`** keeps the unbudgeted checker and two revisions.
|
|
62
|
+
|
|
51
63
|
**Circular optimization — ensure trace session active:**
|
|
52
64
|
```bash
|
|
53
65
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init \
|
|
@@ -57,7 +69,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init \
|
|
|
57
69
|
|
|
58
70
|
## 2. Parse and Normalize Arguments
|
|
59
71
|
|
|
60
|
-
Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath
|
|
72
|
+
Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`, `--quality`, `--full`). `--quality` and `--full` force the full ceremony for this run (`size phase` above).
|
|
61
73
|
|
|
62
74
|
Extract `--prd <filepath>` from $ARGUMENTS. If present, set PRD_FILE to the filepath.
|
|
63
75
|
|
|
@@ -202,7 +214,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace log \
|
|
|
202
214
|
|
|
203
215
|
2. Display: `Auto-mode: no Phase ${PHASE} context.md — planning from project-level research + requirements + idea.md`
|
|
204
216
|
|
|
205
|
-
3. Proceed to step 5 (Handle Research). The `pan-planner` agent reads project-level `.planning/research/
|
|
217
|
+
3. Proceed to step 5 (Handle Research). The `pan-planner` agent reads the project-level answers (`.planning/research/research-summary.md`, when research ran) and the original `.planning/idea.md` to derive phase-scoped decisions itself.
|
|
206
218
|
|
|
207
219
|
**Interactive-mode decision tree (the original behavior; runs when neither `--auto` nor `workflow.auto_advance` is set):**
|
|
208
220
|
|
|
@@ -218,63 +230,55 @@ If "Run discuss-phase first": Display `/pan:discuss-phase {X}` and exit workflow
|
|
|
218
230
|
|
|
219
231
|
## 5. Handle Research
|
|
220
232
|
|
|
221
|
-
**
|
|
233
|
+
Research is **opt-in**: it runs only with `--research`, or when `research_enabled` (from init: `workflow.research`, false by default) is true. When it runs it answers at most five questions with one researcher and settles decisions; it never adds scope to the phase.
|
|
222
234
|
|
|
223
|
-
**
|
|
235
|
+
**Skip if:** `--gaps` flag, `--skip-research` flag, `research_enabled` is false without `--research`, or `SIZING.path` is `lean` (the requirements already say what to build) without `--research`.
|
|
224
236
|
|
|
225
|
-
|
|
226
|
-
2. The phase is scaffolding, config, docs or a single-file feature with ≤3 tasks (judge from its goal; no plan field records this)
|
|
227
|
-
3. Project-level `research/architecture.md`, `features.md`, `stack.md` already exist (so the planner has broad context to draw from)
|
|
237
|
+
**P-1401 lightweight-phase bypass (v3.7.3+):** With `research_enabled` true but no `--research`, also skip when the phase's roadmap section expects no more than one plan (`**Plans:** 1 plan`, or the `TBD` / `0 plans` the roadmapper and `phase add`/`insert` write before any planning) and it is scaffolding, config, docs or a single-file feature with ≤3 tasks (judge from its goal). Log a `decision` trace event (`type: "decision", category: "skip-research-trivial"`) and proceed to step 6.
|
|
228
238
|
|
|
229
|
-
|
|
239
|
+
**P-1602 phase_record_compact (v3.7.5+):** When `workflow.phase_record_compact: true` AND the lightweight-phase bypass above triggers, also skip per-phase context.md creation (step 4) and emit a single combined `${padded_phase}-record.md` after planning containing: goal, locked decisions (from project-level context), plan summary, must_haves. Off by default — opt-in via `pan-tools config-set workflow.phase_record_compact true`.
|
|
230
240
|
|
|
231
|
-
|
|
241
|
+
**If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
|
|
232
242
|
|
|
233
|
-
**
|
|
243
|
+
**Otherwise:**
|
|
234
244
|
|
|
235
|
-
**
|
|
245
|
+
**5a. Write the questions.** Read `{slice_path}` (and `{context_path}` when it exists) and list at most **5** open questions the phase's requirements leave unanswered and that block building: a technology choice, an external API's behaviour, a data format, a limit or rule. A question qualifies only if a task cannot be written without its answer; a decision context.md already locks is not open. If `.planning/research/research-summary.md` already answers one, it is not open either.
|
|
236
246
|
|
|
237
|
-
|
|
247
|
+
Write `{phase_dir}/{padded_phase}-research-questions.md` as a numbered list:
|
|
238
248
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
242
|
-
PAN ► RESEARCHING PHASE {X}
|
|
243
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
249
|
+
```markdown
|
|
250
|
+
# Phase {X} research questions
|
|
244
251
|
|
|
245
|
-
|
|
252
|
+
1. [question] — blocks: [the task or decision it settles]
|
|
246
253
|
```
|
|
247
254
|
|
|
248
|
-
|
|
255
|
+
**No questions → no research.** If nothing blocks building, write no file, display `No open questions block Phase {X} — research skipped`, and continue to step 6.
|
|
256
|
+
|
|
257
|
+
**5b. Spawn one researcher.**
|
|
249
258
|
|
|
250
|
-
```
|
|
251
|
-
|
|
259
|
+
```
|
|
260
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
261
|
+
PAN ► RESEARCHING PHASE {X} ({N} QUESTIONS)
|
|
262
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
252
263
|
```
|
|
253
264
|
|
|
254
265
|
Research prompt:
|
|
255
266
|
|
|
256
267
|
```markdown
|
|
257
268
|
<objective>
|
|
258
|
-
|
|
259
|
-
Answer: "What do I need to know to PLAN this phase well?"
|
|
269
|
+
Answer the research questions for Phase {phase_number}: {phase_name}, and nothing else.
|
|
260
270
|
</objective>
|
|
261
271
|
|
|
262
272
|
<files_to_read>
|
|
273
|
+
- {phase_dir}/{padded_phase}-research-questions.md (The questions)
|
|
263
274
|
- {context_path} (USER DECISIONS from /pan:discuss-phase)
|
|
275
|
+
- {assumptions_path} (the user's corrections to /pan:assumptions, when the file exists: `init` reports `assumptions_path`; each correction binds the plan like a decision)
|
|
264
276
|
- {slice_path} (This phase's roadmap and requirements)
|
|
265
|
-
- {state_path} (Project decisions and history)
|
|
266
277
|
</files_to_read>
|
|
267
278
|
|
|
268
|
-
<additional_context>
|
|
269
|
-
**Phase description:** {phase_description}
|
|
270
|
-
**Phase requirement IDs (MUST address):** {phase_req_ids}
|
|
271
|
-
|
|
272
|
-
**Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
|
|
273
|
-
**Project skills:** Check .agents/skills/ directory (if exists) — read SKILL.md files, research should account for project skill patterns
|
|
274
|
-
</additional_context>
|
|
275
|
-
|
|
276
279
|
<output>
|
|
277
280
|
Write to: {phase_dir}/{padded_phase}-research.md
|
|
281
|
+
One row per question: | # | Question | Answer | Source | Confidence | Decision it settles |, or `unknown — assume: …`. At most 4 searches or fetches per question. Anything that suggests new scope goes under ## Ideas (v2 candidates).
|
|
278
282
|
</output>
|
|
279
283
|
```
|
|
280
284
|
|
|
@@ -287,9 +291,19 @@ Task(
|
|
|
287
291
|
)
|
|
288
292
|
```
|
|
289
293
|
|
|
294
|
+
**5c. Check the answers.**
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs research check "${PHASE_DIR}/${PADDED_PHASE}-research-questions.md" "${PHASE_DIR}/${PADDED_PHASE}-research.md"
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Exit 1: send its `errors` to the researcher once as a revision (the same `subagent_type` and model, with the errors and the file to fix). One revision at most: if the check still fails, proceed, and add a `## Unknowns` list to the research file naming each question still without a sourced answer and the assumption the plan uses. Research never blocks planning.
|
|
301
|
+
|
|
302
|
+
The planner uses the answers to settle decisions. It never plans an item from `## Ideas (v2 candidates)`: those are for the user, through `/pan:todo-add` or a later phase.
|
|
303
|
+
|
|
290
304
|
### Handle Researcher Return
|
|
291
305
|
|
|
292
|
-
- **`## RESEARCH COMPLETE`:** Display
|
|
306
|
+
- **`## RESEARCH COMPLETE`:** Display the decisions it settled, run 5c, continue to step 6
|
|
293
307
|
- **`## RESEARCH BLOCKED`:** Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
|
|
294
308
|
|
|
295
309
|
## 5.5. Create Validation Strategy (if Nyquist enabled)
|
|
@@ -331,6 +345,14 @@ ls "${PHASE_DIR}"/*-plan.md 2>/dev/null
|
|
|
331
345
|
|
|
332
346
|
## 8. Spawn pan-planner Agent
|
|
333
347
|
|
|
348
|
+
**Lean path (`SIZING.path` is `lean`, not `--gaps`): the engine plans the phase.**
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
LEAN_PLAN=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs size phase-plan "${PHASE_NUMBER}")
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Exit 0: the plans are written (one task per requirement, each task's action the requirement's own text, at most `workflow.lean_max_requirements` tasks a plan), checked, recorded as the phase's plan check and committed. Show its `paths` and go to step 13. Exit 1 (`has_plans`, `not_lean`, or a check that failed): continue below with the planner.
|
|
355
|
+
|
|
334
356
|
Display banner:
|
|
335
357
|
```
|
|
336
358
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
@@ -351,6 +373,7 @@ Planner prompt:
|
|
|
351
373
|
- {state_path} (Project State)
|
|
352
374
|
- {slice_path} (This phase's roadmap and requirements — read the whole roadmap.md or requirements.md only for something it leaves out)
|
|
353
375
|
- {context_path} (USER DECISIONS from /pan:discuss-phase)
|
|
376
|
+
- {assumptions_path} (the user's corrections to /pan:assumptions, when the file exists: `init` reports `assumptions_path`; each correction binds the plan like a decision)
|
|
354
377
|
- {research_path} (Technical Research)
|
|
355
378
|
- {verification_path} (Verification Gaps - if --gaps)
|
|
356
379
|
- {uat_path} (UAT Gaps - if --gaps)
|
|
@@ -362,6 +385,11 @@ Planner prompt:
|
|
|
362
385
|
**Project skills:** Check .agents/skills/ directory (if exists) — read SKILL.md files, plans should account for project skill rules
|
|
363
386
|
</planning_context>
|
|
364
387
|
|
|
388
|
+
<ceremony>
|
|
389
|
+
{Only when SIZING.path is lean, include:}
|
|
390
|
+
Lean path: this phase's requirements already name what to build. Write ONE plan, as short as the requirements allow: no research section, no restating of the requirements, decisions only (signatures, values, assertions, the verify command). The engine checks the plan in code instead of a plan-checker.
|
|
391
|
+
</ceremony>
|
|
392
|
+
|
|
365
393
|
<downstream_consumer>
|
|
366
394
|
Output consumed by /pan:exec-phase. Plans need:
|
|
367
395
|
- Frontmatter (wave, depends_on, files_modified, autonomous)
|
|
@@ -398,7 +426,15 @@ Task(
|
|
|
398
426
|
|
|
399
427
|
## 10. Spawn pan-plan-checker Agent
|
|
400
428
|
|
|
401
|
-
**
|
|
429
|
+
**Lean path (`SIZING.path` is `lean`): the engine checks the plans.**
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
ENGINE_CHECK=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs size plan-check "${PHASE_NUMBER}")
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Exit 0 (`ok`, `recorded`): the plan set, every plan's structure and the plans' grep gates pass, and the engine has recorded the phase's plan check. Skip the checker and go to step 13. Exit 1: send its `errors` to the planner as the revision context (step 12; it counts as an iteration) and run `size plan-check` again; when it still fails, continue below with the plan-checker agent.
|
|
436
|
+
|
|
437
|
+
**Full path. First, the checks code can make.** Run them before spending a checker:
|
|
402
438
|
|
|
403
439
|
```bash
|
|
404
440
|
PLAN_SET=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify plan-set "${PHASE_NUMBER}")
|
|
@@ -432,6 +468,7 @@ Checker prompt:
|
|
|
432
468
|
- {PHASE_DIR}/*-plan.md (Plans to verify)
|
|
433
469
|
- {slice_path} (This phase's roadmap and requirements — read the whole roadmap.md or requirements.md only for something it leaves out)
|
|
434
470
|
- {context_path} (USER DECISIONS from /pan:discuss-phase)
|
|
471
|
+
- {assumptions_path} (the user's corrections to /pan:assumptions, when the file exists: `init` reports `assumptions_path`; each correction binds the plan like a decision)
|
|
435
472
|
- {research_path} (Technical Research — includes Validation Architecture)
|
|
436
473
|
</files_to_read>
|
|
437
474
|
|
|
@@ -453,6 +490,11 @@ Checker prompt:
|
|
|
453
490
|
- ## VERIFICATION PASSED — all checks pass
|
|
454
491
|
- ## ISSUES FOUND — structured issue list
|
|
455
492
|
</expected_output>
|
|
493
|
+
|
|
494
|
+
<output_budget>
|
|
495
|
+
{Only when SIZING.mode is auto, include:}
|
|
496
|
+
Report the verdict and the blocking issues only: one line per issue (plan, task, what is wrong, the fix), at most 300 words before the pan-verdict block. No summary of what passed.
|
|
497
|
+
</output_budget>
|
|
456
498
|
```
|
|
457
499
|
|
|
458
500
|
```
|
|
@@ -483,11 +525,11 @@ Each re-check in the revision loop overwrites the same file and is recorded agai
|
|
|
483
525
|
|
|
484
526
|
## 12. Revision Loop (At Most 2 Revisions, 3 Checks)
|
|
485
527
|
|
|
486
|
-
Track `iteration_count` (starts at 1 after initial plan + check).
|
|
528
|
+
Track `iteration_count` (starts at 1 after initial plan + check). `MAX_CHECKS` is 2 when `SIZING.mode` is `auto` (one revision: a second failure goes to the user, not another paid round) and 3 when it is `full`.
|
|
487
529
|
|
|
488
|
-
**If iteration_count <
|
|
530
|
+
**If iteration_count < MAX_CHECKS:**
|
|
489
531
|
|
|
490
|
-
Display: `Sending back to planner for revision... (iteration {N}/
|
|
532
|
+
Display: `Sending back to planner for revision... (iteration {N}/{MAX_CHECKS})`
|
|
491
533
|
|
|
492
534
|
Revision prompt:
|
|
493
535
|
|
|
@@ -499,6 +541,7 @@ Revision prompt:
|
|
|
499
541
|
<files_to_read>
|
|
500
542
|
- {PHASE_DIR}/*-plan.md (Existing plans)
|
|
501
543
|
- {context_path} (USER DECISIONS from /pan:discuss-phase)
|
|
544
|
+
- {assumptions_path} (the user's corrections to /pan:assumptions, when the file exists: `init` reports `assumptions_path`; each correction binds the plan like a decision)
|
|
502
545
|
</files_to_read>
|
|
503
546
|
|
|
504
547
|
**Checker issues:** {structured_issues_from_checker}
|
|
@@ -522,7 +565,7 @@ Task(
|
|
|
522
565
|
|
|
523
566
|
After planner returns -> spawn checker again (step 10), increment iteration_count.
|
|
524
567
|
|
|
525
|
-
**If iteration_count >=
|
|
568
|
+
**If iteration_count >= MAX_CHECKS:**
|
|
526
569
|
|
|
527
570
|
Display: `Max iterations reached. {N} issues remain:` + issue list
|
|
528
571
|
|
|
@@ -530,7 +573,7 @@ Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
|
|
|
530
573
|
|
|
531
574
|
**On "Force proceed":** record that planning continues past the remaining issues. Execution and the milestone audit will see them as deferred, with this reason:
|
|
532
575
|
```bash
|
|
533
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "${PHASE_NUMBER}" --agent pan-plan-checker --open --as deferred --reason "force proceed after
|
|
576
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "${PHASE_NUMBER}" --agent pan-plan-checker --open --as deferred --reason "force proceed after ${MAX_CHECKS} plan checks"
|
|
534
577
|
```
|
|
535
578
|
|
|
536
579
|
## 13. Present Final Status
|
|
@@ -682,7 +725,7 @@ Verification: {Passed | Passed with override | Skipped}
|
|
|
682
725
|
|
|
683
726
|
**Also available:**
|
|
684
727
|
- cat .planning/phases/{phase-dir}/*-plan.md — review plans
|
|
685
|
-
- /pan:plan-phase {X} --research —
|
|
728
|
+
- /pan:plan-phase {X} --research — answer open questions first, then replan
|
|
686
729
|
|
|
687
730
|
───────────────────────────────────────────────────────────────
|
|
688
731
|
</offer_next>
|
|
@@ -692,8 +735,8 @@ Verification: {Passed | Passed with override | Skipped}
|
|
|
692
735
|
- [ ] Phase validated against roadmap
|
|
693
736
|
- [ ] Phase directory created if needed
|
|
694
737
|
- [ ] context.md loaded early (step 4) and passed to ALL agents
|
|
695
|
-
- [ ] Research
|
|
696
|
-
- [ ]
|
|
738
|
+
- [ ] Research only when asked for (`--research` or `workflow.research: true`): at most 5 questions, one pan-phase-researcher, `research check` run
|
|
739
|
+
- [ ] No idea from research planned into the phase
|
|
697
740
|
- [ ] Existing plans checked
|
|
698
741
|
- [ ] pan-planner spawned with context.md + research.md
|
|
699
742
|
- [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
|
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
<objective>
|
|
2
|
+
Switch the model profile used by PAN agents. Sets the model tier PAN's workflows pass when they spawn an agent (mapped to the detected provider's models), balancing quality vs token spend. `/pan:army` and `pan-conductor` spawn with no model, so the agents they run use their own `model:` pin, else the session model, under every profile.
|
|
3
|
+
|
|
4
|
+
Routes to the profile workflow which handles:
|
|
5
|
+
- Argument validation (quality/balanced/budget)
|
|
6
|
+
- Downgrade confirmation (quality → balanced → budget requires 'yes')
|
|
7
|
+
- Config file creation if missing
|
|
8
|
+
- Profile update in config.json
|
|
9
|
+
- Confirmation with model table display
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<tier_decision_tree>
|
|
13
|
+
**Capability-aware routing** (shipped v2.10.0 — E-7). `resolveModel` can adjust the profile's tier per call from three hints — context estimate, whether the task needs extended thinking, and whether prompt cache is warm — but only when the caller passes them (`resolve-model <agent> --metadata '{…}'`). No shipped workflow, command or agent passes them, so the tree and the quick guide below describe what a caller's hints would do.
|
|
14
|
+
|
|
15
|
+
The decision order `resolveModel` applies after the baseline profile pick:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Baseline tier (from MODEL_PROFILES[agent][profile])
|
|
19
|
+
│
|
|
20
|
+
▼
|
|
21
|
+
┌─────────────────────────────────────────────┐
|
|
22
|
+
│ context_estimate > 700K tokens? │── yes ──▶ force reasoning (widest ctx tier)
|
|
23
|
+
└─────────────────────────────────────────────┘
|
|
24
|
+
│ no
|
|
25
|
+
▼
|
|
26
|
+
┌─────────────────────────────────────────────┐
|
|
27
|
+
│ needs_thinking AND tier == fast? │── yes ──▶ upgrade fast → mid
|
|
28
|
+
└─────────────────────────────────────────────┘
|
|
29
|
+
│ no
|
|
30
|
+
▼
|
|
31
|
+
┌─────────────────────────────────────────────┐
|
|
32
|
+
│ cache_warm AND !needs_thinking │── yes ──▶ downgrade mid → fast
|
|
33
|
+
│ AND context_estimate < 50K AND tier == mid │
|
|
34
|
+
└─────────────────────────────────────────────┘
|
|
35
|
+
│ no
|
|
36
|
+
▼
|
|
37
|
+
Final tier → provider-native model name
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Quick guide:**
|
|
41
|
+
- Heavy verification (plan-checker, verifier, integration-checker, reviewer, debugger): `needs_thinking: true` — baseline upgrades fast→mid.
|
|
42
|
+
- Whole-repo context estimates above the large-context threshold (`context_estimate > 700K` tokens — `LARGE_CONTEXT_TOKEN_THRESHOLD`): forced to reasoning, which inherits the model you launched with. Note the direction: `/pan:map-codebase` picks `single-shot` **at or below** 700K and `sharded` above it, so the repos that trip this rule are the ones the mapper is already sharding.
|
|
43
|
+
- Routine exec tasks with project.md cached: `cache_warm + small ctx` — mid gets downgraded to fast for a cost win.
|
|
44
|
+
- All rules are additive to the `quality` / `balanced` / `budget` profile you pick here — profile sets the floor, capability hints adjust upward or downward within that floor's band.
|
|
45
|
+
|
|
46
|
+
**Inspecting routing:** use `pan-tools resolve-model <agent> --metadata '{"context_estimate":900000,"needs_thinking":true}'` to see what tier a given hint set resolves to.
|
|
47
|
+
|
|
48
|
+
**Effort dimension (2026-06):** `resolve-model` also returns an `effort` level (`low`/`medium`/`high`/`xhigh`) per agent — the within-model reasoning-depth dial on current models. Profiles modulate it: `budget` steps each agent's base effort down one level (floor `low`); `quality`/`balanced` keep the base. Per-agent override: `.planning/config.json` → `"effort_overrides": { "pan-verifier": "xhigh" }`.
|
|
49
|
+
</tier_decision_tree>
|
|
50
|
+
|
|
1
51
|
<purpose>
|
|
2
52
|
Switch the model profile used by PAN agents. Controls which model tier each agent uses, balancing quality vs token spend.
|
|
3
53
|
</purpose>
|
|
@@ -128,6 +128,16 @@ CONTEXT: [✓ if has_context | - if not]
|
|
|
128
128
|
</step>
|
|
129
129
|
|
|
130
130
|
<step name="route">
|
|
131
|
+
**Ask the router first.** One verb decides the next step:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
NEXT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs next-action)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
It returns `{action, phase, reason, command}`, read from roadmap.md and the phase directories by the same state machine the MCP `pan_next_action` tool uses, so progress, resume and transition never disagree about what comes next. `action` is one of `plan`, `execute`, `verify`, `complete_phase`, `plan_gaps`, `audit_milestone`, `new_milestone`, `new_project` or `stop`, and `command` is the command that carries it out.
|
|
138
|
+
|
|
139
|
+
Its `action` picks the route below: `execute` → **Route A**, `plan` → **Route B**, `plan_gaps` → **Route E**, `verify` → offer `/pan:verify-phase {phase}`, `complete_phase` → run `command`, then **Route C**, `audit_milestone` → **Route D** (audit before `/pan:milestone-done`), `new_milestone` → **Route F**. The counts below are what the router read; use them to explain the route, not to pick a different one.
|
|
140
|
+
|
|
131
141
|
**Determine next action based on verified counts.**
|
|
132
142
|
|
|
133
143
|
**Step 1: Count plans, summaries, and issues in current phase**
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Execute small, ad-hoc tasks with PAN guarantees (atomic commits, state.md tracking). Quick mode spawns pan-planner (quick mode) + pan-executor(s), tracks tasks in `.planning/quick/`, and updates state.md's "Quick Tasks Completed" table.
|
|
3
3
|
|
|
4
4
|
With `--full` flag: enables plan-checking (max 2 iterations) and post-execution verification for quality guarantees without full milestone ceremony.
|
|
5
|
+
|
|
6
|
+
Without `--full`, a task whose description already says precisely what to build takes the lean path: the engine writes its one-task plan (`pan-tools size quick-plan`) and no planner runs. `--quality`, the `quality` profile or `workflow.ceremony: full` keep the planner.
|
|
5
7
|
</purpose>
|
|
6
8
|
|
|
7
9
|
<required_reading>
|
|
@@ -13,6 +15,7 @@ Read all files referenced by the invoking prompt's execution_context before star
|
|
|
13
15
|
|
|
14
16
|
Parse `$ARGUMENTS` for:
|
|
15
17
|
- `--full` flag → store as `$FULL_MODE` (true/false)
|
|
18
|
+
- `--quality` flag → store as `$QUALITY` (true/false): the full ceremony for this run
|
|
16
19
|
- Remaining text → use as `$DESCRIPTION` if non-empty
|
|
17
20
|
|
|
18
21
|
If `$DESCRIPTION` is empty after parsing, prompt user interactively:
|
|
@@ -50,6 +53,14 @@ Parse JSON for: `planner_model`, `executor_model`, `checker_model`, `verifier_mo
|
|
|
50
53
|
|
|
51
54
|
**If `roadmap_exists` is false:** Error — Quick mode requires an active project with roadmap.md. Run `/pan:new-project` first.
|
|
52
55
|
|
|
56
|
+
**Size the ceremony** (pass `--full` and `--quality` through when set):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
SIZING=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs size task "$DESCRIPTION" [--full] [--quality])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`SIZING.path` is `lean` (the description names what to build and how to check it) or `full`; `SIZING.mode` is `auto` or `full`. Show it in one line: `Ceremony: {path} ({reasons joined by "; "})`.
|
|
63
|
+
|
|
53
64
|
Quick tasks can run mid-phase - validation only checks roadmap.md exists, not phase status.
|
|
54
65
|
|
|
55
66
|
**Circular optimization — ensure trace session active:**
|
|
@@ -90,6 +101,16 @@ Store `$QUICK_DIR` for use in orchestration.
|
|
|
90
101
|
|
|
91
102
|
**Step 5: Spawn planner (quick mode)**
|
|
92
103
|
|
|
104
|
+
**If `SIZING.path` is `lean`:** the engine writes the plan and no planner runs:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs size quick-plan --out "${QUICK_DIR}/${next_num}-plan.md" --num "${next_num}" "$DESCRIPTION"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Report `Plan written by the engine (lean path): ${QUICK_DIR}/${next_num}-plan.md` and go to Step 6.
|
|
111
|
+
|
|
112
|
+
**Otherwise**, spawn the planner:
|
|
113
|
+
|
|
93
114
|
**If `$FULL_MODE`:** Use `quick-full` mode with stricter constraints.
|
|
94
115
|
|
|
95
116
|
**If NOT `$FULL_MODE`:** Use standard `quick` mode.
|
|
@@ -168,6 +189,11 @@ Checker prompt:
|
|
|
168
189
|
**Scope:** This is a quick task, not a full phase. Skip checks that require a ROADMAP phase goal.
|
|
169
190
|
</verification_context>
|
|
170
191
|
|
|
192
|
+
<output_budget>
|
|
193
|
+
{Only when SIZING.mode is auto, include:}
|
|
194
|
+
Report the verdict and the blocking issues only: one line per issue (task, what is wrong, the fix), at most 200 words before the pan-verdict block. No summary of what passed.
|
|
195
|
+
</output_budget>
|
|
196
|
+
|
|
171
197
|
<check_dimensions>
|
|
172
198
|
- Requirement coverage: Does the plan address the task description?
|
|
173
199
|
- Task completeness: Do tasks have files, action, verify, done fields?
|
|
@@ -336,57 +362,22 @@ Store as `$VERIFICATION_STATUS`.
|
|
|
336
362
|
|
|
337
363
|
**Step 7: Update state.md**
|
|
338
364
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
**7a. Check if "Quick Tasks Completed" section exists:**
|
|
342
|
-
|
|
343
|
-
Read state.md and check for `### Quick Tasks Completed` section.
|
|
344
|
-
|
|
345
|
-
**7b. If section doesn't exist, create it:**
|
|
346
|
-
|
|
347
|
-
Insert after `### Blockers/Concerns` section:
|
|
365
|
+
Record the task through the engine. It creates the "### Quick Tasks Completed" table after "### Blockers/Concerns" when it is missing, numbers the row, and keeps an existing table's columns. Pass `description_cell` exactly as init returned it, never `$DESCRIPTION`: init escapes `|` and folds line breaks, and a raw `|` would split the row.
|
|
348
366
|
|
|
349
367
|
**If `$FULL_MODE`:**
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
| # | Description | Date | Commit | Status | Directory |
|
|
354
|
-
|---|-------------|------|--------|--------|-----------|
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**If NOT `$FULL_MODE`:**
|
|
358
|
-
```markdown
|
|
359
|
-
### Quick Tasks Completed
|
|
360
|
-
|
|
361
|
-
| # | Description | Date | Commit | Directory |
|
|
362
|
-
|---|-------------|------|--------|-----------|
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
**Note:** If the table already exists, match its existing column format. If adding `--full` to a project that already has quick tasks without a Status column, add the Status column to the header and separator rows, and leave Status empty for the new row's predecessors.
|
|
366
|
-
|
|
367
|
-
**7c. Append new row to table:**
|
|
368
|
-
|
|
369
|
-
Use `date` and `description_cell` from init. Write `description_cell` exactly as init returned it, never `$DESCRIPTION`: init escapes `|` and folds line breaks, and a raw `|` in a description would split the row into an extra column and break the table for every later read.
|
|
370
|
-
|
|
371
|
-
**If `$FULL_MODE` (or table has Status column):**
|
|
372
|
-
```markdown
|
|
373
|
-
| ${next_num} | ${description_cell} | ${date} | ${commit_hash} | ${VERIFICATION_STATUS} | [${next_num}-${slug}](./quick/${next_num}-${slug}/) |
|
|
368
|
+
```bash
|
|
369
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state quick-task --description "${description_cell}" --date "${date}" --commit "${commit_hash}" --status "${VERIFICATION_STATUS}" --directory "[${next_num}-${slug}](./quick/${next_num}-${slug}/)"
|
|
374
370
|
```
|
|
375
371
|
|
|
376
|
-
**If NOT `$FULL_MODE
|
|
377
|
-
```markdown
|
|
378
|
-
| ${next_num} | ${description_cell} | ${date} | ${commit_hash} | [${next_num}-${slug}](./quick/${next_num}-${slug}/) |
|
|
379
|
-
```
|
|
372
|
+
**If NOT `$FULL_MODE`:** the same without `--status`.
|
|
380
373
|
|
|
381
|
-
|
|
374
|
+
Then the activity line:
|
|
382
375
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
**Last Activity:** ${date}
|
|
386
|
-
**Last Activity Description:** Completed quick task ${next_num}: ${description_cell}
|
|
376
|
+
```bash
|
|
377
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state patch --"Last Activity" "${date}" --"Last Activity Description" "Completed quick task ${next_num}: ${description_cell}"
|
|
387
378
|
```
|
|
388
379
|
|
|
389
|
-
|
|
380
|
+
Never edit state.md with the Edit tool (under `hooks.guard: enforce` the guard denies it).
|
|
390
381
|
|
|
391
382
|
---
|
|
392
383
|
|