@pharaoh-so/mcp 0.3.25 → 0.3.27

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.
@@ -0,0 +1,185 @@
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