pan-wizard 2.8.1 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +4 -2
  2. package/bin/install.js +23 -0
  3. package/commands/pan/assumptions.md +38 -3
  4. package/commands/pan/audit-deployment.md +6 -0
  5. package/commands/pan/debug.md +71 -2
  6. package/commands/pan/exec-phase.md +90 -0
  7. package/commands/pan/focus-auto.md +181 -18
  8. package/commands/pan/focus-design.md +302 -14
  9. package/commands/pan/focus-doc-audit.md +530 -0
  10. package/commands/pan/focus-drift-walking.md +525 -0
  11. package/commands/pan/focus-exec.md +168 -46
  12. package/commands/pan/focus-plan.md +204 -12
  13. package/commands/pan/focus-scan.md +17 -5
  14. package/commands/pan/map-codebase.md +32 -6
  15. package/commands/pan/milestone-audit.md +23 -0
  16. package/commands/pan/new-project.md +64 -0
  17. package/commands/pan/pause.md +42 -1
  18. package/commands/pan/plan-phase.md +84 -0
  19. package/commands/pan/profile.md +2 -1
  20. package/commands/pan/quick.md +15 -0
  21. package/commands/pan/resume.md +62 -2
  22. package/commands/pan/verify-phase.md +42 -0
  23. package/package.json +1 -1
  24. package/pan-wizard-core/bin/lib/commands.cjs +29 -7
  25. package/pan-wizard-core/bin/lib/config.cjs +10 -0
  26. package/pan-wizard-core/bin/lib/constants.cjs +3 -1
  27. package/pan-wizard-core/bin/lib/core.cjs +168 -21
  28. package/pan-wizard-core/bin/lib/focus.cjs +5 -0
  29. package/pan-wizard-core/bin/lib/verify.cjs +283 -4
  30. package/pan-wizard-core/bin/pan-tools.cjs +11 -2
  31. package/pan-wizard-core/references/model-profiles.md +191 -62
  32. package/pan-wizard-core/workflows/help.md +11 -1
  33. package/pan-wizard-core/workflows/profile.md +8 -1
  34. package/pan-wizard-core/workflows/settings.md +14 -0
  35. package/scripts/generate-skills-docs.py +560 -0
@@ -41,9 +41,74 @@ If you find yourself analyzing PAN command files, agent definitions, or `pan-too
41
41
 
42
42
  ---
43
43
 
44
- ## MANDATORY: Complete All Phases For Selected Mode
44
+ ## Tool Selection Priority
45
45
 
46
- 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`).
46
+ Use the simplest sufficient tool for each research operation:
47
+ 1. **Grep/Glob** — for finding patterns and files in the local codebase
48
+ 2. **Read** — for examining specific files identified by Grep/Glob
49
+ 3. **Bash** — for git history, test runs, build commands
50
+ 4. **Agent (subagent)** — for broad exploration spanning many files (>5 reads)
51
+ 5. **WebSearch/WebFetch** — for external research after local sources are exhausted
52
+ 6. **mcp__context7__*** — for library documentation lookups
53
+
54
+ Prefer local evidence over web research. Start with the codebase, then broaden.
55
+
56
+ ## Context Management Across Phases
57
+
58
+ This pipeline spans 10+ phases. Manage context to maintain quality:
59
+ - **KEEP:** Problem statement, success criteria, key architectural decisions, file paths being designed for
60
+ - **SUMMARIZE:** Research findings (compress to key takeaways after each research phase), competitive analysis results
61
+ - **DISCARD:** Raw web fetch content after extracting relevant data, superseded design drafts
62
+ - After Phase 3 (Strategic Analysis), summarize all findings from Phases 0-3 into a compact brief before entering design phases
63
+
64
+ **Progressive context loading — load only what the current phase needs:**
65
+
66
+ | Phase | What to Load | What NOT to Load Yet |
67
+ |-------|-------------|---------------------|
68
+ | 0. Problem | User's feature description, project README | Implementation details, test files |
69
+ | 1. Landscape | Web search results, competitor docs | Project internals |
70
+ | 2. Codebase | Relevant source files (Glob→Grep→Read) | Unrelated modules, full test suite |
71
+ | 3. Strategic | Findings from 0-2 (summarized) | Raw web content (discard after summary) |
72
+ | 4-6. Design | Architecture files, key modules, API surface | Test implementation details |
73
+ | 7-8. Spec | Design decisions from 4-6, test patterns | Research raw data (long gone) |
74
+ | 9. Output | Spec template, ADR template | Everything else (already in spec) |
75
+
76
+ **Why:** A 10-phase pipeline that loads everything in Phase 0 exhausts context by Phase 5. Each phase loads only its inputs, summarizes its outputs, and discards its raw data.
77
+
78
+ ---
79
+
80
+ ## Reasoning Protocol
81
+
82
+ For research and analysis phases (0, 1, 2, 3), follow observe-think-act:
83
+ 1. **OBSERVE** — State what you found (code patterns, competitive data, user needs)
84
+ 2. **THINK** — Reason about what this means for the design
85
+ 3. **ACT** — Record the finding and move to the next investigation step
86
+ This keeps research structured and prevents rabbit holes.
87
+
88
+ ## Meta-Prompting: Self-Generated Investigation Strategy
89
+
90
+ Before starting Phase 0, generate your own investigation plan based on the feature description:
91
+
92
+ ```
93
+ Given: "{feature description}"
94
+ My investigation strategy:
95
+ 1. What is the core problem? → {how I'll validate it}
96
+ 2. Who are the competitors? → {what to search for}
97
+ 3. What codebase areas are affected? → {what to Glob/Grep for}
98
+ 4. What are the likely architectural constraints? → {what to read}
99
+ 5. What risks should I watch for? → {security, performance, compatibility}
100
+ 6. What is the ideal output format? → {spec structure for this feature type}
101
+ ```
102
+
103
+ This self-generated strategy adapts to the specific feature rather than following a generic checklist. A "add caching layer" feature needs different investigation than "add OAuth provider" — the meta-prompt captures that difference upfront.
104
+
105
+ **After Phase 3, regenerate:** The strategy may need revision based on what you've learned. Update it before entering design phases.
106
+
107
+ ---
108
+
109
+ ## Complete All Phases For Selected Mode
110
+
111
+ When `/pan:focus-design` is invoked, execute all phases for the selected mode automatically. Do not stop to ask questions between phases or 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`).
47
112
 
48
113
  **Modes (mutually exclusive — pick one, default `--full`):**
49
114
 
@@ -569,36 +634,255 @@ Every error condition must specify:
569
634
 
570
635
  ## Phase 5: Architecture Decision Record
571
636
 
572
- Create a formal ADR:
637
+ > *An ADR is the institutional memory of WHY. Make it comprehensive enough that a developer joining 12 months from now can understand the full decision landscape without asking anyone.*
638
+
639
+ ### 5.0 ADR Numbering
640
+ - Read existing ADRs in `docs/decisions/` to determine the next sequential number
641
+ - Format: `ADR-NNNN-<kebab-case-feature-name>.md` (e.g., `ADR-0019-webhook-support.md`)
642
+
643
+ ### 5.1 ADR Structure (MANDATORY — all sections required)
644
+
645
+ The ADR MUST contain ALL of the following sections. Do NOT produce a skeleton with placeholder text — every section must have substantive, project-specific content drawn from the preceding phases.
573
646
 
574
647
  ```markdown
575
- # ADR-NNNN: [Feature Name]
648
+ # ADR-NNNN: [Descriptive Title — not just feature name but what was decided]
576
649
 
577
650
  ## Status
578
- Proposed
651
+ Proposed | Accepted | Superseded by ADR-NNNN | Amended by ADR-NNNN
652
+
653
+ ## Date
654
+ YYYY-MM-DD
579
655
 
580
656
  ## Context
581
- [Problem context — what forces are at play?]
657
+
658
+ ### Problem Statement
659
+ [1-2 paragraphs: What problem exists? Why does it matter? What is the cost of inaction?
660
+ Pull directly from Phase 0.1 — do not paraphrase into vague generalities.]
661
+
662
+ ### Forces & Constraints
663
+ [Enumerate the specific technical, business, regulatory, and organizational forces
664
+ that constrain the solution space. These come from Phase 0 + Phase 1 discoveries.]
665
+
666
+ - **[Force 1]:** [Specific constraint and why it matters]
667
+ - **[Force 2]:** [Specific constraint and why it matters]
668
+ - **[Force 3]:** [Specific constraint and why it matters]
669
+
670
+ ### Current State
671
+ [What exists today? Reference actual files, modules, endpoints discovered in Phase 0.8.
672
+ If enhancing an existing feature, include the Before/After delta from Phase 0.2.5.]
673
+
674
+ ### Requirements Traceability
675
+ [Map to the spec that triggered this ADR. List the success criteria from Phase 0.4.]
676
+
677
+ | Requirement | Source | ADR Section |
678
+ |-------------|--------|-------------|
679
+ | [SC-1 from Phase 0.4] | [spec file or user request] | Decision §X |
680
+ | [SC-2 from Phase 0.4] | [spec file or user request] | Decision §Y |
582
681
 
583
682
  ## Decision
584
- [What was decided and why]
683
+
684
+ ### Summary
685
+ [1-2 sentences: The decision in plain language. A busy reader should understand
686
+ the choice from this paragraph alone.]
687
+
688
+ ### Detailed Design Decisions
689
+ [Number each sub-decision. For each, state WHAT was decided and WHY.
690
+ Pull from Phase 4 design synthesis — every design choice documented there
691
+ must appear here with rationale.]
692
+
693
+ #### 1. [Sub-decision title]
694
+ **Decided:** [What]
695
+ **Rationale:** [Why — reference forces from Context, competitive findings from Phase 2,
696
+ or architectural constraints from Phase 3.5]
697
+ **Alternatives rejected:** [Brief — full analysis in Options Considered]
698
+
699
+ #### 2. [Sub-decision title]
700
+ **Decided:** [What]
701
+ **Rationale:** [Why]
702
+ **Alternatives rejected:** [Brief]
703
+
704
+ [Continue for all significant decisions — typically 3-8 sub-decisions]
705
+
706
+ ### Architecture & Integration
707
+ [How does this fit into the existing system? Include the dependency map from Phase 1.4
708
+ and the layer violation check from Phase 3.5.2. Show which modules are touched.]
709
+
710
+ ```
711
+ [Dependency diagram or integration flow from Phase 1.4 / 3.5.6]
712
+ ```
713
+
714
+ ### Interface Contract
715
+ [The output schema or API contract from Phase 3.5.3 — exact format, not just description.
716
+ Include request/response examples for APIs, CLI input/output for commands,
717
+ or data schema for storage changes.]
585
718
 
586
719
  ## Consequences
720
+
587
721
  ### Positive
588
- - [Benefit 1]
722
+ [Minimum 3 consequences. Each must be specific and measurable, not generic platitudes.
723
+ BAD: "Better user experience" — GOOD: "Reduces statement processing failure rate
724
+ from 80% to <5% for image-based uploads"]
725
+
726
+ - **[Specific benefit 1]:** [Measurable impact]
727
+ - **[Specific benefit 2]:** [Measurable impact]
728
+ - **[Specific benefit 3]:** [Measurable impact]
729
+
589
730
  ### Negative
590
- - [Cost 1]
731
+ [Minimum 2 consequences. Be honest about costs and tradeoffs.
732
+ Every negative must include a mitigation strategy or explicit acceptance rationale.]
733
+
734
+ - **[Specific cost 1]:** [Impact] — *Mitigation:* [how addressed or why accepted]
735
+ - **[Specific cost 2]:** [Impact] — *Mitigation:* [how addressed or why accepted]
736
+
591
737
  ### Neutral
592
- - [Side effect]
738
+ [Side effects that are neither clearly positive nor negative]
739
+
740
+ - [Side effect 1]
741
+ - [Side effect 2]
593
742
 
594
743
  ## Options Considered
595
- 1. [Option A] — [summary]
596
- 2. [Option B — chosen] — [summary]
597
744
 
598
- ## Links
599
- - Related to: [commands, modules, issues]
745
+ > *Document ALL options evaluated, including the chosen one. For each option,
746
+ > provide enough detail that a reader can understand why it was accepted or rejected
747
+ > WITHOUT reading the full spec.*
748
+
749
+ ### Option 1: [Name] — REJECTED
750
+ **Description:** [2-3 sentences: what this approach involves]
751
+ **Pros:** [Bullet list]
752
+ **Cons:** [Bullet list]
753
+ **Rejected because:** [Specific reason tied to forces/constraints in Context]
754
+
755
+ ### Option 2: [Name] — REJECTED
756
+ **Description:** [2-3 sentences]
757
+ **Pros:** [Bullet list]
758
+ **Cons:** [Bullet list]
759
+ **Rejected because:** [Specific reason]
760
+
761
+ ### Option 3: [Name] — CHOSEN
762
+ **Description:** [2-3 sentences]
763
+ **Pros:** [Bullet list]
764
+ **Cons:** [Bullet list — same as Negative consequences]
765
+ **Chosen because:** [Specific reason — ties back to forces, competitive position, strategic analysis]
766
+
767
+ ### Option 4: [Name] — DEFERRED
768
+ **Description:** [2-3 sentences]
769
+ **Deferred because:** [Not rejected — viable for future consideration. State trigger conditions.]
770
+
771
+ [Include 3-5 options minimum. If fewer than 3 alternatives were genuinely considered,
772
+ explain why the solution space was constrained.]
773
+
774
+ ### Decision Matrix (when 3+ options share comparable tradeoffs)
775
+ | Criterion (from forces) | Weight | Option 1 | Option 2 | Option 3 (chosen) |
776
+ |--------------------------|--------|----------|----------|-------------------|
777
+ | [Force/requirement 1] | High | Poor | Good | Excellent |
778
+ | [Force/requirement 2] | Medium | Good | Poor | Good |
779
+ | [Force/requirement 3] | High | N/A | Good | Excellent |
780
+ | **Weighted Score** | | Low | Medium | **High** |
781
+
782
+ ## Success Criteria
783
+
784
+ [Copy directly from Phase 0.4 — these are the machine-checkable acceptance criteria
785
+ that determine whether this ADR's decision was correctly implemented.]
786
+
787
+ | ID | Criterion | Verification Method | Pass Condition |
788
+ |----|-----------|-------------------|----------------|
789
+ | SC-1 | [description] | test / grep / manual | [exact condition] |
790
+ | SC-2 | [description] | test / grep / manual | [exact condition] |
791
+ | SC-3 | No regression | project test command | All existing tests pass |
792
+
793
+ ## Breaking Changes
794
+
795
+ [From Phase 3.5.5. If no breaking changes, state "None — all changes are additive."]
796
+
797
+ | Change | Impact | Migration Strategy |
798
+ |--------|--------|--------------------|
799
+ | [What changes] | [Who is affected] | [How to migrate] |
800
+
801
+ ## Security Implications
802
+
803
+ [From Phase 7. Summarize the threat model and key controls.]
804
+
805
+ | Threat | Risk Level | Control |
806
+ |--------|-----------|---------|
807
+ | [Threat from STRIDE-lite] | Low/Medium/High | [Mitigation implemented] |
808
+
809
+ If no security implications: "No new attack surface introduced. [Brief justification.]"
810
+
811
+ ## Performance Implications
812
+
813
+ [From Phase 3.5.7 performance budget. State the expected performance characteristics
814
+ and any budgets that must be maintained.]
815
+
816
+ | Operation | Budget | Justification |
817
+ |-----------|--------|---------------|
818
+ | [Key operation 1] | < Xms | [Why this budget] |
819
+ | [Key operation 2] | < Xms | [Why this budget] |
820
+
821
+ ## Implementation Guidance
822
+
823
+ [From Phase 8. Not the full task list — just enough for an implementer to know
824
+ WHERE to start and what patterns to follow.]
825
+
826
+ | Order | Task | Files Affected | Effort |
827
+ |-------|------|---------------|--------|
828
+ | 1 | [First task] | [file paths] | XS/S/M/L |
829
+ | 2 | [Second task] | [file paths] | XS/S/M/L |
830
+
831
+ **Patterns to follow:** [Reference specific existing implementations discovered in Phase 0.8
832
+ that the implementer should use as templates]
833
+
834
+ ## Feature Ladder
835
+
836
+ [From Phase 4.5. Shows the incremental delivery plan.]
837
+
838
+ | Version | Scope | Value Delivered |
839
+ |---------|-------|----------------|
840
+ | v0 (MVP) | [smallest useful slice] | [what user can do] |
841
+ | v1 (Complete) | [full feature] | [full value] |
842
+ | v2 (Enhanced) | [future extensions] | [additional value] |
843
+
844
+ ## Links & References
845
+
846
+ - **Spec:** `docs/specs/<feature>_featureai.md`
847
+ - **Related ADRs:** [list with brief relationship description]
848
+ - **Supersedes:** [ADR number if replacing a previous decision, or "N/A"]
849
+ - **External references:** [Standards, RFCs, competitor docs, regulatory requirements]
850
+ - **Affected components:** [List of files/modules/services from impact analysis]
600
851
  ```
601
852
 
853
+ ### 5.2 ADR Quality Gate (Self-Check Before Writing)
854
+
855
+ Before writing the ADR file, verify ALL of these:
856
+
857
+ | Check | Requirement | Source Phase |
858
+ |-------|-------------|-------------|
859
+ | Context has specific forces | Not just "we need X" — enumerate WHY and WHAT CONSTRAINS | Phase 0 + 1 |
860
+ | Decision has numbered sub-decisions | Every design choice from Phase 4 is captured with rationale | Phase 4 |
861
+ | Options >= 3 | At least 3 genuine alternatives evaluated | Phase 2 + 3 |
862
+ | Each option has pros AND cons | No straw-man options set up just to be rejected | Phase 2 + 3 |
863
+ | Consequences are specific | No generic "better UX" — measurable impacts only | Phase 3 + 4 |
864
+ | Negative consequences have mitigations | Every cost is either mitigated or explicitly accepted | Phase 4 |
865
+ | Success criteria are machine-checkable | At least 2 can be verified by automated test | Phase 0.4 |
866
+ | Breaking changes documented or "None" stated | Never omitted silently | Phase 3.5.5 |
867
+ | Security section present | Even if "no new attack surface" — must be explicit | Phase 7 |
868
+ | Performance budget stated | Key operations with time budgets | Phase 3.5.7 |
869
+ | Implementation guidance references real files | Not hypothetical paths — actual discovered locations | Phase 0.8 + 8 |
870
+ | Links trace to spec file | ADR → spec → requirements chain is complete | Phase 10 |
871
+
872
+ **If any check fails:** Go back to the relevant phase and extract the missing content. Do NOT write placeholder text.
873
+
874
+ ### 5.3 ADR Anti-Patterns (NEVER DO)
875
+
876
+ - **Skeleton ADR:** `[Problem context — what forces are at play?]` — NEVER use placeholder brackets in the output
877
+ - **Single-option ADR:** Only describing the chosen approach without alternatives — this is a design doc, not an ADR
878
+ - **Consequence-free ADR:** Listing only positives — EVERY decision has real costs
879
+ - **Generic consequences:** "Improves code quality" / "Better maintainability" — be specific or remove
880
+ - **Missing rationale:** "We chose X" without explaining WHY over alternatives
881
+ - **Orphan ADR:** No link to spec, no link to related ADRs, no traceability
882
+ - **Copy-paste from spec:** The ADR is a DECISION record, not a spec summary — focus on WHY, not WHAT
883
+ - **Straw-man options:** Including obviously bad alternatives just to make the chosen option look good
884
+ - **Missing migration strategy:** Documenting breaking changes without explaining how to handle them
885
+
602
886
  ---
603
887
 
604
888
  ## Phase 6: Error Handling & Diagnostics Design
@@ -753,6 +1037,10 @@ Write complete spec to: `docs/specs/<feature_name>_featureai.md`
753
1037
  ### 10.2 Save ADR
754
1038
  Write ADR to: `docs/decisions/ADR-NNNN-<feature_name>.md`
755
1039
 
1040
+ **ADR completeness gate:** Before saving, verify the ADR passes ALL checks from Phase 5.2. The ADR file must contain every section defined in Phase 5.1 with substantive content — no placeholder brackets, no skeleton sections, no missing tables. If any section would be empty, go back to the relevant phase and extract the content.
1041
+
1042
+ **Minimum ADR size:** A proper ADR for a `--full` mode investigation should be 80-200+ lines. If the ADR is under 60 lines, it is almost certainly missing required sections. For `--internal` mode, minimum 60 lines. For `--outward` mode, minimum 70 lines.
1043
+
756
1044
  ### 10.3 Report Summary
757
1045
  Output a complete summary with:
758
1046
  - **Problem & Evidence** — 1-sentence problem, evidence sources