@rune-kit/rune 2.7.0 → 2.10.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 (123) hide show
  1. package/README.md +78 -41
  2. package/agents/adversary.md +27 -0
  3. package/agents/architect.md +19 -29
  4. package/agents/asset-creator.md +18 -4
  5. package/agents/audit.md +25 -4
  6. package/agents/autopsy.md +19 -4
  7. package/agents/ba.md +35 -0
  8. package/agents/brainstorm.md +31 -4
  9. package/agents/browser-pilot.md +21 -4
  10. package/agents/coder.md +21 -29
  11. package/agents/completion-gate.md +20 -4
  12. package/agents/constraint-check.md +18 -4
  13. package/agents/context-engine.md +22 -4
  14. package/agents/context-pack.md +32 -0
  15. package/agents/cook.md +41 -4
  16. package/agents/db.md +19 -4
  17. package/agents/debug.md +33 -4
  18. package/agents/dependency-doctor.md +20 -4
  19. package/agents/deploy.md +27 -4
  20. package/agents/design.md +22 -4
  21. package/agents/doc-processor.md +27 -0
  22. package/agents/docs-seeker.md +19 -4
  23. package/agents/docs.md +31 -0
  24. package/agents/fix.md +37 -4
  25. package/agents/git.md +29 -0
  26. package/agents/hallucination-guard.md +20 -4
  27. package/agents/incident.md +21 -4
  28. package/agents/integrity-check.md +18 -4
  29. package/agents/journal.md +19 -4
  30. package/agents/launch.md +32 -4
  31. package/agents/logic-guardian.md +26 -11
  32. package/agents/marketing.md +23 -4
  33. package/agents/mcp-builder.md +26 -0
  34. package/agents/neural-memory.md +30 -0
  35. package/agents/onboard.md +22 -4
  36. package/agents/perf.md +21 -4
  37. package/agents/plan.md +29 -4
  38. package/agents/preflight.md +22 -4
  39. package/agents/problem-solver.md +20 -4
  40. package/agents/rescue.md +23 -4
  41. package/agents/research.md +19 -4
  42. package/agents/researcher.md +19 -29
  43. package/agents/retro.md +32 -0
  44. package/agents/review-intake.md +20 -4
  45. package/agents/review.md +32 -4
  46. package/agents/reviewer.md +20 -28
  47. package/agents/safeguard.md +19 -4
  48. package/agents/sast.md +18 -4
  49. package/agents/scaffold.md +41 -0
  50. package/agents/scanner.md +19 -28
  51. package/agents/scope-guard.md +18 -4
  52. package/agents/scout.md +23 -4
  53. package/agents/sentinel-env.md +26 -0
  54. package/agents/sentinel.md +33 -4
  55. package/agents/sequential-thinking.md +20 -4
  56. package/agents/session-bridge.md +24 -4
  57. package/agents/skill-forge.md +22 -4
  58. package/agents/skill-router.md +26 -4
  59. package/agents/slides.md +24 -0
  60. package/agents/surgeon.md +19 -4
  61. package/agents/team.md +30 -4
  62. package/agents/test.md +36 -4
  63. package/agents/trend-scout.md +17 -4
  64. package/agents/verification.md +20 -4
  65. package/agents/video-creator.md +20 -4
  66. package/agents/watchdog.md +19 -4
  67. package/agents/worktree.md +17 -4
  68. package/compiler/__tests__/analytics.test.js +370 -0
  69. package/compiler/adapters/openclaw.js +2 -2
  70. package/compiler/analytics.js +385 -0
  71. package/compiler/bin/rune.js +68 -2
  72. package/compiler/dashboard.js +883 -0
  73. package/compiler/transforms/branding.js +1 -1
  74. package/extensions/ui/skills/animation-patterns.md +21 -0
  75. package/extensions/ui/skills/component-patterns.md +25 -0
  76. package/extensions/ui/skills/landing-patterns.md +1 -1
  77. package/hooks/context-watch/index.cjs +95 -68
  78. package/hooks/metrics-collector/index.cjs +86 -42
  79. package/hooks/post-session-reflect/index.cjs +41 -5
  80. package/hooks/session-start/index.cjs +8 -2
  81. package/package.json +2 -2
  82. package/skills/audit/SKILL.md +1 -0
  83. package/skills/autopsy/SKILL.md +78 -2
  84. package/skills/autopsy/references/repo-analysis-patterns.md +113 -0
  85. package/skills/ba/SKILL.md +72 -2
  86. package/skills/brainstorm/SKILL.md +1 -0
  87. package/skills/completion-gate/SKILL.md +26 -3
  88. package/skills/context-engine/SKILL.md +49 -1
  89. package/skills/cook/SKILL.md +72 -3
  90. package/skills/cook/references/output-format.md +33 -0
  91. package/skills/db/SKILL.md +1 -0
  92. package/skills/debug/SKILL.md +57 -1
  93. package/skills/deploy/SKILL.md +1 -1
  94. package/skills/design/SKILL.md +110 -3
  95. package/skills/docs/SKILL.md +2 -1
  96. package/skills/fix/SKILL.md +47 -1
  97. package/skills/graft/SKILL.md +352 -0
  98. package/skills/graft/references/challenge-framework.md +98 -0
  99. package/skills/graft/references/mode-decision.md +44 -0
  100. package/skills/incident/SKILL.md +2 -0
  101. package/skills/journal/SKILL.md +2 -0
  102. package/skills/launch/SKILL.md +2 -0
  103. package/skills/marketing/SKILL.md +46 -2
  104. package/skills/mcp-builder/SKILL.md +3 -1
  105. package/skills/mcp-builder/references/auto-discovery-pattern.md +169 -0
  106. package/skills/plan/SKILL.md +60 -4
  107. package/skills/plan/references/feature-map.md +84 -0
  108. package/skills/preflight/SKILL.md +20 -1
  109. package/skills/rescue/SKILL.md +25 -1
  110. package/skills/research/SKILL.md +24 -1
  111. package/skills/retro/SKILL.md +2 -0
  112. package/skills/review/SKILL.md +55 -2
  113. package/skills/scaffold/SKILL.md +1 -0
  114. package/skills/scope-guard/SKILL.md +35 -17
  115. package/skills/scout/SKILL.md +22 -1
  116. package/skills/sentinel/SKILL.md +29 -1
  117. package/skills/sentinel-env/SKILL.md +0 -2
  118. package/skills/session-bridge/SKILL.md +155 -9
  119. package/skills/skill-forge/SKILL.md +43 -1
  120. package/skills/skill-router/{skill.md → SKILL.md} +27 -2
  121. package/skills/team/SKILL.md +24 -1
  122. package/skills/test/SKILL.md +29 -2
  123. package/skills/verification/SKILL.md +1 -2
@@ -0,0 +1,98 @@
1
+ # Challenge Framework
2
+
3
+ 5-dimension evaluation gate. Score each dimension before grafting code into your project.
4
+
5
+ ## Scoring
6
+
7
+ | Score | Meaning | Action |
8
+ |-------|---------|--------|
9
+ | ✅ Pass | No concerns | Proceed |
10
+ | ⚠️ Warn | Minor concerns | Proceed with documented caveats |
11
+ | ❌ Fail | Blocking concern | Requires user override or blocks graft |
12
+
13
+ **Decision matrix**: 0 ❌ → PROCEED. 1 ❌ → WARN + require explicit user override. 2+ ❌ → BLOCK.
14
+
15
+ ## Dimensions
16
+
17
+ ### 1. License Compatibility
18
+
19
+ | Source License | Your Project MIT | Your Project Apache-2.0 | Your Project GPL |
20
+ |---------------|-----------------|------------------------|-----------------|
21
+ | MIT | ✅ | ✅ | ✅ |
22
+ | Apache-2.0 | ✅ | ✅ | ✅ |
23
+ | BSD-2/3 | ✅ | ✅ | ✅ |
24
+ | ISC | ✅ | ✅ | ✅ |
25
+ | GPL-2.0/3.0 | ❌ | ❌ | ✅ |
26
+ | AGPL | ❌ | ❌ | ⚠️ |
27
+ | SSPL/BSL | ❌ | ❌ | ❌ |
28
+ | No license | ❌ | ❌ | ❌ |
29
+ | Unlicense | ✅ | ✅ | ✅ |
30
+
31
+ **Check**: Read LICENSE file in repo root. If missing → ❌ (no license = all rights reserved).
32
+
33
+ ### 2. Stack Fit
34
+
35
+ | Scenario | Score |
36
+ |----------|-------|
37
+ | Identical stack (same framework + language + version) | ✅ |
38
+ | Same language, different framework (React→Svelte) | ⚠️ — port mode recommended |
39
+ | Same framework, major version gap (Next 13→15) | ⚠️ — API changes likely |
40
+ | Different language entirely (Python→TypeScript) | ❌ — port is a rewrite |
41
+ | Incompatible paradigm (OOP→FP, REST→GraphQL) | ❌ — fundamental rethink needed |
42
+
43
+ ### 3. Scope
44
+
45
+ | Scenario | Score |
46
+ |----------|-------|
47
+ | ≤5 files, ≤500 LOC | ✅ — manageable |
48
+ | 6-15 files, 500-2000 LOC | ⚠️ — consider narrowing |
49
+ | >15 files or >2000 LOC | ❌ — too broad, must narrow scope |
50
+ | Feature has clear boundaries (self-contained module) | ✅ bonus |
51
+ | Feature is deeply entangled with source codebase | ❌ — extraction risk high |
52
+
53
+ ### 4. Quality
54
+
55
+ | Signal | Score |
56
+ |--------|-------|
57
+ | Has tests with >60% coverage | ✅ |
58
+ | Has tests but minimal | ⚠️ |
59
+ | No tests | ❌ |
60
+ | TypeScript strict / fully typed | ✅ bonus |
61
+ | Uses `any` extensively or untyped | ⚠️ |
62
+ | Well-documented (JSDoc, README for module) | ✅ bonus |
63
+ | No documentation | ⚠️ |
64
+ | Known anti-patterns (mutations, god classes, deep nesting) | ⚠️ — improve mode recommended |
65
+
66
+ **Composite**: ≥2 ✅ signals → ✅. 1 ✅ + warnings → ⚠️. No tests + untyped → ❌.
67
+
68
+ ### 5. Maintenance
69
+
70
+ | Signal | Score |
71
+ |--------|-------|
72
+ | Last commit < 3 months ago | ✅ |
73
+ | Last commit 3-12 months ago | ⚠️ |
74
+ | Last commit > 12 months ago | ❌ |
75
+ | Active issues being addressed | ✅ |
76
+ | 50+ open issues, no response | ⚠️ |
77
+ | Archived or deprecated | ❌ |
78
+ | Multiple contributors | ✅ |
79
+ | Solo maintainer, inactive | ⚠️ |
80
+
81
+ **Note**: For compare mode, maintenance is informational only — not blocking.
82
+
83
+ ## Presentation Format
84
+
85
+ ```markdown
86
+ ## Challenge Gate Results
87
+
88
+ | # | Dimension | Score | Detail |
89
+ |---|-----------|-------|--------|
90
+ | 1 | License | ✅ | MIT — compatible with your MIT project |
91
+ | 2 | Stack Fit | ⚠️ | React 18 → React 19 — minor API changes |
92
+ | 3 | Scope | ✅ | 4 files, ~350 LOC — well-scoped |
93
+ | 4 | Quality | ✅ | Typed, 12 tests, documented |
94
+ | 5 | Maintenance | ⚠️ | Last commit 5 months ago, but stable |
95
+
96
+ **Verdict**: PROCEED with caveats (0 ❌, 2 ⚠️)
97
+ Caveats: React 18→19 useEffect changes, verify repo still works with latest deps.
98
+ ```
@@ -0,0 +1,44 @@
1
+ # Mode Decision Tree
2
+
3
+ Auto-select the optimal graft mode when user doesn't specify explicitly.
4
+
5
+ ## Decision Flow
6
+
7
+ ```
8
+ 1. User wants analysis only? (says "compare", "vs", "analyze")
9
+ → YES: compare mode
10
+ → NO: continue
11
+
12
+ 2. Source and local tech stacks match?
13
+ → NO (different framework/language): port mode (forced)
14
+ → YES: continue
15
+
16
+ 3. Source code has quality issues? (anti-patterns, no types, no tests)
17
+ → YES: improve mode (fix issues during graft)
18
+ → NO: continue
19
+
20
+ 4. User wants exact replica? (says "exact", "as-is", "copy")
21
+ → YES: copy mode
22
+ → NO: improve mode (default for same-stack, good-quality)
23
+ ```
24
+
25
+ ## Mode Output Contracts
26
+
27
+ | Mode | Creates Files? | Modifies Files? | Produces Report? | Calls fix? | Calls review? |
28
+ |------|---------------|----------------|-----------------|-----------|--------------|
29
+ | compare | ❌ | ❌ | ✅ comparison report | ❌ | ❌ |
30
+ | copy | ✅ | ⚠️ minimal (imports) | ❌ | ❌ | ❌ |
31
+ | port | ✅ | ✅ | ❌ | ✅ | ❌ |
32
+ | improve | ✅ | ✅ | ❌ | ✅ | ✅ |
33
+
34
+ ## Examples
35
+
36
+ | Scenario | Auto Mode | Why |
37
+ |----------|-----------|-----|
38
+ | Next.js auth → your Next.js app | improve | Same stack, default to improving |
39
+ | Django REST → FastAPI | port | Different framework, rewrite needed |
40
+ | "How does Stripe handle webhooks in repo X?" | compare | Analysis intent, no code changes |
41
+ | "Copy their date picker component exactly" | copy | User explicitly wants exact replica |
42
+ | Vue component → React project | port | Different framework |
43
+ | Express middleware, has `any` everywhere | improve | Same stack (Node) but quality issues |
44
+ | "Use their testing approach" | compare | Learning intent, not adoption |
@@ -9,6 +9,7 @@ metadata:
9
9
  model: sonnet
10
10
  group: delivery
11
11
  tools: "Read, Write, Edit, Bash, Glob, Grep"
12
+ listen: incident.detected
12
13
  ---
13
14
 
14
15
  # incident
@@ -22,6 +23,7 @@ Structured incident response for production issues. Follows a strict order: tria
22
23
  - `/rune incident "description of what's broken"` — direct user invocation
23
24
  - Called by `launch` (L1): watchdog alerts during Phase 3 VERIFY
24
25
  - Called by `deploy` (L2): health check fails post-deploy
26
+ - Signal: auto-triggers when `watchdog` emits `incident.detected` — no manual invocation needed
25
27
 
26
28
  ## Calls (outbound)
27
29
 
@@ -8,6 +8,7 @@ metadata:
8
8
  model: haiku
9
9
  group: state
10
10
  tools: "Read, Write, Edit, Glob, Grep"
11
+ listen: graft.complete
11
12
  ---
12
13
 
13
14
  # journal
@@ -35,6 +36,7 @@ None — pure L3 state management utility.
35
36
  - `audit` (L2): save AUDIT-REPORT.md and record health trend entry
36
37
  - `incident` (L2): record incident timeline and postmortem
37
38
  - `skill-forge` (L2): record skill creation decisions and rationale
39
+ - `graft` (L2): auto-log graft operations — source URL, mode, challenge score, files changed
38
40
 
39
41
  ## Files Managed
40
42
 
@@ -11,6 +11,7 @@ metadata:
11
11
  model: sonnet
12
12
  group: orchestrator
13
13
  tools: "Read, Write, Edit, Bash, Glob, Grep"
14
+ listen: audit.complete
14
15
  ---
15
16
 
16
17
  # launch
@@ -34,6 +35,7 @@ Orchestrate the full deployment and marketing pipeline. Launch coordinates testi
34
35
  - `audit` (L2): pre-launch health check — full 7-phase quality gate
35
36
  - `deploy` (L2): push to target platform
36
37
  - `incident` (L2): if post-launch health check fails → triage and contain
38
+ - `retro` (L2): post-launch retrospective — what went well, what didn't
37
39
  - `browser-pilot` (L3): verify live site screenshots and performance
38
40
  - `marketing` (L2): create launch assets (landing copy, social, SEO)
39
41
  - `watchdog` (L3): setup post-deploy monitoring
@@ -3,7 +3,7 @@ name: marketing
3
3
  description: Create marketing assets and execute launch strategy. Generates landing copy, social banners, SEO meta, blog posts, and video scripts.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.3.0"
6
+ version: "0.4.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: delivery
@@ -31,6 +31,8 @@ Create marketing assets and execute launch strategy. Marketing generates landing
31
31
  - `slides` (L3): generate presentation decks for launches and demos
32
32
  - `browser-pilot` (L3): capture screenshots for marketing assets
33
33
  - L4 extension packs: domain-specific content when context matches (e.g., @rune/content for blog posts, @rune/analytics for campaign measurement)
34
+ - `@rune-pro/growth/content-scorer` (L4 Pro, optional): 5-dimension content quality gate — if available, score all generated copy for AI phrase contamination and humanity
35
+ - `@rune-pro/growth/cro-analyst` (L4 Pro, optional): psychology-driven CRO analysis for landing pages — if available, audit generated landing copy through 7 behavioral lenses
34
36
 
35
37
  ## Execution Steps
36
38
 
@@ -87,8 +89,15 @@ If `marketing/brand-voice.md` already exists → Read it and apply. Do NOT regen
87
89
 
88
90
  Using product understanding, market research, and **brand voice contract**, produce:
89
91
 
92
+ **Anti-AI Copy Rules** (apply to ALL generated copy):
93
+ - NEVER open with "In today's...", "Are you struggling with...", "Have you ever wondered..."
94
+ - NEVER use: "game-changer", "revolutionary", "seamlessly", "leverage", "unlock the power of", "dive deep into", "delve", "robust", "streamline", "cutting-edge"
95
+ - MUST use one of 5 hook types for headlines: Provocative Question, Specific Scenario, Surprising Statistic, Bold Statement, or Counterintuitive Claim
96
+ - MUST include specific numbers, names, or outcomes — not vague claims ("many users love it")
97
+ - If the copy sounds like it was written by a generic AI → rewrite until it has personality
98
+
90
99
  **Hero section**
91
- - Headline (under 10 words, outcome-focused)
100
+ - Headline (under 10 words, outcome-focused, uses one of the 5 hook types above)
92
101
  - Subheadline (1-2 sentences expanding the promise)
93
102
  - Primary CTA button text
94
103
 
@@ -147,6 +156,41 @@ If the project already has a deployed site or existing pages, run a technical SE
147
156
  7. **Sitemap**: Check for `sitemap.xml` or sitemap generation in build config. Flag if missing.
148
157
  8. **Robots**: Check for `robots.txt`. Verify it doesn't accidentally block important pages.
149
158
 
159
+ **9. Schema Markup**: Check for `application/ld+json` blocks. Recommend adding relevant types:
160
+
161
+ | Content Type | Schema Type | Key Properties |
162
+ |-------------|-------------|---------------|
163
+ | Product page | `Product` | name, description, offers, review, aggregateRating |
164
+ | Article/Blog | `Article` | headline, author, datePublished, dateModified, image |
165
+ | FAQ section | `FAQPage` | mainEntity[].name, mainEntity[].acceptedAnswer |
166
+ | How-to guide | `HowTo` | name, step[].name, step[].text, totalTime |
167
+ | Organization | `Organization` | name, url, logo, sameAs[] |
168
+ | Breadcrumbs | `BreadcrumbList` | itemListElement[].name, itemListElement[].item |
169
+ | Software | `SoftwareApplication` | name, operatingSystem, applicationCategory, offers |
170
+ | Review | `Review` | itemReviewed, reviewRating, author, reviewBody |
171
+ | Comparison | `ItemList` | itemListElement[] with individual Product/Review schemas |
172
+ | Local biz | `LocalBusiness` | name, address, telephone, openingHoursSpecification |
173
+
174
+ Use `@graph` pattern to combine multiple schema types on a single page:
175
+ ```json
176
+ {
177
+ "@context": "https://schema.org",
178
+ "@graph": [
179
+ { "@type": "Organization", ... },
180
+ { "@type": "WebPage", ... },
181
+ { "@type": "BreadcrumbList", ... }
182
+ ]
183
+ }
184
+ ```
185
+
186
+ **10. Programmatic SEO awareness**: If the site has repeatable content patterns (product listings, city pages, comparison pages), note the opportunity for template-driven SEO pages. Common playbooks:
187
+ - **Templates**: `best [tool] for [persona]` pages across personas
188
+ - **Comparisons**: `[product A] vs [product B]` for all competitor pairs
189
+ - **Locations**: `[service] in [city]` for local reach
190
+ - **Integrations**: `[product] + [integration]` for every supported integration
191
+
192
+ Flag programmatic SEO opportunities in the audit report. Execution details are in `@rune-pro/growth` pack.
193
+
150
194
  **Output**: SEO Audit Report with pass/fail per check. Save to `marketing/seo-audit.md`.
151
195
 
152
196
  Fix critical SEO issues (missing titles, broken heading hierarchy) in the implementation plan. Non-critical issues go to `marketing/seo-backlog.md`.
@@ -3,7 +3,7 @@ name: mcp-builder
3
3
  description: Build Model Context Protocol servers from specifications. Generates tool definitions, resource handlers, and test suites for MCP servers in TypeScript or Python (FastMCP).
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.4.0"
6
+ version: "0.5.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: creation
@@ -54,6 +54,8 @@ If user provides a detailed spec or existing API docs → extract answers, confi
54
54
 
55
55
  ### Step 2 — Architecture Design
56
56
 
57
+ <MUST-READ path="references/auto-discovery-pattern.md" trigger="when the server has 5+ tools OR multiple API providers — use auto-discovery registry for graceful degradation"/>
58
+
57
59
  Determine server structure based on spec:
58
60
 
59
61
  **TypeScript (default):**
@@ -0,0 +1,169 @@
1
+ # Auto-Discovery Tool Registry Pattern
2
+
3
+ Reference architecture for MCP servers that support partial deployment — tools register automatically at startup, gracefully skipping those with missing API keys.
4
+
5
+ ## Problem
6
+
7
+ MCP servers with 10+ tools often require 5+ API keys. Requiring ALL keys before the server starts means users can't use any tools until every key is configured. This kills adoption.
8
+
9
+ ## Pattern: Scan → Validate → Register
10
+
11
+ ```
12
+ tools/
13
+ ├── web-search/
14
+ │ └── index.ts # exports: definition, handler, requiredEnvVars
15
+ ├── reddit-search/
16
+ │ └── index.ts
17
+ ├── youtube-search/
18
+ │ └── index.ts
19
+ └── content-scorer/
20
+ └── index.ts # no requiredEnvVars → always available
21
+ ```
22
+
23
+ ### Startup Flow
24
+
25
+ ```typescript
26
+ // lib/tool-registry.ts
27
+ import { glob } from 'fs';
28
+
29
+ interface ToolModule {
30
+ definition: ToolDefinition;
31
+ handler: (params: unknown) => Promise<unknown>;
32
+ requiredEnvVars?: string[];
33
+ }
34
+
35
+ async function discoverTools(toolsDir: string): Promise<Map<string, ToolModule>> {
36
+ const registered = new Map<string, ToolModule>();
37
+ const skipped: string[] = [];
38
+
39
+ const toolDirs = await glob(`${toolsDir}/*/index.ts`);
40
+
41
+ for (const toolPath of toolDirs) {
42
+ const mod: ToolModule = await import(toolPath);
43
+
44
+ // Check env vars — skip if missing
45
+ const missing = (mod.requiredEnvVars ?? [])
46
+ .filter(key => !process.env[key]);
47
+
48
+ if (missing.length > 0) {
49
+ skipped.push(`${mod.definition.name} (missing: ${missing.join(', ')})`);
50
+ continue;
51
+ }
52
+
53
+ registered.set(mod.definition.name, mod);
54
+ }
55
+
56
+ if (skipped.length > 0) {
57
+ console.error(`[registry] Skipped ${skipped.length} tools: ${skipped.join('; ')}`);
58
+ }
59
+
60
+ console.error(`[registry] Registered ${registered.size} tools`);
61
+ return registered;
62
+ }
63
+ ```
64
+
65
+ ### Per-Tool Module Contract
66
+
67
+ ```typescript
68
+ // tools/reddit-search/index.ts
69
+ import { z } from 'zod';
70
+
71
+ export const requiredEnvVars = ['RAPIDAPI_KEY'];
72
+
73
+ export const definition = {
74
+ name: 'reddit_search',
75
+ description: 'Search Reddit posts and comments. Use when researching community sentiment, finding discussions about a topic, or gathering user feedback.',
76
+ inputSchema: z.object({
77
+ query: z.string().describe('Search query'),
78
+ subreddit: z.string().optional().describe('Limit to specific subreddit'),
79
+ sort: z.enum(['hot', 'top', 'new', 'relevance']).default('relevance'),
80
+ time_filter: z.enum(['hour', 'day', 'week', 'month', 'year', 'all']).default('month'),
81
+ limit: z.number().min(1).max(25).default(10),
82
+ }),
83
+ };
84
+
85
+ export async function handler(params: z.infer<typeof definition.inputSchema>) {
86
+ // Implementation...
87
+ }
88
+ ```
89
+
90
+ ### Tools Without API Keys (Always Available)
91
+
92
+ ```typescript
93
+ // tools/content-scorer/index.ts — no external dependencies
94
+ export const requiredEnvVars = []; // or omit entirely
95
+
96
+ export const definition = {
97
+ name: 'content_scorer',
98
+ description: 'Score content items by engagement with time-decay. Pure computation, no API calls.',
99
+ inputSchema: z.object({
100
+ items: z.array(ContentItemSchema),
101
+ recency_weight: z.number().default(0.1),
102
+ }),
103
+ };
104
+ ```
105
+
106
+ ## Key Design Rules
107
+
108
+ ### 1. Graceful Degradation (Non-Negotiable)
109
+ - Missing API keys = tool is skipped, NOT a server crash
110
+ - Server MUST boot with 0 API keys configured (local-only tools still work)
111
+ - Log skipped tools to stderr (not stdout — MCP uses stdout for protocol)
112
+
113
+ ### 2. Adding New Tools = Zero Core Changes
114
+ - Create `tools/<name>/index.ts` with the module contract
115
+ - Export `definition`, `handler`, and optionally `requiredEnvVars`
116
+ - Registry auto-discovers at next startup
117
+
118
+ ### 3. Provider Fallback (Optional, Recommended)
119
+ For tools with multiple data sources, support tiered fallback:
120
+
121
+ ```typescript
122
+ export const requiredEnvVars = []; // none required — has fallback chain
123
+
124
+ export async function handler(params) {
125
+ // Tier 1: Dedicated API (best quality)
126
+ if (process.env.GETX_API_KEY) {
127
+ return await fetchFromGetXAPI(params);
128
+ }
129
+ // Tier 2: RapidAPI (good quality, shared key)
130
+ if (process.env.RAPIDAPI_KEY) {
131
+ return await fetchFromRapidAPI(params);
132
+ }
133
+ // Tier 3: Web search fallback (approximate)
134
+ return await fetchViaWebSearch(params);
135
+ }
136
+ ```
137
+
138
+ Mark output with `data_source: "api" | "web_search" | "mixed"` so downstream consumers know the reliability level.
139
+
140
+ ### 4. Status Endpoint
141
+ Expose a `server_status` tool (or MCP resource) that reports which tools are active, which are skipped, and why:
142
+
143
+ ```json
144
+ {
145
+ "registered": ["web_search", "content_scorer", "reddit_search"],
146
+ "skipped": [
147
+ { "tool": "youtube_search", "reason": "Missing YOUTUBE_API_KEY" },
148
+ { "tool": "linkedin_search", "reason": "Missing RAPIDAPI_KEY" }
149
+ ],
150
+ "total": 5,
151
+ "active": 3
152
+ }
153
+ ```
154
+
155
+ ## When to Use This Pattern
156
+
157
+ | Server Type | Use Auto-Discovery? |
158
+ |-------------|-------------------|
159
+ | Single-API wrapper (1-3 tools) | NO — overkill, just require the key |
160
+ | Multi-source aggregator (5+ tools, 3+ APIs) | YES — users rarely have ALL keys |
161
+ | Internal tools (no external APIs) | NO — no env vars to gate on |
162
+ | Plugin system (user adds custom tools) | YES — extensibility is the point |
163
+
164
+ ## Anti-Patterns
165
+
166
+ - **Crashing on missing keys** — kills adoption for users who only need 2 of 10 tools
167
+ - **Requiring all keys in .env** — users give up during setup
168
+ - **Silent skip without logging** — users don't know why a tool isn't available
169
+ - **Dynamic import without validation** — malformed tool modules crash the entire server
@@ -3,13 +3,13 @@ name: plan
3
3
  description: Create structured implementation plans from requirements. Produces master plan + phase files for enterprise-scale project management. Master plan = overview (<80 lines). Phase files = execution detail (<150 lines each). Each session handles 1 phase. Uses opus for deep reasoning.
4
4
  metadata:
5
5
  author: runedev
6
- version: "1.2.0"
6
+ version: "1.4.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: creation
10
10
  tools: "Read, Write, Edit, Glob, Grep"
11
11
  emit: plan.ready
12
- listen: codebase.scanned
12
+ listen: codebase.scanned, project.onboarded, security.blocked
13
13
  ---
14
14
 
15
15
  # plan
@@ -111,6 +111,7 @@ High-level multi-feature planning — organize features into milestones.
111
111
  - `ba` (L2): Requirements Document → plan's primary input (locked decisions, user stories)
112
112
  - `scout` (L2): codebase analysis → plan's convention/pattern awareness
113
113
  - `neural-memory` (external): past architectural decisions → plan's precedent context
114
+ - `sentinel` (L2): repeated security blocks → plan's constraint awareness for future features
114
115
 
115
116
  ### Feedback Loops ↻
116
117
 
@@ -123,8 +124,12 @@ High-level multi-feature planning — organize features into milestones.
123
124
 
124
125
  Check for `.rune/features/*/requirements.md` via `Glob`. If a Requirements Document exists (from `rune:ba`), read it — it contains user stories, acceptance criteria, scope, constraints. Do NOT re-gather what BA already elicited.
125
126
 
127
+ If `project.onboarded` signal was received, scout output is already available in session context — skip re-invoking scout.
128
+
126
129
  Invoke `rune:scout` if not already done — plans without context produce wrong file paths. Call `neural-memory` (Recall Mode) to surface past architecture decisions before making new ones.
127
130
 
131
+ **Feature Map**: Check for `.rune/features.md` via `Glob`. If it exists, read it — understand the existing feature landscape, dependencies, and known gaps BEFORE planning. Cross-reference: does the new feature overlap, conflict with, or depend on existing features? If `.rune/features.md` does not exist, note this — Step 6.5 will create it.
132
+
128
133
  ### Step 2 — Classify Complexity
129
134
 
130
135
  Determine inline plan vs master + phase files:
@@ -201,6 +206,25 @@ When presenting alternatives (from brainstorm or Step 3), rate each **Completene
201
206
 
202
207
  Present the **master plan** to user (NOT all phase files). User reviews: phase breakdown, key decisions, risks, completeness scores. Wait for explicit approval ("go", "proceed", "yes") before writing phase files.
203
208
 
209
+ ### Step 6.5 — Update Feature Map (Always)
210
+ <MUST-READ path="references/feature-map.md" trigger="every plan invocation"/>
211
+
212
+ After plan approval, update `.rune/features.md`:
213
+
214
+ **If `.rune/features.md` does NOT exist** (first run):
215
+ 1. Reverse-engineer features from scout output — each top-level module = 1 feature
216
+ 2. Map inter-feature dependencies from imports and shared types
217
+ 3. Assess status per feature (complete, partial, planned)
218
+ 4. Generate `.rune/features.md` with Features table, Dependency Graph, Detected Gaps
219
+
220
+ **If `.rune/features.md` exists** (subsequent runs):
221
+ 1. Add or update the current feature's row (status, deps, key files)
222
+ 2. Cross-reference: new feature resolves existing gaps? Creates new ones?
223
+ 3. Validate dependency graph — flag missing features, orphans, circular deps, dead signals
224
+ 4. Write updated `.rune/features.md`
225
+
226
+ **Skip if**: Inline plan for trivial task (no feature-level impact).
227
+
204
228
  ### Step 7 — Execution Handoff
205
229
 
206
230
  ```
@@ -262,8 +286,6 @@ Every plan output — master plan, phase file, or inline plan — MUST end with
262
286
 
263
287
  ## Change Stacking (Overlap Detection)
264
288
 
265
- > From OpenSpec (Fission-AI/OpenSpec, 32.8k★): "Dependencies without metadata create phantom coupling."
266
-
267
289
  When producing phase files with wave-based task grouping, every task MUST declare dependency metadata:
268
290
 
269
291
  ```markdown
@@ -301,6 +323,7 @@ When producing phase files with wave-based task grouping, every task MUST declar
301
323
  11. MUST include failure scenarios table — what happens when things go wrong
302
324
  12. MUST include rejection criteria — explicit "DO NOT" anti-patterns to prevent common mistakes
303
325
  13. MUST include cross-phase context — what's assumed from prior phases, what's exported for future
326
+ 14. MUST update `.rune/features.md` after every non-trivial plan — feature map is a living artifact
304
327
 
305
328
  ## Returns
306
329
 
@@ -310,8 +333,35 @@ When producing phase files with wave-based task grouping, every task MUST declar
310
333
  | Phase files | Markdown | `.rune/plan-<feature>-phase<N>.md` (one per phase) |
311
334
  | Feature spec | Markdown | `.rune/features/<name>/spec.md` (Feature Spec Mode only) |
312
335
  | Roadmap | Markdown | `.rune/roadmap.md` (Roadmap Mode only) |
336
+ | Feature map | Markdown | `.rune/features.md` (auto-maintained) |
313
337
  | Inline plan | Markdown (inline) | Emitted directly for trivial tasks |
314
338
 
339
+ ## Chain Metadata
340
+
341
+ Append to plan output when invoked standalone. Suppress when called as sub-skill inside an L1 orchestrator (cook, team, etc.) — the orchestrator emits a consolidated block. See `docs/references/chain-metadata.md`.
342
+
343
+ ```yaml
344
+ chain_metadata:
345
+ skill: "rune:plan"
346
+ version: "1.4.0"
347
+ status: "[DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED]"
348
+ domain: "[area planned]"
349
+ files_changed:
350
+ - "[.rune/plan-*.md files created]"
351
+ exports:
352
+ plan_file: "[.rune/plan-<feature>.md path]"
353
+ phase_count: [N]
354
+ estimated_complexity: "[low | medium | high]"
355
+ risk_areas: ["[domains with identified risks]"]
356
+ suggested_next:
357
+ - skill: "rune:adversary"
358
+ reason: "[grounded in plan — e.g., 'Plan touches auth + payments — stress-test assumptions']"
359
+ consumes: ["plan_file", "risk_areas"]
360
+ - skill: "rune:cook"
361
+ reason: "Plan ready for execution"
362
+ consumes: ["plan_file", "phase_count"]
363
+ ```
364
+
315
365
  ## Sharp Edges
316
366
 
317
367
  | Failure Mode | Severity | Mitigation |
@@ -337,6 +387,8 @@ When producing phase files with wave-based task grouping, every task MUST declar
337
387
  | Outcome Block "Next Action" is a list, not one action | LOW | One action only — ambiguity about where to start causes re-analysis and lost context |
338
388
  | Overlapping file ownership across parallel phases/streams | HIGH | Change Stacking: every task declares `touches[]` — overlap detection flags same file in 2+ tasks before execution |
339
389
  | Missing dependency between tasks that share artifacts | HIGH | Every task declares `provides[]` and `requires[]` — cycle detection + missing dep check before dispatch |
390
+ | New feature planned without checking existing feature map | HIGH | Step 1 reads `.rune/features.md` — catches overlaps, conflicts, and missing dependencies before planning begins |
391
+ | Feature map never created — gaps accumulate silently | MEDIUM | Step 6.5 always runs (create or update) — feature map grows organically with each plan invocation |
340
392
 
341
393
  ## Self-Validation
342
394
 
@@ -348,6 +400,8 @@ SELF-VALIDATION (run before presenting plan to user):
348
400
  - [ ] Phase files have ALL Amateur-Proof sections (data flow, code contracts, failure scenarios, rejection criteria)
349
401
  - [ ] Locked decisions from BA are reflected in plan — none contradicted or ignored
350
402
  - [ ] Every BA requirement has a corresponding Req ID in at least one phase's Traceability Matrix
403
+ - [ ] `.rune/features.md` updated with current feature (or created if first run)
404
+ - [ ] No cross-feature conflicts detected (or flagged to user if found)
351
405
  ```
352
406
 
353
407
  ## Done When
@@ -366,6 +420,8 @@ SELF-VALIDATION (run before presenting plan to user):
366
420
  - Self-Validation: all checks passed
367
421
  - Outcome Block present in every plan output (master plan, phase files, inline plan)
368
422
  - Outcome Block contains: What Was Planned + Immediate Next Action (single action) + How to Measure table
423
+ - `.rune/features.md` created (first run) or updated (subsequent) with current feature
424
+ - Cross-feature dependencies validated — no conflicts or orphans left unaddressed
369
425
 
370
426
  ## Cost Profile
371
427
 
@@ -0,0 +1,84 @@
1
+ # Feature Map
2
+
3
+ Living document that grows with each plan invocation. Provides bird's-eye view of all features, their dependencies, and detected gaps.
4
+
5
+ ## Location
6
+
7
+ `.rune/features.md` — auto-created on first plan run, updated on every subsequent run.
8
+
9
+ ## Format
10
+
11
+ ```markdown
12
+ # Feature Map
13
+ <!-- Auto-maintained by rune:plan. Do not edit manually. -->
14
+ <!-- Last updated: YYYY-MM-DD -->
15
+
16
+ ## Features
17
+
18
+ | Feature | Status | Depends On | Consumed By | Key Files | Gaps |
19
+ |---------|--------|-----------|-------------|-----------|------|
20
+ | Auth | ✅ | Database, Email | Dashboard, API | src/auth/* | No 2FA |
21
+ | Dashboard | 🔄 70% | Auth, Analytics | — | src/dashboard/* | No export |
22
+
23
+ ## Dependency Graph
24
+
25
+ <!-- ASCII or mermaid — keep under 20 lines -->
26
+ Auth ──→ Dashboard
27
+ │ ↑
28
+ └──→ API ─┘
29
+ Database ──→ Auth
30
+
31
+ ## Detected Gaps
32
+
33
+ - [ ] Auth → Payments: dependency missing (payments needs auth but not wired)
34
+ - [ ] Dashboard depends on Analytics but Analytics not in feature map
35
+ - [ ] Email: single consumer — fragile if auth changes notification strategy
36
+
37
+ ## Signals
38
+
39
+ - [ ] Feature X emits event.Y but no feature listens
40
+ - [ ] Feature Z listens for event.W but no feature emits it
41
+ ```
42
+
43
+ ## Feature Detection (First Run)
44
+
45
+ When `.rune/features.md` does not exist, reverse-engineer from codebase:
46
+
47
+ 1. **Read scout output** — directory structure, modules, entry points
48
+ 2. **Identify features** — each top-level module or bounded context = 1 feature
49
+ 3. **Map dependencies** — imports between modules, shared types, API calls
50
+ 4. **Assess status** — has tests? has docs? complete or partial?
51
+ 5. **Write `.rune/features.md`** with detected features
52
+
53
+ Detection heuristics:
54
+ - `src/<name>/` or `app/<name>/` directories → likely features
55
+ - Route files (pages/, routes/, api/) → user-facing features
56
+ - Shared directories (utils/, lib/, shared/) → NOT features, but dependencies
57
+ - Package.json workspaces → monorepo features
58
+
59
+ ## Feature Update (Subsequent Runs)
60
+
61
+ When `.rune/features.md` exists, update incrementally:
62
+
63
+ 1. **Read existing map** — current features, deps, gaps
64
+ 2. **Check new feature** — does the feature being planned already exist in map?
65
+ - Yes → update status, deps, gaps
66
+ - No → add new row
67
+ 3. **Cross-reference** — does new feature create/resolve any gaps?
68
+ - New dependency on existing feature → add to Depends On
69
+ - New feature fills a gap → mark gap resolved
70
+ - New feature creates orphan → add to Detected Gaps
71
+ 4. **Write updated `.rune/features.md`**
72
+
73
+ ## Gap Detection Rules
74
+
75
+ | Pattern | Gap Type | Severity |
76
+ |---------|----------|----------|
77
+ | Feature A depends on B, but B not in map | Missing feature | HIGH |
78
+ | Feature A has no consumers (nothing depends on it) | Orphan feature | MEDIUM |
79
+ | Feature A emits signal but nothing listens | Dead signal | MEDIUM |
80
+ | Feature A listens for signal but nothing emits | Missing producer | HIGH |
81
+ | Two features both write to same data store | Write conflict | HIGH |
82
+ | Feature has no tests | Quality gap | MEDIUM |
83
+ | Feature depends on deprecated module | Tech debt | LOW |
84
+ | Circular dependency: A → B → A | Coupling issue | HIGH |