@rune-kit/rune 2.2.0 → 2.2.2

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 (199) hide show
  1. package/README.md +72 -40
  2. package/compiler/__tests__/pack-split.test.js +145 -0
  3. package/compiler/bin/rune.js +26 -9
  4. package/compiler/doctor.js +42 -0
  5. package/compiler/emitter.js +27 -4
  6. package/compiler/parser.js +41 -3
  7. package/compiler/transformer.js +10 -6
  8. package/compiler/transforms/compliance.js +40 -0
  9. package/docs/ANTIGRAVITY-GAP-ANALYSIS.md +369 -0
  10. package/docs/ARCHITECTURE.md +332 -0
  11. package/docs/COMMUNITY-PACKS.md +109 -0
  12. package/docs/CONTRIBUTING-L4.md +215 -0
  13. package/docs/CROSS-IDE-ANALYSIS.md +164 -0
  14. package/docs/EXTENSION-TEMPLATE.md +108 -0
  15. package/docs/MESH-RULES.md +34 -0
  16. package/docs/MULTI-PLATFORM.md +804 -0
  17. package/docs/SKILL-DEPTH-AUDIT.md +191 -0
  18. package/docs/SKILL-TEMPLATE.md +72 -0
  19. package/docs/TRADE-MATRIX.md +327 -0
  20. package/docs/VERSIONING.md +91 -0
  21. package/docs/VISION.md +263 -0
  22. package/docs/assets/demo-subtitles.srt +215 -0
  23. package/docs/assets/end-card.html +276 -0
  24. package/docs/assets/mesh-diagram.html +654 -0
  25. package/docs/assets/thumbnail.html +295 -0
  26. package/docs/guides/cli.md +403 -0
  27. package/docs/guides/index.html +1346 -0
  28. package/docs/index.html +674 -0
  29. package/docs/references/claudekit-analysis.md +414 -0
  30. package/docs/references/voltagent-analysis.md +189 -0
  31. package/docs/script.js +277 -0
  32. package/docs/skills/index.html +832 -0
  33. package/docs/style.css +583 -0
  34. package/docs/video-demo-plan.md +172 -0
  35. package/extensions/ai-ml/PACK.md +38 -474
  36. package/extensions/ai-ml/skills/ai-agents.md +172 -0
  37. package/extensions/ai-ml/skills/code-sandbox.md +187 -0
  38. package/extensions/ai-ml/skills/deep-research.md +146 -0
  39. package/extensions/ai-ml/skills/embedding-search.md +66 -0
  40. package/extensions/ai-ml/skills/fine-tuning-guide.md +74 -0
  41. package/extensions/ai-ml/skills/llm-architect.md +125 -0
  42. package/extensions/ai-ml/skills/llm-integration.md +64 -0
  43. package/extensions/ai-ml/skills/prompt-patterns.md +72 -0
  44. package/extensions/ai-ml/skills/rag-patterns.md +66 -0
  45. package/extensions/ai-ml/skills/web-extraction.md +114 -0
  46. package/extensions/analytics/PACK.md +19 -484
  47. package/extensions/analytics/skills/ab-testing.md +72 -0
  48. package/extensions/analytics/skills/dashboard-patterns.md +83 -0
  49. package/extensions/analytics/skills/data-validation.md +68 -0
  50. package/extensions/analytics/skills/funnel-analysis.md +81 -0
  51. package/extensions/analytics/skills/sql-patterns.md +57 -0
  52. package/extensions/analytics/skills/statistical-analysis.md +79 -0
  53. package/extensions/analytics/skills/tracking-setup.md +71 -0
  54. package/extensions/backend/PACK.md +44 -618
  55. package/extensions/backend/skills/api-patterns.md +84 -0
  56. package/extensions/backend/skills/async-pipeline.md +193 -0
  57. package/extensions/backend/skills/auth-patterns.md +97 -0
  58. package/extensions/backend/skills/background-jobs.md +133 -0
  59. package/extensions/backend/skills/caching-patterns.md +108 -0
  60. package/extensions/backend/skills/cli-generation.md +133 -0
  61. package/extensions/backend/skills/database-patterns.md +87 -0
  62. package/extensions/backend/skills/middleware-patterns.md +104 -0
  63. package/extensions/chrome-ext/PACK.md +19 -921
  64. package/extensions/chrome-ext/skills/cws-preflight.md +143 -0
  65. package/extensions/chrome-ext/skills/cws-publish.md +104 -0
  66. package/extensions/chrome-ext/skills/ext-ai-integration.md +251 -0
  67. package/extensions/chrome-ext/skills/ext-messaging.md +139 -0
  68. package/extensions/chrome-ext/skills/ext-storage.md +133 -0
  69. package/extensions/chrome-ext/skills/mv3-scaffold.md +164 -0
  70. package/extensions/content/PACK.md +43 -335
  71. package/extensions/content/skills/blog-patterns.md +88 -0
  72. package/extensions/content/skills/cms-integration.md +131 -0
  73. package/extensions/content/skills/content-scoring.md +107 -0
  74. package/extensions/content/skills/i18n.md +83 -0
  75. package/extensions/content/skills/mdx-authoring.md +137 -0
  76. package/extensions/content/skills/reference.md +1014 -0
  77. package/extensions/content/skills/seo-patterns.md +67 -0
  78. package/extensions/content/skills/video-repurpose.md +153 -0
  79. package/extensions/devops/PACK.md +38 -457
  80. package/extensions/devops/skills/chaos-testing.md +67 -0
  81. package/extensions/devops/skills/ci-cd.md +75 -0
  82. package/extensions/devops/skills/docker.md +58 -0
  83. package/extensions/devops/skills/edge-serverless.md +163 -0
  84. package/extensions/devops/skills/infra-as-code.md +158 -0
  85. package/extensions/devops/skills/kubernetes.md +110 -0
  86. package/extensions/devops/skills/monitoring.md +57 -0
  87. package/extensions/devops/skills/server-setup.md +64 -0
  88. package/extensions/devops/skills/ssl-domain.md +42 -0
  89. package/extensions/ecommerce/PACK.md +62 -226
  90. package/extensions/ecommerce/skills/cart-system.md +79 -0
  91. package/extensions/ecommerce/skills/inventory-mgmt.md +102 -0
  92. package/extensions/ecommerce/skills/order-management.md +126 -0
  93. package/extensions/ecommerce/skills/payment-integration.md +472 -0
  94. package/extensions/ecommerce/skills/shopify-dev.md +69 -0
  95. package/extensions/ecommerce/skills/subscription-billing.md +93 -0
  96. package/extensions/ecommerce/skills/tax-compliance.md +117 -0
  97. package/extensions/gamedev/PACK.md +66 -317
  98. package/extensions/gamedev/skills/asset-pipeline.md +74 -0
  99. package/extensions/gamedev/skills/audio-system.md +129 -0
  100. package/extensions/gamedev/skills/camera-system.md +87 -0
  101. package/extensions/gamedev/skills/ecs.md +98 -0
  102. package/extensions/gamedev/skills/game-loops.md +72 -0
  103. package/extensions/gamedev/skills/input-system.md +199 -0
  104. package/extensions/gamedev/skills/multiplayer.md +180 -0
  105. package/extensions/gamedev/skills/particles.md +105 -0
  106. package/extensions/gamedev/skills/physics-engine.md +89 -0
  107. package/extensions/gamedev/skills/scene-management.md +146 -0
  108. package/extensions/gamedev/skills/threejs-patterns.md +90 -0
  109. package/extensions/gamedev/skills/webgl.md +71 -0
  110. package/extensions/mobile/PACK.md +56 -223
  111. package/extensions/mobile/skills/app-store-connect.md +152 -0
  112. package/extensions/mobile/skills/app-store-prep.md +66 -0
  113. package/extensions/mobile/skills/deep-linking.md +109 -0
  114. package/extensions/mobile/skills/flutter.md +60 -0
  115. package/extensions/mobile/skills/ios-build-pipeline.md +142 -0
  116. package/extensions/mobile/skills/native-bridge.md +66 -0
  117. package/extensions/mobile/skills/ota-updates.md +97 -0
  118. package/extensions/mobile/skills/push-notifications.md +111 -0
  119. package/extensions/mobile/skills/react-native.md +82 -0
  120. package/extensions/saas/PACK.md +26 -720
  121. package/extensions/saas/skills/billing-integration.md +121 -0
  122. package/extensions/saas/skills/feature-flags.md +130 -0
  123. package/extensions/saas/skills/multi-tenant.md +103 -0
  124. package/extensions/saas/skills/onboarding-flow.md +139 -0
  125. package/extensions/saas/skills/subscription-flow.md +95 -0
  126. package/extensions/saas/skills/team-management.md +144 -0
  127. package/extensions/security/PACK.md +10 -448
  128. package/extensions/security/skills/api-security.md +140 -0
  129. package/extensions/security/skills/compliance.md +68 -0
  130. package/extensions/security/skills/owasp-audit.md +64 -0
  131. package/extensions/security/skills/pentest-patterns.md +77 -0
  132. package/extensions/security/skills/secret-mgmt.md +65 -0
  133. package/extensions/security/skills/supply-chain.md +65 -0
  134. package/extensions/trading/PACK.md +18 -535
  135. package/extensions/trading/skills/chart-components.md +55 -0
  136. package/extensions/trading/skills/experiment-loop.md +125 -0
  137. package/extensions/trading/skills/fintech-patterns.md +47 -0
  138. package/extensions/trading/skills/indicator-library.md +58 -0
  139. package/extensions/trading/skills/quant-analysis.md +111 -0
  140. package/extensions/trading/skills/realtime-data.md +58 -0
  141. package/extensions/trading/skills/trade-logic.md +104 -0
  142. package/extensions/ui/PACK.md +36 -853
  143. package/extensions/ui/skills/a11y-audit.md +91 -0
  144. package/extensions/ui/skills/animation-patterns.md +106 -0
  145. package/extensions/ui/skills/component-patterns.md +75 -0
  146. package/extensions/ui/skills/design-decision.md +108 -0
  147. package/extensions/ui/skills/design-system.md +68 -0
  148. package/extensions/ui/skills/landing-patterns.md +155 -0
  149. package/extensions/ui/skills/palette-picker.md +173 -0
  150. package/extensions/ui/skills/react-health.md +90 -0
  151. package/extensions/ui/skills/type-system.md +125 -0
  152. package/extensions/ui/skills/web-vitals.md +153 -0
  153. package/extensions/zalo/PACK.md +117 -0
  154. package/extensions/zalo/skills/zalo-oa-mcp.md +317 -0
  155. package/extensions/zalo/skills/zalo-oa-messaging.md +429 -0
  156. package/extensions/zalo/skills/zalo-oa-setup.md +236 -0
  157. package/extensions/zalo/skills/zalo-oa-webhook.md +189 -0
  158. package/extensions/zalo/skills/zalo-personal-messaging.md +194 -0
  159. package/extensions/zalo/skills/zalo-personal-setup.md +153 -0
  160. package/extensions/zalo/skills/zalo-rate-guard.md +219 -0
  161. package/hooks/.gitkeep +0 -0
  162. package/hooks/auto-format/index.cjs +48 -0
  163. package/hooks/context-watch/index.cjs +68 -0
  164. package/hooks/hooks.json +99 -0
  165. package/hooks/metrics-collector/index.cjs +42 -0
  166. package/hooks/post-session-reflect/index.cjs +153 -0
  167. package/hooks/pre-compact/index.cjs +95 -0
  168. package/hooks/pre-tool-guard/index.cjs +68 -0
  169. package/hooks/run-hook +17 -0
  170. package/hooks/run-hook.cjs +16 -0
  171. package/hooks/run-hook.cmd +1 -0
  172. package/hooks/secrets-scan/index.cjs +100 -0
  173. package/hooks/session-start/index.cjs +65 -0
  174. package/hooks/typecheck/index.cjs +65 -0
  175. package/package.json +9 -4
  176. package/references/ui-pro-max-data/LICENSE-UI-PRO-MAX +21 -0
  177. package/references/ui-pro-max-data/charts.csv +26 -0
  178. package/references/ui-pro-max-data/colors.csv +162 -0
  179. package/references/ui-pro-max-data/styles.csv +85 -0
  180. package/references/ui-pro-max-data/typography.csv +74 -0
  181. package/references/ui-pro-max-data/ui-reasoning.csv +162 -0
  182. package/references/ui-pro-max-data/ux-guidelines.csv +100 -0
  183. package/skills/ba/SKILL.md +10 -0
  184. package/skills/brainstorm/SKILL.md +63 -1
  185. package/skills/completion-gate/SKILL.md +34 -1
  186. package/skills/context-engine/SKILL.md +13 -0
  187. package/skills/cook/SKILL.md +155 -5
  188. package/skills/debug/SKILL.md +56 -1
  189. package/skills/design/SKILL.md +11 -0
  190. package/skills/fix/SKILL.md +26 -1
  191. package/skills/mcp-builder/SKILL.md +48 -1
  192. package/skills/plan/SKILL.md +23 -6
  193. package/skills/review/SKILL.md +44 -5
  194. package/skills/review-intake/SKILL.md +17 -1
  195. package/skills/skill-forge/SKILL.md +38 -3
  196. package/skills/skill-router/SKILL.md +89 -7
  197. package/skills/team/SKILL.md +24 -1
  198. package/skills/test/SKILL.md +28 -1
  199. package/skills/verification/SKILL.md +98 -1
@@ -233,6 +233,16 @@ US-1: As a [persona], I want to [action] so that [benefit]
233
233
  ## Risks
234
234
  - [risk]: [mitigation strategy]
235
235
 
236
+ ## Decision Classification
237
+
238
+ | Category | Meaning | Example |
239
+ |----------|---------|---------|
240
+ | **Decisions** (locked) | User confirmed — agent MUST follow | "Use PostgreSQL, not MongoDB" |
241
+ | **Discretion** (agent decides) | User trusts agent judgment | "Pick the best validation library" |
242
+ | **Deferred** (out of scope) | Explicitly NOT this task | "Mobile app — future phase" |
243
+
244
+ Plan gates on Decision compliance — Discretion items don't need approval.
245
+
236
246
  ## Next Step
237
247
  → Hand off to rune:plan for implementation planning
238
248
  ```
@@ -3,7 +3,7 @@ name: brainstorm
3
3
  description: Creative ideation and solution exploration. Generates multiple approaches with trade-offs, uses structured frameworks (SCAMPER, First Principles), and hands off to plan for structuring.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.3.0"
6
+ version: "0.4.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: creation
@@ -27,6 +27,20 @@ This applies to EVERY task regardless of perceived simplicity.
27
27
  ### Discovery Mode (default)
28
28
  Normal brainstorming at the start of a task — generate approaches before any code is written.
29
29
 
30
+ ### Vision Mode
31
+ Activated for product-level rethinks — not "how to implement X" but "should we even build X?" Forces 10x thinking instead of incremental improvement.
32
+
33
+ **Vision Mode triggers:**
34
+ - Manual: `/rune brainstorm vision <product area>`
35
+ - Called by `@rune-pro/product.feature-spec` when requirements feel incremental
36
+ - When the user says "rethink", "reimagine", "what if we", "step back"
37
+
38
+ **Vision Mode constraints:**
39
+ 1. MUST restate the user's REAL problem (not their proposed solution) — "you asked for a settings page, but your real problem is users can't find the right config"
40
+ 2. MUST generate 2-3 approaches where at least 1 eliminates the need for the feature entirely
41
+ 3. MUST apply the "10-star experience" lens: what would a 1-star, 5-star, and 10-star version look like?
42
+ 4. MUST challenge assumptions: "why does this need to be a page?" "why does the user need to do this at all?"
43
+
30
44
  ### Rescue Mode
31
45
  Activated when an approach has been tried and **fundamentally failed** — not a bug, but a wrong approach. Rescue mode forces **category-diverse** alternatives instead of variants of the failed approach.
32
46
 
@@ -125,6 +139,7 @@ CRAZY 8s — 8 ideas in 8 minutes (rapid ideation)
125
139
  ### Step 0 — Detect Mode
126
140
 
127
141
  Check the invocation context:
142
+ - If `mode="vision"` is set, or user says "rethink/reimagine/step back" → **Vision Mode**
128
143
  - If `mode="rescue"` is set, or caller is Approach Pivot Gate / 3-Fix Escalation → **Rescue Mode**
129
144
  - Otherwise → **Discovery Mode**
130
145
 
@@ -139,6 +154,53 @@ State the decision to be made in one clear sentence: "We need to decide HOW TO [
139
154
 
140
155
  If the problem is unclear, ask the user ONE clarifying question before proceeding.
141
156
 
157
+ ### Step 1.5 — Problem Restatement (MANDATORY)
158
+
159
+ After framing the problem, restate it back to the user for confirmation:
160
+
161
+ ```
162
+ "Let me confirm: you want to [X] because [Y],
163
+ and the main constraint is [Z]. Correct?"
164
+ ```
165
+
166
+ DO NOT generate approaches until user confirms the restatement. This prevents wasted ideation on a misunderstood problem — the most expensive brainstorm failure mode.
167
+
168
+ **Skip conditions** (Rescue Mode only):
169
+ - Rescue Mode: problem is already well-defined by `failure_evidence` — restatement is implicit in the failed approach summary.
170
+
171
+ ### Step 1.75 — Dynamic Questioning (When Clarification Needed)
172
+
173
+ When Step 1 or Step 1.5 reveals gaps, ask structured clarifying questions using this format:
174
+
175
+ ```
176
+ ### [P0|P1|P2] **[DECISION POINT]**
177
+
178
+ **Question:** [Clear, specific question]
179
+
180
+ **Why This Matters:**
181
+ - [Architectural consequence — what changes based on the answer]
182
+ - [Affects: cost | complexity | timeline | scale | security]
183
+
184
+ **Options:**
185
+ | Option | Pros | Cons | Best For |
186
+ |--------|------|------|----------|
187
+ | A | [+] | [-] | [scenario] |
188
+ | B | [+] | [-] | [scenario] |
189
+
190
+ **If Not Specified:** [Default choice + rationale]
191
+ ```
192
+
193
+ **Priority levels:**
194
+ - **P0**: Blocking — cannot generate approaches without this answer
195
+ - **P1**: High-leverage — significantly changes the recommended approach
196
+ - **P2**: Nice-to-have — refines the recommendation but doesn't change direction
197
+
198
+ **Rules:**
199
+ 1. Ask maximum 3 questions per round (avoid overwhelming the user)
200
+ 2. Each question MUST connect to a specific decision point (no generic "what do you want?")
201
+ 3. MUST provide a default answer — if user says "you decide", the default is used
202
+ 4. Questions generate data, not assumptions — each eliminates implementation paths
203
+
142
204
  ### Step 2 — Generate Approaches
143
205
 
144
206
  **Discovery Mode**: Produce exactly 2–3 distinct approaches.
@@ -4,7 +4,7 @@ description: "Validates agent claims against evidence trail. Catches 'done' with
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "1.1.0"
7
+ version: "1.2.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: validation
@@ -58,6 +58,21 @@ CLAIM PATTERNS:
58
58
 
59
59
  Extract each claim as: `{ claim: string, source_skill: string }`
60
60
 
61
+ ### Step 1b — Stub Detection (Existence Theater Check)
62
+
63
+ Before checking claims, scan all files created/modified in this workflow for stubs:
64
+
65
+ ```
66
+ Grep for stub patterns in new/modified files:
67
+ - "Placeholder" | "TODO" | "Not implemented" | "NotImplementedError"
68
+ - Functions with body: only `return null` / `return {}` / `pass` / `throw`
69
+ - Components returning only a single div with no logic
70
+ ```
71
+
72
+ If ANY stub detected:
73
+ - Add synthetic claim: "implemented [filename]" → CONTRADICTED (file is a stub)
74
+ - This catches agents that create files but don't implement them
75
+
61
76
  ### Step 2 — Match Evidence
62
77
 
63
78
  For each claim, look for corresponding evidence in the conversation context:
@@ -108,6 +123,23 @@ IF no evidence found:
108
123
  UNCONFIRMED — 1 claim lacks evidence, 1 contradicted. Cannot proceed to commit.
109
124
  ```
110
125
 
126
+ ### Step 5 — Evidence Quality Gate
127
+
128
+ Before emitting verdict, verify evidence quality:
129
+
130
+ 1. **IDENTIFY** — list every claim the agent made (Step 1 output)
131
+ 2. **RUN** — confirm verification commands were actually executed (not just planned)
132
+ 3. **READ** — read every line of command output (not just exit code)
133
+ 4. **VERIFY** — match each claim to a specific evidence quote (file:line or output snippet)
134
+ 5. **CLAIM** — only mark CONFIRMED if evidence quote directly supports the claim
135
+
136
+ | Evidence Quality | Verdict |
137
+ |-----------------|---------|
138
+ | Exit code 0 only, no output read | INSUFFICIENT — re-run and read output |
139
+ | Output read but no quote matched to claim | UNCONFIRMED — cite specific evidence |
140
+ | Quote matches claim exactly | CONFIRMED |
141
+ | Quote contradicts claim | CONTRADICTED |
142
+
111
143
  ## Verdict Rules
112
144
 
113
145
  ```
@@ -137,6 +169,7 @@ Completion Gate Report with status (CONFIRMED/UNCONFIRMED/CONTRADICTED), claim v
137
169
  | Evidence from a DIFFERENT test run (stale) | HIGH | Check that evidence timestamp/context matches current changes |
138
170
  | Agent pre-generates evidence by running commands proactively | LOW | This is actually GOOD behavior — we want agents to provide evidence |
139
171
  | Completion-gate itself claims "all confirmed" without evidence | CRITICAL | Gate report MUST include the evidence table — no table = report is invalid |
172
+ | Existence Theater — agent creates files but they're stubs | HIGH | Step 1b stub detection: grep for Placeholder/TODO/NotImplementedError in new files |
140
173
 
141
174
  ## Done When
142
175
 
@@ -117,6 +117,19 @@ Block further tool calls until compaction is acknowledged.
117
117
 
118
118
  Emit the context health report to the calling skill.
119
119
 
120
+ ### Step 6b — Context Percentage Advisory
121
+
122
+ In addition to tool-call counting, monitor context window percentage when available:
123
+
124
+ | Remaining | Level | Action |
125
+ |-----------|-------|--------|
126
+ | >35% | SAFE | Continue normally |
127
+ | 25-35% | WARNING | Advise: "Context at ~[X]%. Consider /compact at next phase boundary" |
128
+ | <25% | CRITICAL | Save state via session-bridge → recommend immediate /compact |
129
+
130
+ Debounce: emit advisory max once per 5 tool calls to avoid noise.
131
+ Tool-call thresholds (Steps 1-2) remain the primary signal. Percentage advisory is supplementary — use when CLI status bar data is available.
132
+
120
133
  ## Context Health Levels
121
134
 
122
135
  ```
@@ -5,7 +5,7 @@ context: fork
5
5
  agent: general-purpose
6
6
  metadata:
7
7
  author: runedev
8
- version: "0.5.0"
8
+ version: "0.7.0"
9
9
  layer: L1
10
10
  model: sonnet
11
11
  group: orchestrator
@@ -115,6 +115,23 @@ Skip silently on subsequent runs. User can force with `/rune env-check`.
115
115
  - Extract decisions relevant to the current task domain (match by keywords: module names, tech choices, patterns)
116
116
  - These become **constraints for Phase 2 (PLAN)** — the plan MUST NOT contradict active decisions without explicit user override
117
117
  - If no `.rune/decisions.md` exists, skip silently
118
+ ### Phase 1 Step 3.5 — Clarification Gate (Lightweight Socratic Check)
119
+
120
+ Before planning, ask the user at minimum **2 clarifying questions**:
121
+
122
+ 1. **"What does success look like?"** — defines acceptance criteria (how we know we're done)
123
+ 2. **"What should NOT change?"** — defines blast radius constraints (what's off-limits)
124
+
125
+ **Skip conditions** (ALL must be true to skip):
126
+ - Bug fix with clear reproduction steps already provided by user
127
+ - User explicitly said "just do it", "no questions", or "skip questions"
128
+ - Fast mode active AND estimated change < 10 LOC
129
+ - Hotfix chain active (production emergency)
130
+
131
+ This is NOT the full BA elicitation (5 questions). It's a lightweight 2-question gate that prevents the most common failure: implementing the wrong thing. If the answers reveal complexity → escalate to `rune:ba` for deep requirement analysis.
132
+
133
+ **Question format**: Use brainstorm's dynamic questioning format when possible (Priority level, Decision Point, Why This Matters, Options table, Default).
134
+
118
135
  4. Invoke scout to scan the codebase:
119
136
  - Use `Glob` to find files matching the feature domain (e.g., `**/*auth*`, `**/*user*`)
120
137
  - Use `Grep` to search for related patterns, imports, existing implementations
@@ -136,7 +153,16 @@ Skip silently on subsequent runs. User can force with `/rune env-check`.
136
153
 
137
154
  **Goal**: Detect if domain-specific L4 extension packs apply to this task.
138
155
 
139
- After scout completes (Phase 1), check if the detected tech stack or task description matches any L4 extension pack. If a match is found, read the pack's PACK.md to load domain-specific patterns, constraints, and sharp edges into the current workflow.
156
+ After scout completes (Phase 1), check if the detected tech stack or task description matches any L4 extension pack. If a match is found, load the relevant domain-specific patterns, constraints, and sharp edges into the current workflow.
157
+
158
+ **Split pack protocol** (context-efficient):
159
+ - `Read` the matching PACK.md index (~60-80 lines) — this contains triggers, skill table, connections, and workflows
160
+ - Match the task to the specific skill name in the index's Skills Included table
161
+ - `Read` only the matching skill file(s) from `skills/` subdirectory (e.g., `extensions/backend/skills/auth.md`)
162
+ - Load max 2-3 skill files per invocation — not all skills in the pack
163
+ - Pack-level constraints (from index's Connections and Sharp Edges sections) always apply
164
+
165
+ **Monolith pack protocol** (legacy): If no `format: split` in PACK.md frontmatter, read the full PACK.md and extract the matching `### skill-name` section as before.
140
166
 
141
167
  1. Check the project's detected stack against the L4 pack mapping:
142
168
 
@@ -154,13 +180,20 @@ After scout completes (Phase 1), check if the detected tech stack or task descri
154
180
  | `three`, `pixi`, `phaser`, `*.glsl`, game loop | `@rune/gamedev` | `extensions/gamedev/PACK.md` |
155
181
  | CMS, blog, MDX, `i18next`, SEO | `@rune/content` | `extensions/content/PACK.md` |
156
182
  | Analytics, tracking, A/B test, funnel | `@rune/analytics` | `extensions/analytics/PACK.md` |
183
+ | Chrome extension, `manifest.json`, service worker, content script | `@rune/chrome-ext` | `extensions/chrome-ext/PACK.md` |
157
184
  | PRD, roadmap, KPI, release notes, `.rune/business/` | `@rune-pro/product` | `extensions/pro-product/PACK.md` |
185
+ | Sales outreach, pipeline, call prep, competitive intel | `@rune-pro/sales` | `extensions/pro-sales/PACK.md` |
186
+ | Data science, SQL, dashboard, statistical testing, ETL | `@rune-pro/data-science` | `extensions/pro-data-science/PACK.md` |
187
+ | Support ticket, KB article, escalation, SLA, FAQ | `@rune-pro/support` | `extensions/pro-support/PACK.md` |
188
+ | Budget, expense, revenue forecast, P&L, cash flow, runway | `@rune-pro/finance` | `extensions/pro-finance/PACK.md` |
189
+ | Contract, NDA, compliance, GDPR, IP, legal incident | `@rune-pro/legal` | `extensions/pro-legal/PACK.md` |
158
190
 
159
191
  2. If ≥1 pack matches:
160
- - Use `Read` to load the matching PACK.md
161
- - Extract the relevant skill's **Workflow** steps and **Constraints**
192
+ - Use `Read` to load the matching PACK.md (index if split, full if monolith)
193
+ - For split packs: identify the relevant skill from the index table, then `Read` only that skill file from `skills/` subdirectory
194
+ - For monolith packs: extract the relevant `### skill-name` section from the PACK.md body
162
195
  - Apply pack constraints alongside cook's own constraints for the rest of the workflow
163
- - Announce: "Loaded @rune/[pack] applying [skill-name] domain patterns"
196
+ - Announce: "Loaded @rune/[pack] [skill-name] (split)" or "Loaded @rune/[pack] → [skill-name] (full)"
164
197
 
165
198
  3. If 0 packs match: skip silently, proceed to Phase 2
166
199
 
@@ -407,6 +440,32 @@ This is OPT-IN — only activate if:
407
440
  - User explicitly requests checkpoints
408
441
  ```
409
442
 
443
+ ## Phase Transition Protocol (MANDATORY)
444
+
445
+ Before entering ANY Phase N+1, assert ALL of the following:
446
+
447
+ ```
448
+ ASSERT Phase N status == completed (in TodoWrite)
449
+ ASSERT Phase N gate condition met (see Mesh Gates table below)
450
+ ASSERT No BLOCK status from any sub-skill in Phase N
451
+ ASSERT No unresolved CRITICAL findings from quality checks
452
+
453
+ IF any assertion fails:
454
+ → STOP. Do NOT proceed to Phase N+1.
455
+ → Log: "BLOCKED at Phase N→N+1 transition: [specific assertion that failed]"
456
+ → Fix the blocking issue, then re-check assertions.
457
+ ```
458
+
459
+ **Key transitions to enforce:**
460
+ | Transition | Gate | Common Violation |
461
+ |---|---|---|
462
+ | Phase 1 → 2 | Scout Gate (codebase scanned) | Skipping scout "to save time" |
463
+ | Phase 2 → 3 | Plan Gate (user approved plan) | Starting code without approval |
464
+ | Phase 3 → 4 | Test-First Gate (failing tests exist) | Writing code before tests |
465
+ | Phase 4 → 5 | All tests pass | Moving to quality with failing tests |
466
+ | Phase 5 → 6 | Quality gate (no CRITICAL findings) | Ignoring sentinel CRITICAL |
467
+ | Phase 6 → 7 | Verification green (lint + types + build) | Committing broken build |
468
+
410
469
  ## Phase 6: VERIFY
411
470
 
412
471
  **Goal**: Final automated verification before commit.
@@ -497,6 +556,27 @@ cook instance → commit → push → create PR → wait CI
497
556
  IF 3 retries fail → escalate to user with CI logs
498
557
  ```
499
558
 
559
+ ### Formal Pause/Resume (`.continue-here.md`)
560
+
561
+ When cook must pause mid-phase (context limit, user break, session end before phase completes):
562
+
563
+ 1. Create `.rune/.continue-here.md` with structured handoff:
564
+ ```markdown
565
+ ## Continue Here
566
+ - **Phase**: [current phase number and name]
567
+ - **Task**: [current task within phase — e.g., "Task 3 of 5"]
568
+ - **Completed**: [list of tasks done this session]
569
+ - **Remaining**: [list of tasks not yet started]
570
+ - **Decisions**: [any decisions made this session]
571
+ - **Blockers**: [if any — what's stuck and why]
572
+ - **WIP Files**: [files modified but not yet committed]
573
+ ```
574
+ 2. Create a WIP commit: `wip: cook phase N paused at task M`
575
+ 3. Phase 0 (RESUME CHECK) detects `.continue-here.md` → resumes from exact task position
576
+ 4. After successful resume and phase completion → delete `.continue-here.md`
577
+
578
+ This is more granular than Phase 0's plan-level resume — it resumes within a phase, not just between phases.
579
+
500
580
  ### Exit Conditions (Mandatory for Autonomous Runs)
501
581
 
502
582
  Every cook invocation inside `team` or autonomous workflows MUST have exit conditions:
@@ -513,6 +593,40 @@ TIMEOUT_SIGNAL: If context-watch reports ORANGE, wrap up current phase and ch
513
593
 
514
594
  If any exit condition triggers without resolution → cook emits `BLOCKED` status with details and stops. Never spin indefinitely.
515
595
 
596
+ ### Subagent Status Protocol
597
+
598
+ When cook completes (whether standalone or invoked by `team`), it MUST return one of four statuses. Sub-skills invoked by cook (fix, test, review, sentinel, etc.) MUST also return one of these statuses so cook can route accordingly.
599
+
600
+ | Status | Meaning | Cook Action |
601
+ |--------|---------|-------------|
602
+ | `DONE` | Task complete, no issues | Proceed to next phase |
603
+ | `DONE_WITH_CONCERNS` | Task complete but issues noted (e.g., "tests pass but a performance regression observed") | Proceed, but append concern to `.rune/progress.md` and surface in Cook Report; address in Phase 5 (QUALITY) or next review cycle |
604
+ | `NEEDS_CONTEXT` | Cannot proceed without more information (missing requirement, ambiguous spec, unknown environment) | Pause execution. Ask user the specific question(s) blocking progress. Resume from the same phase after answer received. |
605
+ | `BLOCKED` | Hard blocker — cannot continue regardless of context (broken dependency, fundamental incompatibility, exhausted escalation chain) | Trigger escalation chain: debug-fix (3x) → re-plan (1x) → brainstorm rescue (1x) → then escalate to user with full details |
606
+
607
+ **DONE_WITH_CONCERNS logging format** (append to `.rune/progress.md`):
608
+ ```
609
+ [CONCERN][phase][timestamp] <sub-skill>: <concern description>
610
+ ```
611
+
612
+ **NEEDS_CONTEXT format**: State exactly what is unknown, why it blocks progress, and what the two most likely answers are (to help the user respond quickly).
613
+
614
+ **BLOCKED format**: Include the phase, the sub-skill that emitted BLOCKED, the specific blocker, and what was already attempted.
615
+
616
+ ## Deviation Rules
617
+
618
+ When implementation diverges from plan:
619
+
620
+ | Rule | Scope | Action | Example |
621
+ |------|-------|--------|---------|
622
+ | R1: Bug fix | Code doesn't work as planned | Auto-fix, continue | Test fails due to typo, missing import |
623
+ | R2: Security fix | Vulnerability discovered | Auto-fix, continue | SQL injection, XSS, hardcoded secret |
624
+ | R3: Blocking fix | Can't proceed without change | Auto-fix, continue | Missing dependency, wrong API signature |
625
+ | R4: Architectural change | Different approach than planned | **ASK user first** | New database table, changed API contract, different library |
626
+
627
+ R1-R3: security primitives and correctness fixes are NOT features — fix silently.
628
+ R4: if you catch yourself thinking "this is a better way" — STOP and ask. The plan was approved for a reason.
629
+
516
630
  ## Error Recovery
517
631
 
518
632
  | Phase | If this fails... | Do this... |
@@ -526,6 +640,23 @@ If any exit condition triggers without resolution → cook emits `BLOCKED` statu
526
640
  | 5c REVIEW | Code quality issues | Fix CRITICAL/HIGH → re-review (max 2 loops) |
527
641
  | 6 VERIFY | Build/lint/type fails | Fix → re-run verification |
528
642
 
643
+ ### Repair Operators (before escalation)
644
+
645
+ When a task fails during Phase 4 (IMPLEMENT):
646
+
647
+ | Operator | When | Action |
648
+ |----------|------|--------|
649
+ | **RETRY** | Transient failure (network, timeout, flaky test) | Re-run same approach, max 2 attempts |
650
+ | **DECOMPOSE** | Task too complex, partial progress | Split into 2-3 smaller tasks, continue |
651
+ | **PRUNE** | Approach fundamentally wrong | Remove failed code, try different approach from plan |
652
+
653
+ **Budget**: 2 repair attempts per task. After 2 failures → escalate:
654
+ - Same error both times → `debug` for root cause
655
+ - Different errors → `plan` to redesign the task
656
+ - All approaches exhausted → `brainstorm(rescue)` for alternative category
657
+
658
+ Do NOT ask user until repair budget is spent.
659
+
529
660
  ## Called By (inbound)
530
661
 
531
662
  - User: `/rune cook` direct invocation — primary entry point
@@ -562,6 +693,24 @@ If any exit condition triggers without resolution → cook emits `BLOCKED` statu
562
693
  - `worktree` (L3): Phase 4 — worktree isolation for parallel implementation
563
694
  - L4 extension packs: Phase 1.5 — domain-specific patterns when stack matches (see Phase 1.5 mapping table)
564
695
 
696
+ ## Analysis Paralysis Guard
697
+
698
+ <HARD-GATE>
699
+ 5+ consecutive read-only tool calls (Read, Grep, Glob) without a single write action (Edit, Write, Bash) = STUCK.
700
+
701
+ You MUST either:
702
+ 1. **Act** — write code, run a command, create a file
703
+ 2. **Report BLOCKED** — state the specific missing piece: "Cannot proceed because [X]"
704
+
705
+ Stuck patterns (all banned):
706
+ - Reading 10+ files to "fully understand" before acting
707
+ - Grepping every variation of a string across the entire repo
708
+ - Reading the same file twice in one investigation
709
+ - "Let me check one more thing" — repeated after 5 reads
710
+
711
+ A wrong first attempt that produces feedback beats perfect understanding that never ships.
712
+ </HARD-GATE>
713
+
565
714
  ## Constraints
566
715
 
567
716
  1. MUST run scout before planning — no plan based on assumptions alone
@@ -620,6 +769,7 @@ Known failure modes for this skill. Check these before declaring done.
620
769
  | Not escalating to sentinel:opus on security-sensitive tasks | MEDIUM | Auth, crypto, payment code → sentinel must run at opus, not sonnet |
621
770
  | Running Phase 5 checks sequentially instead of parallel | MEDIUM | Launch preflight+sentinel+review as parallel Task agents for speed |
622
771
  | Saying "done" without evidence trail | CRITICAL | completion-gate validates claims — UNCONFIRMED = BLOCK |
772
+ | Analysis paralysis — 5+ reads without writing | HIGH | Analysis Paralysis Guard: act on incomplete info or report BLOCKED with specific missing piece |
623
773
  | Fast mode on security-relevant code | HIGH | Fast mode auto-excludes auth/crypto/payments — never fast-track security code |
624
774
  | Loading all phase files at once into context | HIGH | Phase File Gate: load ONLY the active phase file — one phase per session |
625
775
  | Resuming without checking master plan | MEDIUM | Phase 0 (RESUME CHECK) runs before Phase 1 — detects existing plans |
@@ -3,7 +3,7 @@ name: debug
3
3
  description: Root cause analysis for bugs and unexpected behavior. Traces errors through code, uses structured reasoning, and hands off to fix when cause is found. Core of the debug↔fix mesh.
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: development
@@ -101,6 +101,49 @@ Before hypothesizing, add diagnostic logging at EACH component boundary:
101
101
 
102
102
  This reveals: "secrets reach workflow ✓, workflow reaches build ✗" — pinpoints the failing layer.
103
103
 
104
+ ### Step 2b: Instrument with Preserved Markers
105
+
106
+ When adding diagnostic logging or instrumentation during investigation, mark ALL additions with region markers:
107
+
108
+ ```
109
+ // #region agent-debug — [hypothesis being tested]
110
+ console.log('[DEBUG] value at boundary:', data);
111
+ // #endregion agent-debug
112
+ ```
113
+
114
+ Language-appropriate equivalents:
115
+ - Python: `# region agent-debug` / `# endregion agent-debug`
116
+ - Rust: `// region agent-debug` / `// endregion agent-debug`
117
+
118
+ **Why preserved markers matter:**
119
+ - `rune:fix` will preserve these markers until the bug is fully resolved and tests pass
120
+ - If the bug recurs, markers show exactly what was previously instrumented
121
+ - Cleaning up debug traces before the fix is verified prevents learning from failure history
122
+ - After fix is verified + tests pass → fix will clean up markers in a final pass
123
+
124
+ <HARD-GATE>
125
+ ALL diagnostic code added during debug MUST be wrapped in `#region agent-debug` markers.
126
+ Unmarked instrumentation will be treated as stray code and removed prematurely.
127
+ </HARD-GATE>
128
+
129
+ ### Step 2c: Check Debug Knowledge Base
130
+
131
+ Before forming hypotheses, check `.rune/debug/knowledge-base.md`:
132
+ - If file exists → search for matching symptoms/error messages
133
+ - If match found → try known fix FIRST, skip hypothesis cycle
134
+ - If no match → proceed to Step 3
135
+
136
+ After successful root cause identification (Step 5), append entry:
137
+ ```
138
+ ### [date] — [symptom summary]
139
+ - **Symptom**: [error message or behavior]
140
+ - **Root Cause**: [what was actually wrong]
141
+ - **Fix**: [what resolved it]
142
+ - **Files**: [affected files]
143
+ ```
144
+
145
+ This prevents re-debugging the same issue across sessions.
146
+
104
147
  ### Step 3: Form Hypotheses
105
148
 
106
149
  List exactly 2-3 possible root causes — no more, no fewer.
@@ -163,6 +206,16 @@ Produce structured output and hand off to rune:fix.
163
206
  - Call `rune:fix` with the full report if fix is needed
164
207
  - Do NOT apply any code changes — report only
165
208
 
209
+ ## Analysis Paralysis Guard
210
+
211
+ <HARD-GATE>
212
+ Debug is read-heavy by nature — but there are limits.
213
+
214
+ After Step 4 (Test Hypotheses): if NO hypothesis is confirmed after 3 cycles of Steps 2-4, you MUST stop and escalate. Do NOT start cycle 4. Report all evidence gathered and escalate to problem-solver or sequential-thinking.
215
+
216
+ Within any single step: 5+ consecutive Read/Grep calls without forming or testing a hypothesis = stuck. Stop reading, form a hypothesis from what you have, and test it. Incomplete hypotheses that get tested are better than perfect hypotheses that never form.
217
+ </HARD-GATE>
218
+
166
219
  ## Red Flags — STOP and Return to Step 2
167
220
 
168
221
  If you catch yourself thinking any of these, you are GUESSING, not debugging:
@@ -174,6 +227,7 @@ If you catch yourself thinking any of these, you are GUESSING, not debugging:
174
227
  - "Here are the main problems: [lists fixes without investigation]"
175
228
  - Proposing solutions before tracing data flow
176
229
  - "One more fix attempt" (when already tried 2+)
230
+ - "Let me read one more file before forming a hypothesis" (after 5+ reads)
177
231
 
178
232
  ALL of these mean: STOP. Return to Step 2 (Gather Evidence).
179
233
 
@@ -231,6 +285,7 @@ ALL of these mean: STOP. Return to Step 2 (Gather Evidence).
231
285
  | Same bug "fixed" 3+ times without questioning architecture | CRITICAL | 3-Fix Escalation Rule: classify failure → same blocker category = brainstorm(rescue), different bugs = plan redesign |
232
286
  | Escalating to plan when the APPROACH is wrong (not the module) | HIGH | If all 3 fixes hit the same category of blocker (API limit, platform gap), the approach needs pivoting via brainstorm(rescue), not re-planning |
233
287
  | Not tracking fix attempt number for recurring bugs | HIGH | Debug Report MUST include Fix Attempt counter — enables escalation gate |
288
+ | Adding instrumentation without region markers | MEDIUM | All debug logging MUST use `#region agent-debug` — unmarked code gets cleaned up prematurely by fix |
234
289
 
235
290
  ## Done When
236
291
 
@@ -57,6 +57,17 @@ Load the design knowledge base before reasoning:
57
57
 
58
58
  > **Why two layers**: The baseline ships "good enough" universal design knowledge. Users who care about aesthetics create their own `design-dna.md` with curated palettes, font pairings, and style preferences. The design skill works well with either — it just works _better_ with a curated reference.
59
59
 
60
+ ### External Data Source
61
+
62
+ Design intelligence data from [UI/UX Pro Max](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill) (MIT, 42.8k★).
63
+ Located at `references/ui-pro-max-data/` — 161 palettes, 84 styles, 73 font pairings, 161 reasoning rules, 99 UX guidelines.
64
+
65
+ When `references/ui-pro-max-data/` is available:
66
+ - Step 2: query `styles.csv` for domain-matched visual styles (expands from 10 → 84)
67
+ - Step 3: query `ui-reasoning.csv` for industry-specific design rules (161 rules)
68
+ - Step 3: query `colors.csv` for palette alternatives (expands from 10 → 161)
69
+ - Step 6 (Anti-AI): cross-check proposed style against reasoning DB — if flagged as "AI-generic", suggest 3 alternatives
70
+
60
71
  ### Step 1 — Discover
61
72
 
62
73
  Invoke `scout` to detect:
@@ -3,7 +3,7 @@ name: fix
3
3
  description: Apply code changes and fixes. Writes implementation code, applies bug fixes, and verifies changes with tests. Core action hub in the development mesh.
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: development
@@ -112,6 +112,17 @@ Single validation at one point can be bypassed by different code paths, refactor
112
112
 
113
113
  Apply this when: the bug was caused by invalid data flowing through multiple layers. Skip for trivial one-liner fixes.
114
114
 
115
+ ### Step 5b: Preserve Debug Instrumentation
116
+
117
+ If `rune:debug` left `#region agent-debug` markers in the code:
118
+
119
+ 1. **During fix**: DO NOT remove these markers — they capture the investigation trail
120
+ 2. **After fix verified** (tests pass, lint pass): scan for `#region agent-debug` markers
121
+ 3. **Remove markers and their contents** in a final cleanup pass ONLY after full verification
122
+ 4. If the fix is partial or tests still fail → KEEP all markers for the next debug cycle
123
+
124
+ **Why:** Premature cleanup of debug instrumentation erases failure history. If the bug recurs after cleanup, the next debug session starts from zero. Keeping markers until verification means downstream skills can see what was already investigated.
125
+
115
126
  ### Step 6: Self-Review
116
127
 
117
128
  Verify correctness of the changes just made.
@@ -141,6 +152,19 @@ Produce a structured summary of all changes made.
141
152
  5. MUST follow project conventions found by scout — don't invent new patterns
142
153
  6. MUST NOT add unplanned features while fixing — fix only what was diagnosed
143
154
  7. MUST track fix attempt number — this feeds debug's 3-Fix Escalation classification
155
+ 8. MUST preserve `#region agent-debug` markers until fix is fully verified — cleanup only after tests pass
156
+
157
+ ## Scope Gate
158
+
159
+ | Change Type | Action |
160
+ |-------------|--------|
161
+ | Bug fix (diagnosed cause) | Fix it |
162
+ | Security fix (found during fix) | Fix it + flag to sentinel |
163
+ | Blocking issue (can't complete fix without) | Fix it + document in report |
164
+ | Unrelated improvement | **STOP — create separate task** |
165
+ | Architectural change | **STOP — escalate to cook/plan** |
166
+
167
+ If fix requires touching >3 files not in the diagnosis → re-diagnose. You're probably fixing a symptom.
144
168
 
145
169
  ## Mesh Gates
146
170
 
@@ -182,6 +206,7 @@ Known failure modes for this skill. Check these before declaring done.
182
206
  | Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changes — run tests after each edit |
183
207
  | Fixing at crash site without tracing data origin | HIGH | Defense-in-depth: trace where bad data ORIGINATES, add validation at every layer it passes through |
184
208
  | Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
209
+ | Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests pass — premature cleanup erases failure history |
185
210
 
186
211
  ## Done When
187
212
 
@@ -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.2.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: creation
@@ -174,6 +174,52 @@ const envSchema = z.object({
174
174
  export const config = envSchema.parse(process.env);
175
175
  ```
176
176
 
177
+ ### Step 3.5 — Tool Safety Classification
178
+
179
+ Before generating tests, classify every tool as `query` or `mutation`:
180
+
181
+ | Category | Examples | Behavior |
182
+ |---|---|---|
183
+ | `query` | read, list, search, get, fetch | Auto-approve — no confirmation needed |
184
+ | `mutation` | create, update, delete, send, write, publish | Require user confirmation before execution |
185
+
186
+ **Implementation rules:**
187
+
188
+ 1. Add `safety` metadata to each tool definition:
189
+ ```typescript
190
+ export const deleteTool = {
191
+ name: 'delete_user',
192
+ description: '...',
193
+ safety: 'mutation' as const, // ← add this
194
+ inputSchema: z.object({ id: z.string() }),
195
+ async handler(input) { ... },
196
+ };
197
+ ```
198
+
199
+ 2. For every `mutation` tool, generate a preview step that surfaces WHAT WILL HAPPEN before the action runs:
200
+ ```typescript
201
+ // In the handler, before executing:
202
+ if (tool.safety === 'mutation') {
203
+ return {
204
+ content: [{ type: 'text', text:
205
+ `⚠️ Will delete user "${user.name}" (ID: ${input.id}). This cannot be undone.\nConfirm? (yes/no)`
206
+ }],
207
+ requiresConfirmation: true,
208
+ };
209
+ }
210
+ // Proceed only after confirmation received
211
+ ```
212
+
213
+ 3. For Python (FastMCP), add a `@confirm_mutation` decorator or inline guard in the docstring:
214
+ ```python
215
+ @mcp.tool()
216
+ async def delete_user(id: str) -> str:
217
+ """[MUTATION] Delete a user by ID. Will prompt for confirmation before executing."""
218
+ ...
219
+ ```
220
+
221
+ 4. Document the safety classification in the README tool catalog (add a `🔒` badge on mutation tools).
222
+
177
223
  ### Step 4 — Generate Tests
178
224
 
179
225
  For each tool:
@@ -295,6 +341,7 @@ mcp-server-<name>/
295
341
  | Tests mock everything → no real integration coverage | MEDIUM | Generate both unit tests (mocked) and integration test template (real API) |
296
342
  | Generated server doesn't match MCP spec | HIGH | Use official SDK — don't hand-roll protocol handling |
297
343
  | Installation docs only for Claude Code | LOW | Include Cursor/Windsurf config examples too |
344
+ | Mutation tool without confirmation gate | CRITICAL | Step 3.5: classify every tool — any write/delete/send without a preview+confirm step is a footgun |
298
345
 
299
346
  ## Done When
300
347