@rune-kit/rune 2.1.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 (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +357 -0
  3. package/agents/.gitkeep +0 -0
  4. package/agents/architect.md +29 -0
  5. package/agents/asset-creator.md +11 -0
  6. package/agents/audit.md +11 -0
  7. package/agents/autopsy.md +11 -0
  8. package/agents/brainstorm.md +11 -0
  9. package/agents/browser-pilot.md +11 -0
  10. package/agents/coder.md +29 -0
  11. package/agents/completion-gate.md +11 -0
  12. package/agents/constraint-check.md +11 -0
  13. package/agents/context-engine.md +11 -0
  14. package/agents/cook.md +11 -0
  15. package/agents/db.md +11 -0
  16. package/agents/debug.md +11 -0
  17. package/agents/dependency-doctor.md +11 -0
  18. package/agents/deploy.md +11 -0
  19. package/agents/design.md +11 -0
  20. package/agents/docs-seeker.md +11 -0
  21. package/agents/fix.md +11 -0
  22. package/agents/hallucination-guard.md +11 -0
  23. package/agents/incident.md +11 -0
  24. package/agents/integrity-check.md +11 -0
  25. package/agents/journal.md +11 -0
  26. package/agents/launch.md +11 -0
  27. package/agents/logic-guardian.md +11 -0
  28. package/agents/marketing.md +11 -0
  29. package/agents/onboard.md +11 -0
  30. package/agents/perf.md +11 -0
  31. package/agents/plan.md +11 -0
  32. package/agents/preflight.md +11 -0
  33. package/agents/problem-solver.md +11 -0
  34. package/agents/rescue.md +11 -0
  35. package/agents/research.md +11 -0
  36. package/agents/researcher.md +29 -0
  37. package/agents/review-intake.md +11 -0
  38. package/agents/review.md +11 -0
  39. package/agents/reviewer.md +28 -0
  40. package/agents/safeguard.md +11 -0
  41. package/agents/sast.md +11 -0
  42. package/agents/scanner.md +28 -0
  43. package/agents/scope-guard.md +11 -0
  44. package/agents/scout.md +11 -0
  45. package/agents/sentinel.md +11 -0
  46. package/agents/sequential-thinking.md +11 -0
  47. package/agents/session-bridge.md +11 -0
  48. package/agents/skill-forge.md +11 -0
  49. package/agents/skill-router.md +11 -0
  50. package/agents/surgeon.md +11 -0
  51. package/agents/team.md +11 -0
  52. package/agents/test.md +11 -0
  53. package/agents/trend-scout.md +11 -0
  54. package/agents/verification.md +11 -0
  55. package/agents/video-creator.md +11 -0
  56. package/agents/watchdog.md +11 -0
  57. package/agents/worktree.md +11 -0
  58. package/commands/.gitkeep +0 -0
  59. package/commands/rune.md +168 -0
  60. package/compiler/__tests__/openclaw-adapter.test.js +140 -0
  61. package/compiler/__tests__/parser.test.js +55 -0
  62. package/compiler/adapters/antigravity.js +59 -0
  63. package/compiler/adapters/claude.js +37 -0
  64. package/compiler/adapters/cursor.js +67 -0
  65. package/compiler/adapters/generic.js +60 -0
  66. package/compiler/adapters/index.js +45 -0
  67. package/compiler/adapters/openclaw.js +150 -0
  68. package/compiler/adapters/windsurf.js +60 -0
  69. package/compiler/bin/rune.js +288 -0
  70. package/compiler/doctor.js +153 -0
  71. package/compiler/emitter.js +240 -0
  72. package/compiler/parser.js +208 -0
  73. package/compiler/transformer.js +69 -0
  74. package/compiler/transforms/branding.js +27 -0
  75. package/compiler/transforms/cross-references.js +29 -0
  76. package/compiler/transforms/frontmatter.js +38 -0
  77. package/compiler/transforms/hooks.js +68 -0
  78. package/compiler/transforms/subagents.js +36 -0
  79. package/compiler/transforms/tool-names.js +60 -0
  80. package/contexts/dev.md +34 -0
  81. package/contexts/research.md +43 -0
  82. package/contexts/review.md +55 -0
  83. package/extensions/ai-ml/PACK.md +517 -0
  84. package/extensions/analytics/PACK.md +557 -0
  85. package/extensions/backend/PACK.md +678 -0
  86. package/extensions/chrome-ext/PACK.md +995 -0
  87. package/extensions/content/PACK.md +381 -0
  88. package/extensions/devops/PACK.md +520 -0
  89. package/extensions/ecommerce/PACK.md +280 -0
  90. package/extensions/gamedev/PACK.md +393 -0
  91. package/extensions/mobile/PACK.md +273 -0
  92. package/extensions/saas/PACK.md +805 -0
  93. package/extensions/security/PACK.md +536 -0
  94. package/extensions/trading/PACK.md +597 -0
  95. package/extensions/ui/PACK.md +947 -0
  96. package/package.json +47 -0
  97. package/skills/.gitkeep +0 -0
  98. package/skills/adversary/SKILL.md +271 -0
  99. package/skills/asset-creator/SKILL.md +157 -0
  100. package/skills/audit/SKILL.md +466 -0
  101. package/skills/autopsy/SKILL.md +200 -0
  102. package/skills/ba/SKILL.md +279 -0
  103. package/skills/brainstorm/SKILL.md +266 -0
  104. package/skills/browser-pilot/SKILL.md +168 -0
  105. package/skills/completion-gate/SKILL.md +151 -0
  106. package/skills/constraint-check/SKILL.md +165 -0
  107. package/skills/context-engine/SKILL.md +176 -0
  108. package/skills/cook/SKILL.md +636 -0
  109. package/skills/db/SKILL.md +256 -0
  110. package/skills/debug/SKILL.md +240 -0
  111. package/skills/dependency-doctor/SKILL.md +235 -0
  112. package/skills/deploy/SKILL.md +174 -0
  113. package/skills/design/DESIGN-REFERENCE.md +365 -0
  114. package/skills/design/SKILL.md +462 -0
  115. package/skills/doc-processor/SKILL.md +254 -0
  116. package/skills/docs/SKILL.md +336 -0
  117. package/skills/docs-seeker/SKILL.md +166 -0
  118. package/skills/fix/SKILL.md +192 -0
  119. package/skills/git/SKILL.md +285 -0
  120. package/skills/hallucination-guard/SKILL.md +204 -0
  121. package/skills/incident/SKILL.md +241 -0
  122. package/skills/integrity-check/SKILL.md +169 -0
  123. package/skills/journal/SKILL.md +190 -0
  124. package/skills/launch/SKILL.md +330 -0
  125. package/skills/logic-guardian/SKILL.md +240 -0
  126. package/skills/marketing/SKILL.md +229 -0
  127. package/skills/mcp-builder/SKILL.md +311 -0
  128. package/skills/onboard/SKILL.md +298 -0
  129. package/skills/perf/SKILL.md +297 -0
  130. package/skills/plan/SKILL.md +520 -0
  131. package/skills/preflight/SKILL.md +231 -0
  132. package/skills/problem-solver/SKILL.md +284 -0
  133. package/skills/rescue/SKILL.md +434 -0
  134. package/skills/research/SKILL.md +122 -0
  135. package/skills/review/SKILL.md +354 -0
  136. package/skills/review-intake/SKILL.md +222 -0
  137. package/skills/safeguard/SKILL.md +188 -0
  138. package/skills/sast/SKILL.md +190 -0
  139. package/skills/scaffold/SKILL.md +276 -0
  140. package/skills/scope-guard/SKILL.md +150 -0
  141. package/skills/scout/SKILL.md +232 -0
  142. package/skills/sentinel/SKILL.md +320 -0
  143. package/skills/sentinel-env/SKILL.md +226 -0
  144. package/skills/sequential-thinking/SKILL.md +234 -0
  145. package/skills/session-bridge/SKILL.md +287 -0
  146. package/skills/skill-forge/SKILL.md +317 -0
  147. package/skills/skill-router/SKILL.md +267 -0
  148. package/skills/surgeon/SKILL.md +203 -0
  149. package/skills/team/SKILL.md +397 -0
  150. package/skills/test/SKILL.md +271 -0
  151. package/skills/trend-scout/SKILL.md +145 -0
  152. package/skills/verification/SKILL.md +201 -0
  153. package/skills/video-creator/SKILL.md +201 -0
  154. package/skills/watchdog/SKILL.md +166 -0
  155. package/skills/worktree/SKILL.md +140 -0
@@ -0,0 +1,317 @@
1
+ ---
2
+ name: skill-forge
3
+ description: Use when creating new Rune skills, editing existing skills, or verifying skill quality before deployment. Applies TDD discipline to skill authoring — test before write, verify before ship.
4
+ metadata:
5
+ author: runedev
6
+ version: "1.0.0"
7
+ layer: L2
8
+ model: opus
9
+ group: creation
10
+ tools: "Read, Write, Edit, Bash, Glob, Grep"
11
+ ---
12
+
13
+ # skill-forge
14
+
15
+ ## Purpose
16
+
17
+ The skill that builds skills. Applies Test-Driven Development to skill authoring: write a pressure test first, watch agents fail without the skill, write the skill to fix those failures, then close loopholes until bulletproof. Ensures every Rune skill is battle-tested before it enters the mesh.
18
+
19
+ ## Triggers
20
+
21
+ - `/rune skill-forge` — manual invocation to create or edit a skill
22
+ - Auto-trigger: when user says "create a skill", "new skill", "add skill to rune"
23
+ - Auto-trigger: when editing any `skills/*/SKILL.md` file
24
+
25
+ ## Calls (outbound)
26
+
27
+ - `scout` (L3): scan existing skills for patterns and naming conventions
28
+ - `plan` (L2): structure complex skills with multiple phases
29
+ - `hallucination-guard` (L3): verify referenced skills/tools actually exist
30
+ - `verification` (L3): validate SKILL.md format compliance
31
+ - `journal` (L3): record skill creation decisions in ADR
32
+
33
+ ## Called By (inbound)
34
+
35
+ - `cook` (L1): when the feature being built IS a new skill
36
+
37
+ ## Workflow
38
+
39
+ ### Phase 1 — DISCOVER
40
+
41
+ Before writing anything, understand the landscape:
42
+
43
+ 1. **Scan existing skills** via `scout` — is this already covered?
44
+ 2. **Check for overlap** — will this duplicate or conflict with existing skills?
45
+ 3. **Identify layer** — L1 (orchestrator), L2 (workflow hub), L3 (utility)?
46
+ 4. **Identify mesh connections** — what calls this? What does this call?
47
+
48
+ <HARD-GATE>
49
+ If a skill with >70% overlap already exists → extend it, don't create new.
50
+ The mesh grows stronger by deepening connections, not by adding nodes.
51
+ </HARD-GATE>
52
+
53
+ ### Phase 2 — RED (Baseline Test)
54
+
55
+ **Write the test BEFORE writing the skill.**
56
+
57
+ Create a pressure scenario that exposes the problem the skill solves:
58
+
59
+ ```markdown
60
+ ## Pressure Scenario: [skill-name]
61
+
62
+ ### Setup
63
+ [Describe the situation an agent faces]
64
+
65
+ ### Pressures (combine 2-3)
66
+ - Time pressure: "This is urgent, just do it"
67
+ - Sunk cost: "I already wrote 200 lines, can't restart"
68
+ - Complexity: "Too many moving parts to follow process"
69
+ - Authority: "Senior dev says skip testing"
70
+ - Exhaustion: "We're 50 tool calls deep"
71
+
72
+ ### Expected Failure (without skill)
73
+ [What the agent will probably do wrong]
74
+
75
+ ### Success Criteria (with skill)
76
+ [What the agent should do instead]
77
+ ```
78
+
79
+ Run the scenario with a subagent WITHOUT the skill. Document:
80
+ - **Exact behavior** — what did the agent do?
81
+ - **Rationalizations** — verbatim excuses for skipping discipline
82
+ - **Failure point** — where exactly did it go wrong?
83
+
84
+ <HARD-GATE>
85
+ You MUST observe at least one failure before writing the skill.
86
+ No failure observed = you don't understand the problem well enough to write the solution.
87
+ </HARD-GATE>
88
+
89
+ ### Phase 3 — GREEN (Write Minimal Skill)
90
+
91
+ Write the SKILL.md addressing ONLY the failures observed in Phase 2.
92
+
93
+ Follow `docs/SKILL-TEMPLATE.md` format. Required sections:
94
+
95
+ | Section | Required | Purpose |
96
+ |---|---|---|
97
+ | Frontmatter | YES | Name, description, metadata |
98
+ | Purpose | YES | One paragraph, ecosystem role |
99
+ | Triggers | YES | When to invoke |
100
+ | Calls / Called By | YES | Mesh connections |
101
+ | Workflow | YES | Step-by-step execution |
102
+ | Output Format | YES | Structured, parseable output |
103
+ | Constraints | YES | 3-7 MUST/MUST NOT rules |
104
+ | Sharp Edges | YES | Known failure modes |
105
+ | Done When | YES | Verifiable completion criteria |
106
+ | Cost Profile | YES | Token estimate |
107
+ | Mesh Gates | L1/L2 only | Progression guards |
108
+
109
+ #### Frontmatter Rules
110
+
111
+ ```yaml
112
+ ---
113
+ name: kebab-case-max-64-chars # letters, numbers, hyphens only
114
+ description: Use when [specific triggers]. [Symptoms that signal this skill applies].
115
+ metadata:
116
+ layer: L1|L2|L3
117
+ model: haiku|sonnet|opus # haiku=scan, sonnet=code, opus=architecture
118
+ group: [see template]
119
+ ---
120
+ ```
121
+
122
+ **Description rules:**
123
+ - MUST start with "Use when..."
124
+ - MUST describe triggering conditions, NOT workflow
125
+ - MUST be third person
126
+ - MUST NOT summarize what the skill does internally
127
+
128
+ ```yaml
129
+ # BAD: Summarizes workflow — agent reads description, skips full content
130
+ description: TDD workflow that writes tests first, then code, then refactors
131
+
132
+ # GOOD: Only triggers — agent must read full content to know workflow
133
+ description: Use when implementing any feature or bugfix, before writing code
134
+ ```
135
+
136
+ **Why this matters:** When description summarizes the workflow, agents take the shortcut — they follow the description and skip the full SKILL.md. Tested and confirmed.
137
+
138
+ #### Writing Constraints
139
+
140
+ Every constraint MUST block a specific failure mode observed in Phase 2:
141
+
142
+ ```markdown
143
+ # BAD: Generic rule
144
+ 1. MUST write good code
145
+
146
+ # GOOD: Blocks specific failure with consequence
147
+ 1. MUST run tests after each fix — batch-and-pray causes cascading regressions
148
+ ```
149
+
150
+ #### Anti-Rationalization Table
151
+
152
+ Capture every excuse from Phase 2 baseline testing:
153
+
154
+ ```markdown
155
+ | Excuse | Reality |
156
+ |--------|---------|
157
+ | "[verbatim excuse from test]" | [why it's wrong + what to do instead] |
158
+ ```
159
+
160
+ ### Phase 4 — VERIFY (Green Check)
161
+
162
+ Run the SAME pressure scenario from Phase 2, now WITH the skill loaded.
163
+
164
+ Check:
165
+ - Does the agent follow the skill's workflow?
166
+ - Are all constraints respected under pressure?
167
+ - Does the output match the defined format?
168
+
169
+ <HARD-GATE>
170
+ If agent still fails with skill loaded → skill is insufficient.
171
+ Go back to Phase 3, strengthen the weak section. Do NOT ship.
172
+ </HARD-GATE>
173
+
174
+ ### Phase 5 — REFACTOR (Close Loopholes)
175
+
176
+ Run additional pressure scenarios with varied pressures. For each new failure:
177
+
178
+ 1. Identify the rationalization
179
+ 2. Add it to the anti-rationalization table
180
+ 3. Add explicit constraint or sharp edge
181
+ 4. Re-run verification
182
+
183
+ Repeat until no new failures emerge in 2 consecutive test runs.
184
+
185
+ ### Phase 6 — INTEGRATE
186
+
187
+ Wire the skill into the mesh:
188
+
189
+ 1. **Update `docs/ARCHITECTURE.md`** — add to correct layer/group table
190
+ 2. **Update `CLAUDE.md`** — increment skill count, add to layer list
191
+ 3. **Add mesh connections** — update SKILL.md of skills that should call/be called by this one
192
+ 4. **Verify no conflicts** — new skill's output format compatible with consumers?
193
+
194
+ ### Phase 7 — SHIP
195
+
196
+ ```bash
197
+ git add skills/[skill-name]/SKILL.md
198
+ git add docs/ARCHITECTURE.md CLAUDE.md
199
+ # Add any updated existing skills
200
+ git commit -m "feat: add [skill-name] — [one-line purpose]"
201
+ ```
202
+
203
+ ## Skill Quality Checklist
204
+
205
+ **Format:**
206
+ - [ ] Name is kebab-case, max 64 chars, letters/numbers/hyphens only
207
+ - [ ] Description starts with "Use when...", does NOT summarize workflow
208
+ - [ ] All template sections present
209
+ - [ ] Constraints are specific (not generic "write good code")
210
+ - [ ] Sharp edges have severity + mitigation
211
+
212
+ **Content:**
213
+ - [ ] Baseline test run BEFORE skill was written
214
+ - [ ] At least one observed failure documented
215
+ - [ ] Anti-rationalization table from real test failures
216
+ - [ ] Mesh connections bidirectional (calls AND called-by both updated)
217
+ - [ ] Output format is structured and parseable by other skills
218
+
219
+ **Architecture:**
220
+ - [ ] Layer assignment correct (L1=orchestrate, L2=workflow, L3=utility)
221
+ - [ ] Model assignment correct (haiku=scan, sonnet=code, opus=architect)
222
+ - [ ] No >70% overlap with existing skills
223
+ - [ ] ARCHITECTURE.md updated
224
+ - [ ] CLAUDE.md updated
225
+
226
+ ## Adapting Existing Skills
227
+
228
+ When editing, not creating:
229
+
230
+ <HARD-GATE>
231
+ Same TDD cycle applies to edits.
232
+ 1. Write a test that exposes the gap in the current skill
233
+ 2. Run baseline — confirm the skill fails on this scenario
234
+ 3. Edit the skill to address the gap
235
+ 4. Verify the edit fixes the gap WITHOUT breaking existing behavior
236
+ </HARD-GATE>
237
+
238
+ "Just adding a section" is not an excuse to skip testing.
239
+
240
+ ## Token Efficiency Guidelines
241
+
242
+ Skills are loaded into context when invoked. Every word costs tokens.
243
+
244
+ | Skill Type | Target | Notes |
245
+ |---|---|---|
246
+ | L3 utility (haiku) | <300 words | Runs frequently, keep lean |
247
+ | L2 workflow hub | <500 words | Moderate frequency |
248
+ | L1 orchestrator | <800 words | Runs once per workflow |
249
+ | Reference sections | Extract to separate file | >100 lines → own file |
250
+
251
+ Techniques:
252
+ - Reference `--help` instead of documenting all flags
253
+ - Cross-reference other skills instead of repeating content
254
+ - One excellent example > three mediocre ones
255
+ - Inline code only if <50 lines, otherwise separate file
256
+
257
+ ## Output Format
258
+
259
+ ```
260
+ ## Skill Forge Report
261
+ - **Skill**: [name] (L[layer])
262
+ - **Action**: CREATE | EDIT
263
+ - **Status**: SHIPPED | NEEDS_WORK | BLOCKED
264
+
265
+ ### Baseline Test
266
+ - Scenario: [test scenario description]
267
+ - Result WITHOUT skill: [observed failure]
268
+ - Result WITH skill: [observed success or remaining gap]
269
+
270
+ ### Quality Checklist
271
+ - Format: [pass/fail count]
272
+ - Content: [pass/fail count]
273
+ - Architecture: [pass/fail count]
274
+
275
+ ### Files Created/Modified
276
+ - skills/[name]/SKILL.md — [created | modified]
277
+ - docs/ARCHITECTURE.md — [updated | skipped]
278
+ - CLAUDE.md — [updated | skipped]
279
+
280
+ ### Mesh Impact
281
+ - New connections: [count] ([list of skills])
282
+ - Bidirectional check: PASS | FAIL
283
+ ```
284
+
285
+ ## Constraints
286
+
287
+ 1. MUST run baseline test BEFORE writing skill — no skill without observed failure
288
+ 2. MUST verify skill fixes the observed failures — green check required before ship
289
+ 3. MUST NOT create skill with >70% overlap with existing — extend instead
290
+ 4. MUST follow SKILL-TEMPLATE.md format — all required sections present
291
+ 5. MUST update ARCHITECTURE.md and CLAUDE.md on every new skill
292
+ 6. MUST NOT ship skill that fails its own pressure test
293
+ 7. MUST write description as triggers only — never summarize workflow in description
294
+
295
+ ## Sharp Edges
296
+
297
+ | Failure Mode | Severity | Mitigation |
298
+ |---|---|---|
299
+ | Writing skill without baseline test | CRITICAL | Phase 2 HARD-GATE: must observe failure first |
300
+ | Description summarizes workflow → agents skip content | HIGH | Phase 3 description rules: "Use when..." triggers only |
301
+ | New skill duplicates existing skill | HIGH | Phase 1 HARD-GATE: >70% overlap → extend, don't create |
302
+ | Skill passes test but breaks mesh connections | MEDIUM | Phase 6 integration: verify output compatibility |
303
+ | Editing skill without testing the edit | MEDIUM | Adapting section: same TDD cycle for edits |
304
+ | Overly verbose skill burns context tokens | MEDIUM | Token efficiency guidelines: layer-based word targets |
305
+
306
+ ## Done When
307
+
308
+ - Baseline test documented with observed failures
309
+ - SKILL.md follows template format completely
310
+ - Skill passes pressure test (agent complies with skill loaded)
311
+ - No new failures in 2 consecutive varied-pressure test runs
312
+ - Mesh connections wired (ARCHITECTURE.md, CLAUDE.md, related skills)
313
+ - Git committed with conventional commit message
314
+
315
+ ## Cost Profile
316
+
317
+ ~3000-8000 tokens per skill creation (opus for Phase 2-5 reasoning, haiku for scout/verification). Most cost is in the iterative test-refine loop (Phase 4-5). Budget 2-4 test iterations per skill.
@@ -0,0 +1,267 @@
1
+ ---
2
+ name: skill-router
3
+ description: "Meta-enforcement layer that routes EVERY agent action through the correct skill. MUST check this routing table before ANY response involving code, files, or technical decisions. Default: route to rune:cook for code tasks. Prevents rationalization, enforces check-before-act discipline."
4
+ user-invocable: false
5
+ metadata:
6
+ author: runedev
7
+ version: "1.1.0"
8
+ layer: L0
9
+ model: haiku
10
+ group: orchestrator
11
+ tools: "Read, Glob, Grep"
12
+ ---
13
+
14
+ ## Live Routing Context
15
+
16
+ Routing overrides (if available): !`cat .rune/metrics/routing-overrides.json 2>/dev/null || echo "No adaptive routing rules active."`
17
+
18
+ Recent skill usage: !`cat .rune/metrics/skills.json 2>/dev/null | head -20 || echo "No metrics collected yet."`
19
+
20
+ # skill-router
21
+
22
+ ## Purpose
23
+
24
+ The missing enforcement layer for Rune. While individual skills have HARD-GATEs and constraints, nothing forces the agent to *check* for the right skill before acting. `skill-router` fixes this by intercepting every user request and routing it through the correct skill(s) before any code is written, any file is read, or any clarifying question is asked.
25
+
26
+ This is L0 — it sits above L1 orchestrators. It doesn't do work itself; it ensures the right skill does the work.
27
+
28
+ ## Triggers
29
+
30
+ - **ALWAYS** — This skill is conceptually active on every user message
31
+ - Loaded via system prompt or plugin description, not invoked manually
32
+ - The agent MUST internalize this routing table and apply it before every response
33
+
34
+ ## Calls (outbound connections)
35
+
36
+ - Any skill (L1-L3): routes to the correct skill based on intent detection
37
+
38
+ ## Called By (inbound connections)
39
+
40
+ - None — this is the entry point. Nothing calls skill-router; it IS the first check.
41
+
42
+ ## Workflow
43
+
44
+ ### Step 0 — Check Routing Overrides (H3 Adaptive Routing)
45
+
46
+ Before standard routing, check if adaptive routing rules exist:
47
+
48
+ 1. Use `Read` on `.rune/metrics/routing-overrides.json`
49
+ 2. If the file exists and has active rules, scan each rule's `condition` against the current user intent
50
+ 3. If a rule matches:
51
+ - Apply the override action (e.g., "route to problem-solver before debug")
52
+ - Log: "Adaptive routing: applying rule [id] — [action]"
53
+ 4. If no file exists or no rules match, proceed to standard routing (Step 1)
54
+
55
+ **Override constraints**:
56
+ - Overrides MUST NOT bypass layer discipline (L3 cannot call L1)
57
+ - Overrides MUST NOT skip quality gates (sentinel, preflight, verification)
58
+ - Overrides MUST NOT route to non-existent skills
59
+ - If an override seems wrong, announce it and let user decide to keep or disable
60
+
61
+ **Model hint support** (Adaptive Model Re-balancing):
62
+ - Override entries may include `"model_hint": "opus"` — this signals that a skill previously failed at sonnet-level and needed opus reasoning depth
63
+ - When a model_hint is present, announce: "Adaptive routing: this skill previously required opus-level reasoning for [context]. Escalating model."
64
+ - Model hints are written by cook Phase 8 when debug-fix loops hit max retries on the same error pattern
65
+ - Model hints do NOT override explicit user model preferences
66
+
67
+ ### Step 0.5 — STOP before responding
68
+
69
+ Before generating ANY response (including clarifying questions), the agent MUST:
70
+
71
+ 1. **Classify the user's intent** using the routing table below
72
+ 2. **Identify which skill(s) match** — if even 1% chance a skill applies, invoke it
73
+ 3. **Invoke the skill** via the Skill tool
74
+ 4. **Follow the skill's instructions** — the skill dictates the workflow, not the agent
75
+
76
+ ### Step 1 — Intent Classification (Progressive Disclosure)
77
+
78
+ Skills are organized into 3 tiers for discoverability. **Tier 1 skills handle 90% of user requests.**
79
+
80
+ #### Tier 1 — Primary Entry Points (User-Facing)
81
+
82
+ These 5 skills are the main interface. Most user intents route here first:
83
+
84
+ | User Intent | Route To | When |
85
+ |---|---|---|
86
+ | Build / implement / add feature / fix bug | `rune:cook` | Any code change request |
87
+ | Large multi-part task / parallel work | `rune:team` | 5+ files or 3+ modules |
88
+ | Deploy + launch + marketing | `rune:launch` | Ship to production |
89
+ | Legacy code / rescue / modernize | `rune:rescue` | Old/messy codebase |
90
+ | Check project health / full audit | `rune:audit` | Quality assessment |
91
+ | New project / bootstrap / scaffold | `rune:scaffold` | Greenfield project creation |
92
+
93
+ **Default route**: If unclear, route to `rune:cook`. Cook handles 70% of all requests.
94
+
95
+ #### Tier 2 — Power User Skills (Direct Invocation)
96
+
97
+ For users who know exactly what they want:
98
+
99
+ | User Intent | Route To | Priority |
100
+ |---|---|---|
101
+ | Plan / design / architect | `rune:plan` | L2 — requires opus |
102
+ | Brainstorm / explore ideas | `rune:brainstorm` | L2 — before plan |
103
+ | Review code / check quality | `rune:review` | L2 |
104
+ | Write tests | `rune:test` | L2 — TDD |
105
+ | Refactor | `rune:surgeon` | L2 — incremental |
106
+ | Deploy (without marketing) | `rune:deploy` | L2 |
107
+ | Security concern | `rune:sentinel` | L2 — opus for critical |
108
+ | Performance issue | `rune:perf` | L2 |
109
+ | Database change | `rune:db` | L2 |
110
+ | Received code review / PR feedback | `rune:review-intake` | L2 |
111
+ | Protect / audit / document business logic | `rune:logic-guardian` | L2 |
112
+ | Create / edit a Rune skill | `rune:skill-forge` | L2 — requires opus |
113
+ | Incident / outage | `rune:incident` | L2 |
114
+ | UI/UX design | `rune:design` | L2 |
115
+ | Fix bug / debug only (no fix) | `rune:debug` → `rune:fix` | L2 chain |
116
+ | Marketing assets only | `rune:marketing` | L2 |
117
+ | Gather requirements / BA / elicit needs | `rune:ba` | L2 — requires opus |
118
+ | Generate / update docs | `rune:docs` | L2 |
119
+ | Build MCP server | `rune:mcp-builder` | L2 |
120
+ | Red-team / challenge a plan / stress-test | `rune:adversary` | L2 — requires opus |
121
+
122
+ #### Tier 3 — Internal Skills (Called by Other Skills)
123
+
124
+ These are rarely invoked directly — they're called by Tier 1/2 skills:
125
+
126
+ | Skill | Called By | Purpose |
127
+ |---|---|---|
128
+ | `rune:scout` | cook, plan, team | Codebase scanning |
129
+ | `rune:fix` | debug, cook | Apply code changes |
130
+ | `rune:preflight` | cook | Quality gate |
131
+ | `rune:verification` | cook, fix | Run lint/test/build |
132
+ | `rune:hallucination-guard` | cook, fix | Verify imports |
133
+ | `rune:completion-gate` | cook | Validate claims |
134
+ | `rune:sentinel-env` | cook, scaffold, onboard | Environment pre-flight |
135
+ | `rune:research` / `rune:docs-seeker` | any | Look up docs |
136
+ | `rune:session-bridge` | cook, team | Save context |
137
+ | `rune:git` | cook, scaffold, team, launch | Semantic commits, PRs, branches |
138
+ | `rune:doc-processor` | docs, marketing | PDF/DOCX/XLSX/PPTX generation |
139
+ | "Done" / "ship it" / "xong" | — | `rune:verification` → commit |
140
+
141
+ #### Tier 4 — Domain Extension Packs (L4)
142
+
143
+ When user intent matches a domain-specific pattern or user explicitly invokes an L4 trigger command, route to the L4 pack. The agent reads the pack's PACK.md and follows the matching skill's workflow.
144
+
145
+ | User Intent / Domain Signal | Route To | Pack File |
146
+ |---|---|---|
147
+ | Frontend UI, design system, a11y, animation | `@rune/ui` | `extensions/ui/PACK.md` |
148
+ | API design, auth, middleware, rate limiting | `@rune/backend` | `extensions/backend/PACK.md` |
149
+ | Docker, CI/CD, monitoring, server setup | `@rune/devops` | `extensions/devops/PACK.md` |
150
+ | React Native, Flutter, mobile app, app store | `@rune/mobile` | `extensions/mobile/PACK.md` |
151
+ | OWASP, pentest, secrets, compliance | `@rune/security` | `extensions/security/PACK.md` |
152
+ | Trading, fintech, charts, market data | `@rune/trading` | `extensions/trading/PACK.md` |
153
+ | Multi-tenant, billing, SaaS subscription | `@rune/saas` | `extensions/saas/PACK.md` |
154
+ | Shopify, payments, cart, inventory | `@rune/ecommerce` | `extensions/ecommerce/PACK.md` |
155
+ | LLM, RAG, embeddings, fine-tuning | `@rune/ai-ml` | `extensions/ai-ml/PACK.md` |
156
+ | Three.js, WebGL, game loop, physics | `@rune/gamedev` | `extensions/gamedev/PACK.md` |
157
+ | Blog, CMS, MDX, i18n, SEO | `@rune/content` | `extensions/content/PACK.md` |
158
+ | Analytics, A/B testing, funnels, dashboards | `@rune/analytics` | `extensions/analytics/PACK.md` |
159
+
160
+ **L4 routing rules:**
161
+ 1. If user explicitly invokes an L4 trigger (e.g., `/rune rag-patterns`), read the PACK.md and follow the skill workflow directly
162
+ 2. If the intent also involves implementation, route to `cook` (L1) first — cook will detect L4 context in Phase 1.5
163
+ 3. L4 packs supplement L1/L2 workflows — they are domain knowledge, not standalone orchestrators
164
+ 4. L4 packs can call L3 utilities (scout, verification) but CANNOT call L1 or L2 skills
165
+ 5. If the L4 pack file is not found on disk, skip silently and proceed with standard routing
166
+
167
+ ### Step 2 — Compound Intent Resolution
168
+
169
+ Many requests combine intents. Route to the HIGHEST-PRIORITY skill first:
170
+
171
+ ```
172
+ Priority: L1 > L2 > L3
173
+ Within same layer: process skills > implementation skills
174
+
175
+ Example: "Add auth and deploy it"
176
+ → rune:cook (add auth) FIRST
177
+ → rune:deploy SECOND (after cook completes)
178
+
179
+ Example: "Fix the login bug and add tests"
180
+ → rune:debug (diagnose) FIRST
181
+ → rune:fix (apply fix) SECOND
182
+ → rune:test (add tests) THIRD
183
+
184
+ L4 integration: If cook is the primary route AND a domain pack matches,
185
+ cook handles orchestration while the L4 pack provides domain patterns.
186
+ Both are active — cook for workflow, L4 for domain knowledge.
187
+ ```
188
+
189
+ ### Step 3 — Anti-Rationalization Gate
190
+
191
+ The agent MUST NOT bypass routing with these excuses:
192
+
193
+ | Thought | Reality | Action |
194
+ |---|---|---|
195
+ | "This is too simple for a skill" | Simple tasks still benefit from structure | Route it |
196
+ | "I already know how to do this" | Skills have constraints you'll miss | Route it |
197
+ | "Let me just read the file first" | Skills tell you HOW to read | Route first |
198
+ | "I need more context before routing" | Route first, skill will gather context | Route it |
199
+ | "The user just wants a quick answer" | Quick answers can still be wrong | Check routing table |
200
+ | "No skill matches exactly" | Pick closest match, or use scout + plan | Route it |
201
+ | "I'll apply the skill patterns mentally" | Mental application misses constraints | Actually invoke it |
202
+ | "This is just a follow-up" | Follow-ups can change intent | Re-check routing |
203
+
204
+ ### Step 4 — Execute
205
+
206
+ Once routed:
207
+ 1. Announce: "Using `rune:<skill>` to [purpose]"
208
+ 2. Invoke the skill via Skill tool
209
+ 3. Follow the skill's workflow exactly
210
+ 4. If the skill has a checklist/phases, track via TodoWrite
211
+
212
+ ## Routing Exceptions
213
+
214
+ These DO NOT need skill routing:
215
+ - Pure conversational responses ("hello", "thanks")
216
+ - Answering questions about Rune itself (meta-questions)
217
+ - Single-line factual answers with no code impact
218
+ - Resuming an already-active skill workflow
219
+
220
+ ## Output Format
221
+
222
+ ```
223
+ ## Routing Decision
224
+ - **Intent**: [classified user intent]
225
+ - **Skill**: rune:[skill-name]
226
+ - **Confidence**: HIGH | MEDIUM | LOW
227
+ - **Override**: [routing override applied, if any]
228
+ - **Reason**: [one-line justification for skill selection]
229
+ ```
230
+
231
+ For multi-skill chains:
232
+ ```
233
+ ## Routing Chain
234
+ 1. rune:[skill-1] — [purpose]
235
+ 2. rune:[skill-2] — [purpose]
236
+ 3. rune:[skill-3] — [purpose]
237
+ ```
238
+
239
+ ## Constraints
240
+
241
+ 1. MUST check routing table before EVERY response that involves code, files, or technical decisions
242
+ 2. MUST invoke skill via Skill tool — "mentally applying" a skill is NOT acceptable
243
+ 3. MUST NOT write code without routing through at least one skill first
244
+ 4. MUST NOT skip routing because "it's faster" — speed without correctness wastes more time
245
+ 5. MUST re-route on intent change — if user shifts from "plan" to "implement", switch skills
246
+ 6. MUST announce which skill is being used and why — transparency builds trust
247
+ 7. MUST follow skill's internal workflow, not override it with own judgment
248
+
249
+ ## Sharp Edges
250
+
251
+ | Failure Mode | Severity | Mitigation |
252
+ |---|---|---|
253
+ | Agent writes code without invoking any skill | CRITICAL | Constraint 3: code REQUIRES skill routing. No exceptions. |
254
+ | Agent "mentally applies" skill without invoking | HIGH | Constraint 2: must use Skill tool for full content |
255
+ | Routes to wrong skill, wastes a full workflow | MEDIUM | Step 2 compound resolution + re-route on mismatch |
256
+ | Over-routing trivial tasks (e.g., "what time is it") | LOW | Routing Exceptions section covers non-technical queries |
257
+ | Skill invocation adds latency to simple tasks | LOW | Acceptable trade-off: correctness > speed |
258
+
259
+ ## Done When
260
+
261
+ - This skill is never "done" — it's a persistent routing layer
262
+ - Success = every agent response passes through routing check
263
+ - Failure = any code written without skill invocation
264
+
265
+ ## Cost Profile
266
+
267
+ ~0 tokens (routing logic is internalized from this document). Cost comes from the skills it routes to, not from skill-router itself. The routing table is loaded once and cached in context.