@rune-kit/rune 2.2.0 → 2.2.1

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 (144) hide show
  1. package/README.md +40 -34
  2. package/compiler/__tests__/pack-split.test.js +145 -0
  3. package/compiler/bin/rune.js +0 -5
  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/extensions/ai-ml/PACK.md +38 -474
  10. package/extensions/ai-ml/skills/ai-agents.md +172 -0
  11. package/extensions/ai-ml/skills/code-sandbox.md +187 -0
  12. package/extensions/ai-ml/skills/deep-research.md +146 -0
  13. package/extensions/ai-ml/skills/embedding-search.md +66 -0
  14. package/extensions/ai-ml/skills/fine-tuning-guide.md +74 -0
  15. package/extensions/ai-ml/skills/llm-architect.md +125 -0
  16. package/extensions/ai-ml/skills/llm-integration.md +64 -0
  17. package/extensions/ai-ml/skills/prompt-patterns.md +72 -0
  18. package/extensions/ai-ml/skills/rag-patterns.md +66 -0
  19. package/extensions/ai-ml/skills/web-extraction.md +114 -0
  20. package/extensions/analytics/PACK.md +19 -484
  21. package/extensions/analytics/skills/ab-testing.md +72 -0
  22. package/extensions/analytics/skills/dashboard-patterns.md +83 -0
  23. package/extensions/analytics/skills/data-validation.md +68 -0
  24. package/extensions/analytics/skills/funnel-analysis.md +81 -0
  25. package/extensions/analytics/skills/sql-patterns.md +57 -0
  26. package/extensions/analytics/skills/statistical-analysis.md +79 -0
  27. package/extensions/analytics/skills/tracking-setup.md +71 -0
  28. package/extensions/backend/PACK.md +44 -618
  29. package/extensions/backend/skills/api-patterns.md +84 -0
  30. package/extensions/backend/skills/async-pipeline.md +193 -0
  31. package/extensions/backend/skills/auth-patterns.md +97 -0
  32. package/extensions/backend/skills/background-jobs.md +133 -0
  33. package/extensions/backend/skills/caching-patterns.md +108 -0
  34. package/extensions/backend/skills/cli-generation.md +133 -0
  35. package/extensions/backend/skills/database-patterns.md +87 -0
  36. package/extensions/backend/skills/middleware-patterns.md +104 -0
  37. package/extensions/chrome-ext/PACK.md +19 -921
  38. package/extensions/chrome-ext/skills/cws-preflight.md +143 -0
  39. package/extensions/chrome-ext/skills/cws-publish.md +104 -0
  40. package/extensions/chrome-ext/skills/ext-ai-integration.md +251 -0
  41. package/extensions/chrome-ext/skills/ext-messaging.md +139 -0
  42. package/extensions/chrome-ext/skills/ext-storage.md +133 -0
  43. package/extensions/chrome-ext/skills/mv3-scaffold.md +164 -0
  44. package/extensions/content/PACK.md +43 -335
  45. package/extensions/content/skills/blog-patterns.md +88 -0
  46. package/extensions/content/skills/cms-integration.md +131 -0
  47. package/extensions/content/skills/content-scoring.md +107 -0
  48. package/extensions/content/skills/i18n.md +83 -0
  49. package/extensions/content/skills/mdx-authoring.md +137 -0
  50. package/extensions/content/skills/reference.md +1014 -0
  51. package/extensions/content/skills/seo-patterns.md +67 -0
  52. package/extensions/content/skills/video-repurpose.md +153 -0
  53. package/extensions/devops/PACK.md +38 -457
  54. package/extensions/devops/skills/chaos-testing.md +67 -0
  55. package/extensions/devops/skills/ci-cd.md +75 -0
  56. package/extensions/devops/skills/docker.md +58 -0
  57. package/extensions/devops/skills/edge-serverless.md +163 -0
  58. package/extensions/devops/skills/infra-as-code.md +158 -0
  59. package/extensions/devops/skills/kubernetes.md +110 -0
  60. package/extensions/devops/skills/monitoring.md +57 -0
  61. package/extensions/devops/skills/server-setup.md +64 -0
  62. package/extensions/devops/skills/ssl-domain.md +42 -0
  63. package/extensions/ecommerce/PACK.md +62 -226
  64. package/extensions/ecommerce/skills/cart-system.md +79 -0
  65. package/extensions/ecommerce/skills/inventory-mgmt.md +102 -0
  66. package/extensions/ecommerce/skills/order-management.md +126 -0
  67. package/extensions/ecommerce/skills/payment-integration.md +472 -0
  68. package/extensions/ecommerce/skills/shopify-dev.md +69 -0
  69. package/extensions/ecommerce/skills/subscription-billing.md +93 -0
  70. package/extensions/ecommerce/skills/tax-compliance.md +117 -0
  71. package/extensions/gamedev/PACK.md +66 -317
  72. package/extensions/gamedev/skills/asset-pipeline.md +74 -0
  73. package/extensions/gamedev/skills/audio-system.md +129 -0
  74. package/extensions/gamedev/skills/camera-system.md +87 -0
  75. package/extensions/gamedev/skills/ecs.md +98 -0
  76. package/extensions/gamedev/skills/game-loops.md +72 -0
  77. package/extensions/gamedev/skills/input-system.md +199 -0
  78. package/extensions/gamedev/skills/multiplayer.md +180 -0
  79. package/extensions/gamedev/skills/particles.md +105 -0
  80. package/extensions/gamedev/skills/physics-engine.md +89 -0
  81. package/extensions/gamedev/skills/scene-management.md +146 -0
  82. package/extensions/gamedev/skills/threejs-patterns.md +90 -0
  83. package/extensions/gamedev/skills/webgl.md +71 -0
  84. package/extensions/mobile/PACK.md +56 -223
  85. package/extensions/mobile/skills/app-store-connect.md +152 -0
  86. package/extensions/mobile/skills/app-store-prep.md +66 -0
  87. package/extensions/mobile/skills/deep-linking.md +109 -0
  88. package/extensions/mobile/skills/flutter.md +60 -0
  89. package/extensions/mobile/skills/ios-build-pipeline.md +142 -0
  90. package/extensions/mobile/skills/native-bridge.md +66 -0
  91. package/extensions/mobile/skills/ota-updates.md +97 -0
  92. package/extensions/mobile/skills/push-notifications.md +111 -0
  93. package/extensions/mobile/skills/react-native.md +82 -0
  94. package/extensions/saas/PACK.md +26 -720
  95. package/extensions/saas/skills/billing-integration.md +121 -0
  96. package/extensions/saas/skills/feature-flags.md +130 -0
  97. package/extensions/saas/skills/multi-tenant.md +103 -0
  98. package/extensions/saas/skills/onboarding-flow.md +139 -0
  99. package/extensions/saas/skills/subscription-flow.md +95 -0
  100. package/extensions/saas/skills/team-management.md +144 -0
  101. package/extensions/security/PACK.md +10 -448
  102. package/extensions/security/skills/api-security.md +140 -0
  103. package/extensions/security/skills/compliance.md +68 -0
  104. package/extensions/security/skills/owasp-audit.md +64 -0
  105. package/extensions/security/skills/pentest-patterns.md +77 -0
  106. package/extensions/security/skills/secret-mgmt.md +65 -0
  107. package/extensions/security/skills/supply-chain.md +65 -0
  108. package/extensions/trading/PACK.md +18 -535
  109. package/extensions/trading/skills/chart-components.md +55 -0
  110. package/extensions/trading/skills/experiment-loop.md +125 -0
  111. package/extensions/trading/skills/fintech-patterns.md +47 -0
  112. package/extensions/trading/skills/indicator-library.md +58 -0
  113. package/extensions/trading/skills/quant-analysis.md +111 -0
  114. package/extensions/trading/skills/realtime-data.md +58 -0
  115. package/extensions/trading/skills/trade-logic.md +104 -0
  116. package/extensions/ui/PACK.md +34 -853
  117. package/extensions/ui/skills/a11y-audit.md +91 -0
  118. package/extensions/ui/skills/animation-patterns.md +106 -0
  119. package/extensions/ui/skills/component-patterns.md +75 -0
  120. package/extensions/ui/skills/design-decision.md +98 -0
  121. package/extensions/ui/skills/design-system.md +68 -0
  122. package/extensions/ui/skills/landing-patterns.md +155 -0
  123. package/extensions/ui/skills/palette-picker.md +162 -0
  124. package/extensions/ui/skills/react-health.md +90 -0
  125. package/extensions/ui/skills/type-system.md +125 -0
  126. package/extensions/ui/skills/web-vitals.md +153 -0
  127. package/extensions/zalo/PACK.md +117 -0
  128. package/extensions/zalo/skills/zalo-oa-mcp.md +317 -0
  129. package/extensions/zalo/skills/zalo-oa-messaging.md +429 -0
  130. package/extensions/zalo/skills/zalo-oa-setup.md +236 -0
  131. package/extensions/zalo/skills/zalo-oa-webhook.md +189 -0
  132. package/extensions/zalo/skills/zalo-personal-messaging.md +194 -0
  133. package/extensions/zalo/skills/zalo-personal-setup.md +153 -0
  134. package/extensions/zalo/skills/zalo-rate-guard.md +219 -0
  135. package/package.json +1 -1
  136. package/skills/brainstorm/SKILL.md +63 -1
  137. package/skills/cook/SKILL.md +84 -5
  138. package/skills/mcp-builder/SKILL.md +48 -1
  139. package/skills/review/SKILL.md +42 -5
  140. package/skills/review-intake/SKILL.md +17 -1
  141. package/skills/skill-router/SKILL.md +89 -7
  142. package/skills/team/SKILL.md +24 -1
  143. package/skills/test/SKILL.md +18 -0
  144. package/skills/verification/SKILL.md +40 -1
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: zalo-rate-guard
3
+ pack: "@rune/zalo"
4
+ description: Rate limiting patterns for Zalo OA and personal APIs — token bucket per endpoint, exponential backoff, queue management, quota monitoring, anti-ban strategies.
5
+ model: sonnet
6
+ tools: "Read, Glob, Grep, Bash, Write, Edit"
7
+ ---
8
+
9
+ # zalo-rate-guard
10
+
11
+ Shared rate limiting layer for both Track A (OA API) and Track B (Personal via zca-js).
12
+ Zalo has **undocumented rate limits** — no official RPM/QPM numbers published.
13
+ Exceeding limits: throttled (429) → warned → OA suspended / account banned.
14
+ Neither `zalo-php-sdk`, `zalo-java-sdk`, nor `zca-js` implement any rate limiting.
15
+ This skill fills that gap.
16
+
17
+ ---
18
+
19
+ ## Estimated Safe Limits
20
+
21
+ **Track A — OA API:**
22
+
23
+ | Endpoint | Safe RPM | Burst | Notes |
24
+ |----------|----------|-------|-------|
25
+ | Send CS message | 200 | 10 | Per OA, includes all message types |
26
+ | Send broadcast | 50 | 5 | Monthly quota based on follower count |
27
+ | Get user profile | 300 | 20 | Cacheable — use name cache |
28
+ | Get follower list | 100 | 10 | Paginated, cache results |
29
+ | Upload media | 60 | 5 | Large payloads, slower |
30
+ | Global | 500 | 30 | Total across all endpoints |
31
+
32
+ **Track B — Personal (zca-js):**
33
+
34
+ | Action | Safe RPM | Burst | Notes |
35
+ |--------|----------|-------|-------|
36
+ | Send message (DM) | 30 | 5 | Much lower than OA — personal account |
37
+ | Send message (group) | 20 | 3 | Groups are more scrutinized |
38
+ | Friend operations | 10 | 2 | Add/remove friend is very sensitive |
39
+ | Profile lookups | 60 | 10 | Less sensitive, still cache |
40
+ | Global | 100 | 15 | Err on side of caution |
41
+
42
+ ---
43
+
44
+ ## Token Bucket Implementation
45
+
46
+ ```typescript
47
+ import PQueue from 'p-queue'
48
+
49
+ interface RateLimitConfig {
50
+ rpm: number // requests per minute
51
+ burst: number // max concurrent
52
+ retryAfter: number // ms to wait on 429
53
+ }
54
+
55
+ const LIMITS: Record<string, RateLimitConfig> = {
56
+ 'oa:send_message': { rpm: 200, burst: 10, retryAfter: 5000 },
57
+ 'oa:broadcast': { rpm: 50, burst: 5, retryAfter: 10000 },
58
+ 'oa:get_profile': { rpm: 300, burst: 20, retryAfter: 3000 },
59
+ 'oa:upload': { rpm: 60, burst: 5, retryAfter: 5000 },
60
+ 'personal:send_dm': { rpm: 30, burst: 5, retryAfter: 10000 },
61
+ 'personal:send_grp': { rpm: 20, burst: 3, retryAfter: 15000 },
62
+ 'personal:friend': { rpm: 10, burst: 2, retryAfter: 30000 },
63
+ }
64
+
65
+ export class ZaloRateLimiter {
66
+ private queues = new Map<string, PQueue>()
67
+
68
+ constructor() {
69
+ for (const [key, config] of Object.entries(LIMITS)) {
70
+ this.queues.set(key, new PQueue({
71
+ concurrency: config.burst,
72
+ intervalCap: config.rpm,
73
+ interval: 60_000, // per minute window
74
+ }))
75
+ }
76
+ }
77
+
78
+ async execute<T>(endpoint: string, fn: () => Promise<T>): Promise<T> {
79
+ const queue = this.queues.get(endpoint)
80
+ if (!queue) throw new Error(`Unknown endpoint: ${endpoint}`)
81
+ return queue.add(fn) as Promise<T>
82
+ }
83
+
84
+ queueSize(endpoint: string): number {
85
+ return this.queues.get(endpoint)?.size ?? 0
86
+ }
87
+
88
+ pending(endpoint: string): number {
89
+ return this.queues.get(endpoint)?.pending ?? 0
90
+ }
91
+ }
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Exponential Backoff on 429
97
+
98
+ ```typescript
99
+ export async function withBackoff<T>(
100
+ fn: () => Promise<T>,
101
+ maxRetries = 3,
102
+ baseDelay = 1000
103
+ ): Promise<T> {
104
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
105
+ try {
106
+ return await fn()
107
+ } catch (error: any) {
108
+ const isRateLimit = error?.status === 429 || error?.error_code === 429
109
+ if (!isRateLimit || attempt === maxRetries) throw error
110
+ const delay = baseDelay * Math.pow(2, attempt) + Math.random() * 1000
111
+ console.warn(`[zalo-rate-guard] Rate limited. Retry ${attempt + 1}/${maxRetries} in ${Math.round(delay)}ms`)
112
+ await new Promise(r => setTimeout(r, delay))
113
+ }
114
+ }
115
+ throw new Error('Unreachable')
116
+ }
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Quota Monitoring (OA Broadcast)
122
+
123
+ Broadcast quota is a **hard monthly limit** — exceeding it silently drops messages, no error returned.
124
+
125
+ ```typescript
126
+ interface QuotaTracker {
127
+ monthly_limit: number // based on follower count + OA level
128
+ used: number
129
+ resets_at: Date // 1st of each month
130
+ }
131
+
132
+ export function canBroadcast(tracker: QuotaTracker, recipientCount: number): boolean {
133
+ const remaining = tracker.monthly_limit - tracker.used
134
+ if (recipientCount > remaining) {
135
+ console.error(
136
+ `[zalo-rate-guard] Broadcast quota insufficient: need ${recipientCount}, have ${remaining}/${tracker.monthly_limit}`
137
+ )
138
+ return false
139
+ }
140
+ return true
141
+ }
142
+
143
+ export function trackBroadcastUsed(tracker: QuotaTracker, sent: number): QuotaTracker {
144
+ return { ...tracker, used: tracker.used + sent }
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Integration Pattern
151
+
152
+ ```typescript
153
+ // Singleton — shared across the app
154
+ export const limiter = new ZaloRateLimiter()
155
+
156
+ // Track A: OA message send with rate limiting
157
+ export async function sendOaMessage(userId: string, text: string) {
158
+ return limiter.execute('oa:send_message', () =>
159
+ withBackoff(() =>
160
+ oaApiCall('/message/cs', {
161
+ recipient: { user_id: userId },
162
+ message: { text },
163
+ })
164
+ )
165
+ )
166
+ }
167
+
168
+ // Track B: Personal DM with rate limiting + human jitter
169
+ export async function sendPersonalMessage(threadId: string, text: string) {
170
+ const jitter = 500 + Math.random() * 1500 // 500–2000ms
171
+ await new Promise(r => setTimeout(r, jitter))
172
+ return limiter.execute('personal:send_dm', () =>
173
+ withBackoff(() => api.sendMessage(text, threadId, 'User'))
174
+ )
175
+ }
176
+
177
+ // Track B: Friend operation — highest-risk, extra jitter
178
+ export async function addFriend(userId: string) {
179
+ const jitter = 2000 + Math.random() * 3000 // 2–5s
180
+ await new Promise(r => setTimeout(r, jitter))
181
+ return limiter.execute('personal:friend', () =>
182
+ withBackoff(() => api.sendFriendRequest(userId), 2, 5000)
183
+ )
184
+ }
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Anti-Ban Strategies
190
+
191
+ **Track A (OA):**
192
+ 1. Stay under safe RPM limits (table above)
193
+ 2. Exponential backoff on ALL 429 responses — never retry immediately
194
+ 3. Cache user profiles — avoid repeated lookups for the same user
195
+ 4. Spread broadcasts over time — don't burst the entire follower list at once
196
+ 5. Monitor quota before each broadcast batch — stop before hitting monthly limit
197
+ 6. Use `appsecret_proof` on all requests — proves you're the legitimate app owner
198
+
199
+ **Track B (Personal):**
200
+ 1. Much lower limits than OA — personal accounts are watched more closely
201
+ 2. Add human-like jitter: 500–2000ms random delay between messages (not optional)
202
+ 3. Avoid 3–6 AM (VN timezone) — traffic at those hours flags automated activity
203
+ 4. Never change profile info programmatically — triggers manual review
204
+ 5. Friend operations are highest-risk — max 10 RPM, prefer lower in practice
205
+ 6. Keep sessions long-lived — repeated login/logout is a strong ban signal
206
+ 7. Use a consistent device fingerprint (`userAgent` + `IMEI`) per account
207
+ 8. On `DuplicateConnection` (error 3000): wait 30s before reconnecting, never spam reconnects
208
+
209
+ ---
210
+
211
+ ## Sharp Edges
212
+
213
+ - Rate limits are **estimated** — Zalo does not publish official numbers; treat all figures as conservative targets
214
+ - `p-queue` `intervalCap` applies per window, not per request — test behavior under burst
215
+ - 429 without backoff = accelerating toward ban, not slowing down
216
+ - Broadcast quota overflow **silently drops messages** — no 429, no error, just lost sends
217
+ - Stale cached profile data is acceptable; hitting rate limits for fresh data is not
218
+ - Personal account friend operations are the single highest-risk action — handle with care
219
+ - Human jitter for personal track is a survival strategy, not a nice-to-have
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rune-kit/rune",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "58-skill mesh for AI coding assistants — 5-layer architecture, 200+ connections, 8 platforms (Claude Code, Cursor, Windsurf, Antigravity, Codex, OpenCode, OpenClaw, Generic)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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.
@@ -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.
@@ -513,6 +572,26 @@ TIMEOUT_SIGNAL: If context-watch reports ORANGE, wrap up current phase and ch
513
572
 
514
573
  If any exit condition triggers without resolution → cook emits `BLOCKED` status with details and stops. Never spin indefinitely.
515
574
 
575
+ ### Subagent Status Protocol
576
+
577
+ 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.
578
+
579
+ | Status | Meaning | Cook Action |
580
+ |--------|---------|-------------|
581
+ | `DONE` | Task complete, no issues | Proceed to next phase |
582
+ | `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 |
583
+ | `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. |
584
+ | `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 |
585
+
586
+ **DONE_WITH_CONCERNS logging format** (append to `.rune/progress.md`):
587
+ ```
588
+ [CONCERN][phase][timestamp] <sub-skill>: <concern description>
589
+ ```
590
+
591
+ **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).
592
+
593
+ **BLOCKED format**: Include the phase, the sub-skill that emitted BLOCKED, the specific blocker, and what was already attempted.
594
+
516
595
  ## Error Recovery
517
596
 
518
597
  | Phase | If this fails... | Do this... |
@@ -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
 
@@ -3,7 +3,7 @@ name: review
3
3
  description: Code quality review — patterns, security, performance, correctness. Finds bugs, suggests improvements, triggers fix for issues found. Escalates to opus for security-critical code.
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: development
@@ -70,14 +70,17 @@ Determine what to review.
70
70
  - If context is unclear: use `rune:scout` to identify all files touched by the change
71
71
  - List every file in scope before proceeding — do not review files outside the stated scope
72
72
 
73
- ### Step 2: Logic Check
73
+ ### Step 2: Logic Check (Production-Critical Focus)
74
74
 
75
- Read each changed file and check for correctness.
75
+ Read each changed file. Prioritize bugs that **pass CI but break production** — these are the highest-value findings because linters and type checkers already catch the rest.
76
76
 
77
77
  - Use `Read` on every file in scope
78
+ - **Race conditions**: async operations without proper sequencing, shared mutable state, missing locks
79
+ - **State corruption**: mutations that affect other consumers, cache invalidation gaps, stale closures
80
+ - **Silent failures**: caught errors that swallow context, empty catch blocks, promises without rejection handling
81
+ - **Data loss paths**: write operations without confirmation, delete without soft-delete, truncation without backup
82
+ - **Edge cases**: empty input, null/undefined, zero, negative numbers, empty arrays, Unicode, timezone boundaries
78
83
  - Check for: logic errors, off-by-one errors, incorrect conditionals, broken async/await patterns
79
- - Check for: missing error handling, uncaught promise rejections, silent failures
80
- - Check for: edge cases — empty input, null/undefined, zero, negative numbers, empty arrays
81
84
  - Flag each finding with file path, line number, and severity
82
85
 
83
86
  **Common patterns to flag:**
@@ -163,6 +166,39 @@ Identify gaps in test coverage.
163
166
  - If untested code found: call `rune:test` with specific instructions on what to test
164
167
  - Flag as HIGH if business logic is untested, MEDIUM if utility code is untested
165
168
 
169
+ ### Step 5.5: Two-Stage Review Gate
170
+
171
+ Separate spec compliance from code quality. Most reviews conflate both — this gate forces the distinction.
172
+
173
+ **Stage 1 — Spec Compliance (check FIRST)**
174
+
175
+ Before evaluating code quality, verify the implementation matches what was asked:
176
+
177
+ - Load the originating plan, task, ticket, or `requirements.md` if available
178
+ - Does the implementation cover every acceptance criterion? Check each one explicitly
179
+ - Is there **under-engineering** — requirements stated but not implemented?
180
+ - Is there **over-engineering** — abstractions, generalization, or features beyond scope?
181
+ - Does the file/function structure match what the plan specified?
182
+
183
+ Flag spec deviations as HIGH — clean code that misses requirements ships broken products.
184
+
185
+ ```
186
+ # Spec Compliance Checklist
187
+ [ ] All acceptance criteria from plan/ticket covered
188
+ [ ] No stated requirements missing from implementation
189
+ [ ] No unrequested features added (scope creep)
190
+ [ ] API surface matches what was specified (signatures, endpoints, return types)
191
+ [ ] File structure matches plan (no renamed or relocated files without justification)
192
+ ```
193
+
194
+ If spec violations found: document them separately from code quality findings in the report. Label as `SPEC-MISS` or `SPEC-CREEP`.
195
+
196
+ **Stage 2 — Code Quality**
197
+
198
+ Proceed to Step 6 only after Stage 1 passes. Code quality findings (bugs, patterns, security, coverage) are the existing Steps 2–5 above.
199
+
200
+ The review report MUST show both stages: spec compliance verdict first, then code quality findings.
201
+
166
202
  ### Step 6: Report
167
203
 
168
204
  Produce a structured severity-ranked report.
@@ -340,6 +376,7 @@ LOW — style inconsistency, naming suggestion, minor refactor opportunity
340
376
  | Expanding review scope beyond the diff | MEDIUM | Limit to `git diff` scope — do not creep into adjacent unchanged files |
341
377
  | Security finding without sentinel escalation | HIGH | Any auth/crypto/payment code touched → MUST call rune:sentinel |
342
378
  | Skipping UI anti-pattern checks for frontend changes | MEDIUM | Any .tsx/.jsx/.svelte/.vue in diff → MUST run UI/UX Anti-Pattern Checks section |
379
+ | Skipping spec compliance check (Step 5.5 Stage 1) | HIGH | Code quality without spec check ships clean code that does the wrong thing — always load the plan/ticket before reviewing quality |
343
380
  | Treating purple/indigo accent as "just a color choice" | MEDIUM | It is a documented AI-generated UI signature — always flag for domain justification |
344
381
 
345
382
  ## Done When
@@ -3,7 +3,7 @@ name: review-intake
3
3
  description: Use when receiving code review feedback, PR comments, or external suggestions before implementing any changes. Prevents blind implementation, enforces verification-first discipline.
4
4
  metadata:
5
5
  author: runedev
6
- version: "1.0.0"
6
+ version: "1.1.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -112,9 +112,25 @@ UNCLEAR: "Need clarification on [specific aspect]."
112
112
  BANNED: "You're absolutely right!"
113
113
  BANNED: "Great point!" / "Great catch!"
114
114
  BANNED: "Thanks for catching that!"
115
+ BANNED: "I agree with your suggestion"
116
+ BANNED: "That's a good idea"
117
+ BANNED: "I see what you mean"
118
+ BANNED: Any sentence that adds no technical information
115
119
  BANNED: Any performative gratitude — actions speak, not words.
116
120
  ```
117
121
 
122
+ <HARD-GATE>
123
+ Every response to a review item MUST start with an ACTION VERB:
124
+ - "Fixed — [description]"
125
+ - "Reverted — [reason]"
126
+ - "Deferred — [reason + ticket]"
127
+ - "Pushed back — [technical evidence]"
128
+ - "Clarifying — [question]"
129
+
130
+ Responses starting with praise, agreement, or social pleasantries are BLOCKED.
131
+ This is a professional code review, not a conversation — signal with actions, not words.
132
+ </HARD-GATE>
133
+
118
134
  When replying to GitHub PR comments, reply in the thread:
119
135
  ```bash
120
136
  gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies \