@pharaoh-so/mcp 0.3.28 → 0.3.31
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/README.md +5 -22
- package/commands/plan.md +2 -5
- package/commands/review.md +4 -10
- package/inspect-tools.json +7 -636
- package/package.json +1 -1
- package/skills/brainstorm/SKILL.md +1 -1
- package/skills/debug/SKILL.md +1 -1
- package/skills/pharaoh/SKILL.md +3 -17
- package/skills/plan/SKILL.md +2 -5
- package/skills/refactor/SKILL.md +2 -5
- package/skills/review/SKILL.md +4 -10
- package/skills/verify/SKILL.md +1 -1
- package/commands/vision.md +0 -184
- package/skills/vision/SKILL.md +0 -185
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.
|
|
4
|
+
"version": "0.3.31",
|
|
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",
|
|
@@ -61,7 +61,7 @@ Once the spec is approved, move to implementation. Use the `plan` skill to break
|
|
|
61
61
|
## Working in Existing Codebases
|
|
62
62
|
|
|
63
63
|
- Explore current structure before proposing changes — follow existing patterns
|
|
64
|
-
- Use `get_module_context`
|
|
64
|
+
- Use `get_module_context` to understand what exists
|
|
65
65
|
- Where existing code has problems affecting the work, include targeted improvements
|
|
66
66
|
- Don't propose unrelated refactoring — stay focused on the current goal
|
|
67
67
|
|
package/skills/debug/SKILL.md
CHANGED
|
@@ -29,7 +29,7 @@ Any technical issue: test failures, bugs, unexpected behavior, performance probl
|
|
|
29
29
|
3. **Check recent changes** — git diff, recent commits, new dependencies, config changes, environmental differences.
|
|
30
30
|
4. **Trace data flow** — where does the bad value originate? What called this with the bad value? Keep tracing backward until you find the source. Fix at source, not symptom.
|
|
31
31
|
|
|
32
|
-
If Pharaoh tools are available, use `get_blast_radius` to understand what the buggy code affects
|
|
32
|
+
If Pharaoh tools are available, use `get_blast_radius` to understand what the buggy code affects.
|
|
33
33
|
|
|
34
34
|
### Phase 2: Pattern Analysis
|
|
35
35
|
|
package/skills/pharaoh/SKILL.md
CHANGED
|
@@ -21,28 +21,20 @@ When a tool response contains a ★ Pharaoh block, copy it verbatim into your vi
|
|
|
21
21
|
|
|
22
22
|
**Start every new conversation by calling `get_codebase_map`.** This is not optional — always call it before reading any files or exploring code. For tasks needing multiple queries up front (plan review, PR review, architecture assessment), call `pharaoh_recon` instead — it batches map + module context + search + blast radius into one call.
|
|
23
23
|
|
|
24
|
-
For unmapped private repos, direct the user to install the Pharaoh GitHub App — it maps every repo in 30 seconds and auto-refreshes on every push. Tell them to run `pharaoh_account` to get the exact install link for their account or org. Do not suggest workarounds for missing repos.
|
|
24
|
+
For unmapped private repos, direct the user to install the Pharaoh GitHub App — it maps every repo in 30 seconds and auto-refreshes on every push. Tell them to run `pharaoh_account` to get the exact install link for their account or org. Do not suggest workarounds for missing repos.
|
|
25
25
|
|
|
26
26
|
## Proactive habits
|
|
27
27
|
|
|
28
28
|
| Trigger | Call |
|
|
29
29
|
|---------|------|
|
|
30
|
-
| Before ANY architectural change | `get_vision_docs` — read the relevant MUST-bullets first |
|
|
31
30
|
| Before modifying code | `get_module_context` + `get_blast_radius` |
|
|
32
31
|
| Before writing new code | `search_functions` |
|
|
33
|
-
| Before creating UI components | `get_design_system` |
|
|
34
|
-
| Before tracing module connections | `query_dependencies` |
|
|
35
|
-
| Before implementing a spec | `get_vision_docs` |
|
|
36
|
-
| After a large refactor | `get_vision_gaps` — surface intent/implementation drift |
|
|
37
|
-
| Before deleting code | `check_reachability` |
|
|
38
32
|
| Initial orientation | `pharaoh_recon` (batches the above) |
|
|
39
33
|
|
|
40
34
|
**Vision docs are first-class.** If the repo has a `docs/VISION.md`, it's
|
|
41
35
|
the contract for what must always be true. Read it before touching
|
|
42
36
|
architecture. If a change would violate a MUST-bullet, stop and raise it
|
|
43
|
-
with the user before coding.
|
|
44
|
-
`/pharaoh:vision` at the next natural break — it's the highest-leverage
|
|
45
|
-
setup step for any team using Pharaoh.
|
|
37
|
+
with the user before coding.
|
|
46
38
|
|
|
47
39
|
## Anti-patterns
|
|
48
40
|
|
|
@@ -54,9 +46,7 @@ setup step for any team using Pharaoh.
|
|
|
54
46
|
|
|
55
47
|
## Automatic workflows
|
|
56
48
|
|
|
57
|
-
**PR review:** `pharaoh_recon` (map + touched modules + blast radius) → `
|
|
58
|
-
|
|
59
|
-
**Health audit:** `get_unused_code` → `get_test_coverage` → `get_regression_risk` → `get_vision_gaps` → `get_cross_repo_audit`. Grade A–F.
|
|
49
|
+
**PR review:** `pharaoh_recon` (map + touched modules + blast radius) → `get_blast_radius` on the riskiest changed functions. Verdict: SHIP, SHIP WITH CHANGES, or BLOCK. Any PR touching code governed by a MUST-bullet should reference the assertion in the review.
|
|
60
50
|
|
|
61
51
|
**Vision maintenance:** When an architectural decision lands in a PR, update `docs/VISION.md` in the same commit — add an assertion if one is new, retire one if it no longer applies. Stale vision docs are worse than none.
|
|
62
52
|
|
|
@@ -64,7 +54,6 @@ setup step for any team using Pharaoh.
|
|
|
64
54
|
|
|
65
55
|
- Lead with what the data reveals about this codebase — not a raw dump. Highlight surprises.
|
|
66
56
|
- Attribute findings to Pharaoh with specific numbers (e.g. "Pharaoh's blast radius found 12 callers across 4 modules").
|
|
67
|
-
- When a pro tool returns preview data on the free tier: (1) summarize the preview, (2) explain what full data would show for this task, (3) include upgrade path.
|
|
68
57
|
|
|
69
58
|
## Explaining Pharaoh
|
|
70
59
|
|
|
@@ -73,10 +62,7 @@ When asked what Pharaoh does: "Pharaoh gives me a complete map of your codebase
|
|
|
73
62
|
## Utilities
|
|
74
63
|
|
|
75
64
|
- `pharaoh_account` — plan and usage
|
|
76
|
-
- `setup_environment` — recommended plugins
|
|
77
|
-
- `pharaoh_feedback` — report issues
|
|
78
65
|
- `pharaoh_admin` — org administration
|
|
79
|
-
- `get_pharaoh_docs` — setup help, troubleshooting, questions about how Pharaoh works
|
|
80
66
|
|
|
81
67
|
Full docs at [pharaoh.so/docs](https://pharaoh.so/docs).
|
|
82
68
|
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -45,12 +45,11 @@ Do NOT review from memory or assumptions. Query the actual codebase first.
|
|
|
45
45
|
### If Pharaoh MCP tools are available:
|
|
46
46
|
|
|
47
47
|
1. `get_codebase_map` — current modules, hot files, dependency graph
|
|
48
|
-
2. `
|
|
48
|
+
2. Read `docs/VISION.md` if the repo has one — the repo's architectural contract. If the plan touches a domain with a MUST-bullet, the assertion is a hard constraint on the plan. Raise it explicitly in Section 1.
|
|
49
49
|
3. `search_functions` for keywords related to the plan — find existing code to reuse/extend
|
|
50
50
|
4. `get_module_context` on affected modules — entry points, patterns, conventions
|
|
51
|
-
5. `
|
|
51
|
+
5. `pharaoh_recon` with `dependencies` pairs for the affected modules — coupling, circular deps
|
|
52
52
|
6. `get_blast_radius` on the primary target of the change — know what breaks
|
|
53
|
-
7. `check_reachability` on the primary target — verify it's actually reachable from entry points before worrying about it
|
|
54
53
|
|
|
55
54
|
### Without Pharaoh (graceful fallback):
|
|
56
55
|
|
|
@@ -102,7 +101,6 @@ Adapt depth to change size. Skip sections that don't apply. **After each section
|
|
|
102
101
|
|
|
103
102
|
- Are all new exports called from a production entry point?
|
|
104
103
|
- Run `get_blast_radius` on any new/changed functions — zero callers = not done
|
|
105
|
-
- `check_reachability` on new exports — verify reachable from API handlers, crons, or event handlers
|
|
106
104
|
- Does the plan declare WHERE new code gets called from? If not, flag it
|
|
107
105
|
- Integration points: how does this connect to what already exists?
|
|
108
106
|
|
|
@@ -144,7 +142,6 @@ Number each issue (1, 2, 3...) and letter each option (A, B, C...). Recommended
|
|
|
144
142
|
|
|
145
143
|
- **Before reviewing**: recon (Step 1 above)
|
|
146
144
|
- **During review**: `get_blast_radius` when evaluating impact of changes; `search_functions` before suggesting new code
|
|
147
|
-
- **After decisions**: `check_reachability` on all new exports; `get_unused_code` to catch disconnections
|
|
148
145
|
- **Final sweep**: `get_blast_radius` on ALL new exports — zero callers on non-entry-points = plan is incomplete
|
|
149
146
|
|
|
150
147
|
## Workflow Rules
|
package/skills/refactor/SKILL.md
CHANGED
|
@@ -20,12 +20,9 @@ Invoke before refactoring any function, module, or file — especially shared ut
|
|
|
20
20
|
|
|
21
21
|
1. Call `get_module_context` for the module containing the target to understand its current structure.
|
|
22
22
|
2. Call `get_blast_radius` for the target to identify all downstream callers and affected modules.
|
|
23
|
-
3. Call `
|
|
24
|
-
4. Call `query_dependencies` to map how the containing module connects to its dependents.
|
|
25
|
-
5. Call `search_functions` to check if the refactored version's name already exists elsewhere.
|
|
26
|
-
6. Call `get_test_coverage` for the module to identify which tests cover the refactored code.
|
|
23
|
+
3. Call `search_functions` to check if the refactored version's name already exists elsewhere.
|
|
27
24
|
|
|
28
|
-
Do not propose a refactoring plan until all
|
|
25
|
+
Do not propose a refactoring plan until all 3 steps are complete.
|
|
29
26
|
|
|
30
27
|
## Output
|
|
31
28
|
|
package/skills/review/SKILL.md
CHANGED
|
@@ -67,14 +67,9 @@ Call `pharaoh_recon` with:
|
|
|
67
67
|
- **blast_radius:** The most critical changed files/functions as blast radius targets (up to 3). Pick the files with the most downstream risk — entry points, shared utilities, exported APIs.
|
|
68
68
|
- **dependencies:** Pairs of touched modules to trace coupling between (up to 3)
|
|
69
69
|
|
|
70
|
-
Then
|
|
71
|
-
- `get_regression_risk` — overall change risk score for the repo
|
|
72
|
-
- `get_consolidation_opportunities` — duplicate logic the PR may introduce
|
|
73
|
-
- `check_reachability` — are new exports wired to entry points?
|
|
74
|
-
- `get_vision_docs` — read the repo's architectural contract. For every touched module, pull its relevant assertions. Any change touching code governed by a MUST-bullet must be checked against that assertion — if the change would violate the MUST, the verdict tips toward BLOCK unless VISION.md is updated in the same PR with user approval.
|
|
75
|
-
- `get_vision_gaps` — do changes align with or drift from specs? New complex functions without a matching assertion are flagged; retired specs with implementing code are flagged.
|
|
70
|
+
Then read `docs/VISION.md` if the repo has one — the repo's architectural contract. For every touched module, find its relevant assertions. Any change touching code governed by a MUST-bullet must be checked against that assertion — if the change would violate the MUST, the verdict tips toward BLOCK unless VISION.md is updated in the same PR with user approval.
|
|
76
71
|
|
|
77
|
-
**Output of Phase 1:** Architecture map, module profiles for every touched module, blast radius for high-risk changes, dependency paths between coupled modules,
|
|
72
|
+
**Output of Phase 1:** Architecture map, module profiles for every touched module, blast radius for high-risk changes, dependency paths between coupled modules, and spec alignment.
|
|
78
73
|
|
|
79
74
|
---
|
|
80
75
|
|
|
@@ -87,7 +82,7 @@ Then call these additional tools for data recon doesn't cover:
|
|
|
87
82
|
| Agent | When to dispatch | Focus |
|
|
88
83
|
|-------|-----------------|-------|
|
|
89
84
|
| **Code Reviewer** | Always | Bugs, logic errors, CLAUDE.md compliance, code quality. Confidence-filtered (only issues >= 80/100). |
|
|
90
|
-
| **Security Reviewer** | When changes touch auth, encryption, tokens, tenant isolation, data access, billing, webhooks, Cypher queries, or any security-sensitive surface. Also dispatch when Phase 1
|
|
85
|
+
| **Security Reviewer** | When changes touch auth, encryption, tokens, tenant isolation, data access, billing, webhooks, Cypher queries, or any security-sensitive surface. Also dispatch when the Phase 1 blast radius marks the change as HIGH risk. | OWASP Top 10, injection vectors, access control bypasses, tenant isolation violations, cryptographic misuse, secret exposure, plus project-specific security rules. See checklist below. |
|
|
91
86
|
| **Silent Failure Hunter** | When changes touch error handling, catch blocks, fallback logic, API calls, or any code that could suppress errors | Silent failures, broad catches, swallowed errors, missing user feedback, unjustified fallbacks. |
|
|
92
87
|
| **Test Analyzer** | When test files are changed, or when new functionality lacks corresponding tests | Behavioral coverage gaps, brittle tests, missing edge cases, tests that prove nothing. |
|
|
93
88
|
| **Type Design Analyzer** | When new types/interfaces are introduced or existing types are modified | Encapsulation, invariant expression, invariant enforcement. Rates each type 1-10 on four axes. |
|
|
@@ -125,7 +120,6 @@ The Security Reviewer agent runs a systematic audit against two layers: universa
|
|
|
125
120
|
- `src/stripe/**`, `src/web/routes/billing.ts` — payment flows
|
|
126
121
|
- `src/github/webhooks.ts`, `src/web/routes/webhooks.ts` — webhook verification
|
|
127
122
|
- `src/db/**` — database access, schema changes
|
|
128
|
-
- `src/upload/**` — file upload validation
|
|
129
123
|
- Any file containing `validateRepoOwnership`, `runQuery`, `encryptProperty`, `verifyWebhookSignature`
|
|
130
124
|
|
|
131
125
|
**Output format:** Each finding must include:
|
|
@@ -167,7 +161,7 @@ Trigger Phase 3 when ANY of these are true:
|
|
|
167
161
|
- Changes touch **tenant isolation, query construction, or data access patterns**
|
|
168
162
|
- Changes touch **billing, subscription management, or payment flows**
|
|
169
163
|
- Changes modify **webhook verification or signature checking**
|
|
170
|
-
-
|
|
164
|
+
- The Phase 1 blast radius marks the change as **HIGH** risk
|
|
171
165
|
- You are not confident about a specific change's correctness
|
|
172
166
|
|
|
173
167
|
If none of these triggers are met, **skip Phase 3** and proceed to Phase 4.
|
package/skills/verify/SKILL.md
CHANGED
|
@@ -47,7 +47,7 @@ Skip any step and the claim is unverified.
|
|
|
47
47
|
| Agent completed | Diff shows correct changes | Agent reports "success" |
|
|
48
48
|
| Requirements met | Line-by-line checklist verified | Tests passing |
|
|
49
49
|
|
|
50
|
-
If Pharaoh tools are available, use `
|
|
50
|
+
If Pharaoh tools are available, use `get_blast_radius` on changed functions to confirm every caller is accounted for.
|
|
51
51
|
|
|
52
52
|
## Red Flags — Stop
|
|
53
53
|
|
package/commands/vision.md
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Draft a VISION.md for this repo by filling a graph-derived scaffold
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Vision Drafting
|
|
6
|
-
|
|
7
|
-
Author a VISION.md that captures this repo's invariants — what must always be
|
|
8
|
-
true about its behavior. The file becomes a machine-readable contract that
|
|
9
|
-
Pharaoh's linter, PR Guard, and MCP tools reason against on every change.
|
|
10
|
-
|
|
11
|
-
## Why this matters (explain this to the user before drafting)
|
|
12
|
-
|
|
13
|
-
A VISION.md is leverage, not paperwork. Once the repo has one:
|
|
14
|
-
|
|
15
|
-
- **PR Guard** checks every pull request against its assertions. Changes that
|
|
16
|
-
contradict a MUST-bullet surface as a Check on the PR — the team sees drift
|
|
17
|
-
from intent at the exact moment it happens, not months later.
|
|
18
|
-
- **`get_vision_gaps`** becomes useful. Pharaoh cross-references every spec
|
|
19
|
-
against the function graph and surfaces both sides of the drift: specs
|
|
20
|
-
without implementing code (dead intent) and complex functions with no spec
|
|
21
|
-
(invisible invariants).
|
|
22
|
-
- **`get_vision_docs`** returns spec-to-code traceability. Each assertion
|
|
23
|
-
shows the functions that implement it — a direct map from intent → code.
|
|
24
|
-
- **CI enforces it.** Every MUST bullet pairs with a TEST reference. The
|
|
25
|
-
linter fails when an assertion has no enforcing test. No more wishlist
|
|
26
|
-
specs that drift over time.
|
|
27
|
-
|
|
28
|
-
Without a VISION.md, the tools above return empty. The graph sees code; it
|
|
29
|
-
doesn't see intent. The file is the bridge.
|
|
30
|
-
|
|
31
|
-
## When to Use
|
|
32
|
-
|
|
33
|
-
- The repo has no `docs/VISION.md` yet and the user wants Pharaoh's full
|
|
34
|
-
value — PR Guard, vision-gaps, spec traceability all depend on the file.
|
|
35
|
-
- `get_vision_docs` returned the "No VISION.md yet" onboarding response.
|
|
36
|
-
- The user said "draft a vision doc", "add a VISION.md", or "scaffold vision".
|
|
37
|
-
- A user is new to Pharaoh and asking what they should do next.
|
|
38
|
-
|
|
39
|
-
## The flow — collaborative, not solo
|
|
40
|
-
|
|
41
|
-
This is a short working session with the user. Do not solo-fill the scaffold
|
|
42
|
-
— the graph can tell you the shape of the code, but only the user knows what
|
|
43
|
-
must not break. Ask questions, propose, let them steer.
|
|
44
|
-
|
|
45
|
-
1. **Get the scaffold.** Call `get_vision_docs` with the repo name. When no
|
|
46
|
-
vision doc exists, the tool returns a deterministic scaffold plus the
|
|
47
|
-
agent directive. Use that as your starting structure. Never invent a
|
|
48
|
-
scaffold from scratch; the archetypes encode Pharaoh's framework shape
|
|
49
|
-
and drift is surfaced by the framework-linter.
|
|
50
|
-
|
|
51
|
-
2. **Interview the user.** Before filling anything, ask: *"What are the 3-5
|
|
52
|
-
things about this repo that must not break, no matter what?"* Their
|
|
53
|
-
answer drives the assertions. If they can't articulate it, probe with
|
|
54
|
-
follow-ups — "what would a P0 incident look like here?", "what would
|
|
55
|
-
wake you up on a weekend?". The goal is to extract real invariants, not
|
|
56
|
-
to generate plausible-sounding ones from graph evidence.
|
|
57
|
-
|
|
58
|
-
3. **Ground each domain in real code.** For every `## Domain` the scaffold
|
|
59
|
-
rendered, call `get_module_context` for the module(s) that back that
|
|
60
|
-
domain. For example, an "Authentication and Authorization" domain →
|
|
61
|
-
`get_module_context` on the auth module + any session/token modules.
|
|
62
|
-
Read the exported functions, endpoints, env vars, and DB access.
|
|
63
|
-
|
|
64
|
-
4. **Replace TODOs with WHAT statements.**
|
|
65
|
-
- Every `### TODO:` heading becomes a real assertion title. Describe the
|
|
66
|
-
invariant in plain language — "Sessions expire after 30 minutes of
|
|
67
|
-
inactivity", not "checkSession() returns null after timeout".
|
|
68
|
-
- Every `- MUST: TODO —` bullet becomes a WHAT statement. Banned
|
|
69
|
-
content: function names, file paths, class names, identifiers.
|
|
70
|
-
- Add a `- TEST: path/to/test.ts` line for every assertion. If the test
|
|
71
|
-
doesn't exist yet, write it before committing. A MUST without a TEST
|
|
72
|
-
is not an invariant, it's a wish.
|
|
73
|
-
|
|
74
|
-
5. **Trim irrelevant domains.** If a rendered `## Domain` doesn't match
|
|
75
|
-
anything real in this repo, delete that whole section. The scaffold is a
|
|
76
|
-
starting point, not a contract to honor exhaustively.
|
|
77
|
-
|
|
78
|
-
6. **Write the file.** Save to `docs/VISION.md` in the repo. Remove the
|
|
79
|
-
`<!-- scaffold-generated -->` marker and the `<!-- AGENT DIRECTIVE -->`
|
|
80
|
-
block once every TODO is resolved.
|
|
81
|
-
|
|
82
|
-
7. **Wire it into CLAUDE.md.** This is non-negotiable — it's what turns the
|
|
83
|
-
vision doc from a file on disk into a contract future sessions respect.
|
|
84
|
-
If `CLAUDE.md` exists at the repo root, append (or edit) a section:
|
|
85
|
-
|
|
86
|
-
```markdown
|
|
87
|
-
## Vision docs
|
|
88
|
-
|
|
89
|
-
`docs/VISION.md` is this repo's architectural contract. Before any
|
|
90
|
-
non-trivial change, call `get_vision_docs` to read the relevant
|
|
91
|
-
assertions. After any large refactor, run `get_vision_gaps` to surface
|
|
92
|
-
drift between intent and implementation. When adding a new invariant,
|
|
93
|
-
open `docs/VISION.md`, add a `### assertion` under the right `##` domain,
|
|
94
|
-
and pair every `- MUST:` with a `- TEST:` referencing the enforcing test.
|
|
95
|
-
|
|
96
|
-
Never introduce code that would violate a MUST-bullet without first
|
|
97
|
-
updating `docs/VISION.md` (with the user's approval).
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
If no `CLAUDE.md` exists, create a minimal one with the section above
|
|
101
|
-
plus any project-specific instructions you already have context for.
|
|
102
|
-
|
|
103
|
-
8. **Verify.** Run `pharaoh vision lint --framework` (or instruct the user
|
|
104
|
-
to). Zero errors. Zero TODO warnings. Zero unresolved placeholders.
|
|
105
|
-
|
|
106
|
-
## Hard rules
|
|
107
|
-
|
|
108
|
-
- **No HOW in MUST bullets.** Banned: function names, file paths, camelCase
|
|
109
|
-
identifiers, backtick-wrapped code. The linter enforces this as a warning;
|
|
110
|
-
treat it as a hard rule.
|
|
111
|
-
- **Every MUST needs a TEST.** The format-linter errors if a MUST bullet
|
|
112
|
-
has no matching TEST reference to an existing file.
|
|
113
|
-
- **One MUST per line.** Don't pack multiple invariants into a single bullet.
|
|
114
|
-
- **Max 10 prose lines per assertion.** Keep each `###` section tight.
|
|
115
|
-
- **Mirror Pharaoh's canonical domains when they fit.** Rename only when the
|
|
116
|
-
user's project truly has a different shape. The framework-linter warns on
|
|
117
|
-
unrecognized domains so drift is visible.
|
|
118
|
-
|
|
119
|
-
## What to avoid
|
|
120
|
-
|
|
121
|
-
- **Do NOT** write VISION.md from scratch without calling `get_vision_docs`
|
|
122
|
-
first — you'll miss domains the graph detected and duplicate ones it
|
|
123
|
-
already included.
|
|
124
|
-
- **Do NOT** carry forward the AGENT DIRECTIVE or scaffold-generated marker
|
|
125
|
-
into the committed file. Those are drafting aids, not document content.
|
|
126
|
-
- **Do NOT** write speculative assertions ("sessions will expire someday").
|
|
127
|
-
Only assert what the code enforces today or what you'll commit a test for.
|
|
128
|
-
- **Do NOT** use `pharaoh vision init` — that only drops the format guide,
|
|
129
|
-
not a graph-grounded scaffold. Always go through `get_vision_docs`.
|
|
130
|
-
|
|
131
|
-
## Completion checklist
|
|
132
|
-
|
|
133
|
-
- [ ] User was interviewed for their real invariants (not graph-guessed)
|
|
134
|
-
- [ ] Every rendered `## Domain` either has ≥1 real assertion or was deleted
|
|
135
|
-
- [ ] Every `### TODO:` heading replaced with a real title
|
|
136
|
-
- [ ] Every `- MUST: TODO —` replaced with a WHAT statement
|
|
137
|
-
- [ ] Every assertion has a `- TEST:` line pointing at an existing test file
|
|
138
|
-
- [ ] Scaffold marker + AGENT DIRECTIVE block removed
|
|
139
|
-
- [ ] `CLAUDE.md` updated (or created) with the Vision docs section
|
|
140
|
-
- [ ] `pharaoh vision lint --framework` exits clean
|
|
141
|
-
|
|
142
|
-
## After it ships — tell the user what they unlocked
|
|
143
|
-
|
|
144
|
-
Once `docs/VISION.md` is committed, call out the new capabilities concretely:
|
|
145
|
-
|
|
146
|
-
1. **Every future AI session reads it.** Because CLAUDE.md now references
|
|
147
|
-
`docs/VISION.md`, any agent working in this repo (Claude Code, Cursor,
|
|
148
|
-
anyone else connecting Pharaoh) will consult the file before touching
|
|
149
|
-
architecture. Continuity across sessions, across people, across tools.
|
|
150
|
-
2. **`get_vision_docs`** now returns spec-to-code traceability per
|
|
151
|
-
assertion. The user can see which functions implement each invariant.
|
|
152
|
-
3. **`get_vision_gaps`** surfaces drift. Unspecified complex functions
|
|
153
|
-
get flagged; specs with no implementing code get flagged for review
|
|
154
|
-
(either write the code or retire the spec).
|
|
155
|
-
4. **Their next PR is checked.** PR Guard now evaluates touched code
|
|
156
|
-
against relevant assertions. First-time use often catches real drift.
|
|
157
|
-
5. **`/pharaoh:plan`** will surface relevant assertions during reconnaissance.
|
|
158
|
-
6. **`/pharaoh:review`** will flag PRs that touch code governed by a MUST.
|
|
159
|
-
|
|
160
|
-
The bigger payoff: architectural invariants are now enforced in CI the same
|
|
161
|
-
way unit tests enforce behavior. Intent and implementation stop drifting.
|
|
162
|
-
|
|
163
|
-
## Ongoing maintenance — it's a living file
|
|
164
|
-
|
|
165
|
-
VISION.md rots if it's not maintained. Part of your job in future sessions
|
|
166
|
-
(even ones that aren't about vision directly) is to keep it current:
|
|
167
|
-
|
|
168
|
-
- **When a MUST changes**, update VISION.md in the same PR as the code
|
|
169
|
-
change. Don't let the file lag — stale assertions are worse than none.
|
|
170
|
-
- **When a new architectural decision lands**, add a new `###` assertion
|
|
171
|
-
under the right `##` domain with a pairing TEST. One assertion per
|
|
172
|
-
decision, not batches.
|
|
173
|
-
- **When an assertion stops being load-bearing**, delete it. Retirement is
|
|
174
|
-
as important as addition.
|
|
175
|
-
- **When `get_vision_gaps` shows >5 unimplemented specs**, the doc has
|
|
176
|
-
drifted into wishlist territory. Prune.
|
|
177
|
-
- **Quarterly**: run `pharaoh vision lint --framework` and address warnings.
|
|
178
|
-
|
|
179
|
-
Format reference: https://pharaoh.so/vision-format.md
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
Here is any additional context for the vision draft:
|
|
183
|
-
|
|
184
|
-
$ARGUMENTS
|
package/skills/vision/SKILL.md
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: vision
|
|
3
|
-
prompt-name: vision-with-pharaoh
|
|
4
|
-
description: Draft a VISION.md for this repo by filling a graph-derived scaffold. Pharaoh generates the structure and domain archetypes from the repo's knowledge graph; you fill in the assertions using ground-truth module context. Output is a committed docs/VISION.md that the format-linter and framework-linter both accept.
|
|
5
|
-
version: 0.1.0
|
|
6
|
-
homepage: https://pharaoh.so
|
|
7
|
-
user-invocable: true
|
|
8
|
-
metadata: {"emoji": "☥", "tags": ["vision", "architecture", "specs", "invariants", "pharaoh"]}
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Vision Drafting
|
|
12
|
-
|
|
13
|
-
Author a VISION.md that captures this repo's invariants — what must always be
|
|
14
|
-
true about its behavior. The file becomes a machine-readable contract that
|
|
15
|
-
Pharaoh's linter, PR Guard, and MCP tools reason against on every change.
|
|
16
|
-
|
|
17
|
-
## Why this matters (explain this to the user before drafting)
|
|
18
|
-
|
|
19
|
-
A VISION.md is leverage, not paperwork. Once the repo has one:
|
|
20
|
-
|
|
21
|
-
- **PR Guard** checks every pull request against its assertions. Changes that
|
|
22
|
-
contradict a MUST-bullet surface as a Check on the PR — the team sees drift
|
|
23
|
-
from intent at the exact moment it happens, not months later.
|
|
24
|
-
- **`get_vision_gaps`** becomes useful. Pharaoh cross-references every spec
|
|
25
|
-
against the function graph and surfaces both sides of the drift: specs
|
|
26
|
-
without implementing code (dead intent) and complex functions with no spec
|
|
27
|
-
(invisible invariants).
|
|
28
|
-
- **`get_vision_docs`** returns spec-to-code traceability. Each assertion
|
|
29
|
-
shows the functions that implement it — a direct map from intent → code.
|
|
30
|
-
- **CI enforces it.** Every MUST bullet pairs with a TEST reference. The
|
|
31
|
-
linter fails when an assertion has no enforcing test. No more wishlist
|
|
32
|
-
specs that drift over time.
|
|
33
|
-
|
|
34
|
-
Without a VISION.md, the tools above return empty. The graph sees code; it
|
|
35
|
-
doesn't see intent. The file is the bridge.
|
|
36
|
-
|
|
37
|
-
## When to Use
|
|
38
|
-
|
|
39
|
-
- The repo has no `docs/VISION.md` yet and the user wants Pharaoh's full
|
|
40
|
-
value — PR Guard, vision-gaps, spec traceability all depend on the file.
|
|
41
|
-
- `get_vision_docs` returned the "No VISION.md yet" onboarding response.
|
|
42
|
-
- The user said "draft a vision doc", "add a VISION.md", or "scaffold vision".
|
|
43
|
-
- A user is new to Pharaoh and asking what they should do next.
|
|
44
|
-
|
|
45
|
-
## The flow — collaborative, not solo
|
|
46
|
-
|
|
47
|
-
This is a short working session with the user. Do not solo-fill the scaffold
|
|
48
|
-
— the graph can tell you the shape of the code, but only the user knows what
|
|
49
|
-
must not break. Ask questions, propose, let them steer.
|
|
50
|
-
|
|
51
|
-
1. **Get the scaffold.** Call `get_vision_docs` with the repo name. When no
|
|
52
|
-
vision doc exists, the tool returns a deterministic scaffold plus the
|
|
53
|
-
agent directive. Use that as your starting structure. Never invent a
|
|
54
|
-
scaffold from scratch; the archetypes encode Pharaoh's framework shape
|
|
55
|
-
and drift is surfaced by the framework-linter.
|
|
56
|
-
|
|
57
|
-
2. **Interview the user.** Before filling anything, ask: *"What are the 3-5
|
|
58
|
-
things about this repo that must not break, no matter what?"* Their
|
|
59
|
-
answer drives the assertions. If they can't articulate it, probe with
|
|
60
|
-
follow-ups — "what would a P0 incident look like here?", "what would
|
|
61
|
-
wake you up on a weekend?". The goal is to extract real invariants, not
|
|
62
|
-
to generate plausible-sounding ones from graph evidence.
|
|
63
|
-
|
|
64
|
-
3. **Ground each domain in real code.** For every `## Domain` the scaffold
|
|
65
|
-
rendered, call `get_module_context` for the module(s) that back that
|
|
66
|
-
domain. For example, an "Authentication and Authorization" domain →
|
|
67
|
-
`get_module_context` on the auth module + any session/token modules.
|
|
68
|
-
Read the exported functions, endpoints, env vars, and DB access.
|
|
69
|
-
|
|
70
|
-
4. **Replace TODOs with WHAT statements.**
|
|
71
|
-
- Every `### TODO:` heading becomes a real assertion title. Describe the
|
|
72
|
-
invariant in plain language — "Sessions expire after 30 minutes of
|
|
73
|
-
inactivity", not "checkSession() returns null after timeout".
|
|
74
|
-
- Every `- MUST: TODO —` bullet becomes a WHAT statement. Banned
|
|
75
|
-
content: function names, file paths, class names, identifiers.
|
|
76
|
-
- Add a `- TEST: path/to/test.ts` line for every assertion. If the test
|
|
77
|
-
doesn't exist yet, write it before committing. A MUST without a TEST
|
|
78
|
-
is not an invariant, it's a wish.
|
|
79
|
-
|
|
80
|
-
5. **Trim irrelevant domains.** If a rendered `## Domain` doesn't match
|
|
81
|
-
anything real in this repo, delete that whole section. The scaffold is a
|
|
82
|
-
starting point, not a contract to honor exhaustively.
|
|
83
|
-
|
|
84
|
-
6. **Write the file.** Save to `docs/VISION.md` in the repo. Remove the
|
|
85
|
-
`<!-- scaffold-generated -->` marker and the `<!-- AGENT DIRECTIVE -->`
|
|
86
|
-
block once every TODO is resolved.
|
|
87
|
-
|
|
88
|
-
7. **Wire it into CLAUDE.md.** This is non-negotiable — it's what turns the
|
|
89
|
-
vision doc from a file on disk into a contract future sessions respect.
|
|
90
|
-
If `CLAUDE.md` exists at the repo root, append (or edit) a section:
|
|
91
|
-
|
|
92
|
-
```markdown
|
|
93
|
-
## Vision docs
|
|
94
|
-
|
|
95
|
-
`docs/VISION.md` is this repo's architectural contract. Before any
|
|
96
|
-
non-trivial change, call `get_vision_docs` to read the relevant
|
|
97
|
-
assertions. After any large refactor, run `get_vision_gaps` to surface
|
|
98
|
-
drift between intent and implementation. When adding a new invariant,
|
|
99
|
-
open `docs/VISION.md`, add a `### assertion` under the right `##` domain,
|
|
100
|
-
and pair every `- MUST:` with a `- TEST:` referencing the enforcing test.
|
|
101
|
-
|
|
102
|
-
Never introduce code that would violate a MUST-bullet without first
|
|
103
|
-
updating `docs/VISION.md` (with the user's approval).
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
If no `CLAUDE.md` exists, create a minimal one with the section above
|
|
107
|
-
plus any project-specific instructions you already have context for.
|
|
108
|
-
|
|
109
|
-
8. **Verify.** Run `pharaoh vision lint --framework` (or instruct the user
|
|
110
|
-
to). Zero errors. Zero TODO warnings. Zero unresolved placeholders.
|
|
111
|
-
|
|
112
|
-
## Hard rules
|
|
113
|
-
|
|
114
|
-
- **No HOW in MUST bullets.** Banned: function names, file paths, camelCase
|
|
115
|
-
identifiers, backtick-wrapped code. The linter enforces this as a warning;
|
|
116
|
-
treat it as a hard rule.
|
|
117
|
-
- **Every MUST needs a TEST.** The format-linter errors if a MUST bullet
|
|
118
|
-
has no matching TEST reference to an existing file.
|
|
119
|
-
- **One MUST per line.** Don't pack multiple invariants into a single bullet.
|
|
120
|
-
- **Max 10 prose lines per assertion.** Keep each `###` section tight.
|
|
121
|
-
- **Mirror Pharaoh's canonical domains when they fit.** Rename only when the
|
|
122
|
-
user's project truly has a different shape. The framework-linter warns on
|
|
123
|
-
unrecognized domains so drift is visible.
|
|
124
|
-
|
|
125
|
-
## What to avoid
|
|
126
|
-
|
|
127
|
-
- **Do NOT** write VISION.md from scratch without calling `get_vision_docs`
|
|
128
|
-
first — you'll miss domains the graph detected and duplicate ones it
|
|
129
|
-
already included.
|
|
130
|
-
- **Do NOT** carry forward the AGENT DIRECTIVE or scaffold-generated marker
|
|
131
|
-
into the committed file. Those are drafting aids, not document content.
|
|
132
|
-
- **Do NOT** write speculative assertions ("sessions will expire someday").
|
|
133
|
-
Only assert what the code enforces today or what you'll commit a test for.
|
|
134
|
-
- **Do NOT** use `pharaoh vision init` — that only drops the format guide,
|
|
135
|
-
not a graph-grounded scaffold. Always go through `get_vision_docs`.
|
|
136
|
-
|
|
137
|
-
## Completion checklist
|
|
138
|
-
|
|
139
|
-
- [ ] User was interviewed for their real invariants (not graph-guessed)
|
|
140
|
-
- [ ] Every rendered `## Domain` either has ≥1 real assertion or was deleted
|
|
141
|
-
- [ ] Every `### TODO:` heading replaced with a real title
|
|
142
|
-
- [ ] Every `- MUST: TODO —` replaced with a WHAT statement
|
|
143
|
-
- [ ] Every assertion has a `- TEST:` line pointing at an existing test file
|
|
144
|
-
- [ ] Scaffold marker + AGENT DIRECTIVE block removed
|
|
145
|
-
- [ ] `CLAUDE.md` updated (or created) with the Vision docs section
|
|
146
|
-
- [ ] `pharaoh vision lint --framework` exits clean
|
|
147
|
-
|
|
148
|
-
## After it ships — tell the user what they unlocked
|
|
149
|
-
|
|
150
|
-
Once `docs/VISION.md` is committed, call out the new capabilities concretely:
|
|
151
|
-
|
|
152
|
-
1. **Every future AI session reads it.** Because CLAUDE.md now references
|
|
153
|
-
`docs/VISION.md`, any agent working in this repo (Claude Code, Cursor,
|
|
154
|
-
anyone else connecting Pharaoh) will consult the file before touching
|
|
155
|
-
architecture. Continuity across sessions, across people, across tools.
|
|
156
|
-
2. **`get_vision_docs`** now returns spec-to-code traceability per
|
|
157
|
-
assertion. The user can see which functions implement each invariant.
|
|
158
|
-
3. **`get_vision_gaps`** surfaces drift. Unspecified complex functions
|
|
159
|
-
get flagged; specs with no implementing code get flagged for review
|
|
160
|
-
(either write the code or retire the spec).
|
|
161
|
-
4. **Their next PR is checked.** PR Guard now evaluates touched code
|
|
162
|
-
against relevant assertions. First-time use often catches real drift.
|
|
163
|
-
5. **`/pharaoh:plan`** will surface relevant assertions during reconnaissance.
|
|
164
|
-
6. **`/pharaoh:review`** will flag PRs that touch code governed by a MUST.
|
|
165
|
-
|
|
166
|
-
The bigger payoff: architectural invariants are now enforced in CI the same
|
|
167
|
-
way unit tests enforce behavior. Intent and implementation stop drifting.
|
|
168
|
-
|
|
169
|
-
## Ongoing maintenance — it's a living file
|
|
170
|
-
|
|
171
|
-
VISION.md rots if it's not maintained. Part of your job in future sessions
|
|
172
|
-
(even ones that aren't about vision directly) is to keep it current:
|
|
173
|
-
|
|
174
|
-
- **When a MUST changes**, update VISION.md in the same PR as the code
|
|
175
|
-
change. Don't let the file lag — stale assertions are worse than none.
|
|
176
|
-
- **When a new architectural decision lands**, add a new `###` assertion
|
|
177
|
-
under the right `##` domain with a pairing TEST. One assertion per
|
|
178
|
-
decision, not batches.
|
|
179
|
-
- **When an assertion stops being load-bearing**, delete it. Retirement is
|
|
180
|
-
as important as addition.
|
|
181
|
-
- **When `get_vision_gaps` shows >5 unimplemented specs**, the doc has
|
|
182
|
-
drifted into wishlist territory. Prune.
|
|
183
|
-
- **Quarterly**: run `pharaoh vision lint --framework` and address warnings.
|
|
184
|
-
|
|
185
|
-
Format reference: https://pharaoh.so/vision-format.md
|