pm-pipeline-mcp 0.2.0

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/index.js +1082 -0
  2. package/package.json +41 -0
package/index.js ADDED
@@ -0,0 +1,1082 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * PM Agent Pipeline — MCP Server
4
+ *
5
+ * Two tools:
6
+ * 1. generate_product_brief — creates project scaffold, runs 11-agent pipeline
7
+ * 2. delve_stage — deep-dive into any stage for 2-3x more detailed analysis
8
+ *
9
+ * Install: claude mcp add pm-pipeline node /path/to/mcp/index.js
10
+ */
11
+
12
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
13
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
14
+ import {
15
+ CallToolRequestSchema,
16
+ ListToolsRequestSchema,
17
+ } from "@modelcontextprotocol/sdk/types.js";
18
+ import fs from "fs";
19
+ import path from "path";
20
+ import { fileURLToPath } from "url";
21
+
22
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
23
+
24
+ // ─── Agent Prompts (standard) ─────────────────────────────────────────────────
25
+
26
+ const AGENTS = [
27
+ {
28
+ id: "problem-discoverer",
29
+ name: "Problem Discovery",
30
+ dir: "01-discovery",
31
+ prompt: `You are a problem-discoverer. Find problems worth solving by analyzing feedback, docs, and metrics.
32
+ Write 3-5 ranked problem statements to 01-discovery/problems.md.
33
+ Rank by impact × breadth × solvability. Include evidence with sources.
34
+ Write supporting artifacts to 01-discovery/evidence/.`,
35
+ inputs: ["source-docs/", "10-feedback/insights.md (if exists)"],
36
+ outputs: ["01-discovery/problems.md", "01-discovery/evidence/"],
37
+ },
38
+ {
39
+ id: "opportunity-validator",
40
+ name: "Opportunity Validation",
41
+ dir: "02-validation",
42
+ prompt: `You are an opportunity-validator. Size the market opportunity with financial rigor.
43
+ Write 02-validation/sizing.md with TAM/SAM/SOM, competition landscape, revenue model, projections.
44
+ Write 02-validation/assumptions.md with every assumption flagged as passed/failed/unknown.
45
+ Source every number. Be skeptical of wishful thinking.`,
46
+ inputs: ["01-discovery/problems.md", "source-docs/"],
47
+ outputs: ["02-validation/sizing.md", "02-validation/assumptions.md"],
48
+ },
49
+ {
50
+ id: "current-state-expert",
51
+ name: "Current State Assessment",
52
+ dir: "03-current-state",
53
+ prompt: `You are a current-state-expert. Map what exists today and what constraints apply.
54
+ Write 03-current-state/landscape.md (feature matrix, trends, opportunities).
55
+ Write 03-current-state/constraints.md (technical, business, timeline constraints).
56
+ Label constraints: real vs perceived, fixed vs negotiable.`,
57
+ inputs: ["01-discovery/problems.md", "source-docs/"],
58
+ outputs: ["03-current-state/landscape.md", "03-current-state/constraints.md"],
59
+ },
60
+ {
61
+ id: "solution-generator",
62
+ name: "Solution Generation",
63
+ dir: "04-solutions",
64
+ prompt: `You are a solution-generator. Generate 3+ concrete solutions for validated problems.
65
+ Write 04-solutions/options.md — each with one-liner, effort, stack, core features, monetization.
66
+ Write prototypes to 04-solutions/prototypes/.
67
+ Prefer simple. Include a "do nothing" baseline. Rank by viability.`,
68
+ inputs: ["01-discovery/problems.md", "03-current-state/landscape.md"],
69
+ outputs: ["04-solutions/options.md", "04-solutions/prototypes/"],
70
+ },
71
+ {
72
+ id: "solution-assessor",
73
+ name: "Solution Assessment",
74
+ dir: "05-assessment",
75
+ prompt: `You are a solution-assessor. Score options against weighted criteria.
76
+ Read Idea.md for project mode (pilot/mvp/platform).
77
+ Write 05-assessment/recommendation.md with scoring table, weighted total, recommendation, risk register.
78
+ Write 05-assessment/risks.md. Include a fallback option.`,
79
+ inputs: ["04-solutions/options.md", "Idea.md"],
80
+ outputs: ["05-assessment/recommendation.md", "05-assessment/risks.md"],
81
+ },
82
+ {
83
+ id: "ux-designer",
84
+ name: "UX Design",
85
+ dir: "06-design",
86
+ prompt: `You are a ux-designer. Design flows directly solving validated problems.
87
+ Write 06-design/design-spec.md — core principles, key screens, user flow.
88
+ Every decision traces to a problem. Minimum viable screens. Specify interactions.`,
89
+ inputs: ["01-discovery/problems.md", "04-solutions/options.md"],
90
+ outputs: ["06-design/design-spec.md"],
91
+ },
92
+ {
93
+ id: "ux-design-lead",
94
+ name: "Design Review",
95
+ dir: "07-design-review",
96
+ prompt: `You are a ux-design-lead. Critique the design for consistency and problem alignment.
97
+ Write 07-design-review/review.md with verdict, what works, required revisions, blocking issues.
98
+ Required revisions are non-negotiable. Block if the design doesn't solve top problems.`,
99
+ inputs: ["06-design/design-spec.md", "01-discovery/problems.md"],
100
+ outputs: ["07-design-review/review.md"],
101
+ },
102
+ {
103
+ id: "project-manager",
104
+ name: "Project Planning",
105
+ dir: "08-project-plan",
106
+ prompt: `You are a project-manager. Break the solution into a phased plan.
107
+ Write 08-project-plan/plan.md with timeline, team, deliverables, dependencies.
108
+ Each milestone produces a demoable output. Include 20% buffer.
109
+ If timeline > 8 weeks, propose a 4-week v0.`,
110
+ inputs: ["05-assessment/recommendation.md", "06-design/design-spec.md"],
111
+ outputs: ["08-project-plan/plan.md"],
112
+ },
113
+ {
114
+ id: "gtm-designer",
115
+ name: "GTM Design",
116
+ dir: "09-gtm",
117
+ prompt: `You are a gtm-designer. Design the launch campaign.
118
+ Write 09-gtm/launch-plan.md with channels, phases, and messaging.
119
+ Pick 2-3 primary channels. Include pre-launch, launch, and post-launch phases.
120
+ Headline and tagline should connect to the top problem.`,
121
+ inputs: ["01-discovery/problems.md", "08-project-plan/plan.md"],
122
+ outputs: ["09-gtm/launch-plan.md"],
123
+ },
124
+ {
125
+ id: "feedback-manager",
126
+ name: "Feedback Setup",
127
+ dir: "10-feedback",
128
+ prompt: `You are a feedback-manager. Design how you'll learn if the product works.
129
+ Write 10-feedback/insights.md with collection channels, metrics, learning loops.
130
+ Define success before launch. Prefer behavioral metrics over attitudinal.`,
131
+ inputs: ["01-discovery/problems.md", "06-design/design-spec.md"],
132
+ outputs: ["10-feedback/insights.md"],
133
+ },
134
+ {
135
+ id: "communications-specialist",
136
+ name: "Communications Planning",
137
+ dir: "11-communications",
138
+ prompt: `You are a communications-specialist. Create the daily launch calendar.
139
+ Write 11-communications/calendar.md — day-by-day launch week, weekly post-launch, voice & tone.
140
+ Every post has a goal. No corporate jargon. Adapt per channel.`,
141
+ inputs: ["09-gtm/launch-plan.md"],
142
+ outputs: ["11-communications/calendar.md"],
143
+ },
144
+ ];
145
+
146
+ // ─── Deep-Dive Prompts (for the delve_stage tool) ────────────────────────────
147
+
148
+ const DEEP_PROMPTS = {
149
+ "problem-discoverer": {
150
+ description: "Deep-dive on problem discovery — validate root causes, build personas, run 5-whys",
151
+ outputs: [
152
+ "01-discovery/deep/problems-validated.md",
153
+ "01-discovery/deep/5-whys-analysis.md",
154
+ "01-discovery/deep/personas.md",
155
+ "01-discovery/deep/evidence-triangulation.md",
156
+ ],
157
+ prompt: `You are doing a DEEP-DIVE on problem discovery. The initial pass identified top problems at a high level. Now dig deeper.
158
+
159
+ Read the existing outputs:
160
+ - Idea.md (if exists)
161
+ - 01-discovery/problems.md (initial problem statements)
162
+ - 01-discovery/evidence/ (any initial evidence gathered)
163
+
164
+ Your task — produce ALL of the following:
165
+
166
+ 1. **01-discovery/deep/problems-validated.md** — For each existing problem statement, add:
167
+ - Quantitative validation: Specific numbers from research, surveys, benchmarks
168
+ - Contradicting views: What evidence would argue this ISN'T a real problem?
169
+ - Severity calibration: On a 1-5 scale, how painful is this really? (not assumed, but justified)
170
+ - Frequency estimate: How often does this pain occur? Daily? Weekly? Once?
171
+
172
+ 2. **01-discovery/deep/5-whys-analysis.md** — Root cause deep-dive:
173
+ - Pick the top 2 problems and run a 5-Whys analysis on each
174
+ - Build a causal loop diagram (text-based) showing reinforcing feedback loops
175
+ - Identify leverage points: Where could a small change break the loop?
176
+ - Flag gating assumptions: What must be true for this root cause to be correct?
177
+
178
+ 3. **01-discovery/deep/personas.md** — Persona deep-dive:
179
+ - 3 detailed personas affected by the top problem(s)
180
+ - Each persona: demographics, daily workflow, tools used today, workarounds attempted, emotional state, willingness to pay
181
+ - Quote: "In their own words" — a realistic direct quote expressing their frustration
182
+ - Priority: Which persona suffers most and why they'd be first adopters
183
+
184
+ 4. **01-discovery/deep/evidence-triangulation.md** — Evidence quality assessment:
185
+ - For each evidence source in problems.md: Is it direct (user research) or inferred (analyst report)?
186
+ - Confidence rating per source: strong / moderate / weak / speculative
187
+ - Missing evidence: What data would resolve the biggest open questions?
188
+ - Quick-win research: The cheapest way to validate each assumption in <1 week
189
+
190
+ Rules:
191
+ - Do NOT re-summarize what the initial pass already said. Add NEW depth.
192
+ - Push past the obvious. If a root cause seems surface-level, ask "why?" again.
193
+ - Be skeptical. Good problem discovery disproves hypotheses, doesn't confirm them.
194
+ - If the initial pass had 4 problems and you find a 5th that was missed, add it.`,
195
+ },
196
+
197
+ "opportunity-validator": {
198
+ description: "Deep-dive on market sizing — TAM/SAM/SOM with bottoms-up validation, competitive teardowns, unit economics",
199
+ outputs: [
200
+ "02-validation/deep/competitive-teardown.md",
201
+ "02-validation/deep/bottoms-up-sizing.md",
202
+ "02-validation/deep/unit-economics.md",
203
+ "02-validation/deep/assumptions-validated.md",
204
+ ],
205
+ prompt: `You are doing a DEEP-DIVE on opportunity validation. The initial pass sized the market at a high level. Now build a defensible, bottoms-up model.
206
+
207
+ Read the existing outputs:
208
+ - 02-validation/sizing.md (initial TAM/SAM/SOM)
209
+ - 02-validation/assumptions.md (assumptions log)
210
+ - 01-discovery/problems.md
211
+ - Idea.md (for mode)
212
+
213
+ Your task:
214
+
215
+ 1. **02-validation/deep/competitive-teardown.md** — Full competitive analysis:
216
+ - Identify 5-8 direct and indirect competitors (not just the obvious 3)
217
+ - For each: pricing, MAU/usage estimate, key features, UX quality, funding/revenue
218
+ - Feature comparison matrix (rows = features, cols = competitors, cells = ✓/✗/partial)
219
+ - Competitive positioning map: on two axes (e.g., simplicity vs power, price vs privacy)
220
+ - Winner/Loser analysis: Who's winning today and why? Whose position is vulnerable?
221
+ - Blue ocean angles: What competitors are NOT doing that you could own
222
+
223
+ 2. **02-validation/deep/bottoms-up-sizing.md** — Defensible market model:
224
+ - TAM: Total addressable market with source and calculation (not just a cited number)
225
+ - SAM: Filtered by segment criteria (geo, demographic, behavior) with % attrition at each filter
226
+ - SOM: Year 1-3 bottoms-up projection from channel capacity
227
+ - Example: "We can reach 50K users via Product Hunt (10% conversion → 5K) + organic SEO (500/mo) → 11K Year 1"
228
+ - Growth scenarios: conservative (70% of base), moderate (base), aggressive (130%)
229
+
230
+ 3. **02-validation/deep/unit-economics.md** — Financial model:
231
+ - Customer acquisition cost by channel (estimate with justification)
232
+ - Lifetime value projection (retention curve assumptions, expansion revenue)
233
+ - LTV/CAC ratio for each scenario
234
+ - Break-even analysis: Months to recover CAC, months to overall profitability
235
+ - Sensitivity analysis: Which variable (price, retention, CAC) most changes outcomes?
236
+
237
+ 4. **02-validation/deep/assumptions-validated.md** — Revisit the initial assumptions log:
238
+ - For each assumption in assumptions.md: upgrade/downgrade confidence based on new analysis
239
+ - New assumptions discovered during deep-dive
240
+ - The "bet the company" assumption: What single assumption, if wrong, kills the business?
241
+ - Validation plan: How to test the top 3 highest-impact assumptions in 2 weeks for under $500
242
+
243
+ Rules:
244
+ - Source every number. "Industry average" is not a source.
245
+ - Bottoms-up beats top-down. A $4.2B TAM from Grand View Research is a starting point, not an answer.
246
+ - Be specific about competitor weaknesses: "Streaks has no Android version" > "competition is weak".
247
+ - If assumptions are too numerous to validate, prioritize by impact × uncertainty.`,
248
+ },
249
+
250
+ "current-state-expert": {
251
+ description: "Deep-dive on competitive landscape — feature matrices, trend analysis, constraint validation",
252
+ outputs: [
253
+ "03-current-state/deep/feature-matrix.md",
254
+ "03-current-state/deep/trend-analysis.md",
255
+ "03-current-state/deep/constraint-validated.md",
256
+ "03-current-state/deep/white-space-map.md",
257
+ ],
258
+ prompt: `You are doing a DEEP-DIVE on current state assessment. Move beyond high-level SWOT to granular competitive analysis and constraint validation.
259
+
260
+ Read existing outputs: 03-current-state/landscape.md, 03-current-state/constraints.md, 01-discovery/problems.md, Idea.md
261
+
262
+ Your task:
263
+
264
+ 1. **03-current-state/deep/feature-matrix.md** — Granular feature comparison:
265
+ - 20+ feature rows across categories: core functionality, UX, platform, privacy, pricing, integrations
266
+ - Columns: 8-10 competitors (direct + indirect + adjacent)
267
+ - Each cell: ✓ (native), ~ (partial/limited), ✗ (absent), ? (unknown)
268
+ - Scoring summary: who leads on feature coverage, who on UX polish, who on simplicity
269
+
270
+ 2. **03-current-state/deep/trend-analysis.md** — Market trends:
271
+ - 5-8 trends affecting this space (tech, consumer behavior, regulation, platform shifts)
272
+ - For each: signal strength, time horizon (0-6mo, 6-18mo, 18mo+), your positioning advantage
273
+ - Adjacent trends: What's happening in neighboring markets that could spill over?
274
+ - "Trend surf" assessment: Is the wind at your back or in your face?
275
+
276
+ 3. **03-current-state/deep/constraint-validated.md** — Reality-check constraints:
277
+ - For each constraint in constraints.md: Is it REAL (immovable), NEGOTIABLE (can be changed with effort), or PERCEIVED (assumed but not verified)?
278
+ - Technical deep-dive: What specific technical constraints exist? (API rate limits, platform policies, platform-specific behavior like iOS notification limits)
279
+ - Timeline constraints: What's the actual critical path? Not the optimistic one.
280
+ - Resource constraints: What would you NEED vs what would you LIKE?
281
+
282
+ 4. **03-current-state/deep/white-space-map.md** — Where competitors AREN'T:
283
+ - Map competitors on 2-3 axes relevant to your product's differentiation
284
+ - Highlight empty quadrants — these are your potential white spaces
285
+ - For each white space: Is it unoccupied because no one thought of it, or because it's not viable?
286
+ - Positioning recommendation: Which white space to claim and the one sentence that owns it
287
+
288
+ Rules:
289
+ - Don't just describe competitors — analyze their MOVES and TRAJECTORY
290
+ - A constraint you can work around isn't a real constraint
291
+ - White spaces that are empty for good reason (no demand, no business model) aren't opportunities`,
292
+ },
293
+
294
+ "solution-generator": {
295
+ description: "Deep-dive on solution options — architectural deep-dives, trade-off analysis, prototype specs",
296
+ outputs: [
297
+ "04-solutions/deep/architecture-comparison.md",
298
+ "04-solutions/deep/tradeoff-matrix.md",
299
+ "04-solutions/deep/prototype-spec.md",
300
+ "04-solutions/deep/phasing-strategy.md",
301
+ ],
302
+ prompt: `You are doing a DEEP-DIVE on solution generation. Move beyond 3 options at headline level to architectural trade-offs and detailed prototype specs.
303
+
304
+ Read existing outputs: 04-solutions/options.md, 04-solutions/prototypes/, 01-discovery/problems.md, Idea.md, 05-assessment/recommendation.md (if exists)
305
+
306
+ Your task:
307
+
308
+ 1. **04-solutions/deep/architecture-comparison.md** — Technical deep-dive:
309
+ - For the recommended option: Full architecture (components, data flow, external services, deployment)
310
+ - For the runner-up option: Same, showing where trade-offs differ
311
+ - Decision tree: What would make you switch from Option A to Option B? (e.g., "If pilot shows <20% retention, switch to Option C's approach")
312
+ - Stack evaluation: Why each library/framework was chosen over alternatives
313
+
314
+ 2. **04-solutions/deep/tradeoff-matrix.md** — Build vs buy vs partner analysis:
315
+ - For each major component: Build from scratch, Use OSS + customize, Buy SaaS, Partner/white-label
316
+ - Cost estimate: Dev time per option, ongoing maintenance, vendor lock-in risk
317
+ - Recommendation per component with rationale
318
+
319
+ 3. **04-solutions/deep/prototype-spec.md** — Detailed prototype specification:
320
+ - For Option A: Wireframe descriptions (not visual, but structural — every screen, every state)
321
+ - Empty states, error states, loading states, edge cases
322
+ - Data model: Key entities, relationships, fields
323
+ - API surface: Key endpoints or function signatures
324
+ - Success criteria: How will you know the prototype validated/invalidated the thesis?
325
+
326
+ 4. **04-solutions/deep/phasing-strategy.md** — Build sequencing:
327
+ - Phase 0 (Days 1-3): What's the absolute minimum to test the core risk?
328
+ - Phase 1 (Week 1-2): What gets you to "usable by 5 friends"?
329
+ - Phase 2 (Week 3-4): What makes it "worth sharing on HN"?
330
+ - Phase 3 (Month 2+): What turns it into a real product?
331
+ - Kill criteria: At what point do you stop and pivot?
332
+
333
+ Rules:
334
+ - Architecture matters. Don't hand-wave "React Native + Firebase" — justify the choices.
335
+ - Every trade-off has a cost. Acknowledge what you're giving up, not just what you gain.
336
+ - The prototype spec should be detailed enough that a developer could estimate hours from it.`,
337
+ },
338
+
339
+ "solution-assessor": {
340
+ description: "Deep-dive on assessment — risk quantification, sensitivity analysis, decision trees",
341
+ outputs: [
342
+ "05-assessment/deep/risk-quantified.md",
343
+ "05-assessment/deep/sensitivity-analysis.md",
344
+ "05-assessment/deep/decision-tree.md",
345
+ "05-assessment/deep/retrospective-scenarios.md",
346
+ ],
347
+ prompt: `You are doing a DEEP-DIVE on solution assessment. Move beyond a single scoring matrix to full risk quantification and decision modeling.
348
+
349
+ Read existing outputs: 05-assessment/recommendation.md, 05-assessment/risks.md, 04-solutions/options.md, Idea.md
350
+
351
+ Your task:
352
+
353
+ 1. **05-assessment/deep/risk-quantified.md** — Quantified risk register:
354
+ - For each risk in the initial register: Estimate specific dollar/time impact range
355
+ - Probability distribution: Low/medium/high → percentage ranges (e.g., 10-30%, 40-60%, 70-90%)
356
+ - Risk heat map: Plot risks on impact × probability grid, highlight top 3 to actively manage
357
+ - Mitigation cost: What's the cost (time/money/scope) to mitigate each top risk?
358
+ - Risk owner assignment: Who (by role) is responsible for monitoring each risk?
359
+
360
+ 2. **05-assessment/deep/sensitivity-analysis.md** — What moves the needle:
361
+ - Single-variable sensitivity: If ONLY [variable] changes, at what point does the recommendation flip?
362
+ - Multi-variable scenarios: Best case, worst case, most likely case for the recommended option
363
+ - The "one thing" that matters most: For each option, identify the single assumption that determines success or failure
364
+ - Threshold analysis: What would need to be true for Option B to beat Option A? And is that realistic?
365
+
366
+ 3. **05-assessment/deep/decision-tree.md** — Sequential decision model:
367
+ - Build a decision tree: "If we do X and Y happens, then Z. But if Y' happens instead, then Z'."
368
+ - Include option nodes (choices you control) and chance nodes (things outside your control)
369
+ - Expected value calculation for each path (simplified)
370
+ - Recommend the path with highest expected value, not just the highest upside
371
+ - Path dependency: What decisions TODAY limit your options TOMORROW?
372
+
373
+ 4. **05-assessment/deep/retrospective-scenarios.md** — What would future-you say?:
374
+ - "6 months from now, this failed because..." — 3 concrete failure narratives
375
+ - "6 months from now, this succeeded wildly because..." — 1 success narrative
376
+ - Pre-mortem insights: What actions TODAY prevent the failure scenarios?
377
+ - Kill criteria refinement: Based on the above, what specific metric would trigger a pivot?
378
+
379
+ Rules:
380
+ - Quantify everything you can. "High impact" is not a number.
381
+ - Decision trees expose assumptions. If a branch depends on an assumption you can't verify, flag it.
382
+ - Pre-mortems are more honest than success scenarios. Spend more time on failure modes.`,
383
+ },
384
+
385
+ "ux-designer": {
386
+ description: "Deep-dive on UX — screen-by-screen specs, interaction design, accessibility, microcopy",
387
+ outputs: [
388
+ "06-design/deep/screen-specs.md",
389
+ "06-design/deep/interaction-flows.md",
390
+ "06-design/deep/accessibility-audit.md",
391
+ "06-design/deep/microcopy-guide.md",
392
+ ],
393
+ prompt: `You are doing a DEEP-DIVE on UX design. Move beyond core screens and principles to full interaction specs and accessibility.
394
+
395
+ Read existing outputs: 06-design/design-spec.md, 01-discovery/problems.md, Idea.md
396
+
397
+ Your task:
398
+
399
+ 1. **06-design/deep/screen-specs.md** — Complete screen specifications:
400
+ - Every screen from the initial design-spec.md, plus any missing screens
401
+ - For each screen: purpose, elements (type, label, behavior), states (default, active, error, empty, loading)
402
+ - Input validation rules, error messages, confirmation dialogs
403
+ - Empty states: What does each screen look like with no data?
404
+ - Edge cases: What happens at 1 item? 100 items? Midnight on New Year's?
405
+
406
+ 2. **06-design/deep/interaction-flows.md** — Detailed interaction design:
407
+ - Every tap/swipe/gesture mapped to its outcome
408
+ - Error recovery: What happens when an action fails? (network error, validation error, permission denied)
409
+ - Micro-interactions: Haptic feedback, animations, transitions (describe in words)
410
+ - Task completion times: Estimated seconds per key task (baseline vs target)
411
+ - Offline behavior: What works without internet? What degrades? What breaks?
412
+ - Cross-device: Mobile → tablet → desktop flow continuity
413
+
414
+ 3. **06-design/deep/accessibility-audit.md** — Accessibility specification:
415
+ - Screen reader behavior for every interactive element
416
+ - Color contrast ratios for all text/background combinations
417
+ - Touch target sizes (minimum 44×44pt) and spacing
418
+ - Keyboard navigation order and shortcuts
419
+ - Motion sensitivity: Respecting reduced-motion preferences
420
+ - Text scaling: How UI adapts to larger text sizes
421
+ - WCAG 2.1 level AA compliance checklist
422
+
423
+ 4. **06-design/deep/microcopy-guide.md** — Voice and microcopy:
424
+ - Brand voice: 3-5 adjectives describing the tone, with examples
425
+ - Button labels: Every CTA with rationale ("Why 'Start today' instead of 'Sign up'")
426
+ - Error messages: Tone, structure, recovery action (no "Something went wrong" without guidance)
427
+ - Empty states: Friendly, helpful, not patronizing
428
+ - Notifications: What we push, what we email, what we never say
429
+ - Confirmation flow: "Are you sure?" patterns, undo options, destructive action warnings
430
+
431
+ Rules:
432
+ - Every screen needs every state. Default-only design isn't design.
433
+ - Accessibility is not a checklist. It's how real people use your product.
434
+ - Microcopy is UX. "Delete" vs "Archive" vs "Remove" changes user behavior.`,
435
+ },
436
+
437
+ "ux-design-lead": {
438
+ description: "Deep-dive design review — heuristic evaluation, competitive UX benchmark, user testing plan",
439
+ outputs: [
440
+ "07-design-review/deep/heuristic-evaluation.md",
441
+ "07-design-review/deep/ux-benchmark.md",
442
+ "07-design-review/deep/user-testing-plan.md",
443
+ "07-design-review/deep/design-debt-log.md",
444
+ ],
445
+ prompt: `You are doing a DEEP-DIVE design review. Go beyond blocking issues to a full heuristic evaluation and competitive UX benchmark.
446
+
447
+ Read existing outputs: 07-design-review/review.md, 06-design/design-spec.md, 01-discovery/problems.md
448
+
449
+ Your task:
450
+
451
+ 1. **07-design-review/deep/heuristic-evaluation.md** — Nielsen 10 heuristic evaluation:
452
+ - Score the current design against Jakob Nielsen's 10 usability heuristics
453
+ - For each heuristic: rating (1-5), specific violation examples, severity, fix suggestion
454
+ - Top 3 most damaging violations and why they'll cause real user pain
455
+ - What the design does WELL (don't just criticize — identify what to protect)
456
+
457
+ 2. **07-design-review/deep/ux-benchmark.md** — Competitive UX comparison:
458
+ - Benchmark your design against 3-5 competitors on key UX dimensions
459
+ - Task completion comparison: How many taps/clicks for the core task in each competitor?
460
+ - UX quality scoring: Onboarding, core task, error recovery, settings, export
461
+ - Areas where your design LEADS and areas where it LAGS
462
+
463
+ 3. **07-design-review/deep/user-testing-plan.md** — How to validate the design:
464
+ - 5-question usability test script (tasks, success criteria, time expectations)
465
+ - Participant recruiting criteria (who to test with, where to find them)
466
+ - Test format: Moderated remote? Unmoderated? In-person?
467
+ - Success thresholds: What completion rate and satisfaction score indicate "good enough"?
468
+ - Top 3 things to test FIRST (highest risk areas)
469
+ - Analysis method: How to turn observations into design changes
470
+
471
+ 4. **07-design-review/deep/design-debt-log.md** — Track what to fix later:
472
+ - Design decisions made for speed that need revisiting
473
+ - Each entry: what it is, why it was done, when to revisit, what revisiting would require
474
+ - Priority: P0 (ship-blocking), P1 (fix before v1.1), P2 (nice to have), P3 (vision backlog)
475
+
476
+ Rules:
477
+ - Heuristic evaluations without specific examples are useless. Point to the exact screen and element.
478
+ - A good UX benchmark reveals WHY competitors made their choices, not just what they chose.
479
+ - Testing with 3 users finds 80% of issues. Plan for 5. Don't wait for perfection.`,
480
+ },
481
+
482
+ "project-manager": {
483
+ description: "Deep-dive on project planning — sprint-by-sprint breakdown, dependency mapping, resource loading",
484
+ outputs: [
485
+ "08-project-plan/deep/sprint-breakdown.md",
486
+ "08-project-plan/deep/dependency-graph.md",
487
+ "08-project-plan/deep/resource-plan.md",
488
+ "08-project-plan/deep/milestone-gates.md",
489
+ ],
490
+ prompt: `You are doing a DEEP-DIVE on project planning. Move from a 5-week timeline to sprint-by-sprint task breakdowns with resource loading.
491
+
492
+ Read existing outputs: 08-project-plan/plan.md, 05-assessment/recommendation.md, 06-design/design-spec.md
493
+
494
+ Your task:
495
+
496
+ 1. **08-project-plan/deep/sprint-breakdown.md** — Detailed sprint plans:
497
+ - For each week in the plan: Break into individual tasks (3-7 per week)
498
+ - Each task: description, estimated hours, dependencies, owner, deliverables
499
+ - Task dependencies visual (text-based graph): which tasks block which
500
+ - Critical path: The sequence of tasks that determines the overall timeline
501
+ - Slack/buffer: Where is there flexibility? Where is there zero room?
502
+
503
+ 2. **08-project-plan/deep/dependency-graph.md** — Full dependency map:
504
+ - External dependencies: APIs, libraries, design assets, legal/contract, third-party approvals
505
+ - Internal dependencies: Team member handoffs, technical milestones
506
+ - "Lead time" hazards: What takes 2 weeks to get but 2 minutes to ask for? (e.g., app store review, SSL cert, legal review)
507
+ - Dependency risk: For each dependency, what's the backup plan if it fails or is delayed?
508
+
509
+ 3. **08-project-plan/deep/resource-plan.md** — Resource allocation:
510
+ - Who does what, when, for how long (hourly/daily breakdown)
511
+ - Skill gaps: What does the team NOT know that they'll need to learn?
512
+ - Risk of single points of failure: What if the only person who knows X is sick?
513
+ - Tooling/infra needs: CI/CD, hosting, monitoring, analytics, error tracking
514
+ - Budget estimate (if applicable): Hosting, SaaS tools, contractor costs per month
515
+
516
+ 4. **08-project-plan/deep/milestone-gates.md** — Gated milestones with exit criteria:
517
+ - For each milestone: exact exit criteria (not "mostly done" but "demoable, testable, shippable")
518
+ - Go/no-go decision points: What data determines whether to proceed or pivot?
519
+ - Quality gates: Code review, test coverage, performance benchmarks, UX sign-off
520
+ - Celebration points: Small wins worth marking to maintain momentum
521
+
522
+ Rules:
523
+ - A task without an hour estimate is a wish, not a plan. Be honest about uncertainty (+/- 50% is fine).
524
+ - The critical path is the only thing that matters for timeline. Everything else has buffer.
525
+ - Single points of failure are real risks. Mitigate them or accept the consequences.`,
526
+ },
527
+
528
+ "gtm-designer": {
529
+ description: "Deep-dive on GTM — channel strategy, messaging matrix, launch playbook, influencer map",
530
+ outputs: [
531
+ "09-gtm/deep/channel-strategy.md",
532
+ "09-gtm/deep/messaging-matrix.md",
533
+ "09-gtm/deep/launch-playbook.md",
534
+ "09-gtm/deep/influencer-map.md",
535
+ ],
536
+ prompt: `You are doing a DEEP-DIVE on GTM strategy. Move beyond channel priority to a full launch playbook with messaging variants for every audience.
537
+
538
+ Read existing outputs: 09-gtm/launch-plan.md, 01-discovery/problems.md, Idea.md
539
+
540
+ Your task:
541
+
542
+ 1. **09-gtm/deep/channel-strategy.md** — Channel deep-dive:
543
+ - For each of the top 3 channels: Content strategy, posting cadence, engagement playbook
544
+ - Channel-specific: What works on HN doesn't work on Product Hunt
545
+ - Launch day timeline: Hour-by-hour plan for launch day (what to post, when, where)
546
+ - Secondary channels: 3-5 additional channels with lower expected impact but near-zero marginal effort
547
+ - Community strategy: Where does your target audience already hang out, and how do you add value before asking for attention?
548
+
549
+ 2. **09-gtm/deep/messaging-matrix.md** — Messaging by audience:
550
+ - For each audience segment: Headline, tagline, pain point hook, value prop, proof point, CTA
551
+ - Segments: Indie hackers, PMs, startup CTOs, VC-backed founders, side project builders
552
+ - A/B test pairs: 2-3 message pairs worth testing in the first week
553
+ - Anti-messaging: What to AVOID saying to each audience (jargon they hate, claims they'll see through)
554
+
555
+ 3. **09-gtm/deep/launch-playbook.md** — Step-by-step launch playbook:
556
+ - Pre-launch (D-14 to D-1): Teaser content, influencer outreach, landing page, waitlist, community seeding
557
+ - Launch day (D-Day): Hour-by-hour posting schedule across all channels with exact copy for each post
558
+ - Post-launch (D+1 to D+14): Follow-up content, engagement replies, feedback collection, iteration
559
+ - Crisis mode: What if the launch flops? Emergency pivot plan
560
+ - Measuring success: Exact metrics for each channel (upvotes, stars, signups, comments, shares)
561
+
562
+ 4. **09-gtm/deep/influencer-map.md** — Who can amplify:
563
+ - Tier 1: 3-5 influencers/accounts with direct audience overlap (reach out personally)
564
+ - Tier 2: 10-15 accounts to tag/engage with (no direct ask, build relationship)
565
+ - Tier 3: Communities to post in (Reddit, Discord, Slack groups, newsletters)
566
+ - For each tier 1: why they'd care, what you can offer them, outreach template
567
+
568
+ Rules:
569
+ - Launch day is chaos. An hour-by-hour plan keeps you focused when things get noisy.
570
+ - Different audiences need different messages. Using the same hook for HN and PH is leaving traction on the table.
571
+ - Influencer outreach without a personalized "why this matters to YOU" is spam.`,
572
+ },
573
+
574
+ "feedback-manager": {
575
+ description: "Deep-dive on feedback — metric tree, survey design, analytics schema, learning cadence",
576
+ outputs: [
577
+ "10-feedback/deep/metrics-tree.md",
578
+ "10-feedback/deep/survey-instrument.md",
579
+ "10-feedback/deep/analytics-plan.md",
580
+ "10-feedback/deep/learning-cadence.md",
581
+ ],
582
+ prompt: `You are doing a DEEP-DIVE on feedback setup. Move from collection channels to a full metrics tree with survey instruments and analytics schema.
583
+
584
+ Read existing outputs: 10-feedback/insights.md, 01-discovery/problems.md, Idea.md, 06-design/design-spec.md
585
+
586
+ Your task:
587
+
588
+ 1. **10-feedback/deep/metrics-tree.md** — Full metrics framework:
589
+ - North star metric: One number that captures whether you're delivering real value (justify your choice)
590
+ - Input metrics: 3-5 leading indicators that predict the north star
591
+ - Output metrics: 3-5 lagging indicators that confirm progress
592
+ - Counter-metrics: What could look good but actually be bad? (e.g., high time-in-app = confusing UX)
593
+ - Segment breakdown: Metrics by user cohort (power users vs casual, new vs returning, channel source)
594
+
595
+ 2. **10-feedback/deep/survey-instrument.md** — Surveys ready to deploy:
596
+ - Onboarding survey: 3 questions maximum, placed at the right moment
597
+ - Weekly pulse survey: 1 question, every Friday, automated
598
+ - Churn survey: Show at cancellation with conditional follow-ups
599
+ - NPS survey: Standardized at day 14 with open-ended follow up
600
+ - Customer development interview guide: 10 open-ended questions for 30-min user interviews
601
+ - For each: exact question text, response options, trigger, channel, expected completion rate
602
+
603
+ 3. **10-feedback/deep/analytics-plan.md** — Events and analytics:
604
+ - Key events to track: Every meaningful user action with properties
605
+ - Event taxonomy: Standardized naming convention (object_action_context)
606
+ - Dashboard layout: 3 dashboards (executive, product, engineering) with specific charts
607
+ - Funnel analysis: Key conversion funnels with expected vs concerning drop-off rates
608
+ - Cohort analysis: How retention changes by acquisition channel and signup month
609
+ - Tool recommendation: What analytics stack to use (and why not the alternatives)
610
+
611
+ 4. **10-feedback/deep/learning-cadence.md** — How you'll learn over time:
612
+ - Weekly: Metrics review (30 min), user interview (1 hour), support ticket review (15 min)
613
+ - Monthly: Full metrics deep-dive, survey results review, cohort analysis
614
+ - Quarterly: Strategic review, competitive re-assessment, north star check-in
615
+ - Learning loop: How insights become experiments, experiments become features, features get measured again
616
+ - "Close the loop": How to tell users "you asked for this, here it is"
617
+
618
+ Rules:
619
+ - A north star without supporting metrics is a wish. Build the tree.
620
+ - Surveys need a trigger context. A popup on page 1 gets different answers than one after key action.
621
+ - Events without a dashboard are noise. Define the view before you define the event.`,
622
+ },
623
+
624
+ "communications-specialist": {
625
+ description: "Deep-dive on communications — asset templates, channel-specific copy, engagement playbook, metrics",
626
+ outputs: [
627
+ "11-communications/deep/asset-templates.md",
628
+ "11-communications/deep/channel-copy.md",
629
+ "11-communications/deep/engagement-playbook.md",
630
+ "11-communications/deep/comms-metrics.md",
631
+ ],
632
+ prompt: `You are doing a DEEP-DIVE on communications. Move from a launch-week calendar to full asset templates and channel-specific copy.
633
+
634
+ Read existing outputs: 11-communications/calendar.md, 09-gtm/launch-plan.md, Idea.md, 01-discovery/problems.md
635
+
636
+ Your task:
637
+
638
+ 1. **11-communications/deep/asset-templates.md** — Templates ready to fill:
639
+ - Product Hunt listing template: Title, tagline, description sections, GIF caption, first comment
640
+ - HN Show HN template: Title, body, top comment (you answer your own post)
641
+ - Launch tweet thread template: 5-8 tweets, each with hook, body, CTA
642
+ - Reddit post templates: r/ClaudeAI, r/SideProject, r/SaaS — each with unique angle
643
+ - Newsletter announcement: Subject line, preview text, body, PS
644
+ - For each: [bracketed placeholders] for the parts they need to customize
645
+
646
+ 2. **11-communications/deep/channel-copy.md** — Full copy for each channel:
647
+ - Product Hunt: Full description, first comment, maker comment, tags
648
+ - HN: Show HN title (different from PH), body, first responder comment
649
+ - Twitter: 10-tweet thread, plus 5 standalone posts, plus reply templates
650
+ - Reddit: Full post body for each target subreddit
651
+ - Blog/dev.to: Full draft of the "How I built this" post
652
+ - LinkedIn (optional): Professional version, shorter, more business-forward
653
+
654
+ 3. **11-communications/deep/engagement-playbook.md** — How to respond:
655
+ - Positive comment reply: Template and examples
656
+ - Constructive criticism reply: Template and examples
657
+ - Negative/ dismissive reply: Template and examples
658
+ - "Can you build X?" reply: Template and examples
659
+ - Question reply: How to answer thoroughly without sounding defensive
660
+ - Timing guidelines: Reply within 1 hour on launch day, within 24 hours otherwise
661
+ - Escalation: What to do if a thread goes viral (positive) or toxic (negative)
662
+
663
+ 4. **11-communications/deep/comms-metrics.md** — How to measure comms impact:
664
+ - Per-channel metrics: Impressions, engagement rate, sentiment, conversion to repo star/signup
665
+ - Target ranges: What's good, great, and disappointing for each channel
666
+ - Tracking setup: UTM parameters, referrer tracking, star-to-signup funnel
667
+ - Iteration loop: Review metrics → identify what's working → double down → repeat weekly
668
+
669
+ Rules:
670
+ - Templates save time. Fill them in BEFORE launch day, not during.
671
+ - Every comment is a chance to build or burn goodwill. Reply like a human, not a brand.
672
+ - A launch is not a one-day event. The most valuable engagement happens in the 48 hours after.`,
673
+ },
674
+ };
675
+
676
+ // ─── Server ───────────────────────────────────────────────────────────────────
677
+
678
+ const server = new Server(
679
+ {
680
+ name: "pm-pipeline-mcp",
681
+ version: "0.2.0",
682
+ },
683
+ {
684
+ capabilities: {
685
+ tools: {},
686
+ },
687
+ }
688
+ );
689
+
690
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
691
+ tools: [
692
+ {
693
+ name: "generate_product_brief",
694
+ description:
695
+ "Create a complete product brief for any idea. Runs an 11-agent pipeline: problem discovery → opportunity validation → solution generation → design → project plan → GTM launch plan. Output is a set of markdown files in the current directory.",
696
+ inputSchema: {
697
+ type: "object",
698
+ properties: {
699
+ idea: {
700
+ type: "string",
701
+ description:
702
+ "Describe your product idea. Include target users, core problem, and key differentiators.",
703
+ },
704
+ projectName: {
705
+ type: "string",
706
+ description:
707
+ "Project directory name (defaults to sanitized idea slug)",
708
+ },
709
+ mode: {
710
+ type: "string",
711
+ enum: ["pilot", "mvp", "platform"],
712
+ description:
713
+ "pilot = fastest validation, mvp = balanced, platform = full build",
714
+ default: "mvp",
715
+ },
716
+ },
717
+ required: ["idea"],
718
+ },
719
+ },
720
+ {
721
+ name: "delve_stage",
722
+ description:
723
+ "Deep-dive into a specific pipeline stage. After an initial pipeline run, use this to produce 2-3x more detailed analysis on any single stage. Creates a 'deep/' subfolder inside the stage directory with validated problems, competitive teardowns, full competitive analysis, quantified risks, screen-by-screen specs, sprint breakdowns, or channel-specific copy — depending on the stage.",
724
+ inputSchema: {
725
+ type: "object",
726
+ properties: {
727
+ projectDir: {
728
+ type: "string",
729
+ description:
730
+ "Path to the existing pipeline project directory (must have stages like 01-discovery/, 02-validation/, etc.)",
731
+ },
732
+ stage: {
733
+ type: "string",
734
+ description:
735
+ "Stage to deep-dive. Use agent id (e.g. 'problem-discoverer', 'opportunity-validator') or stage number (1-11).",
736
+ },
737
+ focus: {
738
+ type: "string",
739
+ description:
740
+ "Optional specific area within the stage to explore deeper. If omitted, the agent produces all deep-dive outputs for that stage.",
741
+ },
742
+ approach: {
743
+ type: "string",
744
+ enum: ["depth", "breadth"],
745
+ description:
746
+ "depth = go deeper on what exists (e.g., full teardown of top competitor), breadth = explore adjacent areas (e.g., add 3 more competitors to the analysis)",
747
+ default: "depth",
748
+ },
749
+ },
750
+ required: ["projectDir", "stage"],
751
+ },
752
+ },
753
+ ],
754
+ }));
755
+
756
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
757
+
758
+ function sanitizeProjectName(name) {
759
+ return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
760
+ }
761
+
762
+ function getAgentByInput(stage) {
763
+ // By agent id
764
+ const byId = AGENTS.find((a) => a.id === stage);
765
+ if (byId) return byId;
766
+
767
+ // By number
768
+ const num = parseInt(stage, 10);
769
+ if (!isNaN(num) && num >= 1 && num <= AGENTS.length) {
770
+ return AGENTS[num - 1];
771
+ }
772
+
773
+ return null;
774
+ }
775
+
776
+ function fmtDate() {
777
+ return new Date().toISOString().split("T")[0];
778
+ }
779
+
780
+ // ─── Tool Handlers ────────────────────────────────────────────────────────────
781
+
782
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
783
+ const toolName = request.params.name;
784
+ const args = request.params.arguments;
785
+
786
+ if (toolName === "generate_product_brief") {
787
+ return handleGenerateBrief(args);
788
+ }
789
+
790
+ if (toolName === "delve_stage") {
791
+ return handleDelveStage(args);
792
+ }
793
+
794
+ return {
795
+ content: [{ type: "text", text: `Unknown tool: ${toolName}` }],
796
+ isError: true,
797
+ };
798
+ });
799
+
800
+ // ─── Tool: generate_product_brief ─────────────────────────────────────────────
801
+
802
+ async function handleGenerateBrief(args) {
803
+ const { idea, projectName, mode } = args;
804
+
805
+ const projectDir = path.resolve(
806
+ process.cwd(),
807
+ projectName || sanitizeProjectName(idea)
808
+ );
809
+
810
+ if (fs.existsSync(projectDir)) {
811
+ return {
812
+ content: [
813
+ {
814
+ type: "text",
815
+ text: `❌ Directory "${projectDir}" already exists. Choose a different project name or location.`,
816
+ },
817
+ ],
818
+ isError: true,
819
+ };
820
+ }
821
+
822
+ fs.mkdirSync(projectDir, { recursive: true });
823
+
824
+ // Write Idea.md
825
+ const ideaDoc = `# Idea: ${projectName || "Untitled"}
826
+
827
+ ${idea}
828
+
829
+ **Mode**: ${mode || "mvp"}
830
+
831
+ Generated by PM Agent Pipeline MCP — ${fmtDate()}
832
+ `;
833
+
834
+ fs.writeFileSync(path.join(projectDir, "Idea.md"), ideaDoc);
835
+
836
+ // Create agent output directories
837
+ for (const agent of AGENTS) {
838
+ fs.mkdirSync(path.join(projectDir, agent.dir), { recursive: true });
839
+ }
840
+
841
+ // Write gates.md
842
+ const gates = AGENTS.map((a, i) => {
843
+ const status = i === 0 ? "pending" : "awaiting-previous";
844
+ return `## Gate ${i + 1}: ${a.name}
845
+ - **status**: ${status}
846
+ - **agent**: ${a.id}
847
+ - **artifacts**: ${a.dir}/
848
+ - **summary**: Awaiting ${a.id}`;
849
+ }).join("\n\n");
850
+
851
+ fs.writeFileSync(
852
+ path.join(projectDir, "gates.md"),
853
+ `# Gates — Decision Log\n\n${gates}\n`
854
+ );
855
+
856
+ // Write pipeline.md
857
+ fs.writeFileSync(
858
+ path.join(projectDir, "pipeline.md"),
859
+ `# Pipeline State\n\n## Project\n- **Name**: ${projectName || "Untitled"}\n- **Mode**: ${mode || "mvp"}\n- **Created**: ${fmtDate()}\n\n## Next Step\nRun the first agent: **problem-discoverer** — analyze feedback and write problem statements.\nSee gates.md for the full pipeline status.\n`
860
+ );
861
+
862
+ // Build agent instruction block
863
+ const agentInstructions = AGENTS.map(
864
+ (a, i) => `### Agent ${i + 1}: ${a.name} (${a.id})
865
+
866
+ When it's your turn:
867
+
868
+ 1. Read: ${a.inputs.join(", ")}
869
+ 2. Generate: ${a.outputs.join(", ")}
870
+ 3. Write output to \`${a.dir}/\`
871
+ 4. Update \`gates.md\` — set your gate to \`pending-review\`
872
+
873
+ Your prompt:
874
+ ${a.prompt}
875
+ `
876
+ ).join("\n---\n\n");
877
+
878
+ // Build deep-dive hint
879
+ const deepDiveHint = AGENTS.map(
880
+ (a, i) => `- \`${a.id}\` (Stage ${i + 1}): ${DEEP_PROMPTS[a.id]?.description || "Standard depth available"}`
881
+ ).join("\n");
882
+
883
+ return {
884
+ content: [
885
+ {
886
+ type: "text",
887
+ text: `✅ Project scaffold created at **${projectDir}**
888
+
889
+ ## How to Run
890
+
891
+ The pipeline has 11 agents that run sequentially. Each agent writes output and updates \`gates.md\`. The human reviews and approves each gate before the next agent proceeds.
892
+
893
+ ### Current State
894
+
895
+ Gate 1 (Problem Discovery) is ready to run. All files are in \`${projectDir}/\`.
896
+
897
+ ### Agent Instructions
898
+
899
+ ${agentInstructions}
900
+
901
+ ---
902
+
903
+ ### 🌊 Deep-Dive Mode Available
904
+
905
+ After the initial pipeline run, you can dive deeper into any stage:
906
+
907
+ \`delve_stage(projectDir="${projectDir}", stage="<agent-id>")\`
908
+
909
+ Available deep-dives:
910
+ ${deepDiveHint}
911
+
912
+ Each produces 4 files of 2-3x depth per stage.
913
+
914
+ ### Directory Structure
915
+
916
+ \`\`\`
917
+ ${projectDir}/
918
+ ├── Idea.md ← Your idea (written)
919
+ ├── gates.md ← Pipeline control plane (update after each agent)
920
+ ├── pipeline.md ← Status overview
921
+ ${AGENTS.map((a) => `├── ${a.dir}/ ← Agent ${a.id} output`).join("\n")}
922
+ \`\`\`
923
+ `,
924
+ },
925
+ ],
926
+ };
927
+ }
928
+
929
+ // ─── Tool: delve_stage ────────────────────────────────────────────────────────
930
+
931
+ async function handleDelveStage(args) {
932
+ const { projectDir: rawDir, stage, focus, approach } = args;
933
+ const projectDir = path.resolve(rawDir);
934
+
935
+ // Validate project exists
936
+ if (!fs.existsSync(projectDir)) {
937
+ return {
938
+ content: [
939
+ {
940
+ type: "text",
941
+ text: `❌ Directory "${projectDir}" does not exist. Run \`generate_product_brief\` first to create a project.`,
942
+ },
943
+ ],
944
+ isError: true,
945
+ };
946
+ }
947
+
948
+ // Find the agent
949
+ const agent = getAgentByInput(stage);
950
+ if (!agent) {
951
+ const valid = AGENTS.map((a) => ` "${a.id}" (Stage ${AGENTS.indexOf(a) + 1})`).join("\n");
952
+ return {
953
+ content: [
954
+ {
955
+ type: "text",
956
+ text: `❌ Unknown stage: "${stage}". Valid options:\n${valid}`,
957
+ },
958
+ ],
959
+ isError: true,
960
+ };
961
+ }
962
+
963
+ // Check if deep prompts exist
964
+ const deep = DEEP_PROMPTS[agent.id];
965
+ if (!deep) {
966
+ return {
967
+ content: [
968
+ {
969
+ type: "text",
970
+ text: `❌ No deep-dive prompts defined for "${agent.id}" yet.`,
971
+ },
972
+ ],
973
+ isError: true,
974
+ };
975
+ }
976
+
977
+ // Check initial pass output exists
978
+ const initialOutputs = agent.outputs
979
+ .map((o) => path.join(projectDir, o))
980
+ .filter((p) => fs.existsSync(p));
981
+
982
+ // Create deep directory
983
+ const deepDir = path.join(projectDir, agent.dir, "deep");
984
+ fs.mkdirSync(deepDir, { recursive: true });
985
+
986
+ // Write a manifest for the deep-dive
987
+ const manifestPath = path.join(deepDir, "MANIFEST.md");
988
+ const manifest = `# Deep-Dive: ${agent.name}
989
+
990
+ **Approach**: ${approach || "depth"}
991
+ **Focus**: ${focus || "All areas"}
992
+ **Date**: ${fmtDate()}
993
+
994
+ This deep-dive was triggered by \`delve_stage\` after the initial pipeline pass.
995
+ Use these outputs alongside the initial \`${agent.dir}/\` files.
996
+
997
+ ## Expected Outputs
998
+
999
+ ${deep.outputs.map((o) => `- \`${path.basename(o)}\``).join("\n")}
1000
+
1001
+ ## Instructions for the LLM
1002
+
1003
+ Read the initial outputs from \`${agent.dir}/\`, then execute the deep-dive.
1004
+ Output files go to \`${agent.dir}/deep/\`.
1005
+ `;
1006
+
1007
+ fs.writeFileSync(manifestPath, manifest);
1008
+
1009
+ // Build the output list
1010
+ const outputList = deep.outputs.map((o) => ` - \`${o}\``).join("\n");
1011
+
1012
+ // Check existing initial outputs
1013
+ const initialStatus = initialOutputs.length > 0
1014
+ ? `Found ${initialOutputs.length} existing output(s) in \`${agent.dir}/\`. Deep-dive will build on these.`
1015
+ : `⚠️ No initial outputs found in \`${agent.dir}/\`. Deep-dive will generate standalone content.`;
1016
+
1017
+ // Build stage-specific section
1018
+ const stageMap = {};
1019
+ AGENTS.forEach((a, i) => { stageMap[a.id] = `Stage ${i + 1}: ${a.name}`; });
1020
+
1021
+ let focusSection = "";
1022
+ if (focus) {
1023
+ focusSection = `
1024
+
1025
+ ### Focus Area
1026
+
1027
+ Concentrate on: **${focus}**. The deep-dive should prioritize depth in this area over breadth across all outputs.`;
1028
+ }
1029
+
1030
+ const approachLabel = approach === "breadth"
1031
+ ? "broaden the analysis to cover adjacent areas the initial pass missed"
1032
+ : "go deeper on what was already produced, adding specificity, quantification, and actionable detail";
1033
+
1034
+ return {
1035
+ content: [
1036
+ {
1037
+ type: "text",
1038
+ text: `## 🌊 Deep-Dive: ${agent.name}
1039
+
1040
+ **Stage**: ${stageMap[agent.id]}
1041
+ **Project**: ${projectDir}
1042
+ **Approach**: ${approach || "depth"} (${approachLabel})
1043
+ ${focusSection ? `**Focus**: ${focus}` : ""}
1044
+
1045
+ ### Status
1046
+
1047
+ ${initialStatus}
1048
+
1049
+ Deep-dive directory created: \`${deepDir}/\`
1050
+
1051
+ ### Outputs to Generate
1052
+
1053
+ ${outputList}
1054
+
1055
+ ### LLM Prompt
1056
+
1057
+ \`\`\`
1058
+ ${deep.prompt}
1059
+ \`\`\`
1060
+
1061
+ ### How to Run
1062
+
1063
+ Execute the deep-dive by asking the LLM to:
1064
+
1065
+ 1. Read the initial outputs in \`${projectDir}/${agent.dir}/\`
1066
+ 2. Read the deep-dive manifest at \`${manifestPath}\`
1067
+ 3. Execute the prompt above
1068
+ 4. Write all outputs to \`${projectDir}/${agent.dir}/deep/\`
1069
+ 5. Optionally update \`gates.md\` to reflect the new depth
1070
+
1071
+ ---
1072
+
1073
+ **Pro tip:** After the deep-dive, you can run \`delve_stage\` on another stage, or ask the LLM to cross-reference insights across stages (e.g., "take the competitive teardown from the market sizing deep-dive and incorporate it into the GTM plan").`,
1074
+ },
1075
+ ],
1076
+ };
1077
+ }
1078
+
1079
+ // ─── Transport ────────────────────────────────────────────────────────────────
1080
+
1081
+ const transport = new StdioServerTransport();
1082
+ await server.connect(transport);
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "pm-pipeline-mcp",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for the PM Agent Pipeline — generate product briefs + deep-dive on any stage for 2-3x deeper analysis",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "bin": {
8
+ "pm-pipeline-mcp": "./index.js"
9
+ },
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/asp-builder-git/ai-pm-learning-workspace.git"
14
+ },
15
+ "homepage": "https://github.com/asp-builder-git/ai-pm-learning-workspace/tree/main/pm-agent-pipeline/mcp",
16
+ "bugs": {
17
+ "url": "https://github.com/asp-builder-git/ai-pm-learning-workspace/issues"
18
+ },
19
+ "keywords": [
20
+ "mcp",
21
+ "product-management",
22
+ "ai-agents",
23
+ "claude",
24
+ "product-development",
25
+ "pipeline",
26
+ "pm",
27
+ "product-brief",
28
+ "deep-dive",
29
+ "competitive-analysis"
30
+ ],
31
+ "files": [
32
+ "index.js",
33
+ "package.json"
34
+ ],
35
+ "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.0.0"
37
+ },
38
+ "engines": {
39
+ "node": ">=18"
40
+ }
41
+ }