@pharaoh-so/mcp 0.3.15 → 0.3.16

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 (2) hide show
  1. package/commands/plan.md +139 -2
  2. package/package.json +1 -1
package/commands/plan.md CHANGED
@@ -1,5 +1,142 @@
1
1
  ---
2
- description: Architecture-aware planning with Pharaoh reconnaissance
2
+ description: Architecture-aware planning with Pharaoh reconnaissance (adapted from Garry Tan's planning framework)
3
3
  ---
4
4
 
5
- Invoke the `pharaoh-plan` skill to handle this request. Pass through any arguments: $ARGUMENTS
5
+ # Plan Review
6
+
7
+ Architecture-aware plan review before implementation. Adapted from [Garry Tan's planning framework](https://www.youtube.com/watch?v=bMknfKXIFA8) for AI-assisted development.
8
+
9
+ **You are now in plan mode. Do NOT make any code changes. Think, evaluate, and present decisions.**
10
+
11
+ ## Document Review
12
+
13
+ If the user provides a document, PRD, prompt, or artifact alongside this command, that IS the plan to review. Apply all review sections to that document. Do not treat it as background context — it is the subject of evaluation.
14
+
15
+ Still run Step 1 (Reconnaissance) even when reviewing a document — always verify the plan against the actual codebase state.
16
+
17
+ ## Project Overrides
18
+
19
+ If a `.claude/plan-review.md` file exists in this project, read it now and apply those rules on top of this baseline. Project rules take precedence where they conflict.
20
+
21
+ ## Engineering Preferences (guide all recommendations)
22
+
23
+ - DRY: flag repetition aggressively
24
+ - Well-tested: too many tests > too few; mutation score > line coverage
25
+ - "Engineered enough" — not fragile/hacky, not over-abstracted
26
+ - Handle more edge cases, not fewer; thoughtfulness > speed
27
+ - Explicit > clever; simple > complex
28
+ - Subtraction > addition; target zero or negative net LOC
29
+ - Every export must have a caller; unwired code doesn't exist
30
+
31
+ ## Step 1: Pharaoh Reconnaissance (Required — do this BEFORE reviewing)
32
+
33
+ Do NOT review from memory or assumptions. Query the actual codebase first.
34
+
35
+ ### If Pharaoh MCP tools are available:
36
+
37
+ 1. `get_codebase_map` — current modules, hot files, dependency graph
38
+ 2. `search_functions` for keywords related to the plan — find existing code to reuse/extend
39
+ 3. `get_module_context` on affected modules — entry points, patterns, conventions
40
+ 4. `query_dependencies` between affected modules — coupling, circular deps
41
+ 5. `get_blast_radius` on the primary target of the change — know what breaks
42
+ 6. `check_reachability` on the primary target — verify it's actually reachable from entry points before worrying about it
43
+
44
+ ### Without Pharaoh (graceful fallback):
45
+
46
+ 1. Search the codebase for files and functions related to the plan (grep, glob)
47
+ 2. Read the entry points and module structure of affected areas
48
+ 3. Check existing tests for the modules the plan will touch
49
+ 4. Trace imports manually to estimate blast radius
50
+
51
+ Ground every recommendation in what actually exists. If you propose adding something, confirm it doesn't already exist. If you propose changing something, know its blast radius.
52
+
53
+ ## Step 2: Mode Selection (MANDATORY — ask before proceeding)
54
+
55
+ **STOP and ask the user which mode before starting the review.** This is a hard gate — do not infer, assume, or skip this question even if the user says "yes", "go ahead", or "yes to all". Present both options and wait for an explicit choice:
56
+
57
+ > **BIG CHANGE or SMALL CHANGE?**
58
+ >
59
+ > - **BIG CHANGE**: Full interactive review, all relevant sections, up to 4 top issues per section
60
+ > - **SMALL CHANGE**: One question per section, only sections 2-4
61
+
62
+ If the user's response is ambiguous (e.g. "just do it", "yes to all"), ask again: "I need to know — BIG or SMALL change?" Do not proceed to Step 3 without an answer.
63
+
64
+ ## Step 3: Review Sections
65
+
66
+ Adapt depth to change size. Skip sections that don't apply. **After each section, pause and ask for feedback before moving on.**
67
+
68
+ ### Section 1 — Architecture (skip for small/single-file changes)
69
+
70
+ - Component boundaries and coupling concerns
71
+ - Dependency graph: does this change shrink or expand surface area?
72
+ - Data flow bottlenecks and single points of failure
73
+ - Does this need new code at all, or can a human process / existing pattern solve it?
74
+
75
+ ### Section 2 — Code Quality (always)
76
+
77
+ - Organization, module structure, DRY violations (be aggressive)
78
+ - Error handling gaps and missing edge cases (call out explicitly)
79
+ - Technical debt: shortcuts, hardcoded values, magic strings
80
+ - Over-engineered or under-engineered relative to my preferences
81
+ - Reuse: does code for this already exist somewhere?
82
+
83
+ ### Section 3 — Wiring & Integration (always)
84
+
85
+ - Are all new exports called from a production entry point?
86
+ - Run `get_blast_radius` on any new/changed functions — zero callers = not done
87
+ - `check_reachability` on new exports — verify reachable from API handlers, crons, or event handlers
88
+ - Does the plan declare WHERE new code gets called from? If not, flag it
89
+ - Integration points: how does this connect to what already exists?
90
+
91
+ ### Section 4 — Tests (always)
92
+
93
+ - Coverage gaps: unit, integration, e2e
94
+ - Test quality: real assertions with hardcoded expected values, not `.toBeDefined()` or computed expectations
95
+ - Missing edge cases and untested failure/error paths
96
+ - One integration test proving wiring > ten isolated unit tests
97
+
98
+ ### Section 5 — Performance (only if relevant)
99
+
100
+ - N+1 queries, unnecessary DB round-trips
101
+ - Memory concerns, caching opportunities
102
+ - Slow or high-complexity code paths
103
+
104
+ ### Section 6 — Security & Attack Surface (always for new endpoints/routes/APIs; skip for pure refactors)
105
+
106
+ - **Authentication model** — what authenticates requests in this plan? Where is it validated? What happens on auth failure (redirect, 401, silent pass-through)? Use `search_functions` to find existing auth middleware and confirm reuse.
107
+ - **Sensitive data in URLs** — does the design put tokens, session IDs, or tenant identifiers in URL paths or query params? These leak via Referer headers, browser history, logs, and link sharing.
108
+ - **Authorization boundaries** — what prevents User A from accessing User B's data? Is there an ownership check, or just an "is logged in" check? Use `get_blast_radius` on existing ownership-check functions to see where they're already enforced.
109
+ - **Input trust boundary** — does the plan accept user input that flows into shell commands, database queries, HTML rendering, or file paths? Each is an injection vector.
110
+ - **Error and response surface** — will error responses or API payloads expose internals (stack traces, DB schemas, internal IDs) to unauthenticated callers?
111
+ - **New attack surface** — does the plan introduce new public URLs, webhooks, API routes, or WebSocket endpoints? Each needs: rate limiting, authentication, and input validation. Use `get_module_context` on the receiving module to check what protections exist.
112
+
113
+ ## For Each Issue Found
114
+
115
+ For every specific issue (bug, smell, design concern, risk, missing wiring):
116
+
117
+ 1. **Describe concretely** — file, line/function reference, what's wrong
118
+ 2. **Present 2-3 options** including "do nothing" where reasonable
119
+ 3. **For each option** — implementation effort, risk, blast radius, maintenance burden
120
+ 4. **Recommend one** mapped to my preferences above, and say why
121
+ 5. **Ask** whether I agree or want a different direction
122
+
123
+ Number each issue (1, 2, 3...) and letter each option (A, B, C...). Recommended option is always listed first. Use AskUserQuestion with clear labels like "Issue 1 Option A", "Issue 1 Option B".
124
+
125
+ ## Pharaoh Checkpoints (use throughout, not just at the end)
126
+
127
+ - **Before reviewing**: recon (Step 1 above)
128
+ - **During review**: `get_blast_radius` when evaluating impact of changes; `search_functions` before suggesting new code
129
+ - **After decisions**: `check_reachability` on all new exports; `get_unused_code` to catch disconnections
130
+ - **Final sweep**: `get_blast_radius` on ALL new exports — zero callers on non-entry-points = plan is incomplete
131
+
132
+ ## Workflow Rules
133
+
134
+ - **After each section, pause and ask for feedback before moving on**
135
+ - Do not assume priorities on timeline or scale
136
+ - If you see a better approach to the entire plan, say so BEFORE section-by-section review
137
+ - Challenge the approach if you see a better one — your job is to find problems I'll regret later
138
+ ---
139
+
140
+ Here is the task to review:
141
+
142
+ $ARGUMENTS
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pharaoh-so/mcp",
3
3
  "mcpName": "so.pharaoh/pharaoh",
4
- "version": "0.3.15",
4
+ "version": "0.3.16",
5
5
  "description": "MCP proxy for Pharaoh — maps codebases into queryable knowledge graphs for AI agents. Enables Claude Code in headless environments (VPS, SSH, CI) via device flow auth.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",