pan-wizard 3.35.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 +46 -52
- 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 +2 -3
- package/agents/pan-document_code.md +1 -2
- package/agents/pan-executor.md +25 -0
- package/agents/pan-hardener.md +4 -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 +80 -475
- package/agents/pan-plan-checker.md +40 -3
- package/agents/pan-planner.md +21 -7
- package/agents/pan-previewer.md +3 -2
- package/agents/pan-project-researcher.md +72 -493
- package/agents/pan-release.md +1 -1
- package/agents/pan-reviewer.md +14 -3
- package/agents/pan-roadmapper.md +12 -7
- package/agents/pan-verifier.md +9 -4
- 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/cost.md +21 -1
- 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/preview.md +1 -1
- 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 +41 -5
- package/pan-wizard-core/bin/lib/constants.cjs +27 -1
- package/pan-wizard-core/bin/lib/core.cjs +31 -14
- package/pan-wizard-core/bin/lib/cost.cjs +160 -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/doc-lint.cjs +5 -3
- package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
- package/pan-wizard-core/bin/lib/findings.cjs +148 -9
- package/pan-wizard-core/bin/lib/focus.cjs +1 -1
- package/pan-wizard-core/bin/lib/git.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 +268 -0
- 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-gate.cjs +15 -9
- package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
- package/pan-wizard-core/bin/lib/phase.cjs +85 -13
- package/pan-wizard-core/bin/lib/plan-lint.cjs +310 -0
- package/pan-wizard-core/bin/lib/preview.cjs +26 -4
- package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
- package/pan-wizard-core/bin/lib/research-lint.cjs +268 -0
- 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/roadmap.cjs +1 -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/test-gate.cjs +433 -0
- package/pan-wizard-core/bin/lib/uat.cjs +149 -0
- package/pan-wizard-core/bin/lib/usage.cjs +104 -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 +174 -0
- package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
- package/pan-wizard-core/bin/lib/verify-scope.cjs +143 -2
- package/pan-wizard-core/bin/lib/verify.cjs +86 -31
- package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
- package/pan-wizard-core/bin/pan-tools.cjs +257 -28
- package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
- package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
- package/pan-wizard-core/references/continuation-format.md +3 -3
- package/pan-wizard-core/references/design-methodology.md +1 -1
- package/pan-wizard-core/references/guardrails.md +1 -1
- package/pan-wizard-core/references/handoff-decisions.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 +10 -2
- package/pan-wizard-core/templates/debug.md +1 -0
- package/pan-wizard-core/templates/design.md +5 -4
- package/pan-wizard-core/templates/discovery.md +2 -2
- package/pan-wizard-core/templates/phase-prompt.md +7 -0
- package/pan-wizard-core/templates/requirements.md +9 -0
- package/pan-wizard-core/templates/research.md +10 -0
- package/pan-wizard-core/templates/summary-complex.md +5 -1
- package/pan-wizard-core/templates/summary-minimal.md +4 -0
- package/pan-wizard-core/templates/summary-standard.md +5 -1
- package/pan-wizard-core/templates/summary.md +8 -1
- 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 +79 -15
- package/pan-wizard-core/workflows/execute-plan.md +3 -1
- 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 +114 -77
- 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 +106 -45
- 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/remove-phase.md +11 -1
- 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 +33 -19
- 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 +39 -46
- package/scripts/build-agent-plugin.js +35 -15
- package/scripts/build-help.cjs +106 -0
- 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/mutation-probe.cjs +7 -80
- 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 +175 -6
- 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 -204
- package/pan-wizard-core/templates/research-project/features.md +0 -147
- package/pan-wizard-core/templates/research-project/pitfalls.md +0 -200
- package/pan-wizard-core/templates/research-project/stack.md +0 -120
- package/pan-wizard-core/templates/research-project/summary.md +0 -170
|
@@ -0,0 +1,2336 @@
|
|
|
1
|
+
# Feature Specification: PAN Focus Commands
|
|
2
|
+
|
|
3
|
+
**Feature:** Ship strategic project management as first-class PAN commands — scan, design, plan-work, exec-work, sync-docs
|
|
4
|
+
**Generated:** 2026-03-01
|
|
5
|
+
**Status:** Proposed
|
|
6
|
+
**ADR:** ADR-0006
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Phase 0: Problem Framing & Demand Validation
|
|
11
|
+
|
|
12
|
+
### 0.1 Problem Statement
|
|
13
|
+
|
|
14
|
+
PAN Wizard's shipped workflow is phase-scoped: plan phase 1, execute phase 1, plan phase 2, execute phase 2. But real development doesn't flow linearly. Between milestones, developers need to step back and ask strategic questions: "What should I work on next?", "What's the highest-impact thing I can do in 30 minutes?", "Is this feature worth building at all?", "Which of these 15 TODOs actually matters?". Today, PAN has no shipped answer — these capabilities exist only as custom `.claude/commands/` skills (superplan, execplan, featureAI, session-start/end, sync) that are invisible to users who install PAN via `npx pan-wizard`. The cost of NOT doing this: PAN users are limited to sequential phase execution with no strategic layer, while competitors like Taskmaster AI offer task-level prioritization, and Claude Code's plan mode provides lightweight planning — leaving PAN's most powerful capabilities locked behind custom skill files that don't ship.
|
|
15
|
+
|
|
16
|
+
### 0.2 Demand Evidence
|
|
17
|
+
|
|
18
|
+
| Evidence Type | Source | Finding |
|
|
19
|
+
|--------------|--------|---------|
|
|
20
|
+
| Internal usage | This project | superplan invoked 15 times, execplan ~16 sessions, featureAI 4 specs — these are the most-used custom skills |
|
|
21
|
+
| Competitor feature | Taskmaster AI (17k+ GitHub stars) | Ships task breakdown, prioritization (high/medium/low), dependency tracking, `next` command — same problem space |
|
|
22
|
+
| Competitor feature | Claude Code plan mode (2026) | Plan files saved to project, task lists with DAG dependencies, plansDirectory config — strategic planning built into the tool |
|
|
23
|
+
| Competitor feature | Cline plan/act modes | Separate models for planning vs execution — acknowledges planning is a distinct workflow |
|
|
24
|
+
| User pain | This conversation | User asked "what the equiv of superplan then" — realizing the gap between custom skills and shipped product |
|
|
25
|
+
|
|
26
|
+
### 0.3 Scope Definition
|
|
27
|
+
|
|
28
|
+
| In Scope | Out of Scope (and why) |
|
|
29
|
+
|----------|------------------------|
|
|
30
|
+
| 5 new shipped commands in `commands/pan/` group "Focus" | Separate `pan-focus` CLI tool (must integrate into PAN, not fork) |
|
|
31
|
+
| New `focus.cjs` core module for scan/design/plan/exec logic | Separate superplan file format — integrate into existing roadmap.md/plan.md |
|
|
32
|
+
| Full 10-phase featureAI investigation pipeline as focus-design | PanMonty status tracker (redundant with state.md) |
|
|
33
|
+
| Full 7-phase superplan pipeline as focus-scan (P0-P6, Reality Score, validation) | Memory bank files (.claude/memory/) — keep as dev-only |
|
|
34
|
+
| Full 6-stage execplan pipeline as focus-exec (all 9 rules, 4 modes, 3 tiers) | Separate task.json format (Taskmaster-style — PAN uses plan.md frontmatter) |
|
|
35
|
+
| Priority (P0-P6) and effort (XS-XL) fields in plan.md frontmatter | — |
|
|
36
|
+
| Codebase TODO/FIXME scanning, Reality Score formula, capacity budgeting | — |
|
|
37
|
+
| Doc sync automation (focus-sync), all 4 execution modes | — |
|
|
38
|
+
| Integration with existing phase workflow | — |
|
|
39
|
+
|
|
40
|
+
### 0.4 Success Criteria
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
SC-1: User can run `/pan:focus-scan` to get a prioritized list of work items from codebase + planning files
|
|
44
|
+
SC-2: User can run `/pan:focus-design <topic>` to produce a spec + ADR before building
|
|
45
|
+
SC-3: User can run `/pan:focus-plan` to create a capacity-budgeted batch of work items
|
|
46
|
+
SC-4: User can run `/pan:focus-exec` to execute a planned batch with tier-based shortcuts
|
|
47
|
+
SC-5: User can run `/pan:focus-sync` to synchronize docs after changes
|
|
48
|
+
SC-6: All 5 commands work across Claude Code, OpenCode, Gemini CLI, Codex, Copilot CLI
|
|
49
|
+
SC-7: No regression in existing 802+ tests
|
|
50
|
+
SC-8: New commands integrate with existing phase commands (not a parallel system)
|
|
51
|
+
SC-9: Focus commands respect existing config.json settings
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 0.5 User Stories
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
As a developer using PAN Wizard (on any runtime — Claude Code, OpenCode, Gemini CLI, Codex, or Copilot CLI),
|
|
58
|
+
I want to scan my project for the most important work,
|
|
59
|
+
so that I can focus on high-impact items, instead of manually reading roadmap.md and grepping for TODOs.
|
|
60
|
+
|
|
61
|
+
As a developer starting a new feature, I want to design it with competitive research and architecture review,
|
|
62
|
+
so that I build the right thing the right way, instead of coding first and regretting the design later.
|
|
63
|
+
|
|
64
|
+
As a developer with limited time, I want to plan a work batch that fits my session budget,
|
|
65
|
+
so that I complete meaningful work in each sitting, instead of starting things I can't finish.
|
|
66
|
+
|
|
67
|
+
As a developer finishing a batch, I want docs auto-synced after my changes,
|
|
68
|
+
so that README/CHANGELOG/docs stay accurate, instead of forgetting to update them.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 0.6 Cannibalization Check
|
|
72
|
+
|
|
73
|
+
| Existing Command/Agent | Overlap? | Impact |
|
|
74
|
+
|-----------------------|----------|--------|
|
|
75
|
+
| `/pan:progress` | Partial | focus-scan is a superset — progress shows status, scan adds prioritized action items. Keep both: progress for quick status, scan for strategic planning. |
|
|
76
|
+
| `/pan:plan-phase` | Partial | focus-plan creates cross-cutting work batches that may span phases. plan-phase creates single-phase plans. Complementary. |
|
|
77
|
+
| `/pan:exec-phase` | Partial | focus-exec runs batched items with tier shortcuts. exec-phase runs full wave-based phase execution. focus-exec can delegate to exec-phase for L/XL items. |
|
|
78
|
+
| `/pan:discuss-phase` | Partial | focus-design is feature-level (competitive research, ADR, spec). discuss-phase is phase-level (vision capture). Different scope. |
|
|
79
|
+
| `/pan:health` | None | Health checks .planning/ structure. Scan checks work items. |
|
|
80
|
+
| `pan-project-researcher` | Partial | focus-design uses competitive research. Agent does domain research. Different inputs. |
|
|
81
|
+
|
|
82
|
+
**No full overlap found.** All Focus commands fill genuine gaps.
|
|
83
|
+
|
|
84
|
+
### 0.7 Cognitive Load Assessment
|
|
85
|
+
|
|
86
|
+
| Metric | Before | After | Delta |
|
|
87
|
+
|--------|--------|-------|-------|
|
|
88
|
+
| Commands a new user must learn | 32 | 37 | +5 |
|
|
89
|
+
| New concepts introduced | 0 | 3 (priority tiers, effort sizing, capacity budgets) | +3 |
|
|
90
|
+
| Score | -- | -- | +1 (adds complexity) |
|
|
91
|
+
|
|
92
|
+
**Justification:** The +5 commands are grouped under "Focus" — a single new group name. The 3 concepts (priority, effort, budget) are optional metadata on existing plan.md files, not new file types. Users can ignore Focus commands entirely and use the existing phase workflow. Focus is additive, not disruptive.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Phase 1: Internal Reconnaissance
|
|
97
|
+
|
|
98
|
+
### 1.1 Existing Capabilities Inventory
|
|
99
|
+
|
|
100
|
+
| Capability | Status | Location | Relevance |
|
|
101
|
+
|------------|--------|----------|-----------|
|
|
102
|
+
| Phase lifecycle (plan/execute/verify) | Shipped | phase.cjs, init.cjs | Foundation — Focus extends, doesn't replace |
|
|
103
|
+
| State management (state.md) | Shipped | state.cjs | Focus reads/writes state.md for tracking |
|
|
104
|
+
| Plan tier classification (MICRO/STANDARD/FULL) | Shipped | phase.cjs:classifyPlanTier() | Core of focus-exec tier shortcuts |
|
|
105
|
+
| Effort-to-points conversion | Shipped | init.cjs:effortToPoints() | Capacity budgeting already has point system |
|
|
106
|
+
| Budget tracking (--budget, --dry-run) | Shipped | init.cjs execute-phase | Foundation for focus-plan budgeting |
|
|
107
|
+
| Error pattern learning | Shipped | commands.cjs:readErrorPatterns/appendErrorPattern | Focus-scan surfaces patterns |
|
|
108
|
+
| Session history | Shipped | commands.cjs:appendSessionSummary | Focus-exec records sessions |
|
|
109
|
+
| Rollback snapshots | Shipped | commands.cjs:cmdRollbackSnapshot | Focus-exec uses git tags |
|
|
110
|
+
| Commit safety (--type, --force) | Shipped | commands.cjs:cmdCommit | Focus-sync commits cleanly |
|
|
111
|
+
| Test skip detection | Shipped | commands.cjs:shouldSkipTests | Focus-exec MICRO tier skips |
|
|
112
|
+
| Health composite score | Shipped | commands.cjs:renderHealthReport | Focus-scan includes health |
|
|
113
|
+
| Todo scanning | Shipped | core.cjs:scanPendingTodos | Focus-scan includes todos |
|
|
114
|
+
| Frontmatter extraction | Shipped | frontmatter.cjs | Focus reads priority/effort from plan.md |
|
|
115
|
+
| Config sections (budget, commit, execution) | Shipped | core.cjs:loadConfig | Focus commands respect config |
|
|
116
|
+
|
|
117
|
+
### 1.2 Convention Enforcement Checklist
|
|
118
|
+
|
|
119
|
+
- [x] Functions named `cmd<Module><Action>(cwd, raw, ...args)` — new module: `cmdFocusScan`, `cmdFocusPlan`, etc.
|
|
120
|
+
- [x] File reads use `safeReadFile()` pattern
|
|
121
|
+
- [x] File writes wrapped in try-catch
|
|
122
|
+
- [x] JSON output via `output(data, raw, humanLabel)`
|
|
123
|
+
- [x] Errors via `error(message)`
|
|
124
|
+
- [x] Paths via `toPosix()`
|
|
125
|
+
- [x] Module exports at bottom
|
|
126
|
+
- [x] Subcommands via `switch` in `pan-tools.cjs`
|
|
127
|
+
- [x] CommonJS only (`.cjs`)
|
|
128
|
+
- [x] Zero runtime dependencies
|
|
129
|
+
|
|
130
|
+
### 1.3 Dependency & Integration Map
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
[Focus Commands]
|
|
134
|
+
├── depends on: core.cjs (output, error, safeReadFile, scanPendingTodos)
|
|
135
|
+
├── depends on: phase.cjs (classifyPlanTier, findPhaseInternal)
|
|
136
|
+
├── depends on: init.cjs (effortToPoints)
|
|
137
|
+
├── depends on: frontmatter.cjs (extractFrontmatter)
|
|
138
|
+
├── depends on: state.cjs (readStateSafe)
|
|
139
|
+
├── depends on: commands.cjs (readErrorPatterns, renderHealthReport)
|
|
140
|
+
├── depends on: roadmap.cjs (parseRoadmap)
|
|
141
|
+
├── depends on: constants.cjs (all path constants)
|
|
142
|
+
├── depends on: utils.cjs (planningPath, classifyPhaseStatus)
|
|
143
|
+
├── extends: progress (scan is superset)
|
|
144
|
+
├── extends: exec-phase (exec adds tier shortcuts + budgeting)
|
|
145
|
+
├── conflicts with: nothing
|
|
146
|
+
└── enables: future execution modes, pattern auto-remediation
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**require() chain (no cycles):**
|
|
150
|
+
```
|
|
151
|
+
pan-tools.cjs → focus.cjs → core.cjs → constants.cjs
|
|
152
|
+
→ phase.cjs → utils.cjs
|
|
153
|
+
→ init.cjs
|
|
154
|
+
→ frontmatter.cjs
|
|
155
|
+
→ state.cjs
|
|
156
|
+
→ commands.cjs
|
|
157
|
+
→ roadmap.cjs
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Phase 2: Competitive Intelligence
|
|
163
|
+
|
|
164
|
+
### 2.1 Tool Research
|
|
165
|
+
|
|
166
|
+
**Taskmaster AI (claude-task-master)**
|
|
167
|
+
- **UX:** CLI (`task-master init/list/next/expand/update`) + MCP server for IDE integration
|
|
168
|
+
- **Behavior:** PRD → tasks.json with dependencies, priority (high/medium/low), test strategies. `next` command factors priority + dependency count. `expand` breaks tasks into subtasks.
|
|
169
|
+
- **Ergonomics:** Simple three-tier priority. JSON task storage. Clean `next` routing.
|
|
170
|
+
- **Pitfalls:** No verification step. No rollback. No cross-session learning. Tasks are flat JSON — no phase hierarchy.
|
|
171
|
+
- **Evolution:** Started as Cursor-specific, expanded to multi-IDE via MCP.
|
|
172
|
+
|
|
173
|
+
**Claude Code Plan Mode**
|
|
174
|
+
- **UX:** Shift+Tab×2 toggles plan mode. Task lists via Ctrl+T. Plans saved to `plansDirectory`.
|
|
175
|
+
- **Behavior:** Read-only analysis → structured task list with DAG dependencies → switch to auto-accept → execute. Plans persist across context compaction.
|
|
176
|
+
- **Ergonomics:** Seamless plan→execute transition. Tasks survive /clear. Stop hooks for auto-testing.
|
|
177
|
+
- **Pitfalls:** No priority framework. No capacity budgeting. No competitive research. Plan files are informal markdown.
|
|
178
|
+
- **Evolution:** Added plansDirectory config, task DAG support, stop hooks in 2026.
|
|
179
|
+
|
|
180
|
+
**Cline Plan/Act Modes**
|
|
181
|
+
- **UX:** Toggle between Plan (restricted tools, strategic thinking) and Act (full tools, execution).
|
|
182
|
+
- **Behavior:** Separate model configs per mode — reasoning model for planning, fast model for execution.
|
|
183
|
+
- **Ergonomics:** Clean separation of concerns. Different models optimize cost.
|
|
184
|
+
- **Pitfalls:** No persistence across sessions. No task tracking. Manual mode switching.
|
|
185
|
+
|
|
186
|
+
**Aider**
|
|
187
|
+
- **UX:** CLI chat with `/run`, `/architect`, `/ask` modes.
|
|
188
|
+
- **Behavior:** Architect mode uses reasoning model for design, then coder model implements. Git auto-commit after each change.
|
|
189
|
+
- **Ergonomics:** Excellent git integration. Auto-commit is loved/hated.
|
|
190
|
+
- **Pitfalls:** No project-level planning. No task management. File-level, not feature-level.
|
|
191
|
+
|
|
192
|
+
**Windsurf/Cursor**
|
|
193
|
+
- **UX:** IDE-integrated AI with multi-file editing.
|
|
194
|
+
- **Behavior:** Cascade flows (Windsurf) / Composer (Cursor) for multi-step operations.
|
|
195
|
+
- **Ergonomics:** Great for implementation. Poor for strategic planning.
|
|
196
|
+
- **Pitfalls:** IDE-locked. No CLI workflow. No cross-session persistence.
|
|
197
|
+
|
|
198
|
+
**GitHub Copilot Workspace**
|
|
199
|
+
- **UX:** Issue → plan → implement → PR. Web-based.
|
|
200
|
+
- **Behavior:** Structured plan-execute-verify. Task decomposition from issues.
|
|
201
|
+
- **Ergonomics:** End-to-end from issue to PR. Clear verification.
|
|
202
|
+
- **Pitfalls:** GitHub-locked. Web-only. No local/CLI workflow. Slow iteration.
|
|
203
|
+
|
|
204
|
+
### 2.2 Competitive Matrix
|
|
205
|
+
|
|
206
|
+
| Aspect | PAN (Current) | PAN+Focus | Taskmaster AI | Claude Code | Cline | Aider |
|
|
207
|
+
|--------|--------------|-----------|---------------|-------------|-------|-------|
|
|
208
|
+
| **Planning depth** | Phase-level | Phase + cross-cutting strategy | Task-level (flat) | Informal markdown | Mode toggle | File-level |
|
|
209
|
+
| **Prioritization** | None | P0-P6 + effort sizing | High/Med/Low | None | None | None |
|
|
210
|
+
| **Capacity budgeting** | Partial (--budget) | Full (points + modes) | None | None | None | None |
|
|
211
|
+
| **Execution automation** | Wave-based phases | Tier-based shortcuts + batches | Manual per-task | Auto-accept mode | Act mode | Auto-commit |
|
|
212
|
+
| **Session persistence** | state.md + pause/resume | + session history + patterns | tasks.json | Plan files | None | Git only |
|
|
213
|
+
| **Verification** | UAT (verify-phase) | + scan verification | Test strategy field | Stop hooks | None | None |
|
|
214
|
+
| **Feature design** | discuss-phase | + competitive research + ADR | None | Plan mode (informal) | Plan mode | Architect mode |
|
|
215
|
+
| **Cross-platform** | 5 runtimes | 5 runtimes | MCP + CLI | Claude only | VS Code | CLI |
|
|
216
|
+
| **Doc sync** | Manual | Automated focus-sync | None | None | None | None |
|
|
217
|
+
|
|
218
|
+
### 2.3 Key Insight
|
|
219
|
+
|
|
220
|
+
**No tool combines all three layers:** (1) strategic prioritization, (2) capacity-budgeted execution, (3) cross-session learning. Taskmaster has (1) without (2,3). Claude Code has lightweight (2) without (1,3). PAN+Focus would be the first to ship all three as an integrated system.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Phase 3: Strategic Analysis
|
|
225
|
+
|
|
226
|
+
### 3.1 Blue Ocean Four Actions Framework
|
|
227
|
+
|
|
228
|
+
| Action | Question | Decisions |
|
|
229
|
+
|--------|----------|-----------|
|
|
230
|
+
| **ELIMINATE** | What should we drop from the custom skills? | PanMonty status tracker (redundant with state.md), separate memory bank files (.claude/memory/), PAN-Wizard-specific references (test counts, module names) |
|
|
231
|
+
| **REDUCE** | What should be reduced? | Installation friction (ship as commands, not custom skills). Project-specific hardcoding (generalize for any project). |
|
|
232
|
+
| **RAISE** | What should be enhanced? | Integration with existing phase workflow. Config respect. Cross-session pattern learning. Full pipeline rigor (ALL phases preserved, no shortcuts). |
|
|
233
|
+
| **CREATE** | What should we create that nobody has? | Unified scan→design→plan→exec→sync pipeline as shipped commands. Full 10-phase investigation pipeline (no competitor has this depth). Full 7-phase strategic scanning with Reality Score market-fit filtering. Full 6-stage execution with 9 mandatory behavioral rules and 4 execution modes. |
|
|
234
|
+
|
|
235
|
+
### 3.2 Wardley Evolution Assessment
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
Genesis ──── Custom-Built ──── Product ──── Commodity
|
|
239
|
+
↑ ↑
|
|
240
|
+
Taskmaster AI PAN Focus
|
|
241
|
+
(early product) (targeting)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Strategic planning for AI coding is moving from Genesis (every team builds custom) to Custom-Built (Taskmaster, Claude Code plan mode). PAN Focus targets the Product stage — integrated, consistent, cross-platform.
|
|
245
|
+
|
|
246
|
+
### 3.3 Strategic Moat Analysis
|
|
247
|
+
|
|
248
|
+
| Moat Type | Contribution | Score (0-5) |
|
|
249
|
+
|-----------|-------------|-------------|
|
|
250
|
+
| **Context Engineering** | Focus commands create rich, structured context for AI agents via prioritized work items, design specs, and pattern learning | 5 |
|
|
251
|
+
| **Cross-Platform** | Works across 5 runtimes — Taskmaster is MCP-dependent, Claude Code is Claude-only | 5 |
|
|
252
|
+
| **Developer Experience** | Unified pipeline: scan→design→plan→exec→sync — no other tool has this end-to-end | 4 |
|
|
253
|
+
| **Zero Dependencies** | Maintains zero-runtime-deps — Taskmaster requires API keys and network | 5 |
|
|
254
|
+
| **State Persistence** | Builds on state.md + patterns.md + session-history.md across sessions | 4 |
|
|
255
|
+
| **Verification Quality** | Tier-based verification with rollback snapshots — more rigorous than any competitor | 4 |
|
|
256
|
+
| **Total** | | **27/30** |
|
|
257
|
+
|
|
258
|
+
### 3.4 Strategic Recommendation
|
|
259
|
+
|
|
260
|
+
**Build.** Ship 5 Focus commands that bring the FULL superplan/execplan/featureAI/sync pipelines into PAN as first-class shipped commands. No shortcuts, no streamlining — the complete 10-phase featureAI investigation, complete 7-phase superplan scanning with Reality Score formula, complete 6-stage execplan with all 9 behavioral rules and 4 execution modes. The unique angle is **uncompromised pipeline depth with cross-session learning** — no competitor comes close to this rigor. Taskmaster has flat task prioritization without execution automation. Claude Code plan mode has informal markdown without verification. Cline separates plan/act without persistence. PAN Focus ships the entire proven methodology (16 sessions, 802+ tests) as commands any user can invoke. We explicitly do NOT copy Taskmaster's flat task JSON model (PAN's phase hierarchy is better) or Claude Code's informal plan files (PAN's structured plan.md frontmatter is better).
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Phase 3.5: Architecture & Implementation Assessment
|
|
265
|
+
|
|
266
|
+
### 3.5.1 Feature Type Classification
|
|
267
|
+
|
|
268
|
+
| Component | Type | Template |
|
|
269
|
+
|-----------|------|----------|
|
|
270
|
+
| `focus.cjs` | New Core Module | New lib module with cmd* functions |
|
|
271
|
+
| `pan-tools.cjs` changes | Core Enhancement | New `focus` top-level command with subcommands |
|
|
272
|
+
| 5 command .md files | New Workflows | New `.md` in `commands/pan/` |
|
|
273
|
+
| frontmatter.cjs extension | Core Enhancement | Add `priority` and `effort` field validation |
|
|
274
|
+
| help.md update | Core Enhancement | Add "Focus" group |
|
|
275
|
+
| Installer update | Installer | Register Focus group in help |
|
|
276
|
+
|
|
277
|
+
### 3.5.2 Layer Violation Check
|
|
278
|
+
|
|
279
|
+
- [x] Command .md files invoke pan-tools CLI, not lib modules directly
|
|
280
|
+
- [x] focus.cjs returns data objects, does not import agent .md files
|
|
281
|
+
- [x] output() only called from cmd* entry points
|
|
282
|
+
- [x] No upward dependencies (focus.cjs → core.cjs, never core.cjs → focus.cjs)
|
|
283
|
+
|
|
284
|
+
### 3.5.3 Output Contract Design
|
|
285
|
+
|
|
286
|
+
**focus scan:**
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"health": { "grade": "B", "composite": 72 },
|
|
290
|
+
"items": [
|
|
291
|
+
{
|
|
292
|
+
"id": "P0-1",
|
|
293
|
+
"title": "Fix crash in state cmd",
|
|
294
|
+
"priority": "P0",
|
|
295
|
+
"effort": "S",
|
|
296
|
+
"points": 2,
|
|
297
|
+
"source": "codebase-todo",
|
|
298
|
+
"file": ".planning/phases/01-setup/01-01-plan.md",
|
|
299
|
+
"line": 42
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"summary": {
|
|
303
|
+
"total": 15,
|
|
304
|
+
"by_priority": { "P0": 1, "P1": 2, "P2": 3, "P3": 5, "P4": 4 },
|
|
305
|
+
"total_points": 48,
|
|
306
|
+
"patterns_count": 3,
|
|
307
|
+
"todos_count": 5
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**focus plan:**
|
|
313
|
+
```json
|
|
314
|
+
{
|
|
315
|
+
"batch": [
|
|
316
|
+
{ "id": "P0-1", "title": "...", "priority": "P0", "effort": "S", "points": 2, "tier": "micro" }
|
|
317
|
+
],
|
|
318
|
+
"budget": { "allocated": 42, "limit": 50, "remaining": 8 },
|
|
319
|
+
"batch_file": ".planning/focus/batch-2026-03-01.md"
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**focus exec:**
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"results": [
|
|
327
|
+
{ "id": "P0-1", "title": "...", "status": "completed", "tests_before": 802, "tests_after": 805 }
|
|
328
|
+
],
|
|
329
|
+
"summary": {
|
|
330
|
+
"completed": 8,
|
|
331
|
+
"failed": 1,
|
|
332
|
+
"skipped": 0,
|
|
333
|
+
"points_used": 38,
|
|
334
|
+
"tests_before": 802,
|
|
335
|
+
"tests_after": 825
|
|
336
|
+
},
|
|
337
|
+
"rollback_tag": "pan-focus-20260301T143022"
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**focus design:**
|
|
342
|
+
```json
|
|
343
|
+
{
|
|
344
|
+
"spec_file": "docs/specs/dark_mode_featureai.md",
|
|
345
|
+
"adr_file": "docs/decisions/ADR-0007-dark-mode.md",
|
|
346
|
+
"mode": "full",
|
|
347
|
+
"phases_run": [0, 1, 2, 3, 3.5, 4, 5, 6, 7, 8, 9, 10],
|
|
348
|
+
"phases_skipped": [],
|
|
349
|
+
"tasks": [
|
|
350
|
+
{ "title": "Add theme context provider", "effort": "M", "priority": "P3", "files": ["src/theme.ts"] }
|
|
351
|
+
],
|
|
352
|
+
"feature_ladder": {
|
|
353
|
+
"v0": "Basic toggle, 2 themes",
|
|
354
|
+
"v1": "System preference detection, transition animations",
|
|
355
|
+
"v2": "Custom theme builder"
|
|
356
|
+
},
|
|
357
|
+
"strategic_summary": {
|
|
358
|
+
"moat_score": "22/30",
|
|
359
|
+
"cognitive_load": "+1",
|
|
360
|
+
"recommendation": "Build"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**focus sync:**
|
|
366
|
+
```json
|
|
367
|
+
{
|
|
368
|
+
"updated": ["README.md", "CHANGELOG.md", "docs/USER-GUIDE.md"],
|
|
369
|
+
"skipped": ["docs/ARCHITECTURE.md"],
|
|
370
|
+
"changes_summary": "Updated command count 32→37, added Focus group to help"
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### 3.5.4 State Transition Modeling
|
|
375
|
+
|
|
376
|
+
| Current State | Action | New State | Error If Invalid |
|
|
377
|
+
|--------------|--------|-----------|-----------------|
|
|
378
|
+
| No .planning/ | focus-scan | Error | `{"error": ".planning/ not found", "hint": "Run /pan:new-project"}` |
|
|
379
|
+
| Has roadmap.md + phases | focus-scan | Returns prioritized items | — |
|
|
380
|
+
| Items scanned | focus-plan | Creates batch file in .planning/focus/ | — |
|
|
381
|
+
| Batch planned | focus-exec | Executes batch, updates state.md | — |
|
|
382
|
+
| No batch file | focus-exec | Error | `{"error": "No batch found", "hint": "Run /pan:focus-plan first"}` |
|
|
383
|
+
| Changes made | focus-sync | Updates docs, returns list | — |
|
|
384
|
+
| No changes | focus-sync | Returns empty list | — |
|
|
385
|
+
| Any state | focus-design | Creates spec + ADR | — |
|
|
386
|
+
|
|
387
|
+
### 3.5.5 Breaking Change Assessment
|
|
388
|
+
|
|
389
|
+
| Question | Answer |
|
|
390
|
+
|----------|--------|
|
|
391
|
+
| Changes existing command JSON output? | No |
|
|
392
|
+
| Changes file formats? | Yes — adds optional `priority:` and `effort:` to plan.md frontmatter (backward-compatible, both optional) |
|
|
393
|
+
| Changes directory structure? | Yes — adds `.planning/focus/` for batch files |
|
|
394
|
+
| Changes installer output? | Yes — 5 new command .md files installed, help.md updated with Focus group |
|
|
395
|
+
|
|
396
|
+
**Migration:** All changes are additive. Existing plan.md files without priority/effort fields work unchanged — defaults apply (priority: P3, effort: M).
|
|
397
|
+
|
|
398
|
+
### 3.5.6 Composability Analysis
|
|
399
|
+
|
|
400
|
+
| Interaction | Works? | How |
|
|
401
|
+
|-------------|--------|-----|
|
|
402
|
+
| focus-scan output feeds focus-plan | Yes | Scan produces items, plan budgets them |
|
|
403
|
+
| focus-plan output feeds focus-exec | Yes | Plan creates batch file, exec reads it |
|
|
404
|
+
| focus-exec delegates to exec-phase | Yes | For L/XL items, exec can invoke exec-phase workflow |
|
|
405
|
+
| focus-design feeds plan-phase | Yes | Design outputs tasks compatible with plan.md format |
|
|
406
|
+
| focus-sync called from agents | Yes | Agent can invoke `pan-tools focus sync` |
|
|
407
|
+
| All work in --raw mode | Yes | Raw mode shows human-readable summary |
|
|
408
|
+
|
|
409
|
+
### 3.5.7 Performance Budget
|
|
410
|
+
|
|
411
|
+
| Operation | Cost | Notes |
|
|
412
|
+
|-----------|------|-------|
|
|
413
|
+
| focus-scan: read ROADMAP + phases + todos + patterns | ~50ms | 10-20 file reads |
|
|
414
|
+
| focus-scan: grep codebase for TODO/FIXME | ~200ms | ripgrep or manual fs scan |
|
|
415
|
+
| focus-plan: read scan results + compute budget | ~20ms | Arithmetic only |
|
|
416
|
+
| focus-exec: per-item execution | Variable | Delegates to AI agent |
|
|
417
|
+
| focus-sync: read changed files + update docs | ~50ms | 5-10 file reads/writes |
|
|
418
|
+
| **Total (scan + plan)** | **< 300ms** | Within budget |
|
|
419
|
+
|
|
420
|
+
### 3.5.8 Cross-Platform Considerations
|
|
421
|
+
|
|
422
|
+
| Platform | Consideration |
|
|
423
|
+
|----------|---------------|
|
|
424
|
+
| Windows | toPosix() on all paths in JSON output. CRLF in markdown files handled by safeReadFile. |
|
|
425
|
+
| Mac/Linux | Case-sensitive filenames for batch files. |
|
|
426
|
+
| All runtimes | Command .md files use runtime-agnostic pan-tools CLI invocations. |
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## Phase 4: Design Synthesis
|
|
431
|
+
|
|
432
|
+
### 4.1 Guide-Level Explanation
|
|
433
|
+
|
|
434
|
+
#### PAN Focus — Strategic Project Management
|
|
435
|
+
|
|
436
|
+
Focus commands help you decide **what** to work on, not just **how**. While PAN's phase commands (`plan-phase`, `exec-phase`) handle the mechanics of building, Focus commands handle the strategy of choosing.
|
|
437
|
+
|
|
438
|
+
**The Focus Pipeline:**
|
|
439
|
+
|
|
440
|
+
```
|
|
441
|
+
/pan:focus-scan → "What needs doing?" (prioritized work items)
|
|
442
|
+
/pan:focus-design → "How should we build it?" (spec + ADR)
|
|
443
|
+
/pan:focus-plan → "What fits in this session?" (capacity-budgeted batch)
|
|
444
|
+
/pan:focus-exec → "Build it with tier-based shortcuts" (MICRO/STANDARD/FULL)
|
|
445
|
+
/pan:focus-sync → "Update the docs" (auto-sync README, CHANGELOG, etc.)
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
**Example 1: Quick morning session**
|
|
449
|
+
```
|
|
450
|
+
/pan:focus-scan # See what's most important
|
|
451
|
+
/pan:focus-plan --budget 20 # Plan 20 points of work (XS + S items)
|
|
452
|
+
/pan:focus-exec # Execute with MICRO tier shortcuts
|
|
453
|
+
/pan:focus-sync # Update docs
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**Example 2: Feature design before building**
|
|
457
|
+
```
|
|
458
|
+
/pan:focus-design "dark mode" # Research, design, produce spec + ADR
|
|
459
|
+
/pan:focus-plan # Plan the v0 (MVP) tasks from the spec
|
|
460
|
+
/pan:focus-exec # Build it
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**Example 3: Stability sprint**
|
|
464
|
+
```
|
|
465
|
+
/pan:focus-scan --priority P0-P2 # Show only crash/correctness/coverage items
|
|
466
|
+
/pan:focus-plan --budget 40 # Fill session with fixes
|
|
467
|
+
/pan:focus-exec # Execute with full test verification
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
**How Focus works with existing commands:**
|
|
471
|
+
|
|
472
|
+
Focus commands are additive. You can still use `/pan:plan-phase` and `/pan:exec-phase` for phase-by-phase work. Focus adds the strategic layer on top:
|
|
473
|
+
|
|
474
|
+
- `focus-scan` is the full superplan pipeline (7 phases: orientation, priority classification, strategic context, Reality Score, item collection, effort estimation, plan assembly + validation) shipped as a command
|
|
475
|
+
- `focus-plan` creates a capacity-budgeted work batch with 4 execution modes (bugfix/balanced/features/full)
|
|
476
|
+
- `focus-exec` is the full execplan pipeline (6 stages: session start, plan loading + budgeting, tier-based execution with 9 mandatory rules, verification, doc sync, session end)
|
|
477
|
+
- `focus-design` is the full featureAI investigation pipeline (10 phases: problem validation, internal recon, competitive intelligence, strategic analysis, architecture assessment, design synthesis, ADR, error handling, security, implementation roadmap + test plan)
|
|
478
|
+
- `focus-sync` automates the doc update step that's easy to forget
|
|
479
|
+
|
|
480
|
+
**What Focus does NOT do:**
|
|
481
|
+
- It does not replace phase planning — phases remain the organizational unit
|
|
482
|
+
- It does not require priority/effort fields — they're optional with sensible defaults
|
|
483
|
+
- It does not create a separate task system — it reads existing plan.md, TODO, and codebase TODOs
|
|
484
|
+
|
|
485
|
+
### 4.2 Reference-Level Explanation
|
|
486
|
+
|
|
487
|
+
#### 4.2.1 Command Interface
|
|
488
|
+
|
|
489
|
+
**focus scan** — Full 7-phase strategic work scan with prioritization and Reality Score
|
|
490
|
+
```
|
|
491
|
+
pan-tools focus scan [--priority P0-P6] [--effort XS-XL] [--source todos|plans|codebase] [--focus <area>] [--quick] [--refresh] [--lean]
|
|
492
|
+
Output: { health, items[], summary, reality_scores[], scan_file }
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**focus plan** — Create a capacity-budgeted work batch
|
|
496
|
+
```
|
|
497
|
+
pan-tools focus plan [--budget N] [--mode bugfix|balanced|features|full] [--priority P0-P6] [--lean]
|
|
498
|
+
Output: { batch[], budget, batch_file }
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**focus exec** — Full 6-stage execution pipeline with 9 mandatory rules, 4 modes, 3 tiers
|
|
502
|
+
```
|
|
503
|
+
pan-tools focus exec [--budget N] [--mode bugfix|balanced|features|full] [--priority P0-P6] [--dry-run] [--no-commit] [--continue]
|
|
504
|
+
Output: { results[], summary, rollback_tag, verification_report }
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
**focus design** — Strategic feature investigation, design & specification (4 modes)
|
|
508
|
+
```
|
|
509
|
+
pan-tools focus design <topic> [--full|--internal|--outward|--spike] [--gate] [--audit] [--mvp]
|
|
510
|
+
Output: { spec_file, adr_file, tasks[], feature_ladder, mode, phases_run }
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
**focus sync** — Synchronize documentation after changes
|
|
514
|
+
```
|
|
515
|
+
pan-tools focus sync [--check-only]
|
|
516
|
+
Output: { updated[], skipped[], changes_summary }
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
#### 4.2.2 State Changes & Filesystem Scope
|
|
520
|
+
|
|
521
|
+
```
|
|
522
|
+
Reads from:
|
|
523
|
+
.planning/roadmap.md, state.md, config.json
|
|
524
|
+
.planning/phases/*/ (plan.md frontmatter for priority/effort)
|
|
525
|
+
.planning/todos/pending/
|
|
526
|
+
.planning/patterns.md
|
|
527
|
+
.planning/focus/ (batch files)
|
|
528
|
+
Source files (for TODO/FIXME grep)
|
|
529
|
+
|
|
530
|
+
Writes to:
|
|
531
|
+
.planning/focus/batch-YYYY-MM-DD.md (focus-plan output)
|
|
532
|
+
.planning/state.md (session recording)
|
|
533
|
+
.planning/patterns.md (error pattern learning)
|
|
534
|
+
docs/specs/*.md (focus-design output)
|
|
535
|
+
docs/decisions/*.md (focus-design ADR output)
|
|
536
|
+
|
|
537
|
+
Side effects:
|
|
538
|
+
git tag (rollback snapshots in focus-exec)
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
#### 4.2.3 Error Handling
|
|
542
|
+
|
|
543
|
+
| Condition | JSON Output | Error Style |
|
|
544
|
+
|-----------|-------------|-------------|
|
|
545
|
+
| No .planning/ directory | `{"error": ".planning/ not found", "hint": "Run /pan:new-project to initialize"}` | safeReadFile returns null |
|
|
546
|
+
| No roadmap.md | `{"error": "roadmap.md not found", "hint": "Run /pan:new-project to create roadmap"}` | safeReadFile returns null |
|
|
547
|
+
| No batch file for exec | `{"error": "No batch found", "hint": "Run /pan:focus-plan first"}` | Check .planning/focus/ |
|
|
548
|
+
| Budget exceeded | `{"error": "Budget N exceeded by M points"}` | Arithmetic check |
|
|
549
|
+
| Invalid priority | `{"error": "Invalid priority 'P7' — valid: P0-P6"}` | Arg validation |
|
|
550
|
+
| Write failure | `{"error": "Failed to write batch file: <reason>"}` | try-catch on writeFileSync |
|
|
551
|
+
|
|
552
|
+
### 4.3 Design Decisions
|
|
553
|
+
|
|
554
|
+
| Decision | Adopted From | Rationale | What We Did NOT Copy |
|
|
555
|
+
|----------|-------------|-----------|---------------------|
|
|
556
|
+
| P0-P6 priority framework | SuperPlan custom skill | 7 tiers is granular enough without being overwhelming | Taskmaster's high/med/low (too coarse — P0 crash vs P1 wrong results matter) |
|
|
557
|
+
| Points-based capacity budgeting | ExecPlan custom skill | XS=1 through XL=20 maps to real session capacity | Claude Code task lists (no budgeting at all) |
|
|
558
|
+
| Tier-based execution shortcuts | PanMonty custom skill | MICRO/STANDARD/FULL saves time on small items | Aider auto-commit (too aggressive, no verification) |
|
|
559
|
+
| Full 10-phase investigation pipeline | FeatureAI custom skill | Ship the complete pipeline — demand validation, competitive intelligence, strategic analysis, architecture assessment, design synthesis, ADR, error handling, security, implementation roadmap, test plan, output | Taskmaster's no-design approach (ships tasks without investigation) |
|
|
560
|
+
| Batch files in .planning/focus/ | Original | Keeps focus artifacts alongside phase artifacts | Taskmaster's tasks.json (separate system from phases) |
|
|
561
|
+
| Optional priority/effort fields | Original | Zero migration cost — existing plan.md files work unchanged | Mandatory fields (would break all existing projects) |
|
|
562
|
+
|
|
563
|
+
### 4.4 Drawbacks & Alternatives
|
|
564
|
+
|
|
565
|
+
| Decision Point | Chosen | Alternative | Why Not | Drawback of Chosen |
|
|
566
|
+
|----------------|--------|------------|---------|-------------------|
|
|
567
|
+
| 5 new commands | Grouped under Focus | Extend existing commands (add --scan to progress, --budget to exec-phase) | Overloading existing commands hides the strategic layer | 5 more commands to learn |
|
|
568
|
+
| New focus.cjs module | Dedicated module | Add to commands.cjs | commands.cjs is already 1100+ lines | Another module to maintain |
|
|
569
|
+
| .planning/focus/ directory | Dedicated directory | Write batch info to state.md | Batch files are temporary and shouldn't clutter state.md | Yet another directory |
|
|
570
|
+
| Codebase TODO scanning | Built into focus-scan | Extend list-todos command | list-todos scans .planning/todos/ only — codebase scanning is fundamentally different | Adds ~200ms to scan time |
|
|
571
|
+
|
|
572
|
+
### 4.5 Feature Ladder
|
|
573
|
+
|
|
574
|
+
| Version | Scope | Value Delivered | Effort |
|
|
575
|
+
|---------|-------|----------------|--------|
|
|
576
|
+
| **v0 (MVP)** | focus-scan (read-only prioritized items), focus-plan (budget allocation), focus-sync (doc check). Core module + 3 commands. | Users can see prioritized work and plan sessions. | L (new module + 3 commands + tests) |
|
|
577
|
+
| **v1 (Complete)** | Add focus-exec (full 6-stage execution pipeline with 9 rules, 4 modes, 3 tiers) + focus-design (full 10-phase investigation pipeline with Blue Ocean, Wardley, security, test plan). All 5 commands. | Full strategic pipeline shipped — no shortcuts. | L (2 more commands + agents + tests) |
|
|
578
|
+
| **v2 (Enhanced)** | Execution modes (bugfix/balanced/features). Pattern auto-remediation. Cross-session analytics. | Power-user optimization. | M-L |
|
|
579
|
+
|
|
580
|
+
### 4.6 Adoption Analysis
|
|
581
|
+
|
|
582
|
+
| Question | Answer |
|
|
583
|
+
|----------|--------|
|
|
584
|
+
| How does the user discover this feature? | `/pan:help` shows Focus group. `/pan:progress` suggests `focus-scan` when health drops below B. |
|
|
585
|
+
| What's the learning curve? | Zero config. Run `/pan:focus-scan` and the output explains what to do next. |
|
|
586
|
+
| Does it require changing existing workflows? | No. Focus is additive. Existing phase workflow unchanged. |
|
|
587
|
+
| What's the "aha moment"? | First time focus-scan surfaces a P0 crash bug the user didn't know about, and focus-plan slots it into a 20-minute fix batch. |
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## Phase 5: Architecture Decision Record
|
|
592
|
+
|
|
593
|
+
See `docs/decisions/ADR-0006-focus-commands.md` (created as separate artifact).
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
## Phase 6: Error Handling & Diagnostics Design
|
|
598
|
+
|
|
599
|
+
### 6.1 Failure Mode Analysis
|
|
600
|
+
|
|
601
|
+
| Failure Mode | Category | Detection | Recovery | User Sees |
|
|
602
|
+
|-------------|----------|-----------|----------|-----------|
|
|
603
|
+
| No .planning/ directory | User error | Check dir existence | JSON error + hint | "Run /pan:new-project" |
|
|
604
|
+
| Empty roadmap.md | Edge case | Parse returns 0 phases | Return empty items list | "No phases found" in scan |
|
|
605
|
+
| Malformed plan.md frontmatter | Data corruption | extractFrontmatter returns {} | Use defaults (P3, M) | Degraded but functional |
|
|
606
|
+
| Batch file corrupted | Data corruption | JSON.parse fails | JSON error + hint to re-plan | "Batch file corrupted, run focus-plan" |
|
|
607
|
+
| Git tag creation fails | Environment | execFileSync throws | Log warning, continue | "rollback_warning" field in output |
|
|
608
|
+
| Disk full on batch write | Environment | writeFileSync throws | JSON error | "Failed to write batch file: ENOSPC" |
|
|
609
|
+
| No TODO/FIXME in codebase | Normal | grep returns empty | Include 0 codebase items | Scan works, just no codebase items |
|
|
610
|
+
|
|
611
|
+
### 6.2 Diagnostic Support
|
|
612
|
+
|
|
613
|
+
| Diagnostic | How | When |
|
|
614
|
+
|------------|-----|------|
|
|
615
|
+
| `--raw` flag | Human-readable scan/plan output | Debugging |
|
|
616
|
+
| `--cwd <path>` | Override project directory | Testing |
|
|
617
|
+
| `--dry-run` on focus-exec | Show what would execute | Preview |
|
|
618
|
+
| `--check-only` on focus-sync | Show what would update | Preview |
|
|
619
|
+
| JSON `error` + `hint` fields | Machine-readable with recovery guidance | Any failure |
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
## Phase 7: Security & Threat Model
|
|
624
|
+
|
|
625
|
+
### 7.1 Asset & Attack Surface
|
|
626
|
+
|
|
627
|
+
| Asset | Accessed How | Trust Level |
|
|
628
|
+
|-------|-------------|-------------|
|
|
629
|
+
| .planning/ directory | Read/Write | System-generated, user-editable |
|
|
630
|
+
| Source code files | Read only (TODO scan) | User-controlled |
|
|
631
|
+
| docs/ directory | Write (focus-design, focus-sync) | System-generated |
|
|
632
|
+
| Git tags | Write (rollback snapshots) | System-managed |
|
|
633
|
+
| plan.md frontmatter | Read | User-editable (could contain malicious values) |
|
|
634
|
+
|
|
635
|
+
### 7.2 Path Safety
|
|
636
|
+
|
|
637
|
+
- All file reads within project root: `path.resolve(cwd, relativePath)` verified to start with `path.resolve(cwd)`
|
|
638
|
+
- TODO scanning uses `readdirSync` with depth limit (no symlink following)
|
|
639
|
+
- Batch file paths generated by system, not user input
|
|
640
|
+
- Design topic string sanitized for filesystem use (slug generation matches existing pattern)
|
|
641
|
+
|
|
642
|
+
### 7.3 Output Sanitization
|
|
643
|
+
|
|
644
|
+
- [x] No absolute paths in JSON output (toPosix relative paths)
|
|
645
|
+
- [x] No environment variables exposed
|
|
646
|
+
- [x] No stack traces in errors
|
|
647
|
+
- [x] No function names/line numbers in user errors
|
|
648
|
+
|
|
649
|
+
### 7.4 Content Validation
|
|
650
|
+
|
|
651
|
+
- plan.md frontmatter: priority validated against P0-P6 enum, effort against XS-XL enum
|
|
652
|
+
- Batch files: JSON.parse in try-catch, validate expected structure
|
|
653
|
+
- config.json: loadConfig already validates with defaults
|
|
654
|
+
|
|
655
|
+
### 7.5 Privilege Scope
|
|
656
|
+
|
|
657
|
+
```
|
|
658
|
+
Reads from: .planning/, source files (TODO scan), docs/
|
|
659
|
+
Writes to: .planning/focus/, .planning/state.md, .planning/patterns.md, docs/specs/, docs/decisions/
|
|
660
|
+
Executes shell: git tag (for rollback snapshots) via existing execGit helper
|
|
661
|
+
Reads outside project: No
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
---
|
|
665
|
+
|
|
666
|
+
## Phase 8: Implementation Roadmap
|
|
667
|
+
|
|
668
|
+
### 8.1 Command .md Definitions (DRAFTS)
|
|
669
|
+
|
|
670
|
+
The command `.md` files ARE the AI interface — they must contain the complete pipeline definitions so any AI agent can execute them correctly. No shortcuts, no summaries. The full pipeline is the command.
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
#### /pan:focus-scan — Full 7-Phase Strategic Work Scan
|
|
675
|
+
|
|
676
|
+
```markdown
|
|
677
|
+
---
|
|
678
|
+
name: focus-scan
|
|
679
|
+
group: Focus
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
# /pan:focus-scan — Deep-Dive Strategic Work Scan
|
|
683
|
+
|
|
684
|
+
Survey the project for prioritized work items with evidence-based scoring. $ARGUMENTS
|
|
685
|
+
|
|
686
|
+
**Goal:** Produce a comprehensive, evidence-based prioritized work list by deep-diving into ALL project files, code, and test results. Every item must link to source files and be actionable.
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
690
|
+
## MANDATORY: Execute ALL Phases Automatically
|
|
691
|
+
|
|
692
|
+
When `/pan:focus-scan` is invoked, execute ALL phases without stopping. Do NOT ask questions between phases. Do NOT skip phases. The output is a prioritized work list with Reality Score filtering.
|
|
693
|
+
|
|
694
|
+
**Flags:**
|
|
695
|
+
- `--focus <area>` — Weight items toward a specific area (e.g., `--focus commands`, `--focus hooks`, `--focus tests`)
|
|
696
|
+
- `--quick` — Skip Phase 2 (strategic context) and Phase 6 (validation protocol)
|
|
697
|
+
- `--refresh` — Force re-read all files even if recently cached
|
|
698
|
+
- `--lean` — Apply aggressive Reality Score filtering: DROP items with RS < 1.5, DEFER items with RS < 3.0
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## Phase 0: Orientation & Baseline Snapshot
|
|
703
|
+
|
|
704
|
+
### 0.1 Read Current State
|
|
705
|
+
Read these files to establish baseline:
|
|
706
|
+
|
|
707
|
+
**Core Status:**
|
|
708
|
+
- `package.json` — Version, description, entry points
|
|
709
|
+
- `README.md` — Public documentation
|
|
710
|
+
|
|
711
|
+
**Project Structure:**
|
|
712
|
+
- All core modules in the project's source directories
|
|
713
|
+
- All command definitions
|
|
714
|
+
- All agent definitions
|
|
715
|
+
- All workflow definitions
|
|
716
|
+
- All hook source files
|
|
717
|
+
|
|
718
|
+
**Planning State:**
|
|
719
|
+
- `.planning/state.md` — Current state
|
|
720
|
+
- `.planning/roadmap.md` — Phase progress
|
|
721
|
+
- `.planning/config.json` — Project configuration
|
|
722
|
+
- `.planning/patterns.md` — Known error patterns (if exists)
|
|
723
|
+
|
|
724
|
+
### 0.2 Scan for Real Issues
|
|
725
|
+
Run targeted code searches to find actual problems:
|
|
726
|
+
|
|
727
|
+
```
|
|
728
|
+
Search for: "TODO", "FIXME", "HACK", "STUB", "stub"
|
|
729
|
+
In: source directories, hooks, tests
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
Cross-reference found issues with documented items — flag any UNDOCUMENTED issues as new findings.
|
|
733
|
+
|
|
734
|
+
### 0.3 Check Test Results
|
|
735
|
+
```bash
|
|
736
|
+
npm test 2>&1
|
|
737
|
+
```
|
|
738
|
+
Record: total tests, passing, failing, suites.
|
|
739
|
+
|
|
740
|
+
### 0.4 Baseline Snapshot Table
|
|
741
|
+
|
|
742
|
+
```markdown
|
|
743
|
+
| Metric | Value | Notes |
|
|
744
|
+
|--------|-------|-------|
|
|
745
|
+
| Version | X.Y.Z | |
|
|
746
|
+
| Tests | N/N | M suites |
|
|
747
|
+
| Build | OK/FAIL | |
|
|
748
|
+
| Commands | N | |
|
|
749
|
+
| Phases | N total, M incomplete | |
|
|
750
|
+
| TODOs Found | N | |
|
|
751
|
+
| Error Patterns | N | |
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
---
|
|
755
|
+
|
|
756
|
+
## Phase 1: Priority Classification
|
|
757
|
+
|
|
758
|
+
### Priority Framework (STRICT ORDER)
|
|
759
|
+
|
|
760
|
+
| Priority | Focus | Criteria |
|
|
761
|
+
|----------|-------|----------|
|
|
762
|
+
| **P0: CRASH/ERROR** | Runtime errors, uncaught exceptions | Any command that throws or produces wrong output |
|
|
763
|
+
| **P1: WRONG RESULTS** | Silent data corruption, incorrect output | Commands that succeed but produce bad data |
|
|
764
|
+
| **P2: TEST GAPS** | Missing test coverage | Features without tests or low assertion density |
|
|
765
|
+
| **P3: INCOMPLETE FEATURES** | Partially implemented commands or workflows | Commands that exist but lack full functionality |
|
|
766
|
+
| **P4: NEW FEATURES** | Net-new functionality from roadmap | Features not yet started |
|
|
767
|
+
| **P5: TOOLING** | Developer experience improvements | Hooks, CLI UX, error messages |
|
|
768
|
+
| **P6: DOCUMENTATION** | Docs sync, reference updates | Documentation-only changes |
|
|
769
|
+
|
|
770
|
+
### Classification Rules
|
|
771
|
+
- **Crashes before correctness** — A thrown error is always higher priority than wrong output
|
|
772
|
+
- **Correctness before coverage** — Wrong results are worse than missing tests
|
|
773
|
+
- **Quick wins first within each tier** — S-effort items before L-effort items
|
|
774
|
+
|
|
775
|
+
---
|
|
776
|
+
|
|
777
|
+
## Phase 2: Strategic Context (skip with --quick)
|
|
778
|
+
|
|
779
|
+
### 2.1 Read Strategy Documents
|
|
780
|
+
- `README.md` — What's the public-facing story?
|
|
781
|
+
- User guide / docs — What's documented for users?
|
|
782
|
+
- `CHANGELOG.md` — What's the recent trajectory?
|
|
783
|
+
|
|
784
|
+
### 2.2 Strategic Alignment Check
|
|
785
|
+
For each P4+ item, note whether it:
|
|
786
|
+
- Is on the critical path to the next milestone
|
|
787
|
+
- Enables other high-value work (dependency unblocking)
|
|
788
|
+
- Has been deferred multiple times
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
## Phase 2.5: Feature Reality Check (Market-Fit Scoring)
|
|
793
|
+
|
|
794
|
+
Every feature-tier item (P3-P6) must pass a reality check.
|
|
795
|
+
|
|
796
|
+
### Reality Score (RS)
|
|
797
|
+
|
|
798
|
+
```
|
|
799
|
+
RS = (User Value + Time Criticality + Risk Reduction) / Job Size
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
#### User Value (UV): 1-5
|
|
803
|
+
| Score | Meaning |
|
|
804
|
+
|-------|---------|
|
|
805
|
+
| 5 | Core workflow feature — every user needs this |
|
|
806
|
+
| 4 | Common usage — most projects need it |
|
|
807
|
+
| 3 | Significant audience — power users need it |
|
|
808
|
+
| 2 | Niche audience — specific use case |
|
|
809
|
+
| 1 | Academic / completion-only |
|
|
810
|
+
|
|
811
|
+
#### Time Criticality (TC): 1-5
|
|
812
|
+
| Score | Meaning |
|
|
813
|
+
|-------|---------|
|
|
814
|
+
| 5 | Blocks users from adopting the tool |
|
|
815
|
+
| 4 | Competitive table-stakes — other tools have it |
|
|
816
|
+
| 3 | Unlocks a significant new use case |
|
|
817
|
+
| 2 | Nice to have, users can work around |
|
|
818
|
+
| 1 | No urgency |
|
|
819
|
+
|
|
820
|
+
#### Risk Reduction (RR): 1-5
|
|
821
|
+
| Score | Meaning |
|
|
822
|
+
|-------|---------|
|
|
823
|
+
| 5 | Removes a crash or correctness bug |
|
|
824
|
+
| 4 | Unblocks 3+ downstream features |
|
|
825
|
+
| 3 | Unblocks 1-2 features |
|
|
826
|
+
| 2 | Incremental improvement |
|
|
827
|
+
| 1 | Polish / docs |
|
|
828
|
+
|
|
829
|
+
#### Job Size (JS)
|
|
830
|
+
| Effort | JS Value |
|
|
831
|
+
|--------|----------|
|
|
832
|
+
| XS | 1 |
|
|
833
|
+
| S | 2 |
|
|
834
|
+
| M | 3 |
|
|
835
|
+
| L | 5 |
|
|
836
|
+
| XL | 8 |
|
|
837
|
+
|
|
838
|
+
```
|
|
839
|
+
RS >= 3.0 → DO — Include in next sessions
|
|
840
|
+
RS 1.5-2.9 → DEFER — Include as deferred
|
|
841
|
+
RS < 1.5 → BACKLOG — Move to backlog appendix
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
---
|
|
845
|
+
|
|
846
|
+
## Phase 3: Item Collection & Deduplication
|
|
847
|
+
|
|
848
|
+
### 3.1 Collect ALL Items
|
|
849
|
+
Gather items from:
|
|
850
|
+
|
|
851
|
+
1. **Test failures** — each failure = 1 item
|
|
852
|
+
2. **TODO/FIXME scan** — each finding = 1 item
|
|
853
|
+
3. **Missing test coverage** — each uncovered module = 1 item
|
|
854
|
+
4. **Incomplete commands** — each gap = 1 item
|
|
855
|
+
5. **Missing features** — from roadmap/README promises
|
|
856
|
+
6. **Documentation gaps** — each stale/missing doc = 1 item
|
|
857
|
+
7. **Error pattern prevention** — from patterns.md
|
|
858
|
+
|
|
859
|
+
### 3.2 Deduplicate
|
|
860
|
+
- Same file + same issue = same item
|
|
861
|
+
- Same feature described differently = same item
|
|
862
|
+
|
|
863
|
+
---
|
|
864
|
+
|
|
865
|
+
## Phase 4: Effort Estimation
|
|
866
|
+
|
|
867
|
+
| Size | Time | Lines Changed | Files |
|
|
868
|
+
|------|------|---------------|-------|
|
|
869
|
+
| XS | < 15 min | < 20 | 1 |
|
|
870
|
+
| S | 15-60 min | 20-100 | 1-2 |
|
|
871
|
+
| M | 1-4 hours | 100-500 | 2-5 |
|
|
872
|
+
| L | 4-8 hours | 500-2000 | 5-10 |
|
|
873
|
+
| XL | 8+ hours | 2000+ | 10+ |
|
|
874
|
+
|
|
875
|
+
---
|
|
876
|
+
|
|
877
|
+
## Phase 5: Scan Assembly
|
|
878
|
+
|
|
879
|
+
### 5.1 Output
|
|
880
|
+
Return JSON via `pan-tools focus scan` with all items, or write to `.planning/focus/scan-<YYYY-MM-DD>.md` for persistence.
|
|
881
|
+
|
|
882
|
+
### 5.2 Document Structure
|
|
883
|
+
|
|
884
|
+
The scan output includes:
|
|
885
|
+
- Status Snapshot table
|
|
886
|
+
- Items grouped by priority tier (P0-P6)
|
|
887
|
+
- Each item: ID, title, symptom, root cause, fix guidance, files, effort
|
|
888
|
+
- Summary statistics (items by priority × effort)
|
|
889
|
+
- Recommended execution order (quick wins → core fixes → feature work)
|
|
890
|
+
- Feature Reality Check table (RS scores for P3-P6 items)
|
|
891
|
+
- Deferred items with rationale
|
|
892
|
+
|
|
893
|
+
---
|
|
894
|
+
|
|
895
|
+
## Phase 6: Validation Protocol (skip with --quick)
|
|
896
|
+
|
|
897
|
+
### 6.1 Cross-Check Completeness
|
|
898
|
+
Verify the scan covers:
|
|
899
|
+
- [ ] All failing tests (if any)
|
|
900
|
+
- [ ] All TODO/FIXME items from code scan
|
|
901
|
+
- [ ] All modules without test coverage
|
|
902
|
+
- [ ] All commands listed in README but not implemented
|
|
903
|
+
- [ ] All error patterns that need prevention
|
|
904
|
+
|
|
905
|
+
### 6.2 Sanity Check
|
|
906
|
+
- No item should appear twice
|
|
907
|
+
- Every P0-P2 item should have a specific file path
|
|
908
|
+
- Deferred items should have clear "revisit when" criteria
|
|
909
|
+
|
|
910
|
+
---
|
|
911
|
+
|
|
912
|
+
## NEVER DO
|
|
913
|
+
|
|
914
|
+
- Skip reading source files — the scan must be evidence-based
|
|
915
|
+
- List items without file paths (for code items)
|
|
916
|
+
- Create items with vague descriptions
|
|
917
|
+
- Include items that are already complete
|
|
918
|
+
- Include P3-P6 feature items without an RS score
|
|
919
|
+
|
|
920
|
+
## ALWAYS DO
|
|
921
|
+
|
|
922
|
+
- Deep-dive into actual code (grep for TODOs, read modules)
|
|
923
|
+
- Cross-reference tests against implementations
|
|
924
|
+
- Link every item to its source file
|
|
925
|
+
- Provide specific fix guidance
|
|
926
|
+
- Score every P3-P6 item with the RS formula
|
|
927
|
+
- Sort the Feature Reality Check table by RS descending
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
---
|
|
931
|
+
|
|
932
|
+
#### /pan:focus-plan — Capacity-Budgeted Work Batch
|
|
933
|
+
|
|
934
|
+
```markdown
|
|
935
|
+
---
|
|
936
|
+
name: focus-plan
|
|
937
|
+
group: Focus
|
|
938
|
+
---
|
|
939
|
+
|
|
940
|
+
# /pan:focus-plan — Capacity-Budgeted Work Batch Planner
|
|
941
|
+
|
|
942
|
+
Create a capacity-budgeted work batch from focus-scan results. $ARGUMENTS
|
|
943
|
+
|
|
944
|
+
**Goal:** Select a right-sized batch of work items that fits within the session's point budget, ordered for maximum impact with minimum risk.
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
## MANDATORY: Run focus-scan first
|
|
949
|
+
|
|
950
|
+
If no recent scan exists (`.planning/focus/scan-*.md`), run `/pan:focus-scan` automatically before proceeding.
|
|
951
|
+
|
|
952
|
+
**Flags:**
|
|
953
|
+
- `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
|
|
954
|
+
- `--mode MODE` — Execution mode. Default: `balanced`
|
|
955
|
+
- `bugfix` — P0→P1→smallest-first, no feature work (40 pts)
|
|
956
|
+
- `balanced` — **Default.** Mix of stability fixes + feature development, 60/40 split (50 pts)
|
|
957
|
+
- `features` — Feature-focused: 80% budget on P3-P5, P0 crashes still mandatory (50 pts)
|
|
958
|
+
- `full` — Full-spectrum: enhanced budget, all priorities equally weighted (60 pts)
|
|
959
|
+
- `--priority P0-P6` — Only pick items from these priority tiers
|
|
960
|
+
- `--lean` — Apply RS filtering: exclude items with RS < 1.5
|
|
961
|
+
|
|
962
|
+
---
|
|
963
|
+
|
|
964
|
+
## Capacity Budget System
|
|
965
|
+
|
|
966
|
+
| Size | Points | Per Session | Meaning |
|
|
967
|
+
|------|--------|-------------|---------|
|
|
968
|
+
| **XS** | 1 | Up to 40 | Config tweak, typo fix |
|
|
969
|
+
| **S** | 2 | Up to 20 | Single-file bug fix, add tests |
|
|
970
|
+
| **M** | 4 | Up to 10 | Multi-file feature, new test suite |
|
|
971
|
+
| **L** | 10 | Up to 4 | Multi-module change, new command |
|
|
972
|
+
| **XL** | 20 | Up to 2 | New subsystem, major refactor |
|
|
973
|
+
|
|
974
|
+
---
|
|
975
|
+
|
|
976
|
+
## Execution Modes
|
|
977
|
+
|
|
978
|
+
### `bugfix` — Stability-First
|
|
979
|
+
- **Budget:** 40 pts
|
|
980
|
+
- **Algorithm:** P0 mandatory → P1 → P2-P4 smallest-first
|
|
981
|
+
- **Feature allocation:** None
|
|
982
|
+
|
|
983
|
+
### `balanced` — Mix of Fixes + Features (DEFAULT)
|
|
984
|
+
- **Budget:** 50 pts
|
|
985
|
+
- **Stability pass (60%):** 30 pts for P0-P2
|
|
986
|
+
- **Feature pass (40%):** 20 pts for P3-P6
|
|
987
|
+
|
|
988
|
+
### `features` — Feature-Focused Sprint
|
|
989
|
+
- **Budget:** 50 pts
|
|
990
|
+
- **Mandatory pass:** All P0 items
|
|
991
|
+
- **Feature pass (80%):** 40 pts for P3-P5
|
|
992
|
+
- **Stability pass (20%):** 10 pts for P1-P2 quick wins
|
|
993
|
+
|
|
994
|
+
### `full` — Full-Spectrum Marathon
|
|
995
|
+
- **Budget:** 60 pts
|
|
996
|
+
- **All priorities weighted equally, largest-impact-first**
|
|
997
|
+
|
|
998
|
+
---
|
|
999
|
+
|
|
1000
|
+
## Output
|
|
1001
|
+
|
|
1002
|
+
Produce a batch file at `.planning/focus/batch-<YYYY-MM-DD>.md`:
|
|
1003
|
+
|
|
1004
|
+
```markdown
|
|
1005
|
+
## Focus Batch — <date>
|
|
1006
|
+
**Mode:** balanced | **Budget:** 50 pts | **Allocated:** N pts
|
|
1007
|
+
|
|
1008
|
+
| # | ID | Title | Priority | Size | Pts | Tier | Track |
|
|
1009
|
+
|---|----|-------|----------|------|-----|------|-------|
|
|
1010
|
+
| 1 | P0-1 | Fix crash in state cmd | P0 | S | 2 | MICRO | Stability |
|
|
1011
|
+
| 2 | P2-3 | Add tests for milestone | P2 | M | 4 | STANDARD | Stability |
|
|
1012
|
+
| 3 | P3-1 | Add --json flag to phase | P3 | M | 4 | STANDARD | Feature |
|
|
1013
|
+
|
|
1014
|
+
Execution Order: MICRO first, then STANDARD, then FULL
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
Ready for `/pan:focus-exec`.
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
---
|
|
1021
|
+
|
|
1022
|
+
#### /pan:focus-exec — Full 6-Stage Execution Pipeline
|
|
1023
|
+
|
|
1024
|
+
```markdown
|
|
1025
|
+
---
|
|
1026
|
+
name: focus-exec
|
|
1027
|
+
group: Focus
|
|
1028
|
+
---
|
|
1029
|
+
|
|
1030
|
+
# /pan:focus-exec — Automated Batch Execution Pipeline
|
|
1031
|
+
|
|
1032
|
+
Execute items from the current focus batch with capacity-based sizing, full session lifecycle, and verification. $ARGUMENTS
|
|
1033
|
+
|
|
1034
|
+
**Goal:** One-command pipeline that starts a session, loads the planned batch, implements items with tier-based execution protocols, verifies the work, syncs documentation, and closes the session cleanly.
|
|
1035
|
+
|
|
1036
|
+
---
|
|
1037
|
+
|
|
1038
|
+
## Pipeline Overview
|
|
1039
|
+
|
|
1040
|
+
```
|
|
1041
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
1042
|
+
│ /pan:focus-exec │
|
|
1043
|
+
│ │
|
|
1044
|
+
│ Stage 1: SESSION START │
|
|
1045
|
+
│ └─ Check project status, record baseline │
|
|
1046
|
+
│ │
|
|
1047
|
+
│ Stage 2: BATCH LOADING + VALIDATION │
|
|
1048
|
+
│ └─ Read batch file, validate items, confirm budget │
|
|
1049
|
+
│ │
|
|
1050
|
+
│ Stage 3: EXECUTION (tier-based) │
|
|
1051
|
+
│ └─ Implement items with read→understand→code │
|
|
1052
|
+
│ └─ Build + test cadence per tier │
|
|
1053
|
+
│ │
|
|
1054
|
+
│ Stage 4: VERIFICATION │
|
|
1055
|
+
│ └─ Verify all implemented items actually work │
|
|
1056
|
+
│ └─ Full test suite must pass │
|
|
1057
|
+
│ │
|
|
1058
|
+
│ Stage 5: DOCUMENTATION SYNC │
|
|
1059
|
+
│ └─ Update docs, README, CHANGELOG │
|
|
1060
|
+
│ │
|
|
1061
|
+
│ Stage 6: SESSION END │
|
|
1062
|
+
│ └─ Commit, record session, generate summary │
|
|
1063
|
+
│ │
|
|
1064
|
+
└─────────────────────────────────────────────────────────────┘
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
---
|
|
1068
|
+
|
|
1069
|
+
## MANDATORY: Execute ALL Stages Sequentially
|
|
1070
|
+
|
|
1071
|
+
When `/pan:focus-exec` is invoked, run ALL 6 stages in order. Do NOT skip stages. Do NOT stop between stages unless a critical failure occurs (tests regress).
|
|
1072
|
+
|
|
1073
|
+
**Flags:**
|
|
1074
|
+
- `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
|
|
1075
|
+
- `--mode MODE` — Execution mode (bugfix/balanced/features/full)
|
|
1076
|
+
- `--priority P0-P6` — Only pick items from these priority tiers
|
|
1077
|
+
- `--dry-run` — Run Stages 1-2 only (show what WOULD be executed)
|
|
1078
|
+
- `--no-commit` — Skip the commit step in Stage 6
|
|
1079
|
+
- `--continue` — Resume a previously interrupted execution
|
|
1080
|
+
|
|
1081
|
+
---
|
|
1082
|
+
|
|
1083
|
+
## Capacity Budget System
|
|
1084
|
+
|
|
1085
|
+
| Size | Points | Per Session | Meaning |
|
|
1086
|
+
|------|--------|-------------|---------|
|
|
1087
|
+
| **XS** | 1 | Up to 40 | Config tweak, typo fix |
|
|
1088
|
+
| **S** | 2 | Up to 20 | Single-file bug fix, add tests |
|
|
1089
|
+
| **M** | 4 | Up to 10 | Multi-file feature, new test suite |
|
|
1090
|
+
| **L** | 10 | Up to 4 | Multi-module change, new command |
|
|
1091
|
+
| **XL** | 20 | Up to 2 | New subsystem, major refactor |
|
|
1092
|
+
|
|
1093
|
+
---
|
|
1094
|
+
|
|
1095
|
+
## AI Behavioral Rules (ALL 9 MANDATORY)
|
|
1096
|
+
|
|
1097
|
+
### Rule 1: Read Before You Write (MANDATORY)
|
|
1098
|
+
Before changing ANY file, read it first. Understand context, callers, and invariants.
|
|
1099
|
+
|
|
1100
|
+
### Rule 2: Understand the Root Cause (MANDATORY)
|
|
1101
|
+
Do NOT apply surface-level patches. Trace the code path, identify the actual defect.
|
|
1102
|
+
|
|
1103
|
+
### Rule 3: One Change, One Test (MANDATORY)
|
|
1104
|
+
Every code change must be tested before moving to the next item.
|
|
1105
|
+
|
|
1106
|
+
Test cadence by tier:
|
|
1107
|
+
- **MICRO (XS/S):** Run specific test after implementing. Batch up to 3 independent items before smoke.
|
|
1108
|
+
- **STANDARD (M):** Full test suite after EACH item.
|
|
1109
|
+
- **FULL (L/XL):** Build hooks + full test suite after EACH item.
|
|
1110
|
+
|
|
1111
|
+
### Rule 4: Don't Invent — Follow the Plan (MANDATORY)
|
|
1112
|
+
Implement exactly what the batch says. No scope creep.
|
|
1113
|
+
|
|
1114
|
+
### Rule 5: Cross-Platform Awareness (MANDATORY)
|
|
1115
|
+
- Use `toPosix()` for all paths in JSON output
|
|
1116
|
+
- Use file-based input for shell-sensitive content (`$` signs)
|
|
1117
|
+
- All modules must be CommonJS (`.cjs` with `require()`)
|
|
1118
|
+
|
|
1119
|
+
### Rule 6: Revert Fast, Don't Dig Deep (MANDATORY)
|
|
1120
|
+
If a fix doesn't work within 5 minutes, revert and move on. Failed items carry forward.
|
|
1121
|
+
|
|
1122
|
+
### Rule 7: Verify Understanding Before Committing (MANDATORY)
|
|
1123
|
+
For M/L/XL items, state your understanding before writing code:
|
|
1124
|
+
```
|
|
1125
|
+
Item P2-3 — Add tests for milestone module
|
|
1126
|
+
Understanding: milestone.cjs has 3 exported functions. Need to test
|
|
1127
|
+
completeMilestone, archiveMilestoneFiles, and getMilestoneInfo edge cases.
|
|
1128
|
+
Files: milestone.cjs, tests/milestone.test.cjs
|
|
1129
|
+
Confidence: HIGH
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
### Rule 8: Preserve Existing Test Expectations (MANDATORY)
|
|
1133
|
+
Never change an existing test's expected output to match broken code.
|
|
1134
|
+
|
|
1135
|
+
### Rule 9: Commit Messages Must Be Accurate (MANDATORY)
|
|
1136
|
+
List ONLY items that are actually VERIFIED (passed tests). Include actual test counts.
|
|
1137
|
+
|
|
1138
|
+
---
|
|
1139
|
+
|
|
1140
|
+
## Stage 1: Session Start
|
|
1141
|
+
|
|
1142
|
+
1. **Check Project Status** — git status, recent commits
|
|
1143
|
+
2. **Test Baseline** — run test suite, record current counts
|
|
1144
|
+
3. **Create rollback snapshot** — git tag for safety
|
|
1145
|
+
4. **Report** — Output session start summary
|
|
1146
|
+
|
|
1147
|
+
**Record baseline:**
|
|
1148
|
+
```
|
|
1149
|
+
baseline_version: <from package.json>
|
|
1150
|
+
baseline_tests: <N/N passing>
|
|
1151
|
+
baseline_build: <pass/fail>
|
|
1152
|
+
baseline_commit: <current HEAD>
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
**Failure Gate:** If tests fail, STOP. Fix tests before proceeding.
|
|
1156
|
+
|
|
1157
|
+
---
|
|
1158
|
+
|
|
1159
|
+
## Stage 2: Batch Loading + Validation
|
|
1160
|
+
|
|
1161
|
+
### 2.1 Find Active Batch
|
|
1162
|
+
Search for: `.planning/focus/batch-*.md`
|
|
1163
|
+
Pick the newest. If none exists, tell user to run `/pan:focus-plan` first.
|
|
1164
|
+
|
|
1165
|
+
### 2.2 Read and Validate the Batch
|
|
1166
|
+
Extract all items: ID, Title, Priority, Effort, Points, Tier, Files.
|
|
1167
|
+
Verify total points within budget.
|
|
1168
|
+
|
|
1169
|
+
### 2.3 Show Batch Table
|
|
1170
|
+
Display the execution batch to user, then continue automatically.
|
|
1171
|
+
|
|
1172
|
+
---
|
|
1173
|
+
|
|
1174
|
+
## Stage 3: Execution
|
|
1175
|
+
|
|
1176
|
+
### 3.0 Pre-Execution Setup
|
|
1177
|
+
1. Cache project facts — do NOT re-read later
|
|
1178
|
+
2. Create/update progress tracker with the batch table
|
|
1179
|
+
|
|
1180
|
+
### 3.1 Process Items by Tier
|
|
1181
|
+
|
|
1182
|
+
#### MICRO Items (XS/S)
|
|
1183
|
+
```
|
|
1184
|
+
1. READ target file(s)
|
|
1185
|
+
2. IMPLEMENT the fix
|
|
1186
|
+
3. TEST — run specific test file
|
|
1187
|
+
4. CONFIRM — pass → ✅ DONE | fail → one fix attempt → REVERT → ❌ FAILED
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
#### STANDARD Items (M)
|
|
1191
|
+
```
|
|
1192
|
+
1. STATE UNDERSTANDING (Rule 7)
|
|
1193
|
+
2. READ target files + test files
|
|
1194
|
+
3. IMPLEMENT across necessary files
|
|
1195
|
+
4. TEST — full test suite
|
|
1196
|
+
5. CONFIRM — pass → ✅ DONE | regresses → REVERT → ❌ FAILED
|
|
1197
|
+
```
|
|
1198
|
+
|
|
1199
|
+
#### FULL Items (L/XL)
|
|
1200
|
+
```
|
|
1201
|
+
1. STATE UNDERSTANDING (detailed)
|
|
1202
|
+
2. READ WIDELY — target files, callers, tests, related code
|
|
1203
|
+
3. DESIGN — outline approach before coding
|
|
1204
|
+
4. IMPLEMENT in logical chunks
|
|
1205
|
+
5. BUILD — build hooks if hooks changed
|
|
1206
|
+
6. TEST — full test suite
|
|
1207
|
+
7. CONFIRM — all pass → ✅ DONE | fail → investigate (15 min max) → REVERT → ❌ FAILED
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
### 3.2 Failure Handling
|
|
1211
|
+
- Build breaks: fix typo or revert (5 min limit)
|
|
1212
|
+
- Test regression: identify cause, one fix attempt, else revert
|
|
1213
|
+
- **Never let a failed item block other items**
|
|
1214
|
+
|
|
1215
|
+
### 3.3 Progress Tracking
|
|
1216
|
+
Update progress tracker after each item with status and budget tracking.
|
|
1217
|
+
|
|
1218
|
+
---
|
|
1219
|
+
|
|
1220
|
+
## Stage 4: Verification
|
|
1221
|
+
|
|
1222
|
+
### 4.1 Full Suite Verification
|
|
1223
|
+
Run full test suite. All tests must pass. Compare against Stage 1 baseline.
|
|
1224
|
+
|
|
1225
|
+
### 4.2 Build Verification (if applicable)
|
|
1226
|
+
Build hooks or compile step if applicable. All must pass.
|
|
1227
|
+
|
|
1228
|
+
### 4.3 Verification Report
|
|
1229
|
+
```markdown
|
|
1230
|
+
## Verification Report
|
|
1231
|
+
|
|
1232
|
+
### Item Results
|
|
1233
|
+
| # | ID | Title | Tests | Verdict |
|
|
1234
|
+
|---|----|-------|-------|---------|
|
|
1235
|
+
| 1 | P0-1 | Fix crash | ✅ | VERIFIED |
|
|
1236
|
+
| 2 | P2-3 | Add tests | ✅ | VERIFIED |
|
|
1237
|
+
|
|
1238
|
+
### Regression Check
|
|
1239
|
+
| Test Suite | Before | After | Delta |
|
|
1240
|
+
|------------|--------|-------|-------|
|
|
1241
|
+
| Tests | N/N | M/M | +K |
|
|
1242
|
+
| Build | pass | pass | — |
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
---
|
|
1246
|
+
|
|
1247
|
+
## Stage 5: Documentation Sync
|
|
1248
|
+
|
|
1249
|
+
### 5.1 Update Docs
|
|
1250
|
+
- Update README.md if public API changed
|
|
1251
|
+
- Update CHANGELOG.md with new entries
|
|
1252
|
+
- Update command/workflow files if behavior changed
|
|
1253
|
+
|
|
1254
|
+
### 5.2 Update Scan
|
|
1255
|
+
Edit the active scan file:
|
|
1256
|
+
- Mark completed items with ✅
|
|
1257
|
+
- Mark failed items with ❌ and reason
|
|
1258
|
+
|
|
1259
|
+
---
|
|
1260
|
+
|
|
1261
|
+
## Stage 6: Session End
|
|
1262
|
+
|
|
1263
|
+
### 6.1 Commit Changes
|
|
1264
|
+
Unless `--no-commit`:
|
|
1265
|
+
1. Stage modified files (specific paths, not `git add -A`)
|
|
1266
|
+
2. Create commit with accurate message listing verified items
|
|
1267
|
+
3. Verify commit succeeded
|
|
1268
|
+
|
|
1269
|
+
### 6.2 Record Session
|
|
1270
|
+
- Record session summary (items completed, tests before/after, budget used)
|
|
1271
|
+
- Append error patterns if any failures occurred
|
|
1272
|
+
|
|
1273
|
+
### 6.3 Final Report
|
|
1274
|
+
|
|
1275
|
+
```markdown
|
|
1276
|
+
## /pan:focus-exec Complete
|
|
1277
|
+
|
|
1278
|
+
| Stage | Status |
|
|
1279
|
+
|-------|--------|
|
|
1280
|
+
| 1. Session Start | ✅ Baseline: N/N tests |
|
|
1281
|
+
| 2. Batch Loading | ✅ Mode: balanced, N items |
|
|
1282
|
+
| 3. Execution | ✅ N/M items completed |
|
|
1283
|
+
| 4. Verification | ✅ All verified |
|
|
1284
|
+
| 5. Doc Sync | ✅ Updated N docs |
|
|
1285
|
+
| 6. Session End | ✅ Committed |
|
|
1286
|
+
|
|
1287
|
+
### Results
|
|
1288
|
+
- **Budget:** X/50 points used
|
|
1289
|
+
- **Items completed:** N (X pts)
|
|
1290
|
+
- **Items failed:** K (Y pts returned)
|
|
1291
|
+
- **Tests:** Before N → After M (+K new)
|
|
1292
|
+
|
|
1293
|
+
### Resume
|
|
1294
|
+
Run `/pan:focus-exec --continue` for remaining items.
|
|
1295
|
+
Run `/pan:focus-scan` to regenerate the scan.
|
|
1296
|
+
```
|
|
1297
|
+
|
|
1298
|
+
---
|
|
1299
|
+
|
|
1300
|
+
## NEVER DO
|
|
1301
|
+
|
|
1302
|
+
- Skip reading files before editing them (Rule 1)
|
|
1303
|
+
- Apply symptom patches instead of root cause fixes (Rule 2)
|
|
1304
|
+
- Batch implement without testing between items (Rule 3)
|
|
1305
|
+
- Expand scope beyond the batch item (Rule 4)
|
|
1306
|
+
- Ignore cross-platform path issues (Rule 5)
|
|
1307
|
+
- Spend more than 5 minutes debugging a single failure (Rule 6)
|
|
1308
|
+
- Start coding without stating understanding for M+ items (Rule 7)
|
|
1309
|
+
- Change test expectations to match broken code (Rule 8)
|
|
1310
|
+
- Claim items are fixed without running tests (Rule 9)
|
|
1311
|
+
|
|
1312
|
+
## ALWAYS DO
|
|
1313
|
+
|
|
1314
|
+
- Read before write, understand before implement
|
|
1315
|
+
- Test after every item
|
|
1316
|
+
- Stay within budget and plan scope
|
|
1317
|
+
- Use toPosix() for paths, file-based input for shell-sensitive content
|
|
1318
|
+
- Revert fast when stuck
|
|
1319
|
+
- Record baseline test counts BEFORE making changes
|
|
1320
|
+
- Save progress after each item
|
|
1321
|
+
- Record session at end
|
|
1322
|
+
- Report results with before/after comparison and budget usage
|
|
1323
|
+
```
|
|
1324
|
+
|
|
1325
|
+
---
|
|
1326
|
+
|
|
1327
|
+
#### /pan:focus-design — Full 10-Phase Strategic Feature Investigation
|
|
1328
|
+
|
|
1329
|
+
```markdown
|
|
1330
|
+
---
|
|
1331
|
+
name: focus-design
|
|
1332
|
+
group: Focus
|
|
1333
|
+
---
|
|
1334
|
+
|
|
1335
|
+
# /pan:focus-design — Strategic Feature Investigation, Design & Specification
|
|
1336
|
+
|
|
1337
|
+
Research, design, and specify a new feature with strategic analysis. $ARGUMENTS
|
|
1338
|
+
|
|
1339
|
+
**Goal:** Produce a best-of-breed feature specification that (a) validates the problem with evidence, (b) maps the competitive landscape, (c) identifies strategic differentiation, (d) designs an architecturally sound implementation, (e) plans for error handling, security, and testability from day one, (f) defines an incremental delivery ladder, and (g) outputs a ready-to-implement spec with ADR, test plan, and implementation tasks.
|
|
1340
|
+
|
|
1341
|
+
**Methodology:** Synthesizes Spec-Driven Development, Blue Ocean Strategy, Wardley Mapping, STRIDE-lite threat modeling, Architecture Decision Records, and PAN's workflow methodology into a single investigative pipeline.
|
|
1342
|
+
|
|
1343
|
+
---
|
|
1344
|
+
|
|
1345
|
+
## MANDATORY: Complete All Phases For Selected Mode
|
|
1346
|
+
|
|
1347
|
+
When `/pan:focus-design` is invoked, execute ALL phases for the selected mode automatically. Do NOT stop to ask questions between phases. Do NOT skip phases beyond what the mode specifies. Complete the FULL investigation and produce all output artifacts. The only permitted pause is the Strategy Gate in Phase 3 (if the user passed `--gate`).
|
|
1348
|
+
|
|
1349
|
+
**Modes (mutually exclusive — pick one, default `--full`):**
|
|
1350
|
+
|
|
1351
|
+
### `--full` — Complete 10-Phase Investigation (DEFAULT)
|
|
1352
|
+
Run ALL 10 phases. Nothing skipped. This is the gold standard.
|
|
1353
|
+
```
|
|
1354
|
+
Phases: 0 → 1 → 2 → 2.5(if --audit) → 3 → 3.5 → 4 → 5 → 6 → 7 → 8 → 9 → 10
|
|
1355
|
+
Use case: New features, public-facing commands, anything that ships to users
|
|
1356
|
+
```
|
|
1357
|
+
|
|
1358
|
+
### `--internal` — Internal Development Focus
|
|
1359
|
+
Skip competitive research (Phase 2) and reality check (Phase 2.5). Focus on architecture, implementation, hardening, and testing. For internal tooling where there are no competitors to analyze.
|
|
1360
|
+
```
|
|
1361
|
+
Phases: 0 → 1 → 3 → 3.5 → 4 → 5 → 6 → 7 → 8 → 9 → 10
|
|
1362
|
+
Skips: Phase 2 (Competitive Intelligence), Phase 2.5 (Reality Check)
|
|
1363
|
+
Use case: Internal APIs, dev tooling, refactoring, infrastructure work
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
### `--outward` — Strategic & Market Analysis Focus
|
|
1367
|
+
Emphasize competitive intelligence and strategic positioning. Skip error handling and security hardening (Phases 6, 7) and produce a lighter implementation roadmap. For market research, strategic decisions, and feature evaluation.
|
|
1368
|
+
```
|
|
1369
|
+
Phases: 0 → 1 → 2 → 2.5(if --audit) → 3 → 3.5 → 4 → 5 → 8(tasks only) → 10
|
|
1370
|
+
Skips: Phase 6 (Error Handling), Phase 7 (Security), Phase 9 (Test Plan)
|
|
1371
|
+
Lighter: Phase 8 (tasks list only — no dependency graph, no risk register)
|
|
1372
|
+
Use case: Evaluating whether to build, competitive positioning, strategic ADRs
|
|
1373
|
+
```
|
|
1374
|
+
|
|
1375
|
+
### `--spike` — Fast Proof-of-Concept
|
|
1376
|
+
Minimal 4-phase pass: validate the problem, scan the codebase, synthesize a design, output implementation tasks. No competitive research, no strategic analysis, no hardening.
|
|
1377
|
+
```
|
|
1378
|
+
Phases: 0(lite) → 1(lite) → 4 → 8
|
|
1379
|
+
Lite Phase 0: Problem statement + scope only (skip demand evidence, user stories, cannibalization)
|
|
1380
|
+
Lite Phase 1: Codebase search + conventions only (skip architecture scan, dependency map)
|
|
1381
|
+
Skips: Phases 2, 2.5, 3, 3.5, 5, 6, 7, 9, 10(spec saved, no ADR)
|
|
1382
|
+
Use case: Quick prototyping, time-boxed exploration, "should we even try this?"
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1385
|
+
**Modifiers (layer on top of any mode):**
|
|
1386
|
+
- `--gate` — Pause after Phase 3 (Strategy) for user review before proceeding to design
|
|
1387
|
+
- `--audit` — Add Phase 2.5 reality check of existing implementation (not available with `--spike`)
|
|
1388
|
+
- `--mvp` — Stop after generating the v0 (MVP) task list — skip v1/v2 layers
|
|
1389
|
+
|
|
1390
|
+
**Mode + Phase Matrix:**
|
|
1391
|
+
|
|
1392
|
+
| Phase | `--full` | `--internal` | `--outward` | `--spike` |
|
|
1393
|
+
|-------|----------|-------------|-------------|-----------|
|
|
1394
|
+
| 0: Problem Framing | Full | Full | Full | Lite (statement + scope only) |
|
|
1395
|
+
| 1: Internal Recon | Full | Full | Full | Lite (codebase + conventions only) |
|
|
1396
|
+
| 2: Competitive Intel | Full | **SKIP** | Full | **SKIP** |
|
|
1397
|
+
| 2.5: Reality Check | With --audit | **SKIP** | With --audit | **SKIP** |
|
|
1398
|
+
| 3: Strategic Analysis | Full | Full | Full | **SKIP** |
|
|
1399
|
+
| 3.5: Architecture | Full | Full | Full | **SKIP** |
|
|
1400
|
+
| 4: Design Synthesis | Full | Full | Full | Full |
|
|
1401
|
+
| 5: ADR | Full | Full | Full | **SKIP** |
|
|
1402
|
+
| 6: Error Handling | Full | Full | **SKIP** | **SKIP** |
|
|
1403
|
+
| 7: Security | Full | Full | **SKIP** | **SKIP** |
|
|
1404
|
+
| 8: Implementation | Full | Full | Tasks only | Full |
|
|
1405
|
+
| 9: Test Plan | Full | Full | **SKIP** | **SKIP** |
|
|
1406
|
+
| 10: Output Artifacts | Full | Full | Spec + ADR | Spec only |
|
|
1407
|
+
|
|
1408
|
+
---
|
|
1409
|
+
|
|
1410
|
+
## Phase 0: Problem Framing & Demand Validation
|
|
1411
|
+
|
|
1412
|
+
> *Before designing anything, prove the problem exists and users care.*
|
|
1413
|
+
|
|
1414
|
+
### 0.1 Problem Statement
|
|
1415
|
+
Write a crisp, one-paragraph problem statement answering:
|
|
1416
|
+
- What user pain or limitation does this address?
|
|
1417
|
+
- Why does it matter NOW for the target users (developers using AI coding assistants)?
|
|
1418
|
+
- What is the cost of NOT doing this?
|
|
1419
|
+
|
|
1420
|
+
### 0.2 Demand Evidence (MANDATORY)
|
|
1421
|
+
Gather at least 2 evidence signals that real users want this:
|
|
1422
|
+
|
|
1423
|
+
| Evidence Type | Source | Finding |
|
|
1424
|
+
|--------------|--------|---------|
|
|
1425
|
+
| GitHub issue / feature request | repo issues | [link or "none found"] |
|
|
1426
|
+
| Discord / community request | community channels | [quote or "none found"] |
|
|
1427
|
+
| Competitor feature parity | [tool name] ships this | [description] |
|
|
1428
|
+
| Personal pain (user-stated) | This conversation | [user's words] |
|
|
1429
|
+
|
|
1430
|
+
**If zero evidence found:** Flag this as speculative. The strategic recommendation in Phase 3.4 must justify building without demand evidence.
|
|
1431
|
+
|
|
1432
|
+
### 0.3 Scope Definition
|
|
1433
|
+
| In Scope | Out of Scope (and why) |
|
|
1434
|
+
|----------|------------------------|
|
|
1435
|
+
| ... | ... |
|
|
1436
|
+
|
|
1437
|
+
### 0.4 Success Criteria (Measurable)
|
|
1438
|
+
Define 3-5 concrete, testable success criteria:
|
|
1439
|
+
```
|
|
1440
|
+
SC-1: [User can do X with a single command]
|
|
1441
|
+
SC-2: [Feature works across all supported runtimes]
|
|
1442
|
+
SC-3: [No regression in existing tests]
|
|
1443
|
+
SC-4: [Feature works identically on Windows, Mac, and Linux]
|
|
1444
|
+
SC-5: [Error messages guide user to fix within 1 attempt]
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
### 0.5 User Stories (3 minimum)
|
|
1448
|
+
```
|
|
1449
|
+
As a [developer using PAN Wizard on any runtime], I want [feature],
|
|
1450
|
+
so that [benefit], instead of [current workaround].
|
|
1451
|
+
```
|
|
1452
|
+
|
|
1453
|
+
### 0.6 Cannibalization Check
|
|
1454
|
+
Check ALL existing commands and agents for overlap:
|
|
1455
|
+
|
|
1456
|
+
| Existing Command/Agent | Overlap? | Impact |
|
|
1457
|
+
|-----------------------|----------|--------|
|
|
1458
|
+
| [closest match 1] | None / Partial / Full | [migration path if partial/full] |
|
|
1459
|
+
| [closest match 2] | None / Partial / Full | [migration path if partial/full] |
|
|
1460
|
+
| [closest match 3] | None / Partial / Full | [migration path if partial/full] |
|
|
1461
|
+
|
|
1462
|
+
**If Full overlap found:** STOP — enhance the existing command instead of creating a new one.
|
|
1463
|
+
|
|
1464
|
+
### 0.7 Cognitive Load Assessment
|
|
1465
|
+
| Metric | Before | After | Delta |
|
|
1466
|
+
|--------|--------|-------|-------|
|
|
1467
|
+
| Commands a new user must learn | N | ? | +N |
|
|
1468
|
+
| New concepts introduced | 0 | ? | +N |
|
|
1469
|
+
| Score | — | — | simplifies (-1) / neutral (0) / adds complexity (+1) / significant (+2) |
|
|
1470
|
+
|
|
1471
|
+
**If score = +2:** Must provide explicit justification in Phase 3.4.
|
|
1472
|
+
|
|
1473
|
+
---
|
|
1474
|
+
|
|
1475
|
+
## Phase 1: Internal Reconnaissance
|
|
1476
|
+
|
|
1477
|
+
**Understand what the project already has before looking outward.**
|
|
1478
|
+
|
|
1479
|
+
### 1.1 Architecture Scan
|
|
1480
|
+
Read and extract relevant context from:
|
|
1481
|
+
- `README.md` — Public documentation and architecture
|
|
1482
|
+
- User guide — User workflows
|
|
1483
|
+
- Architecture docs — System design
|
|
1484
|
+
- Project conventions — Known patterns and stability work
|
|
1485
|
+
|
|
1486
|
+
Create an **existing capabilities inventory:**
|
|
1487
|
+
```
|
|
1488
|
+
| Capability | Status | Location | Relevance |
|
|
1489
|
+
|------------|--------|----------|-----------|
|
|
1490
|
+
| ... | ... | ... | ... |
|
|
1491
|
+
```
|
|
1492
|
+
|
|
1493
|
+
### 1.2 Codebase Search
|
|
1494
|
+
| Search Target | Where to Look | What to Extract |
|
|
1495
|
+
|---------------|---------------|-----------------|
|
|
1496
|
+
| CLI dispatcher | Main entry point | Command routing, arg parsing |
|
|
1497
|
+
| Core modules | Library modules | Existing patterns, helpers |
|
|
1498
|
+
| Command definitions | Command files | Orchestration patterns |
|
|
1499
|
+
| Agent definitions | Agent files | Agent tool access, prompts |
|
|
1500
|
+
| Hook source | Hook files | Build hooks, event handling |
|
|
1501
|
+
| Test patterns | Test files + helpers | Testing patterns and helpers |
|
|
1502
|
+
| Installer | Install script | Installation flow, file structure |
|
|
1503
|
+
|
|
1504
|
+
### 1.3 Convention Enforcement Checklist
|
|
1505
|
+
Verify the feature design will conform to ALL project conventions. Mark each as confirmed:
|
|
1506
|
+
- [ ] Function naming convention followed
|
|
1507
|
+
- [ ] File reads use safe read pattern (try-catch, return null)
|
|
1508
|
+
- [ ] File writes wrapped in try-catch
|
|
1509
|
+
- [ ] JSON output via standard output function — never console.log
|
|
1510
|
+
- [ ] Errors via standard error function — never console.error or throw to user
|
|
1511
|
+
- [ ] Paths in output pass through path normalization — never raw path.join in output
|
|
1512
|
+
- [ ] Module exports at bottom
|
|
1513
|
+
- [ ] Subcommands dispatched via standard routing pattern
|
|
1514
|
+
- [ ] Module format matches project (CommonJS/ESM)
|
|
1515
|
+
- [ ] Zero runtime dependencies maintained
|
|
1516
|
+
|
|
1517
|
+
### 1.4 Dependency & Integration Map
|
|
1518
|
+
```
|
|
1519
|
+
[This Feature]
|
|
1520
|
+
├── depends on: [existing module A]
|
|
1521
|
+
├── depends on: [existing module B]
|
|
1522
|
+
├── extends: [existing command C]
|
|
1523
|
+
├── conflicts with: [nothing / feature D because...]
|
|
1524
|
+
└── enables: [future feature E]
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
**require()/import chain:** Draw the module dependency path. Verify no circular dependencies.
|
|
1528
|
+
|
|
1529
|
+
---
|
|
1530
|
+
|
|
1531
|
+
## Phase 2: Competitive Intelligence
|
|
1532
|
+
|
|
1533
|
+
**Research how the best AI workflow tools solve this problem.**
|
|
1534
|
+
|
|
1535
|
+
### 2.1 Deep-Dive Research (6 Tools)
|
|
1536
|
+
For EACH tool, use web search for their current approach:
|
|
1537
|
+
|
|
1538
|
+
| Tool | Focus Areas |
|
|
1539
|
+
|------|-------------|
|
|
1540
|
+
| **Aider** | Session management, context handling, git integration |
|
|
1541
|
+
| **Cursor** | Agent mode, composer, multi-file editing, context |
|
|
1542
|
+
| **Continue.dev** | IDE integration, context providers, slash commands |
|
|
1543
|
+
| **Cline** | Autonomous coding, approval workflows, tool use |
|
|
1544
|
+
| **Windsurf** | Cascade flows, context awareness, multi-step tasks |
|
|
1545
|
+
| **GitHub Copilot Workspace** | Task decomposition, plan-execute-verify patterns |
|
|
1546
|
+
|
|
1547
|
+
For each, extract: **UX** (how invoked), **Behavior** (guarantees), **Ergonomics** (love/hate), **Pitfalls** (known limits), **Evolution** (what they got wrong first).
|
|
1548
|
+
|
|
1549
|
+
### 2.2 Prior Art & Community Research
|
|
1550
|
+
Search for: blog posts from AI tooling creators, Reddit/HN discussions, open issues in competing tools.
|
|
1551
|
+
|
|
1552
|
+
### 2.3 Competitive Matrix
|
|
1553
|
+
```
|
|
1554
|
+
| Aspect | PAN (Current) | Aider | Cursor | Continue | Cline | Windsurf | Copilot WS | Best |
|
|
1555
|
+
|--------|--------------|-------|--------|----------|-------|----------|------------|------|
|
|
1556
|
+
| UX | ... | ... | ... | ... | ... | ... | ... | ... |
|
|
1557
|
+
| Context | ... | ... | ... | ... | ... | ... | ... | ... |
|
|
1558
|
+
| Reliability | ... | ... | ... | ... | ... | ... | ... | ... |
|
|
1559
|
+
```
|
|
1560
|
+
|
|
1561
|
+
---
|
|
1562
|
+
|
|
1563
|
+
## Phase 2.5: Reality Check (OPTIONAL — only with `--audit` flag)
|
|
1564
|
+
|
|
1565
|
+
If any related implementation already exists, verify it's real:
|
|
1566
|
+
- [ ] File existence check (not just claimed in docs)
|
|
1567
|
+
- [ ] Code substance check (not stubs or TODOs)
|
|
1568
|
+
- [ ] Actually run it and verify output
|
|
1569
|
+
- [ ] Test validity check (tests assert real behavior, not just existence)
|
|
1570
|
+
- [ ] Truth table: `| Item | Claimed | Real | Verdict |`
|
|
1571
|
+
|
|
1572
|
+
---
|
|
1573
|
+
|
|
1574
|
+
## Phase 3: Strategic Analysis
|
|
1575
|
+
|
|
1576
|
+
### 3.1 Blue Ocean Four Actions Framework
|
|
1577
|
+
| Action | Question | Decisions |
|
|
1578
|
+
|--------|----------|-----------|
|
|
1579
|
+
| **ELIMINATE** | What should we drop? | (e.g., complex config, IDE lock-in) |
|
|
1580
|
+
| **REDUCE** | What should be reduced? | (e.g., boilerplate, setup time) |
|
|
1581
|
+
| **RAISE** | What should be raised? | (e.g., context quality, verification) |
|
|
1582
|
+
| **CREATE** | What should we create? | (e.g., context rot prevention, state persistence) |
|
|
1583
|
+
|
|
1584
|
+
### 3.2 Wardley Evolution Assessment
|
|
1585
|
+
```
|
|
1586
|
+
Genesis ──── Custom-Built ──── Product ──── Commodity
|
|
1587
|
+
```
|
|
1588
|
+
- Where is this feature in the INDUSTRY?
|
|
1589
|
+
- Where should we position it?
|
|
1590
|
+
- What evolution in 2-3 years? (plan for it now)
|
|
1591
|
+
|
|
1592
|
+
### 3.3 Strategic Moat Analysis
|
|
1593
|
+
| Moat Type | Contribution | Score (0-5) |
|
|
1594
|
+
|-----------|-------------|-------------|
|
|
1595
|
+
| **Context Engineering** | Improve context quality for AI assistants? | |
|
|
1596
|
+
| **Cross-Platform** | Works across all supported runtimes? | |
|
|
1597
|
+
| **Developer Experience** | Meaningfully better than alternatives? | |
|
|
1598
|
+
| **Zero Dependencies** | Maintains zero-runtime-deps promise? | |
|
|
1599
|
+
| **State Persistence** | Improves cross-session continuity? | |
|
|
1600
|
+
| **Verification Quality** | Strengthens verify-before-ship guarantee? | |
|
|
1601
|
+
|
|
1602
|
+
### 3.4 Strategic Recommendation
|
|
1603
|
+
Based on 3.1-3.3 AND Phase 0 demand evidence, write a 1-paragraph recommendation:
|
|
1604
|
+
- Should we build this? (Yes / No / Modified)
|
|
1605
|
+
- What's our unique angle?
|
|
1606
|
+
- What should we explicitly NOT copy?
|
|
1607
|
+
- What's the strategic timing?
|
|
1608
|
+
|
|
1609
|
+
**If `--gate` flag: STOP HERE and present Phases 0-3 for user approval.**
|
|
1610
|
+
|
|
1611
|
+
---
|
|
1612
|
+
|
|
1613
|
+
## Phase 3.5: Architecture & Implementation Pattern Assessment
|
|
1614
|
+
|
|
1615
|
+
**Design with the project's architecture, not against it.**
|
|
1616
|
+
|
|
1617
|
+
### 3.5.1 Feature Type Classification
|
|
1618
|
+
| Type | Description | Template |
|
|
1619
|
+
|------|-------------|----------|
|
|
1620
|
+
| **New Command** | New CLI subcommand | Add to dispatcher + lib module |
|
|
1621
|
+
| **New Agent** | Specialized subagent | New agent file, register in settings |
|
|
1622
|
+
| **New Hook** | Build/event hook | New hook source, build with bundler |
|
|
1623
|
+
| **Core Enhancement** | Modify existing module | Edit lib module, update tests |
|
|
1624
|
+
| **Workflow** | New command orchestrator | New command file |
|
|
1625
|
+
| **Installer** | Change to install script | Modify installer, test with e2e |
|
|
1626
|
+
|
|
1627
|
+
### 3.5.2 Layer Violation Check
|
|
1628
|
+
Verify:
|
|
1629
|
+
- [ ] Command files do NOT call core modules directly — they invoke CLI
|
|
1630
|
+
- [ ] Core modules return data — they do NOT import or depend on agent files
|
|
1631
|
+
- [ ] New module does NOT call output() from a helper function — only from cmd* entry points
|
|
1632
|
+
- [ ] No upward dependencies (lib module must not require dispatcher)
|
|
1633
|
+
|
|
1634
|
+
### 3.5.3 Output Contract Design (Contract-First)
|
|
1635
|
+
Define the JSON schema BEFORE implementation:
|
|
1636
|
+
```json
|
|
1637
|
+
{
|
|
1638
|
+
"field1": "type — description",
|
|
1639
|
+
"field2": "type — description",
|
|
1640
|
+
"error": "string — only present on failure"
|
|
1641
|
+
}
|
|
1642
|
+
```
|
|
1643
|
+
|
|
1644
|
+
**Contract rules:**
|
|
1645
|
+
- [ ] Field names use project convention (camelCase)
|
|
1646
|
+
- [ ] No field name collisions with existing command output
|
|
1647
|
+
- [ ] Error shape consistent with all other commands
|
|
1648
|
+
- [ ] Paths in output normalized — relative to project root, never absolute
|
|
1649
|
+
- [ ] Output size < 10KB typical, < 50KB max
|
|
1650
|
+
|
|
1651
|
+
### 3.5.4 State Transition Modeling
|
|
1652
|
+
**Required if the feature mutates state or planning files.**
|
|
1653
|
+
|
|
1654
|
+
| Current State | Action | New State | Error If Invalid |
|
|
1655
|
+
|--------------|--------|-----------|-----------------|
|
|
1656
|
+
| [state A] | [this command] | [state B] | [error message] |
|
|
1657
|
+
|
|
1658
|
+
### 3.5.5 Breaking Change Assessment
|
|
1659
|
+
| Question | Answer |
|
|
1660
|
+
|----------|--------|
|
|
1661
|
+
| Changes any existing command's output schema? | Yes/No |
|
|
1662
|
+
| Changes file formats? | Yes/No |
|
|
1663
|
+
| Changes directory structure? | Yes/No |
|
|
1664
|
+
| Changes installer output? | Yes/No |
|
|
1665
|
+
|
|
1666
|
+
**If ANY answer is Yes:** Define a migration strategy.
|
|
1667
|
+
|
|
1668
|
+
### 3.5.6 Composability Analysis
|
|
1669
|
+
| Interaction | Works? | How |
|
|
1670
|
+
|-------------|--------|-----|
|
|
1671
|
+
| Output feeds another command's input | Yes/No | [which command] |
|
|
1672
|
+
| Callable from an agent | Yes/No | [how] |
|
|
1673
|
+
| Usable in a hook pipeline | Yes/No | [how] |
|
|
1674
|
+
| Works in --raw mode for humans | Yes/No | [raw output format] |
|
|
1675
|
+
|
|
1676
|
+
### 3.5.7 Performance Budget
|
|
1677
|
+
| Operation | Cost | Notes |
|
|
1678
|
+
|-----------|------|-------|
|
|
1679
|
+
| File reads (N × ~5ms) | ~Xms | [list files] |
|
|
1680
|
+
| Markdown parsing | ~Xms | [if applicable] |
|
|
1681
|
+
| Computation | ~Xms | [describe] |
|
|
1682
|
+
| File writes (N × ~5ms) | ~Xms | [list files] |
|
|
1683
|
+
| **Total** | **< 500ms** | Justify if exceeding |
|
|
1684
|
+
|
|
1685
|
+
### 3.5.8 Cross-Platform Considerations
|
|
1686
|
+
| Platform | Consideration |
|
|
1687
|
+
|----------|---------------|
|
|
1688
|
+
| Windows | Path separators, shell escaping, CRLF, 260-char path limit |
|
|
1689
|
+
| Mac/Linux | POSIX paths, case-sensitive filesystem |
|
|
1690
|
+
| All | path.join() everywhere, no hardcoded separators |
|
|
1691
|
+
| All AI tools | All supported runtime compatibility |
|
|
1692
|
+
|
|
1693
|
+
---
|
|
1694
|
+
|
|
1695
|
+
## Phase 4: Design Synthesis
|
|
1696
|
+
|
|
1697
|
+
### 4.1 Guide-Level Explanation (User-Facing)
|
|
1698
|
+
Write as if teaching this feature to a user who has never seen it:
|
|
1699
|
+
- Introduce the feature by name
|
|
1700
|
+
- Show 2-3 practical examples with real-world scenarios
|
|
1701
|
+
- Explain how it interacts with existing commands they already know
|
|
1702
|
+
- Show the error messages they'd see if they misuse it
|
|
1703
|
+
- Explain what it does NOT do (prevent confusion)
|
|
1704
|
+
|
|
1705
|
+
### 4.2 Reference-Level Explanation (Technical)
|
|
1706
|
+
|
|
1707
|
+
#### 4.2.1 Command Interface
|
|
1708
|
+
```
|
|
1709
|
+
Command: pan-tools <command> [subcommand] [args]
|
|
1710
|
+
Arguments: [list with types]
|
|
1711
|
+
Output: JSON schema (from 3.5.3)
|
|
1712
|
+
Exit codes: 0 = success, 1 = error
|
|
1713
|
+
```
|
|
1714
|
+
|
|
1715
|
+
#### 4.2.2 State Changes & Filesystem Scope
|
|
1716
|
+
```
|
|
1717
|
+
Reads from: [list — must be within project root]
|
|
1718
|
+
Writes to: [list — must be within .planning/ or project root]
|
|
1719
|
+
State mutations: [state changes]
|
|
1720
|
+
Side effects: [git operations, directory creation, etc.]
|
|
1721
|
+
```
|
|
1722
|
+
|
|
1723
|
+
#### 4.2.3 Error Handling
|
|
1724
|
+
Every error condition must specify:
|
|
1725
|
+
| Condition | JSON Output | Error Style |
|
|
1726
|
+
|-----------|-------------|-------------|
|
|
1727
|
+
| [missing file] | {"error": "X not found"} | safe read returns null |
|
|
1728
|
+
| [bad args] | {"error": "X required"} | arg validation before fs ops |
|
|
1729
|
+
|
|
1730
|
+
### 4.3 Design Decisions
|
|
1731
|
+
| Decision | Adopted From | Rationale | What We Did NOT Copy (and Why) |
|
|
1732
|
+
|----------|-------------|-----------|-------------------------------|
|
|
1733
|
+
|
|
1734
|
+
### 4.4 Drawbacks & Alternatives
|
|
1735
|
+
| Decision Point | Chosen | Alternative | Why Not | Drawback of Chosen |
|
|
1736
|
+
|----------------|--------|------------|---------|-------------------|
|
|
1737
|
+
|
|
1738
|
+
### 4.5 Feature Ladder (Incremental Delivery)
|
|
1739
|
+
| Version | Scope | Value Delivered | Effort |
|
|
1740
|
+
|---------|-------|----------------|--------|
|
|
1741
|
+
| **v0 (MVP)** | [smallest useful slice] | [what user can do] | XS-S |
|
|
1742
|
+
| **v1 (Complete)** | [full feature as designed] | [full value] | S-M |
|
|
1743
|
+
| **v2 (Enhanced)** | [future extensions] | [additional value] | M-L |
|
|
1744
|
+
|
|
1745
|
+
### 4.6 Adoption Analysis
|
|
1746
|
+
| Question | Answer |
|
|
1747
|
+
|----------|--------|
|
|
1748
|
+
| How does the user discover this feature? | |
|
|
1749
|
+
| What's the learning curve? | |
|
|
1750
|
+
| Does it require changing existing workflows? | |
|
|
1751
|
+
| What's the "aha moment"? | |
|
|
1752
|
+
|
|
1753
|
+
---
|
|
1754
|
+
|
|
1755
|
+
## Phase 5: Architecture Decision Record
|
|
1756
|
+
|
|
1757
|
+
Create a formal ADR:
|
|
1758
|
+
|
|
1759
|
+
```markdown
|
|
1760
|
+
# ADR-NNNN: [Feature Name]
|
|
1761
|
+
|
|
1762
|
+
## Status
|
|
1763
|
+
Proposed
|
|
1764
|
+
|
|
1765
|
+
## Context
|
|
1766
|
+
[Problem context — what forces are at play?]
|
|
1767
|
+
|
|
1768
|
+
## Decision
|
|
1769
|
+
[What was decided and why]
|
|
1770
|
+
|
|
1771
|
+
## Consequences
|
|
1772
|
+
### Positive
|
|
1773
|
+
- [Benefit 1]
|
|
1774
|
+
### Negative
|
|
1775
|
+
- [Cost 1]
|
|
1776
|
+
### Neutral
|
|
1777
|
+
- [Side effect]
|
|
1778
|
+
|
|
1779
|
+
## Options Considered
|
|
1780
|
+
1. [Option A] — [summary]
|
|
1781
|
+
2. [Option B — chosen] — [summary]
|
|
1782
|
+
|
|
1783
|
+
## Links
|
|
1784
|
+
- Related to: [commands, modules, issues]
|
|
1785
|
+
```
|
|
1786
|
+
|
|
1787
|
+
---
|
|
1788
|
+
|
|
1789
|
+
## Phase 6: Error Handling & Diagnostics Design
|
|
1790
|
+
|
|
1791
|
+
> *Make the feature diagnosable from day one.*
|
|
1792
|
+
|
|
1793
|
+
### 6.1 Failure Mode Analysis
|
|
1794
|
+
| Failure Mode | Category | Detection Pattern | Recovery | User Sees |
|
|
1795
|
+
|-------------|----------|-------------------|----------|-----------|
|
|
1796
|
+
| Missing required file | User error | safe read returns null | JSON error | Actionable error |
|
|
1797
|
+
| Invalid arguments | User error | Arg count/type check | JSON error + hint | Usage guidance |
|
|
1798
|
+
| Disk full/locked | Environment | try-catch on write | Graceful JSON error | No crash |
|
|
1799
|
+
| Race condition | Concurrency | safe read pattern | Return null → error JSON | No crash |
|
|
1800
|
+
| Malformed file content | Data corruption | try-catch on parse | JSON error, skip bad data | Degraded but functional |
|
|
1801
|
+
|
|
1802
|
+
### 6.2 Diagnostic Support
|
|
1803
|
+
| Diagnostic | How | When |
|
|
1804
|
+
|------------|-----|------|
|
|
1805
|
+
| `--raw` flag | Human-readable output instead of JSON | Debugging |
|
|
1806
|
+
| `--cwd <path>` | Override working directory | Testing |
|
|
1807
|
+
| stderr via error() | Error details to stderr | Failures |
|
|
1808
|
+
| JSON `error` field | Machine-readable error | Always on failure |
|
|
1809
|
+
|
|
1810
|
+
---
|
|
1811
|
+
|
|
1812
|
+
## Phase 7: Security & Threat Model
|
|
1813
|
+
|
|
1814
|
+
### 7.1 Asset & Attack Surface Inventory
|
|
1815
|
+
| Asset | Accessed How | Trust Level |
|
|
1816
|
+
|-------|-------------|-------------|
|
|
1817
|
+
| [file/data this feature touches] | Read / Write / Execute | User-controlled / System-generated |
|
|
1818
|
+
|
|
1819
|
+
| Input Vector | Source | Validation Required |
|
|
1820
|
+
|-------------|--------|-------------------|
|
|
1821
|
+
| CLI arguments | User-typed | Type check, length limit, no shell metacharacters |
|
|
1822
|
+
| File contents (*.md, *.json) | Disk (user-writable) | Structure validation, size limit |
|
|
1823
|
+
| Environment variables | OS | Only read known vars, never expose in output |
|
|
1824
|
+
| Path arguments | User-typed | Full path safety protocol (below) |
|
|
1825
|
+
|
|
1826
|
+
### 7.2 Path Safety Protocol (MANDATORY for any path input)
|
|
1827
|
+
1. Resolve to absolute: `path.resolve(cwd, userPath)`
|
|
1828
|
+
2. Verify within project: resolved path starts with `path.resolve(cwd)`
|
|
1829
|
+
3. Reject `..` segments before resolution
|
|
1830
|
+
4. Reject null bytes (`\0`)
|
|
1831
|
+
5. On Windows: reject alternate data streams (`:` after drive letter position 2)
|
|
1832
|
+
|
|
1833
|
+
### 7.3 Output Sanitization
|
|
1834
|
+
- [ ] No absolute filesystem paths in output (use normalized relative paths)
|
|
1835
|
+
- [ ] No environment variable values in output
|
|
1836
|
+
- [ ] No stack traces in error messages
|
|
1837
|
+
- [ ] No internal function names or line numbers in user-facing errors
|
|
1838
|
+
|
|
1839
|
+
### 7.4 Content Validation
|
|
1840
|
+
Every file read must validate structure before processing:
|
|
1841
|
+
- JSON files: `JSON.parse()` inside try-catch, validate expected keys
|
|
1842
|
+
- Markdown files: Check for expected frontmatter or section headers
|
|
1843
|
+
- Never pass raw file content to `eval()`, `Function()`, or template strings
|
|
1844
|
+
|
|
1845
|
+
### 7.5 Privilege Scope Declaration
|
|
1846
|
+
```
|
|
1847
|
+
Reads from: [explicit directory list — must be within project root]
|
|
1848
|
+
Writes to: [explicit directory list — must be within .planning/ or project root]
|
|
1849
|
+
Executes shell: [Yes/No — if yes, what commands and why]
|
|
1850
|
+
Reads outside project: [Yes/No — if yes, justify]
|
|
1851
|
+
```
|
|
1852
|
+
|
|
1853
|
+
---
|
|
1854
|
+
|
|
1855
|
+
## Phase 8: Implementation Roadmap
|
|
1856
|
+
|
|
1857
|
+
### 8.1 Command .md Definition (DRAFT NOW — not deferred)
|
|
1858
|
+
Draft the command file content. The command file IS the interface for AI tools.
|
|
1859
|
+
|
|
1860
|
+
### 8.2 Implementation Tasks (Ordered)
|
|
1861
|
+
Break into small, independently testable units:
|
|
1862
|
+
|
|
1863
|
+
```
|
|
1864
|
+
### Task 1: [Core module changes]
|
|
1865
|
+
Files: [paths]
|
|
1866
|
+
Test: [test command]
|
|
1867
|
+
Estimate: XS/S/M/L
|
|
1868
|
+
Priority: P[0-6]
|
|
1869
|
+
|
|
1870
|
+
### Task 2: [CLI dispatcher routing]
|
|
1871
|
+
...
|
|
1872
|
+
```
|
|
1873
|
+
|
|
1874
|
+
### 8.3 Dependency Graph
|
|
1875
|
+
```
|
|
1876
|
+
Task 1 → Task 2 → Task 3 → ...
|
|
1877
|
+
```
|
|
1878
|
+
|
|
1879
|
+
### 8.4 Risk Register
|
|
1880
|
+
| Risk | Probability | Impact | Mitigation |
|
|
1881
|
+
|------|------------|--------|------------|
|
|
1882
|
+
|
|
1883
|
+
### 8.5 Cognitive Complexity Budget
|
|
1884
|
+
- Max lines per function: 50
|
|
1885
|
+
- Max nesting depth: 3 levels
|
|
1886
|
+
- Max parameters: 4 (use options object if more needed)
|
|
1887
|
+
|
|
1888
|
+
---
|
|
1889
|
+
|
|
1890
|
+
## Phase 9: Test Plan
|
|
1891
|
+
|
|
1892
|
+
### 9.1 Test Pyramid (enforced counts)
|
|
1893
|
+
| Level | Pattern | Minimum Count | What It Catches |
|
|
1894
|
+
|-------|---------|---------------|-----------------|
|
|
1895
|
+
| **Unit** | Test individual functions, mock fs | 5+ | Logic bugs, edge cases |
|
|
1896
|
+
| **Integration** | CLI with real filesystem | 5+ | Wiring bugs, arg parsing, JSON output |
|
|
1897
|
+
| **E2E** | Multi-command workflow sequences | 2+ | State transitions, cross-command interaction |
|
|
1898
|
+
|
|
1899
|
+
### 9.2 Assertion Density Requirements
|
|
1900
|
+
Every test must assert AT MINIMUM:
|
|
1901
|
+
- **Success tests:** (a) correct JSON shape, (b) correct values for ≥ 2 fields, (c) no `error` field
|
|
1902
|
+
- **Error tests:** (a) `error` field with actionable message, (b) no data corruption, (c) clean exit
|
|
1903
|
+
|
|
1904
|
+
### 9.3 Boundary Value Analysis
|
|
1905
|
+
Test these boundary conditions:
|
|
1906
|
+
- [ ] Empty project (no phases, no roadmap, no state)
|
|
1907
|
+
- [ ] Minimal vs maximal project size
|
|
1908
|
+
- [ ] Edge case names (hyphens, underscores, numbers)
|
|
1909
|
+
- [ ] Missing file between check and read (race condition)
|
|
1910
|
+
- [ ] Windows path length near 260-char limit
|
|
1911
|
+
- [ ] File locked by another process
|
|
1912
|
+
- [ ] Malformed/corrupted input files
|
|
1913
|
+
|
|
1914
|
+
### 9.4 Regression Verification
|
|
1915
|
+
- [ ] Full suite passes unchanged
|
|
1916
|
+
- [ ] Related modules explicitly re-tested
|
|
1917
|
+
- [ ] No existing test expectations changed
|
|
1918
|
+
|
|
1919
|
+
### 9.5 Performance Validation
|
|
1920
|
+
- [ ] Command completes in < 500ms for typical usage
|
|
1921
|
+
- [ ] No regression in full test suite runtime
|
|
1922
|
+
- [ ] Output < 10KB for typical usage
|
|
1923
|
+
|
|
1924
|
+
---
|
|
1925
|
+
|
|
1926
|
+
## Phase 10: Output Artifacts
|
|
1927
|
+
|
|
1928
|
+
### 10.1 Save Specification Document
|
|
1929
|
+
Write complete spec to: `docs/specs/<feature_name>_featureai.md`
|
|
1930
|
+
|
|
1931
|
+
### 10.2 Save ADR
|
|
1932
|
+
Write ADR to: `docs/decisions/ADR-NNNN-<feature_name>.md`
|
|
1933
|
+
|
|
1934
|
+
### 10.3 Report Summary
|
|
1935
|
+
Output a complete summary with: problem & evidence, strategic assessment (Blue Ocean, Wardley, Moat Score, Cognitive Load, Recommendation), design summary, feature ladder, implementation tasks, security assessment, adoption analysis, and next steps.
|
|
1936
|
+
|
|
1937
|
+
---
|
|
1938
|
+
|
|
1939
|
+
## NEVER DO
|
|
1940
|
+
|
|
1941
|
+
- Design without proving the problem exists (Phase 0 demand evidence is mandatory)
|
|
1942
|
+
- Skip competitive research — must be best-of-breed
|
|
1943
|
+
- Copy a tool's design without understanding WHY they made that choice
|
|
1944
|
+
- Add runtime dependencies (zero-dep constraint is absolute)
|
|
1945
|
+
- Add a feature without error handling design (Phase 6)
|
|
1946
|
+
- Skip cross-platform considerations (Windows, Mac, AND Linux)
|
|
1947
|
+
- Produce a spec without measurable success criteria
|
|
1948
|
+
- Produce a spec without a test plan with enforced assertion density
|
|
1949
|
+
- Trust existing implementation claims without `--audit` verification
|
|
1950
|
+
- Design in isolation — always map dependencies and integration points
|
|
1951
|
+
- Use `eval()`, `Function()`, string interpolation in shell commands, or unvalidated paths
|
|
1952
|
+
- Violate layer boundaries (commands → agents → lib → dispatcher)
|
|
1953
|
+
- Expose absolute paths, stack traces, or env vars in output
|
|
1954
|
+
- Change existing command output schemas without a migration strategy
|
|
1955
|
+
- Defer the command file definition to "documentation" — draft it during design
|
|
1956
|
+
- Create functions exceeding 50 lines or 3 nesting levels
|
|
1957
|
+
- Add a command scoring +2 on cognitive load without explicit justification
|
|
1958
|
+
- Ship a feature with no demand evidence and no strategic justification
|
|
1959
|
+
|
|
1960
|
+
## ALWAYS DO
|
|
1961
|
+
|
|
1962
|
+
- Start from the USER's problem, not the technology
|
|
1963
|
+
- Gather demand evidence before committing to design
|
|
1964
|
+
- Check all existing commands + agents for overlap before proposing new ones
|
|
1965
|
+
- Research at least 6 competitor tools before designing
|
|
1966
|
+
- Apply Blue Ocean thinking — find where to CREATE, not just copy
|
|
1967
|
+
- Define the JSON output contract BEFORE implementation design (contract-first)
|
|
1968
|
+
- Write the guide-level explanation BEFORE the reference-level
|
|
1969
|
+
- Draft the command file as part of the spec (it IS the AI interface)
|
|
1970
|
+
- Plan for failure (error messages, graceful degradation, clear JSON errors)
|
|
1971
|
+
- Follow the error message style guide (actionable hints, no stack traces)
|
|
1972
|
+
- Apply the path safety protocol for any user-supplied path input
|
|
1973
|
+
- Validate file content structure before processing (never trust disk contents)
|
|
1974
|
+
- Follow existing patterns for output, errors, file reading
|
|
1975
|
+
- Maintain zero runtime dependencies
|
|
1976
|
+
- Enforce the test pyramid (unit ≥ 5, integration ≥ 5, e2e ≥ 2)
|
|
1977
|
+
- Verify dependency chain has no cycles
|
|
1978
|
+
- Stay within cognitive complexity budget (50 lines, 3 nesting, 4 params)
|
|
1979
|
+
- Define a feature ladder (v0 MVP → v1 complete → v2 enhanced)
|
|
1980
|
+
- Model adoption friction (discovery, learning curve, aha moment)
|
|
1981
|
+
- Produce a complete spec with ADR, ready for implementation
|
|
1982
|
+
```
|
|
1983
|
+
|
|
1984
|
+
---
|
|
1985
|
+
|
|
1986
|
+
#### /pan:focus-sync — Documentation Synchronization
|
|
1987
|
+
|
|
1988
|
+
```markdown
|
|
1989
|
+
---
|
|
1990
|
+
name: focus-sync
|
|
1991
|
+
group: Focus
|
|
1992
|
+
---
|
|
1993
|
+
|
|
1994
|
+
# /pan:focus-sync — Documentation Synchronization
|
|
1995
|
+
|
|
1996
|
+
Synchronize project documentation after code changes. $ARGUMENTS
|
|
1997
|
+
|
|
1998
|
+
**Goal:** Detect and fix documentation drift — stale counts, outdated command references, missing CHANGELOG entries, inconsistent descriptions across README, user guide, architecture docs, and command files.
|
|
1999
|
+
|
|
2000
|
+
---
|
|
2001
|
+
|
|
2002
|
+
## MANDATORY: Execute ALL Checks
|
|
2003
|
+
|
|
2004
|
+
When `/pan:focus-sync` is invoked, run ALL sync operations. Report what changed.
|
|
2005
|
+
|
|
2006
|
+
**Flags:**
|
|
2007
|
+
- `--check-only` — Report what would change without modifying files
|
|
2008
|
+
- `--readme` — Update README.md only
|
|
2009
|
+
- `--commands` — Verify command files match implementations
|
|
2010
|
+
- `--agents` — Verify agent files are consistent
|
|
2011
|
+
- `--all` — Full sync of everything (default)
|
|
2012
|
+
|
|
2013
|
+
---
|
|
2014
|
+
|
|
2015
|
+
## Sync Operations
|
|
2016
|
+
|
|
2017
|
+
### 1. README Sync
|
|
2018
|
+
1. Read `README.md`
|
|
2019
|
+
2. Cross-reference with `package.json` for version, description
|
|
2020
|
+
3. Verify command count matches actual command files
|
|
2021
|
+
4. Verify agent count matches actual agent files
|
|
2022
|
+
5. Verify module count matches actual core modules
|
|
2023
|
+
6. Update any stale counts or descriptions
|
|
2024
|
+
|
|
2025
|
+
### 2. User Guide Sync
|
|
2026
|
+
1. Read user guide docs
|
|
2027
|
+
2. Verify all documented commands exist
|
|
2028
|
+
3. Verify command descriptions match implementations
|
|
2029
|
+
4. Update examples if behavior changed
|
|
2030
|
+
|
|
2031
|
+
### 3. Command File Sync
|
|
2032
|
+
1. List all command files
|
|
2033
|
+
2. Cross-reference with dispatcher routing
|
|
2034
|
+
3. Verify each command routes correctly
|
|
2035
|
+
4. Report orphaned commands or missing routes
|
|
2036
|
+
|
|
2037
|
+
### 4. Agent Sync
|
|
2038
|
+
1. List all agent files
|
|
2039
|
+
2. Cross-reference with agent references in workflows
|
|
2040
|
+
3. Verify agent names match between definitions and references
|
|
2041
|
+
|
|
2042
|
+
### 5. CHANGELOG Sync
|
|
2043
|
+
1. Read recent git commits since last CHANGELOG entry
|
|
2044
|
+
2. Group by type (feat/fix/docs/refactor)
|
|
2045
|
+
3. Add missing entries
|
|
2046
|
+
|
|
2047
|
+
### 6. Architecture Sync
|
|
2048
|
+
1. Cross-reference architecture docs with actual module structure
|
|
2049
|
+
2. Flag stale diagrams or outdated module descriptions
|
|
2050
|
+
|
|
2051
|
+
---
|
|
2052
|
+
|
|
2053
|
+
## Source of Truth Hierarchy
|
|
2054
|
+
|
|
2055
|
+
```
|
|
2056
|
+
package.json ← Version, description, entry points
|
|
2057
|
+
↓
|
|
2058
|
+
README.md ← Public documentation
|
|
2059
|
+
↓
|
|
2060
|
+
docs/USER-GUIDE.md ← Detailed user guide
|
|
2061
|
+
↓
|
|
2062
|
+
CHANGELOG.md ← Version history
|
|
2063
|
+
```
|
|
2064
|
+
|
|
2065
|
+
---
|
|
2066
|
+
|
|
2067
|
+
## Output
|
|
2068
|
+
|
|
2069
|
+
```json
|
|
2070
|
+
{
|
|
2071
|
+
"updated": ["README.md", "CHANGELOG.md"],
|
|
2072
|
+
"skipped": ["docs/ARCHITECTURE.md"],
|
|
2073
|
+
"changes_summary": "Updated command count 32→37, added Focus group to help"
|
|
2074
|
+
}
|
|
2075
|
+
```
|
|
2076
|
+
|
|
2077
|
+
## Report Table
|
|
2078
|
+
|
|
2079
|
+
```
|
|
2080
|
+
| Area | Status | Changes Made |
|
|
2081
|
+
|------|--------|--------------|
|
|
2082
|
+
| README | ✅ | Updated command count |
|
|
2083
|
+
| Commands | ✅ | No changes |
|
|
2084
|
+
| Agents | ⚠️ | Missing workflow for X |
|
|
2085
|
+
| CHANGELOG | ✅ | Added 3 entries |
|
|
2086
|
+
```
|
|
2087
|
+
```
|
|
2088
|
+
|
|
2089
|
+
### 8.2 Implementation Tasks
|
|
2090
|
+
|
|
2091
|
+
#### v0 (MVP) — 7 tasks
|
|
2092
|
+
|
|
2093
|
+
```
|
|
2094
|
+
### Task 1: Create focus.cjs core module — scan functions
|
|
2095
|
+
Files: pan-wizard-core/bin/lib/focus.cjs
|
|
2096
|
+
What: cmdFocusScan() — read ROADMAP, phases, todos, patterns, grep TODO/FIXME.
|
|
2097
|
+
classifyItemPriority() — assign P0-P6 from source type.
|
|
2098
|
+
collectWorkItems() — aggregate from all sources.
|
|
2099
|
+
sortByPriority() — P0 first, then by effort (smallest first within tier).
|
|
2100
|
+
Test: node --test tests/focus.test.cjs
|
|
2101
|
+
Estimate: M
|
|
2102
|
+
Priority: P3
|
|
2103
|
+
|
|
2104
|
+
### Task 2: Create focus.cjs — plan functions
|
|
2105
|
+
Files: pan-wizard-core/bin/lib/focus.cjs
|
|
2106
|
+
What: cmdFocusPlan() — read scan results, allocate by budget, write batch file.
|
|
2107
|
+
allocateBudget() — P0 mandatory, then fill by priority + smallest-first.
|
|
2108
|
+
Test: node --test tests/focus.test.cjs
|
|
2109
|
+
Estimate: S
|
|
2110
|
+
Priority: P3
|
|
2111
|
+
|
|
2112
|
+
### Task 3: Create focus.cjs — sync functions
|
|
2113
|
+
Files: pan-wizard-core/bin/lib/focus.cjs
|
|
2114
|
+
What: cmdFocusSync() — read git diff, identify stale docs, report changes.
|
|
2115
|
+
checkDocStaleness() — compare command counts, module counts against docs.
|
|
2116
|
+
Test: node --test tests/focus.test.cjs
|
|
2117
|
+
Estimate: S
|
|
2118
|
+
Priority: P3
|
|
2119
|
+
|
|
2120
|
+
### Task 4: Wire focus commands into pan-tools.cjs dispatcher
|
|
2121
|
+
Files: pan-wizard-core/bin/pan-tools.cjs
|
|
2122
|
+
What: Add 'focus' top-level command with scan/plan/sync subcommands.
|
|
2123
|
+
Test: Unknown subcommand test + successful routing tests
|
|
2124
|
+
Estimate: S
|
|
2125
|
+
Priority: P3
|
|
2126
|
+
|
|
2127
|
+
### Task 5: Add optional priority/effort to frontmatter validation
|
|
2128
|
+
Files: pan-wizard-core/bin/lib/frontmatter.cjs
|
|
2129
|
+
What: Validate priority (P0-P6) and effort (XS-XL) when present in plan.md frontmatter.
|
|
2130
|
+
Return defaults (P3, M) when absent.
|
|
2131
|
+
Test: node --test tests/frontmatter.test.cjs
|
|
2132
|
+
Estimate: XS
|
|
2133
|
+
Priority: P3
|
|
2134
|
+
|
|
2135
|
+
### Task 6: Create 3 command .md files + update help
|
|
2136
|
+
Files: commands/pan/focus-scan.md, focus-plan.md, focus-sync.md, help workflow
|
|
2137
|
+
What: Command definitions for v0 commands. Add Focus group to help.md.
|
|
2138
|
+
Test: Commands appear in help output
|
|
2139
|
+
Estimate: S
|
|
2140
|
+
Priority: P3
|
|
2141
|
+
|
|
2142
|
+
### Task 7: Tests — unit + integration for v0
|
|
2143
|
+
Files: tests/focus.test.cjs
|
|
2144
|
+
What: Unit tests for scan, plan, sync functions. Integration tests via runPanTools.
|
|
2145
|
+
Minimum: 15 unit + 10 integration + 2 e2e.
|
|
2146
|
+
Test: npm test — all pass
|
|
2147
|
+
Estimate: M
|
|
2148
|
+
Priority: P3
|
|
2149
|
+
```
|
|
2150
|
+
|
|
2151
|
+
#### v1 (Complete) — 5 tasks
|
|
2152
|
+
|
|
2153
|
+
```
|
|
2154
|
+
### Task 8: Add focus-exec to focus.cjs
|
|
2155
|
+
Files: pan-wizard-core/bin/lib/focus.cjs
|
|
2156
|
+
What: cmdFocusExec() — read batch, classify tiers, execute with shortcuts.
|
|
2157
|
+
executeMicroBatch() — group XS/S items, targeted tests.
|
|
2158
|
+
executeStandard() — full test per item.
|
|
2159
|
+
executeFull() — design review + implement + build + test.
|
|
2160
|
+
Test: node --test tests/focus.test.cjs
|
|
2161
|
+
Estimate: L
|
|
2162
|
+
Priority: P3
|
|
2163
|
+
|
|
2164
|
+
### Task 9: Add focus-design workflow
|
|
2165
|
+
Files: commands/pan/focus-design.md, agents/ (if needed)
|
|
2166
|
+
What: Full 10-phase strategic investigation pipeline as command .md workflow.
|
|
2167
|
+
Phase 0: Problem Framing → Phase 1: Internal Recon → Phase 2: Competitive Intel →
|
|
2168
|
+
Phase 2.5: Reality Check (--audit) → Phase 3: Strategic Analysis (Blue Ocean, Wardley, Moat) →
|
|
2169
|
+
Phase 3.5: Architecture Assessment → Phase 4: Design Synthesis →
|
|
2170
|
+
Phase 5: ADR → Phase 6: Error Handling → Phase 7: Security →
|
|
2171
|
+
Phase 8: Implementation Roadmap → Phase 9: Test Plan → Phase 10: Output Artifacts.
|
|
2172
|
+
Modes: --full (all 10 phases), --internal (skip competitive intel),
|
|
2173
|
+
--outward (skip hardening phases 6-7), --spike (fast prototype).
|
|
2174
|
+
Modifiers: --gate (pause after Phase 3), --audit (add Phase 2.5), --mvp (stop after v0 tasks).
|
|
2175
|
+
Test: Design output produces valid spec file + ADR
|
|
2176
|
+
Estimate: L
|
|
2177
|
+
Priority: P3
|
|
2178
|
+
|
|
2179
|
+
### Task 10: Wire exec + design into dispatcher + help
|
|
2180
|
+
Files: pan-tools.cjs, help workflow, 2 command .md files
|
|
2181
|
+
What: Add exec and design subcommands. Update help with all 5 Focus commands.
|
|
2182
|
+
Test: All 5 commands routable
|
|
2183
|
+
Estimate: S
|
|
2184
|
+
Priority: P3
|
|
2185
|
+
|
|
2186
|
+
### Task 11: Full test suite for v1
|
|
2187
|
+
Files: tests/focus.test.cjs
|
|
2188
|
+
What: Add exec and design tests. Total target: 30+ unit, 15+ integration, 5+ e2e.
|
|
2189
|
+
Test: npm test — all pass
|
|
2190
|
+
Estimate: M
|
|
2191
|
+
Priority: P3
|
|
2192
|
+
|
|
2193
|
+
### Task 12: Installer + documentation
|
|
2194
|
+
Files: bin/install.js, README.md, USER-GUIDE.md, CHANGELOG.md, ARCHITECTURE.md
|
|
2195
|
+
What: Register Focus commands in installer for all 5 runtimes. Update all docs.
|
|
2196
|
+
Test: E2E install test includes Focus commands
|
|
2197
|
+
Estimate: M
|
|
2198
|
+
Priority: P4
|
|
2199
|
+
```
|
|
2200
|
+
|
|
2201
|
+
### 8.3 Dependency Graph
|
|
2202
|
+
|
|
2203
|
+
```
|
|
2204
|
+
Task 1 (Scan core)
|
|
2205
|
+
├─→ Task 2 (Plan core)
|
|
2206
|
+
├─→ Task 3 (Sync core)
|
|
2207
|
+
└─→ Task 5 (Frontmatter validation)
|
|
2208
|
+
│
|
|
2209
|
+
├─→ Task 4 (Dispatcher wiring)
|
|
2210
|
+
│ └─→ Task 6 (Command .md + help)
|
|
2211
|
+
│ └─→ Task 7 (v0 Tests)
|
|
2212
|
+
│ │
|
|
2213
|
+
│ ▼
|
|
2214
|
+
│ Task 8 (Exec core) ─→ Task 9 (Design workflow)
|
|
2215
|
+
│ │
|
|
2216
|
+
│ ▼
|
|
2217
|
+
│ Task 10 (v1 Dispatcher + help)
|
|
2218
|
+
│ │
|
|
2219
|
+
│ ▼
|
|
2220
|
+
│ Task 11 (v1 Tests)
|
|
2221
|
+
│ │
|
|
2222
|
+
│ ▼
|
|
2223
|
+
└──────────────────────────────→ Task 12 (Installer + docs)
|
|
2224
|
+
```
|
|
2225
|
+
|
|
2226
|
+
### 8.4 Risk Register
|
|
2227
|
+
|
|
2228
|
+
| Risk | Probability | Impact | Mitigation |
|
|
2229
|
+
|------|------------|--------|------------|
|
|
2230
|
+
| Breaks existing tests | Low | High | Run full suite after each task |
|
|
2231
|
+
| focus.cjs grows too large | Medium | Medium | Extract helpers early, cap at 400 LOC |
|
|
2232
|
+
| Codebase TODO scanning is slow | Low | Medium | Limit to .planning/ + source dirs, skip node_modules |
|
|
2233
|
+
| Batch file format changes | Low | Medium | Version field in batch JSON |
|
|
2234
|
+
| Users confused by Focus vs Phase | Medium | Low | Clear help text distinguishing the two |
|
|
2235
|
+
|
|
2236
|
+
### 8.5 Cognitive Complexity Budget
|
|
2237
|
+
|
|
2238
|
+
- Max lines per function: 50
|
|
2239
|
+
- Max nesting depth: 3
|
|
2240
|
+
- Max parameters: 4 (use options object for scan filters)
|
|
2241
|
+
|
|
2242
|
+
---
|
|
2243
|
+
|
|
2244
|
+
## Phase 9: Test Plan
|
|
2245
|
+
|
|
2246
|
+
### 9.1 Test Pyramid
|
|
2247
|
+
|
|
2248
|
+
| Level | Pattern | Minimum Count | What It Catches |
|
|
2249
|
+
|-------|---------|---------------|-----------------|
|
|
2250
|
+
| **Unit** | Test scan/plan/sync/exec functions directly | 20+ | Logic bugs, priority sorting, budget math |
|
|
2251
|
+
| **Integration** | `runPanTools('focus scan', tmpDir)` | 15+ | Dispatcher wiring, JSON output, error handling |
|
|
2252
|
+
| **E2E** | Multi-command: scan → plan → exec → sync | 5+ | State transitions, batch file roundtrip |
|
|
2253
|
+
|
|
2254
|
+
### 9.2 Assertion Density
|
|
2255
|
+
|
|
2256
|
+
**Success tests assert:**
|
|
2257
|
+
1. JSON shape (all expected fields present)
|
|
2258
|
+
2. Correct priority ordering (P0 before P1)
|
|
2259
|
+
3. Budget math (allocated <= limit)
|
|
2260
|
+
4. No `error` field
|
|
2261
|
+
|
|
2262
|
+
**Error tests assert:**
|
|
2263
|
+
1. `error` + `hint` fields present
|
|
2264
|
+
2. State files unchanged after error
|
|
2265
|
+
3. Clean exit
|
|
2266
|
+
|
|
2267
|
+
### 9.3 Boundary Values
|
|
2268
|
+
|
|
2269
|
+
- [x] Empty project (no phases, no todos, no patterns)
|
|
2270
|
+
- [x] Project with 0 incomplete plans (all phases done)
|
|
2271
|
+
- [x] Budget of 0 (should return empty batch)
|
|
2272
|
+
- [x] Budget of 1000 (should include everything)
|
|
2273
|
+
- [x] All items same priority (sort by effort)
|
|
2274
|
+
- [x] No TODO/FIXME in codebase (scan still works)
|
|
2275
|
+
- [x] Malformed plan.md frontmatter (defaults apply)
|
|
2276
|
+
- [x] Batch file missing when exec runs (clear error)
|
|
2277
|
+
- [x] Batch file with 0 items (no-op exec)
|
|
2278
|
+
|
|
2279
|
+
---
|
|
2280
|
+
|
|
2281
|
+
## Phase 10: Output Artifacts
|
|
2282
|
+
|
|
2283
|
+
### 10.1 Specification saved to: `docs/specs/pan_focus_commands_featureai.md`
|
|
2284
|
+
### 10.2 ADR saved to: `docs/decisions/ADR-0006-focus-commands.md`
|
|
2285
|
+
|
|
2286
|
+
---
|
|
2287
|
+
|
|
2288
|
+
## /featureAI Complete — PAN Focus Commands
|
|
2289
|
+
|
|
2290
|
+
### Problem & Evidence
|
|
2291
|
+
PAN's shipped workflow is phase-scoped with no strategic layer for prioritization, capacity budgeting, or feature design — Evidence: internal usage (15 superplan runs, 16 execplan sessions, 4 featureAI specs), Taskmaster AI (17k+ stars for task prioritization), Claude Code plan mode (2026 GA).
|
|
2292
|
+
|
|
2293
|
+
### Strategic Assessment
|
|
2294
|
+
- Blue Ocean: Eliminate PAN-specific hardcoding + installation friction, Reduce nothing (full pipelines preserved), Raise integration with phase workflow + pipeline rigor, Create unified scan→design→plan→exec→sync pipeline with full 10-phase investigation + 7-phase scanning + 6-stage execution
|
|
2295
|
+
- Wardley: Custom-Built → targeting Product stage
|
|
2296
|
+
- Moat Score: 27/30 — strongest in Context Engineering + Cross-Platform
|
|
2297
|
+
- Cognitive Load: +1 (adds complexity, justified by new group)
|
|
2298
|
+
- Recommendation: Build (ship full uncompromised pipelines as 5 Focus commands)
|
|
2299
|
+
|
|
2300
|
+
### Design Summary
|
|
2301
|
+
- Feature Type: New Core Module + 5 Workflow Commands
|
|
2302
|
+
- Modules Affected: focus.cjs (new), pan-tools.cjs, frontmatter.cjs, help.md
|
|
2303
|
+
- Output Schema: 5 contracts defined (scan, plan, exec, design, sync)
|
|
2304
|
+
- Error Handling: safeReadFile + try-catch + JSON error + hint pattern
|
|
2305
|
+
- Breaking Changes: Additive only (optional frontmatter fields, new directory)
|
|
2306
|
+
- Layer Violations: None
|
|
2307
|
+
|
|
2308
|
+
### Feature Ladder
|
|
2309
|
+
- v0 (MVP): focus-scan + focus-plan + focus-sync — L effort (new module + 3 commands + tests)
|
|
2310
|
+
- v1 (Complete): + focus-exec + focus-design — L effort (2 commands + tier execution + design pipeline)
|
|
2311
|
+
- v2 (Enhanced): + execution modes + pattern remediation + analytics — M-L effort
|
|
2312
|
+
|
|
2313
|
+
### Implementation
|
|
2314
|
+
- Tasks: 12 tasks (7 v0, 5 v1)
|
|
2315
|
+
- Complexity: L (new module + 5 commands + tests + installer + docs)
|
|
2316
|
+
- Files to create: 6 (focus.cjs, 5 command .md files)
|
|
2317
|
+
- Files to modify: 5 (pan-tools.cjs, frontmatter.cjs, help.md, install.js, docs)
|
|
2318
|
+
- Tests planned: 40+ (unit: 20, integration: 15, e2e: 5)
|
|
2319
|
+
|
|
2320
|
+
### Security
|
|
2321
|
+
- Attack surface: Read-only codebase scan, writes to .planning/ and docs/
|
|
2322
|
+
- Path safety: Applied (all within project root)
|
|
2323
|
+
- Output sanitization: Verified (toPosix, no absolute paths)
|
|
2324
|
+
|
|
2325
|
+
### Adoption
|
|
2326
|
+
- Discovery: Focus group in /pan:help, progress command suggests scan
|
|
2327
|
+
- Learning curve: Zero config — run focus-scan and follow the output
|
|
2328
|
+
- Aha moment: First time scan surfaces a P0 bug and plan slots it into a 20-minute batch
|
|
2329
|
+
|
|
2330
|
+
### Documents Created
|
|
2331
|
+
- Spec: `docs/specs/pan_focus_commands_featureai.md`
|
|
2332
|
+
- ADR: `docs/decisions/ADR-0006-focus-commands.md`
|
|
2333
|
+
|
|
2334
|
+
### Next Step
|
|
2335
|
+
Add to superplan: `/superplan --refresh`
|
|
2336
|
+
Execute: `/execplan`
|