@pharaoh-so/mcp 0.3.7 → 0.3.8
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/dist/install-skills.js +22 -2
- package/package.json +1 -1
- package/skills/plan/SKILL.md +41 -214
- package/skills/sessions/SKILL.md +35 -19
package/dist/install-skills.js
CHANGED
|
@@ -68,12 +68,32 @@ function installClaudeCodePlugin(home = homedir()) {
|
|
|
68
68
|
process.stderr.write("Pharaoh: .claude-plugin/ manifest not found in package — cannot install.\n");
|
|
69
69
|
return -1;
|
|
70
70
|
}
|
|
71
|
-
// Copy skills/
|
|
71
|
+
// Copy skills/ and generate pharaoh-* prefixed aliases
|
|
72
72
|
let skillCount = 0;
|
|
73
73
|
if (existsSync(BUNDLED_SKILLS_DIR)) {
|
|
74
74
|
cpSync(BUNDLED_SKILLS_DIR, join(pluginDir, "skills"), { recursive: true, force: true });
|
|
75
75
|
const entries = readdirSync(BUNDLED_SKILLS_DIR, { withFileTypes: true });
|
|
76
|
-
|
|
76
|
+
const skillDirs = entries.filter((e) => e.isDirectory());
|
|
77
|
+
skillCount = skillDirs.length;
|
|
78
|
+
// Auto-generate pharaoh-* prefixed copies so both `/plan` and `pharaoh:plan`
|
|
79
|
+
// resolve to the same content. Without this, prefixed copies drift and users
|
|
80
|
+
// get a stripped skeleton when invoking via the pharaoh: prefix.
|
|
81
|
+
for (const dir of skillDirs) {
|
|
82
|
+
if (dir.name === "pharaoh" || dir.name.startsWith("pharaoh-"))
|
|
83
|
+
continue;
|
|
84
|
+
const prefixedName = `pharaoh-${dir.name}`;
|
|
85
|
+
const prefixedDir = join(pluginDir, "skills", prefixedName);
|
|
86
|
+
const srcSkill = join(pluginDir, "skills", dir.name, "SKILL.md");
|
|
87
|
+
if (!existsSync(srcSkill))
|
|
88
|
+
continue;
|
|
89
|
+
mkdirSync(prefixedDir, { recursive: true });
|
|
90
|
+
const content = readFileSync(srcSkill, "utf-8");
|
|
91
|
+
// Rewrite the name field in YAML frontmatter only (between --- delimiters).
|
|
92
|
+
// Using a whole-file /m regex would match `name:` in body content too.
|
|
93
|
+
const rewritten = content.replace(/^(---\n[\s\S]*?)(name:\s*).+(\n[\s\S]*?---)/, `$1$2${prefixedName}$3`);
|
|
94
|
+
writeFileSync(join(prefixedDir, "SKILL.md"), rewritten);
|
|
95
|
+
skillCount++;
|
|
96
|
+
}
|
|
77
97
|
}
|
|
78
98
|
// Copy .mcp.json
|
|
79
99
|
const mcpSrc = join(PKG_ROOT, ".mcp.json");
|
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.8",
|
|
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",
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plan
|
|
3
3
|
prompt-name: plan-with-pharaoh
|
|
4
|
-
description: "
|
|
5
|
-
version: 0.
|
|
4
|
+
description: "Deep plan review before implementing any feature, refactor, or significant code change. Enters plan mode — no code changes, just evaluation and interactive decision-making."
|
|
5
|
+
version: 0.4.0
|
|
6
6
|
homepage: https://pharaoh.so
|
|
7
7
|
user-invocable: true
|
|
8
|
-
metadata: {"emoji": "☥", "tags": ["planning", "architecture", "blast-radius", "pharaoh", "
|
|
8
|
+
metadata: {"emoji": "☥", "tags": ["planning", "architecture", "blast-radius", "pharaoh", "review", "interactive"]}
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# Plan
|
|
11
|
+
# Plan Review
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Architecture-aware plan review before implementation. Adapted from [Garry Tan's planning framework](https://www.youtube.com/watch?v=bMknfKXIFA8) for AI-assisted development.
|
|
14
14
|
|
|
15
|
-
**You are in plan mode. Do NOT make any code changes. Think, evaluate,
|
|
16
|
-
|
|
17
|
-
## When to Use
|
|
18
|
-
|
|
19
|
-
Before implementing any non-trivial change: new features, refactors, adding modules, or anything that touches shared code. Use it whenever you need to answer "what's the right way to build this?" before writing code.
|
|
15
|
+
**You are in plan mode. Do NOT make any code changes. Think, evaluate, present decisions.**
|
|
20
16
|
|
|
21
17
|
## Project Overrides
|
|
22
18
|
|
|
23
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.
|
|
24
20
|
|
|
21
|
+
## Document Review
|
|
22
|
+
|
|
23
|
+
If the user provides a document, PRD, prompt, or artifact alongside this command, that IS the plan to review. Still run Step 1 (Reconnaissance) — always verify against the actual codebase. Then apply all review sections to that document. Do not treat it as background context — it is the subject of evaluation.
|
|
24
|
+
|
|
25
25
|
## Engineering Preferences (guide all recommendations)
|
|
26
26
|
|
|
27
27
|
- DRY: flag repetition aggressively
|
|
@@ -32,174 +32,41 @@ If a `.claude/plan-review.md` file exists in this project, read it now and apply
|
|
|
32
32
|
- Subtraction > addition; target zero or negative net LOC
|
|
33
33
|
- Every export must have a caller; unwired code doesn't exist
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Step 1: Reconnaissance (Required — do this BEFORE reviewing)
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Do NOT review from memory or assumptions. Query the actual codebase first.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Phase 1 — Reconnaissance (required — do this BEFORE anything else)
|
|
42
|
-
|
|
43
|
-
Do NOT plan from memory or assumptions. Query the actual codebase first:
|
|
39
|
+
### If Pharaoh MCP tools are available:
|
|
44
40
|
|
|
45
41
|
1. `get_codebase_map` — current modules, hot files, dependency graph
|
|
46
42
|
2. `search_functions` for keywords related to the plan — find existing code to reuse/extend
|
|
47
|
-
3. `get_module_context` on
|
|
43
|
+
3. `get_module_context` on affected modules — entry points, patterns, conventions
|
|
48
44
|
4. `query_dependencies` between affected modules — coupling, circular deps
|
|
49
45
|
5. `get_blast_radius` on the primary target of the change
|
|
50
46
|
6. `check_reachability` on the primary target to verify it's reachable from entry points
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Phase 2 — Analysis
|
|
48
|
+
### Without Pharaoh:
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
1. Search the codebase for files and functions related to the plan (grep, glob)
|
|
51
|
+
2. Read the entry points and module structure of affected areas
|
|
52
|
+
3. Check existing tests for the modules you'll touch
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
- Check `search_functions` results — does related code already exist? Can you reuse/extend?
|
|
60
|
-
- Assess module coupling — are the affected modules tightly or loosely coupled?
|
|
61
|
-
- Rate the risk level (LOW / MEDIUM / HIGH) based on blast radius and coupling
|
|
62
|
-
- Does this need new code at all, or can an existing pattern solve it?
|
|
63
|
-
|
|
64
|
-
## Phase 3 — Approach
|
|
65
|
-
|
|
66
|
-
### Scope Check
|
|
67
|
-
|
|
68
|
-
If the spec covers multiple independent subsystems, it should be broken into separate plans — one per subsystem. Each plan should produce working, testable software on its own. Suggest splitting if needed.
|
|
54
|
+
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.
|
|
69
55
|
|
|
70
|
-
|
|
56
|
+
## Step 2: Mode Selection (MANDATORY — ask before proceeding)
|
|
71
57
|
|
|
72
|
-
**STOP and ask the user before
|
|
58
|
+
**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:
|
|
73
59
|
|
|
74
|
-
> **
|
|
60
|
+
> **BIG CHANGE or SMALL CHANGE?**
|
|
75
61
|
>
|
|
76
|
-
> - **BIG CHANGE**: Full
|
|
77
|
-
> - **SMALL CHANGE**:
|
|
78
|
-
|
|
79
|
-
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 Phase 4 without an answer.
|
|
80
|
-
|
|
81
|
-
### Approach Trade-offs
|
|
82
|
-
|
|
83
|
-
Propose 2-3 implementation approaches:
|
|
84
|
-
- For each: what files change, estimated blast radius, pros, cons
|
|
85
|
-
- Recommend one with justification
|
|
86
|
-
- Flag any approach that would increase module coupling
|
|
87
|
-
- Flag any approach that requires new code where existing code could be extended
|
|
88
|
-
|
|
89
|
-
## Phase 4 — Plan Writing
|
|
90
|
-
|
|
91
|
-
### File Structure
|
|
92
|
-
|
|
93
|
-
Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in.
|
|
94
|
-
|
|
95
|
-
- Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility.
|
|
96
|
-
- Files that change together should live together. Split by responsibility, not by technical layer.
|
|
97
|
-
- In existing codebases, follow established patterns. If the codebase uses large files, don't unilaterally restructure — but if a file you're modifying has grown unwieldy, including a split is reasonable.
|
|
98
|
-
|
|
99
|
-
This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.
|
|
100
|
-
|
|
101
|
-
### Plan Document Header
|
|
102
|
-
|
|
103
|
-
Every plan MUST start with:
|
|
104
|
-
|
|
105
|
-
```markdown
|
|
106
|
-
# [Feature Name] Implementation Plan
|
|
107
|
-
|
|
108
|
-
> **For agentic workers:** Use `pharaoh:orchestrate` (recommended) or `pharaoh:execute` to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
109
|
-
|
|
110
|
-
**Goal:** [One sentence describing what this builds]
|
|
111
|
-
|
|
112
|
-
**Architecture:** [2-3 sentences about approach]
|
|
113
|
-
|
|
114
|
-
**Tech Stack:** [Key technologies/libraries]
|
|
115
|
-
|
|
116
|
-
**Risk:** [LOW / MEDIUM / HIGH] — [one line justification from Phase 2 data]
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Bite-Sized Task Granularity
|
|
122
|
-
|
|
123
|
-
Each step is one action (2-5 minutes):
|
|
124
|
-
- "Write the failing test" — step
|
|
125
|
-
- "Run it to make sure it fails" — step
|
|
126
|
-
- "Implement the minimal code to make the test pass" — step
|
|
127
|
-
- "Run the tests and make sure they pass" — step
|
|
128
|
-
- "Commit" — step
|
|
129
|
-
|
|
130
|
-
### Task Structure
|
|
131
|
-
|
|
132
|
-
````markdown
|
|
133
|
-
### Task N: [Component Name]
|
|
62
|
+
> - **BIG CHANGE**: Full interactive review, all relevant sections, up to 4 top issues per section
|
|
63
|
+
> - **SMALL CHANGE**: One question per section, only sections 2-4
|
|
134
64
|
|
|
135
|
-
|
|
136
|
-
- Create: `exact/path/to/file.ts`
|
|
137
|
-
- Modify: `exact/path/to/existing.ts:123-145`
|
|
138
|
-
- Test: `tests/exact/path/to/test.ts`
|
|
65
|
+
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.
|
|
139
66
|
|
|
140
|
-
|
|
67
|
+
## Step 3: Review Sections
|
|
141
68
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
- [ ] **Step 1: Write the failing test**
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
test('specific behavior', () => {
|
|
148
|
-
const result = function(input);
|
|
149
|
-
expect(result).toBe(expected);
|
|
150
|
-
});
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
- [ ] **Step 2: Run test to verify it fails**
|
|
154
|
-
|
|
155
|
-
Run: `pnpm test -- tests/path/test.ts`
|
|
156
|
-
Expected: FAIL with "function not defined"
|
|
157
|
-
|
|
158
|
-
- [ ] **Step 3: Write minimal implementation**
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
export function myFunction(input: string): string {
|
|
162
|
-
return expected;
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
- [ ] **Step 4: Run test to verify it passes**
|
|
167
|
-
|
|
168
|
-
Run: `pnpm test -- tests/path/test.ts`
|
|
169
|
-
Expected: PASS
|
|
170
|
-
|
|
171
|
-
- [ ] **Step 5: Commit**
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
git add tests/path/test.ts src/path/file.ts
|
|
175
|
-
git commit -m "feat: add specific feature"
|
|
176
|
-
```
|
|
177
|
-
````
|
|
178
|
-
|
|
179
|
-
### No Placeholders
|
|
180
|
-
|
|
181
|
-
Every step must contain the actual content an engineer needs. These are **plan failures** — never write them:
|
|
182
|
-
|
|
183
|
-
- "TBD", "TODO", "implement later", "fill in details"
|
|
184
|
-
- "Add appropriate error handling" / "add validation" / "handle edge cases"
|
|
185
|
-
- "Write tests for the above" (without actual test code)
|
|
186
|
-
- "Similar to Task N" (repeat the code — the engineer may be reading tasks out of order)
|
|
187
|
-
- Steps that describe what to do without showing how (code blocks required for code steps)
|
|
188
|
-
- References to types, functions, or methods not defined in any task
|
|
189
|
-
|
|
190
|
-
### Remember
|
|
191
|
-
|
|
192
|
-
- Exact file paths always
|
|
193
|
-
- Complete code in every step — if a step changes code, show the code
|
|
194
|
-
- Exact commands with expected output
|
|
195
|
-
- DRY, YAGNI, TDD, frequent commits
|
|
196
|
-
- Every new export must have a declared caller — if a function has no caller, it's not part of the plan
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Phase 5 — Adversarial Review
|
|
201
|
-
|
|
202
|
-
Review the plan before presenting it. Apply all relevant sections, adapting depth to change size. Skip sections that don't apply.
|
|
69
|
+
Adapt depth to change size. Skip sections that don't apply. **After each section, pause and ask for feedback before moving on.**
|
|
203
70
|
|
|
204
71
|
### Section 1 — Architecture (skip for small/single-file changes)
|
|
205
72
|
|
|
@@ -213,15 +80,15 @@ Review the plan before presenting it. Apply all relevant sections, adapting dept
|
|
|
213
80
|
- Organization, module structure, DRY violations (be aggressive)
|
|
214
81
|
- Error handling gaps and missing edge cases (call out explicitly)
|
|
215
82
|
- Technical debt: shortcuts, hardcoded values, magic strings
|
|
216
|
-
- Over-engineered or under-engineered relative to
|
|
83
|
+
- Over-engineered or under-engineered relative to preferences above
|
|
217
84
|
- Reuse: does code for this already exist somewhere?
|
|
218
85
|
|
|
219
86
|
### Section 3 — Wiring & Integration (always)
|
|
220
87
|
|
|
221
88
|
- Are all new exports called from a production entry point?
|
|
222
|
-
- Run `get_blast_radius` on
|
|
89
|
+
- Run `get_blast_radius` on new/changed functions — zero callers = not done
|
|
223
90
|
- `check_reachability` on new exports — verify reachable from API handlers, crons, or event handlers
|
|
224
|
-
- Does
|
|
91
|
+
- Does the plan declare WHERE new code gets called from? If not, flag it
|
|
225
92
|
- Integration points: how does this connect to what already exists?
|
|
226
93
|
|
|
227
94
|
### Section 4 — Tests (always)
|
|
@@ -237,7 +104,7 @@ Review the plan before presenting it. Apply all relevant sections, adapting dept
|
|
|
237
104
|
- Memory concerns, caching opportunities
|
|
238
105
|
- Slow or high-complexity code paths
|
|
239
106
|
|
|
240
|
-
### Section 6 — Security & Attack Surface (
|
|
107
|
+
### Section 6 — Security & Attack Surface (only for new endpoints/routes/APIs)
|
|
241
108
|
|
|
242
109
|
- **Authentication model** — what authenticates requests? Where validated? What happens on failure?
|
|
243
110
|
- **Sensitive data in URLs** — tokens, session IDs, or tenant identifiers in URL paths/params leak via Referer, history, logs
|
|
@@ -246,70 +113,30 @@ Review the plan before presenting it. Apply all relevant sections, adapting dept
|
|
|
246
113
|
- **Error and response surface** — do error responses expose internals to unauthenticated callers?
|
|
247
114
|
- **New attack surface** — new public URLs, webhooks, API routes each need rate limiting, auth, and input validation
|
|
248
115
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
1. **Spec coverage:** Skim each section/requirement in the spec. Can you point to a task that implements it? List any gaps.
|
|
252
|
-
2. **Placeholder scan:** Search the plan for red flags from the "No Placeholders" section. Fix them.
|
|
253
|
-
3. **Type consistency:** Do types, method signatures, and property names used in later tasks match earlier tasks? A function called `clearLayers()` in Task 3 but `clearFullLayers()` in Task 7 is a bug.
|
|
254
|
-
4. **Wiring sweep:** `get_blast_radius` on ALL new exports — zero callers on non-entry-points = plan is incomplete.
|
|
255
|
-
|
|
256
|
-
### For Each Issue Found
|
|
116
|
+
## For Each Issue Found
|
|
257
117
|
|
|
258
118
|
For every specific issue (bug, smell, design concern, risk, missing wiring):
|
|
259
119
|
|
|
260
120
|
1. **Describe concretely** — file, line/function reference, what's wrong
|
|
261
121
|
2. **Present 2-3 options** including "do nothing" where reasonable
|
|
262
122
|
3. **For each option** — implementation effort, risk, blast radius, maintenance burden
|
|
263
|
-
4. **Recommend one** mapped to
|
|
123
|
+
4. **Recommend one** mapped to the preferences above, and say why
|
|
264
124
|
5. **Ask** whether the user agrees or wants a different direction
|
|
265
125
|
|
|
266
|
-
Number each issue (1, 2, 3...) and letter each option (A, B, C...). Recommended option
|
|
267
|
-
|
|
268
|
-
---
|
|
269
|
-
|
|
270
|
-
## Phase 6 — Output & Handoff
|
|
271
|
-
|
|
272
|
-
### Present the Plan
|
|
273
|
-
|
|
274
|
-
A complete implementation plan containing:
|
|
275
|
-
|
|
276
|
-
- Risk rating (LOW / MEDIUM / HIGH) with data backing
|
|
277
|
-
- Recommended approach with trade-off rationale
|
|
278
|
-
- File structure map
|
|
279
|
-
- Numbered tasks with bite-sized steps, exact files, and complete code
|
|
280
|
-
- Blast radius per task
|
|
281
|
-
- Wiring declarations for every new export
|
|
282
|
-
- Required tests per step
|
|
283
|
-
- Adversarial review findings (issues caught and resolved)
|
|
126
|
+
Number each issue (1, 2, 3...) and letter each option (A, B, C...). Recommended option listed first.
|
|
284
127
|
|
|
285
|
-
|
|
286
|
-
(User preferences for plan location override this default)
|
|
287
|
-
|
|
288
|
-
### Execution Handoff
|
|
289
|
-
|
|
290
|
-
After saving the plan, offer execution choice:
|
|
291
|
-
|
|
292
|
-
**"Plan complete and saved. Two execution options:**
|
|
293
|
-
|
|
294
|
-
**1. Orchestrated (recommended)** — I dispatch a fresh subagent per task with two-stage review (spec compliance then code quality). Use `pharaoh:orchestrate`.
|
|
295
|
-
|
|
296
|
-
**2. Inline Execution** — Execute tasks in this session with checkpoints. Use `pharaoh:execute`.
|
|
297
|
-
|
|
298
|
-
**Which approach?"**
|
|
299
|
-
|
|
300
|
-
---
|
|
128
|
+
## Wiring Checkpoints
|
|
301
129
|
|
|
302
|
-
|
|
130
|
+
Use these throughout the review, not just at the end:
|
|
303
131
|
|
|
304
|
-
- **Before
|
|
305
|
-
- **During
|
|
306
|
-
- **
|
|
307
|
-
- **
|
|
308
|
-
- **Final sweep**: `get_blast_radius` on ALL new exports — zero callers on non-entry-points = plan is incomplete
|
|
132
|
+
- **Before reviewing**: recon (Step 1 above)
|
|
133
|
+
- **During review**: check blast radius when evaluating impact; search for existing functions before suggesting new code
|
|
134
|
+
- **After decisions**: verify all new exports are reachable; check for disconnected code
|
|
135
|
+
- **Final sweep**: every new export must have a caller from a production entry point, or the plan is incomplete
|
|
309
136
|
|
|
310
137
|
## Workflow Rules
|
|
311
138
|
|
|
312
|
-
- After each
|
|
139
|
+
- **After each section, pause and ask for feedback before moving on**
|
|
313
140
|
- Do not assume priorities on timeline or scale
|
|
314
141
|
- If you see a better approach to the entire plan, say so BEFORE section-by-section review
|
|
315
142
|
- Challenge the approach if you see a better one — your job is to find problems the user will regret later
|
package/skills/sessions/SKILL.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sessions
|
|
3
3
|
prompt-name: session-decomposition
|
|
4
|
-
description: "Decompose work into parallel, isolated sessions using git worktrees. Each session gets fresh context, a narrow scope, and produces atomic commits.
|
|
5
|
-
version: 0.
|
|
4
|
+
description: "Decompose work into parallel, isolated sessions using git worktrees. Each session gets fresh context, a narrow scope, and produces atomic commits. Presents session prompts for user review before execution."
|
|
5
|
+
version: 0.3.0
|
|
6
6
|
homepage: https://pharaoh.so
|
|
7
7
|
user-invocable: true
|
|
8
8
|
metadata: {"emoji": "☥", "tags": ["sessions", "worktrees", "parallel-work", "context-management", "decomposition"]}
|
|
@@ -10,7 +10,7 @@ metadata: {"emoji": "☥", "tags": ["sessions", "worktrees", "parallel-work", "c
|
|
|
10
10
|
|
|
11
11
|
# Session Decomposition
|
|
12
12
|
|
|
13
|
-
Break large tasks into parallel, isolated work sessions. Each session runs in its own git worktree with fresh context, focused scope, and atomic commits.
|
|
13
|
+
Break large tasks into parallel, isolated work sessions. Each session runs in its own git worktree with fresh context, focused scope, and atomic commits.
|
|
14
14
|
|
|
15
15
|
## When to Use
|
|
16
16
|
|
|
@@ -25,9 +25,11 @@ Break large tasks into parallel, isolated work sessions. Each session runs in it
|
|
|
25
25
|
- Work is sequential (each step depends on the previous)
|
|
26
26
|
- Task fits comfortably in one session
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Step 1: Reconnaissance
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
If Pharaoh MCP tools are available, call `get_codebase_map` and `get_module_context` on affected modules to understand the current landscape before decomposing.
|
|
31
|
+
|
|
32
|
+
## Step 2: Decompose
|
|
31
33
|
|
|
32
34
|
Break the task into sessions. Each session must:
|
|
33
35
|
|
|
@@ -36,19 +38,9 @@ Break the task into sessions. Each session must:
|
|
|
36
38
|
- Be independently verifiable (tests pass, build succeeds)
|
|
37
39
|
- Produce atomic commits that make sense on their own
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
For each session, create an isolated worktree:
|
|
41
|
+
## Step 3: Write Session Prompts
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
git worktree add .worktrees/<session-name> -b <branch-name>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Install dependencies in each worktree. Verify clean baseline (tests pass).
|
|
48
|
-
|
|
49
|
-
### 3. Write Session Prompts
|
|
50
|
-
|
|
51
|
-
Each session gets a prompt containing:
|
|
43
|
+
For each session, write a complete prompt containing:
|
|
52
44
|
|
|
53
45
|
- **Goal:** what this session produces (1-2 sentences)
|
|
54
46
|
- **Scope:** which files/modules to touch (explicit list)
|
|
@@ -56,11 +48,34 @@ Each session gets a prompt containing:
|
|
|
56
48
|
- **Verification:** how to confirm the work is correct
|
|
57
49
|
- **Context:** any architectural decisions or patterns to follow
|
|
58
50
|
|
|
59
|
-
|
|
51
|
+
## Step 4: Present for Review (MANDATORY — do NOT skip)
|
|
52
|
+
|
|
53
|
+
**STOP. Paste every session prompt into the chat as a numbered list.**
|
|
54
|
+
|
|
55
|
+
For each session, show:
|
|
56
|
+
1. The session name
|
|
57
|
+
2. The full prompt text
|
|
58
|
+
3. Which sessions need `/plan` review (flag anything non-trivial)
|
|
59
|
+
|
|
60
|
+
**Wait for the user to approve, modify, add, remove, or reorder sessions before proceeding.** Do not create worktrees or execute any work until the user explicitly approves the decomposition.
|
|
61
|
+
|
|
62
|
+
If the user says "looks good" or similar, proceed. If they request changes, update the prompts and present again.
|
|
63
|
+
|
|
64
|
+
## Step 5: Create Worktrees
|
|
65
|
+
|
|
66
|
+
Only after user approval. For each session, create an isolated worktree:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git worktree add .worktrees/<session-name> -b <branch-name>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Install dependencies in each worktree. Verify clean baseline (tests pass).
|
|
73
|
+
|
|
74
|
+
## Step 6: Execute Sessions
|
|
60
75
|
|
|
61
76
|
Run each session independently. Sessions should not reference each other's work-in-progress — they operate on the same base commit.
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
## Step 7: Integrate
|
|
64
79
|
|
|
65
80
|
After all sessions complete:
|
|
66
81
|
|
|
@@ -84,3 +99,4 @@ After all sessions complete:
|
|
|
84
99
|
- **Atomic commits** — each session's output should be a coherent, reviewable unit
|
|
85
100
|
- **Verify before integrating** — never merge a session that doesn't pass its own checks
|
|
86
101
|
- **Decomposition is the hard part** — spend time getting boundaries right before starting work
|
|
102
|
+
- **The user reviews before execution** — always present prompts, never skip to building
|