@rune-kit/rune 2.2.6 → 2.3.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 (91) hide show
  1. package/README.md +395 -389
  2. package/compiler/__tests__/tier-override.test.js +158 -0
  3. package/compiler/adapters/antigravity.js +3 -8
  4. package/compiler/adapters/codex.js +3 -8
  5. package/compiler/adapters/cursor.js +3 -8
  6. package/compiler/adapters/generic.js +3 -8
  7. package/compiler/adapters/openclaw.js +4 -9
  8. package/compiler/adapters/opencode.js +3 -8
  9. package/compiler/adapters/windsurf.js +3 -8
  10. package/compiler/bin/rune.js +34 -1
  11. package/compiler/emitter.js +94 -5
  12. package/compiler/transforms/branding.js +10 -3
  13. package/docs/ARCHITECTURE.md +3 -3
  14. package/docs/SKILL-TEMPLATE.md +15 -0
  15. package/docs/VISION.md +3 -3
  16. package/docs/guides/index.html +14 -14
  17. package/docs/index.html +82 -13
  18. package/docs/script.js +33 -6
  19. package/docs/skills/index.html +832 -832
  20. package/docs/style.css +62 -0
  21. package/extensions/ai-ml/PACK.md +7 -0
  22. package/extensions/content/PACK.md +7 -0
  23. package/extensions/mobile/PACK.md +9 -9
  24. package/extensions/zalo/PACK.md +9 -0
  25. package/package.json +8 -6
  26. package/skills/adversary/SKILL.md +12 -0
  27. package/skills/audit/SKILL.md +526 -467
  28. package/skills/autopsy/SKILL.md +12 -0
  29. package/skills/ba/SKILL.md +349 -342
  30. package/skills/brainstorm/SKILL.md +11 -0
  31. package/skills/completion-gate/SKILL.md +260 -249
  32. package/skills/context-engine/SKILL.md +77 -1
  33. package/skills/context-pack/SKILL.md +160 -0
  34. package/skills/cook/SKILL.md +648 -958
  35. package/skills/cook/references/deviation-rules.md +19 -0
  36. package/skills/cook/references/error-recovery.md +37 -0
  37. package/skills/cook/references/exit-conditions.md +31 -0
  38. package/skills/cook/references/loop-detection.md +39 -0
  39. package/skills/cook/references/mid-run-signals.md +31 -0
  40. package/skills/cook/references/output-format.md +40 -0
  41. package/skills/cook/references/pack-detection.md +82 -0
  42. package/skills/cook/references/pause-resume-template.md +38 -0
  43. package/skills/cook/references/rfc-template.md +52 -0
  44. package/skills/cook/references/sharp-edges.md +24 -0
  45. package/skills/cook/references/subagent-status.md +38 -0
  46. package/skills/db/SKILL.md +12 -0
  47. package/skills/debug/SKILL.md +392 -362
  48. package/skills/deploy/SKILL.md +10 -0
  49. package/skills/deploy/references/post-deploy-integration.md +192 -0
  50. package/skills/design/SKILL.md +9 -0
  51. package/skills/docs/SKILL.md +12 -0
  52. package/skills/docs-seeker/SKILL.md +11 -0
  53. package/skills/fix/SKILL.md +281 -249
  54. package/skills/incident/SKILL.md +10 -0
  55. package/skills/launch/SKILL.md +12 -0
  56. package/skills/logic-guardian/SKILL.md +11 -0
  57. package/skills/marketing/SKILL.md +13 -0
  58. package/skills/mcp-builder/SKILL.md +13 -0
  59. package/skills/onboard/SKILL.md +50 -2
  60. package/skills/perf/SKILL.md +11 -0
  61. package/skills/plan/SKILL.md +342 -688
  62. package/skills/plan/references/completeness-scoring.md +36 -0
  63. package/skills/plan/references/outcome-block.md +40 -0
  64. package/skills/plan/references/plan-templates.md +193 -0
  65. package/skills/plan/references/wave-planning.md +44 -0
  66. package/skills/plan/references/workflow-registry.md +52 -0
  67. package/skills/preflight/SKILL.md +360 -280
  68. package/skills/rescue/SKILL.md +11 -0
  69. package/skills/research/SKILL.md +149 -150
  70. package/skills/retro/SKILL.md +11 -0
  71. package/skills/review/SKILL.md +489 -396
  72. package/skills/review-intake/SKILL.md +11 -0
  73. package/skills/safeguard/SKILL.md +12 -0
  74. package/skills/scaffold/SKILL.md +10 -0
  75. package/skills/scope-guard/SKILL.md +11 -0
  76. package/skills/scout/SKILL.md +9 -0
  77. package/skills/sentinel/SKILL.md +296 -425
  78. package/skills/sentinel/references/config-protection.md +52 -0
  79. package/skills/sentinel/references/destructive-commands.md +39 -0
  80. package/skills/sentinel/references/domain-hooks.md +73 -0
  81. package/skills/sentinel/references/framework-patterns.md +46 -0
  82. package/skills/sentinel/references/owasp-patterns.md +69 -0
  83. package/skills/sentinel/references/secret-patterns.md +40 -0
  84. package/skills/sentinel/references/skill-content-guard.md +54 -0
  85. package/skills/session-bridge/SKILL.md +56 -2
  86. package/skills/skill-forge/SKILL.md +47 -2
  87. package/skills/skill-router/{SKILL.md → skill.md} +446 -365
  88. package/skills/surgeon/SKILL.md +12 -0
  89. package/skills/team/SKILL.md +34 -1
  90. package/skills/test/SKILL.md +585 -427
  91. package/skills/watchdog/references/webhook-health-checks.md +243 -0
@@ -1,365 +1,446 @@
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.2.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.25 — Request Classifier (Fast-Path Filter)
68
-
69
- Before intent classification, categorize the request into one of 5 types. This determines the **enforcement level** how strictly routing must be followed.
70
-
71
- | Request Type | Keywords / Signals | Enforcement | Action |
72
- |---|---|---|---|
73
- | `CODE_CHANGE` | "build", "implement", "add", "create", "fix", "refactor", "update code" | **FULL** | cook mandatory, no exceptions |
74
- | `QUESTION` | "what is", "how does", "explain", "why" | **LITE** | Check if a skill has domain knowledge first; answer directly if no skill matches |
75
- | `DEBUG_REQUEST` | "error", "bug", "not working", "broken", "crash", "fails" | **FULL** | debug skill mandatory |
76
- | `REVIEW_REQUEST` | "review", "check", "audit", "look at this code" | **FULL** | review skill mandatory |
77
- | `EXPLORE` | "find", "search", "where is", "show me", "list" | **LITE** | scout if codebase-related; answer directly if general |
78
-
79
- **Enforcement levels:**
80
- - **FULL** MUST route through a skill. Writing code without skill invocation = protocol violation.
81
- - **LITE** → SHOULD check if a skill applies. Can answer directly if no skill matches and the response involves no code changes.
82
-
83
- **Escape hatch**: If request is clearly trivial (< 5 LOC change, single-line fix, user says "just do it"), classify as CODE_CHANGE but cook activates Fast Mode automatically.
84
-
85
- ### Step 0.5 STOP before responding
86
-
87
- Before generating ANY response (including clarifying questions), the agent MUST:
88
-
89
- 1. **Check the request type** from Step 0.25 if FULL enforcement, routing is mandatory
90
- 2. **Classify the user's intent** using the routing table below
91
- 3. **Identify which skill(s) match** — if even 1% chance a skill applies, invoke it
92
- 4. **Invoke the skill** via the Skill tool
93
- 5. **Follow the skill's instructions** — the skill dictates the workflow, not the agent
94
-
95
- ### Step 1 — Intent Classification (Progressive Disclosure)
96
-
97
- Skills are organized into 3 tiers for discoverability. **Tier 1 skills handle 90% of user requests.**
98
-
99
- #### Tier 1Primary Entry Points (User-Facing)
100
-
101
- These 5 skills are the main interface. Most user intents route here first:
102
-
103
- | User Intent | Route To | When |
104
- |---|---|---|
105
- | Build / implement / add feature / fix bug | `rune:cook` | Any code change request |
106
- | Large multi-part task / parallel work | `rune:team` | 5+ files or 3+ modules |
107
- | Deploy + launch + marketing | `rune:launch` | Ship to production |
108
- | Legacy code / rescue / modernize | `rune:rescue` | Old/messy codebase |
109
- | Check project health / full audit | `rune:audit` | Quality assessment |
110
- | New project / bootstrap / scaffold | `rune:scaffold` | Greenfield project creation |
111
-
112
- **Default route**: If unclear, route to `rune:cook`. Cook handles 70% of all requests.
113
-
114
- #### Tier 2 — Power User Skills (Direct Invocation)
115
-
116
- For users who know exactly what they want:
117
-
118
- | User Intent | Route To | Priority |
119
- |---|---|---|
120
- | Plan / design / architect | `rune:plan` | L2 — requires opus |
121
- | Brainstorm / explore ideas | `rune:brainstorm` | L2 before plan |
122
- | Review code / check quality | `rune:review` | L2 |
123
- | Write tests | `rune:test` | L2 TDD |
124
- | Refactor | `rune:surgeon` | L2 — incremental |
125
- | Deploy (without marketing) | `rune:deploy` | L2 |
126
- | Security concern | `rune:sentinel` | L2 — opus for critical |
127
- | Performance issue | `rune:perf` | L2 |
128
- | Database change | `rune:db` | L2 |
129
- | Received code review / PR feedback | `rune:review-intake` | L2 |
130
- | Protect / audit / document business logic | `rune:logic-guardian` | L2 |
131
- | Create / edit a Rune skill | `rune:skill-forge` | L2 requires opus |
132
- | Incident / outage | `rune:incident` | L2 |
133
- | UI/UX design | `rune:design` | L2 |
134
- | Fix bug / debug only (no fix) | `rune:debug` → `rune:fix` | L2 chain |
135
- | Marketing assets only | `rune:marketing` | L2 |
136
- | Gather requirements / BA / elicit needs | `rune:ba` | L2 — requires opus |
137
- | Generate / update docs | `rune:docs` | L2 |
138
- | Build MCP server | `rune:mcp-builder` | L2 |
139
- | Red-team / challenge a plan / stress-test | `rune:adversary` | L2 — requires opus |
140
-
141
- #### Tier 3 Internal Skills (Called by Other Skills)
142
-
143
- These are rarely invoked directly they're called by Tier 1/2 skills:
144
-
145
- | Skill | Called By | Purpose |
146
- |---|---|---|
147
- | `rune:scout` | cook, plan, team | Codebase scanning |
148
- | `rune:fix` | debug, cook | Apply code changes |
149
- | `rune:preflight` | cook | Quality gate |
150
- | `rune:verification` | cook, fix | Run lint/test/build |
151
- | `rune:hallucination-guard` | cook, fix | Verify imports |
152
- | `rune:completion-gate` | cook | Validate claims |
153
- | `rune:sentinel-env` | cook, scaffold, onboard | Environment pre-flight |
154
- | `rune:research` / `rune:docs-seeker` | any | Look up docs |
155
- | `rune:session-bridge` | cook, team | Save context (in-session state handoff) |
156
- | `rune:journal` | cook, team | Persistent work log within a session |
157
- | `rune:neural-memory` | cook, team, any L1/L2 | Cross-session cognitive persistence via Neural Memory MCP — semantic complement to session-bridge and journal |
158
- | `rune:git` | cook, scaffold, team, launch | Semantic commits, PRs, branches |
159
- | `rune:doc-processor` | docs, marketing | PDF/DOCX/XLSX/PPTX generation |
160
- | "Done" / "ship it" / "xong" | — | `rune:verification` commit |
161
- | "recall", "remember", "brain", "nmem", "cross-project memory" | `rune:neural-memory` | Retrieve or persist cross-session context |
162
-
163
- #### Tier 4 Domain Extension Packs (L4)
164
-
165
- When user intent matches a domain-specific pattern or user explicitly invokes an L4 trigger command, route to the L4 pack.
166
-
167
- **Split pack loading** (context-efficient): First `Read` the pack's PACK.md index. If the index contains `format: split` in its frontmatter metadata, it is a split pack — the index lists skills in a table but skill content lives in separate files under `skills/`. Match user intent to the specific skill name in the table, then `Read` only that skill file (e.g., `extensions/backend/skills/api-design.md`). This loads ~100-200 lines instead of ~1000+.
168
-
169
- **Monolith pack loading** (legacy): If no `format: split` marker, the PACK.md contains all skills inline — read it fully and extract the matching `### skill-name` section.
170
-
171
- | User Intent / Domain Signal | Route To | Pack File |
172
- |---|---|---|
173
- | Frontend UI, design system, a11y, animation | `@rune/ui` | `extensions/ui/PACK.md` |
174
- | API design, auth, middleware, rate limiting | `@rune/backend` | `extensions/backend/PACK.md` |
175
- | Docker, CI/CD, monitoring, server setup | `@rune/devops` | `extensions/devops/PACK.md` |
176
- | React Native, Flutter, mobile app, app store | `@rune/mobile` | `extensions/mobile/PACK.md` |
177
- | OWASP, pentest, secrets, compliance | `@rune/security` | `extensions/security/PACK.md` |
178
- | Trading, fintech, charts, market data | `@rune/trading` | `extensions/trading/PACK.md` |
179
- | Multi-tenant, billing, SaaS subscription | `@rune/saas` | `extensions/saas/PACK.md` |
180
- | Shopify, payments, cart, inventory | `@rune/ecommerce` | `extensions/ecommerce/PACK.md` |
181
- | LLM, RAG, embeddings, fine-tuning | `@rune/ai-ml` | `extensions/ai-ml/PACK.md` |
182
- | Three.js, WebGL, game loop, physics | `@rune/gamedev` | `extensions/gamedev/PACK.md` |
183
- | Blog, CMS, MDX, i18n, SEO | `@rune/content` | `extensions/content/PACK.md` |
184
- | Analytics, A/B testing, funnels, dashboards | `@rune/analytics` | `extensions/analytics/PACK.md` |
185
- | Chrome extension, manifest, service worker | `@rune/chrome-ext` | `extensions/chrome-ext/PACK.md` |
186
- | PRD, roadmap, KPI, release notes, product spec | `@rune-pro/product` | `extensions/pro-product/PACK.md` |
187
- | Sales outreach, pipeline, call prep, prospecting | `@rune-pro/sales` | `extensions/pro-sales/PACK.md` |
188
- | Data science, SQL, dashboards, statistical analysis | `@rune-pro/data-science` | `extensions/pro-data-science/PACK.md` |
189
- | Support tickets, KB, escalation, SLA tracking | `@rune-pro/support` | `extensions/pro-support/PACK.md` |
190
- | Budget, expense, revenue forecast, P&L, cash flow | `@rune-pro/finance` | `extensions/pro-finance/PACK.md` |
191
- | Contract review, NDA, compliance, GDPR, IP audit | `@rune-pro/legal` | `extensions/pro-legal/PACK.md` |
192
-
193
- **L4 routing rules:**
194
- 1. If user explicitly invokes an L4 trigger (e.g., `/rune rag-patterns`), read the PACK.md index first, then load only the matching skill file (split packs) or extract the matching section (monolith packs)
195
- 2. If the intent also involves implementation, route to `cook` (L1) first — cook will detect L4 context in Phase 1.5
196
- 3. L4 packs supplement L1/L2 workflows they are domain knowledge, not standalone orchestrators
197
- 4. L4 packs can call L3 utilities (scout, verification) but CANNOT call L1 or L2 skills
198
- 5. If the L4 pack file is not found on disk, skip silently and proceed with standard routing
199
- 6. **NEVER load an entire split pack** — always load index first, then only the specific skill file needed
200
-
201
- ### Step 1.5 File Ownership Matrix (Constraint Inheritance)
202
-
203
- When the routed skill produces file changes, the **owner skill's constraints** apply to those files even if a different skill (e.g., cook) is the orchestrator.
204
-
205
- | File Pattern | Owner Skill | Constraints Applied |
206
- |---|---|---|
207
- | `*.test.*`, `*.spec.*`, `__tests__/` | `rune:test` | Test patterns, assertions, no `test.skip`, coverage rules |
208
- | `migrations/`, `schema.*`, `*.prisma` | `rune:db` | Migration safety, rollback script, parameterized queries |
209
- | `Dockerfile`, `*.yml` (CI/CD), `terraform/` | `rune:deploy` | Deployment checklist, no hardcoded secrets |
210
- | `docs/*.md`, `README.md`, `CHANGELOG.md` | `rune:docs` | Documentation patterns, no stale references |
211
- | `SKILL.md`, `PACK.md` | `rune:skill-forge` | Skill template compliance, frontmatter validation |
212
- | `.env*`, `*secret*`, `*credential*` | `rune:sentinel` | Security scan mandatory, never commit secrets |
213
- | `*.css`, `*.scss`, `tailwind.config.*` | `@rune/ui` | Design system patterns (if L4 pack installed) |
214
-
215
- **Ownership rules:**
216
- 1. Ownership = **constraints apply**, NOT exclusive access. cook can modify test files during Phase 4 as long as test constraints are honored.
217
- 2. If a file matches multiple patterns, ALL matching constraints apply (union, not exclusive).
218
- 3. If no pattern matches, the routed skill's own constraints apply (default behavior).
219
- 4. File ownership is checked DURING implementation, not at routing time it augments, not replaces, skill routing.
220
-
221
- ### Step 2 Compound Intent Resolution
222
-
223
- Many requests combine intents. Route to the HIGHEST-PRIORITY skill first:
224
-
225
- ```
226
- Priority: L1 > L2 > L3
227
- Within same layer: process skills > implementation skills
228
-
229
- Example: "Add auth and deploy it"
230
- rune:cook (add auth) FIRST
231
- rune:deploy SECOND (after cook completes)
232
-
233
- Example: "Fix the login bug and add tests"
234
- rune:debug (diagnose) FIRST
235
- rune:fix (apply fix) SECOND
236
- rune:test (add tests) THIRD
237
-
238
- L4 integration: If cook is the primary route AND a domain pack matches,
239
- cook handles orchestration while the L4 pack provides domain patterns.
240
- Both are active — cook for workflow, L4 for domain knowledge.
241
- ```
242
-
243
- ### Step 3Anti-Rationalization Gate
244
-
245
- The agent MUST NOT bypass routing with these excuses:
246
-
247
- | Thought | Reality | Action |
248
- |---|---|---|
249
- | "This is too simple for a skill" | Simple tasks still benefit from structure | Route it |
250
- | "I already know how to do this" | Skills have constraints you'll miss | Route it |
251
- | "Let me just read the file first" | Skills tell you HOW to read | Route first |
252
- | "I need more context before routing" | Route first, skill will gather context | Route it |
253
- | "The user just wants a quick answer" | Quick answers can still be wrong | Check routing table |
254
- | "No skill matches exactly" | Pick closest match, or use scout + plan | Route it |
255
- | "I'll apply the skill patterns mentally" | Mental application misses constraints | Actually invoke it |
256
- | "This is just a follow-up" | Follow-ups can change intent | Re-check routing |
257
-
258
- ### Step 4 Execute
259
-
260
- Once routed:
261
- 1. Announce: "Using `rune:<skill>` to [purpose]"
262
- 2. Invoke the skill via Skill tool
263
- 3. Follow the skill's workflow exactly
264
- 4. If the skill has a checklist/phases, track via TodoWrite
265
-
266
- ### Step 5 Post-Completion Neural Memory Capture
267
-
268
- After ANY L1 or L2 workflow completes (cook, team, launch, rescue, scaffold, plan, design, debug, fix, review, deploy, sentinel, perf, db, ba, docs, mcp-builder, etc.):
269
-
270
- 1. Trigger `rune:neural-memory` in **Capture Mode** automatically
271
- 2. Save 2–5 memories covering: key decisions made, bugs fixed, patterns applied, architectural choices
272
- 3. Use rich cognitive language (causal, temporal, decisional) — NOT flat facts
273
- 4. Tag memories with [project-name, skill-used, topic]
274
- 5. This step is MANDATORY even if the user did not ask for it
275
- 6. Exception: skip if the workflow produced zero technical output (e.g., only a clarifying question was asked)
276
-
277
- **Capture Mode trigger phrase**: "Session artifact — capturing to Neural Memory."
278
-
279
- ## Routing Exceptions
280
-
281
- These DO NOT need skill routing:
282
- - Pure conversational responses ("hello", "thanks")
283
- - Answering questions about Rune itself (meta-questions)
284
- - Single-line factual answers with no code impact
285
- - Resuming an already-active skill workflow
286
-
287
- ## Output Format
288
-
289
- ### Routing Proof (Required in Every Code Response)
290
-
291
- Every response that involves code changes MUST begin with a routing proof line:
292
-
293
- ```
294
- > Routed: rune:<skill> | Type: CODE_CHANGE | Confidence: HIGH
295
- ```
296
-
297
- This is NOT optional formatting. It is evidence that routing occurred. If this line is missing from a code response, the response violated skill-router compliance. For LITE enforcement (QUESTION, EXPLORE), the proof line is optional.
298
-
299
- ### Full Routing Decision (when announcing route)
300
-
301
- ```
302
- ## Routing Decision
303
- - **Intent**: [classified user intent]
304
- - **Type**: CODE_CHANGE | QUESTION | DEBUG_REQUEST | REVIEW_REQUEST | EXPLORE
305
- - **Skill**: rune:[skill-name]
306
- - **Confidence**: HIGH | MEDIUM | LOW
307
- - **Override**: [routing override applied, if any]
308
- - **Reason**: [one-line justification for skill selection]
309
- ```
310
-
311
- For multi-skill chains:
312
- ```
313
- ## Routing Chain
314
- 1. rune:[skill-1] [purpose]
315
- 2. rune:[skill-2] [purpose]
316
- 3. rune:[skill-3] — [purpose]
317
- ```
318
-
319
- ## Constraints
320
-
321
- 1. MUST check routing table before EVERY response that involves code, files, or technical decisions
322
- 2. MUST invoke skill via Skill tool — "mentally applying" a skill is NOT acceptable
323
- 3. MUST NOT write code without routing through at least one skill first
324
- 4. MUST NOT skip routing because "it's faster" — speed without correctness wastes more time
325
- 5. MUST re-route on intent change if user shifts from "plan" to "implement", switch skills
326
- 6. MUST announce which skill is being used and why — transparency builds trust
327
- 7. MUST follow skill's internal workflow, not override it with own judgment
328
-
329
- ## Sharp Edges
330
-
331
- | Failure Mode | Severity | Mitigation |
332
- |---|---|---|
333
- | Agent writes code without invoking any skill | CRITICAL | Constraint 3: code REQUIRES skill routing. No exceptions. |
334
- | Agent "mentally applies" skill without invoking | HIGH | Constraint 2: must use Skill tool for full content |
335
- | Routes to wrong skill, wastes a full workflow | MEDIUM | Step 2 compound resolution + re-route on mismatch |
336
- | Over-routing trivial tasks (e.g., "what time is it") | LOW | Routing Exceptions section covers non-technical queries |
337
- | Skill invocation adds latency to simple tasks | LOW | Acceptable trade-off: correctness > speed |
338
-
339
- ## Done When
340
-
341
- - This skill is never "done" — it's a persistent routing layer
342
- - Success = every agent response passes through routing check
343
- - Failure = any code written without skill invocation
344
-
345
- ## Self-Verification Trigger (MANDATORY)
346
-
347
- <HARD-GATE>
348
- Before EVERY response, complete this 3-point self-check:
349
-
350
- 1. **Did I classify this request?** (Step 0.25 what type is it?)
351
- 2. **Did I route through a skill?** (Step 1-2 which skill handles this?)
352
- 3. **Am I about to write code without a skill invocation?** **STOP. Route first.**
353
-
354
- If the request type is `CODE_CHANGE` or `DEBUG_REQUEST` (FULL enforcement) and ANY answer is "no":
355
- DO NOT RESPOND. Complete routing first.
356
-
357
- If the request type is `QUESTION` or `EXPLORE` (LITE enforcement):
358
- Check if a skill has relevant domain knowledge. If yes, route. If no, respond directly.
359
-
360
- **User override**: If user explicitly says "skip routing", "just write it", "no process" → respect the override. Log: "User override: routing skipped per explicit request."
361
- </HARD-GATE>
362
-
363
- ## Cost Profile
364
-
365
- ~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.
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.3.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
+ ### Context Efficiency (Trigger-Table Pattern)
68
+
69
+ Skill-router's routing table above IS the trigger table it maps keywords to skill paths without loading any skill content. Skills are loaded on-demand via the Skill tool only when routed. This keeps baseline context usage minimal.
70
+
71
+ **Rules for context efficiency:**
72
+ - NEVER read a SKILL.md to decide routing — use the routing table keywords
73
+ - NEVER load multiple skills speculatively route to ONE, let it chain if needed
74
+ - Skill content is loaded by the Skill tool, not by skill-router reading files
75
+
76
+ ### Step 0.25 Request Classifier (Fast-Path Filter)
77
+
78
+ Before intent classification, categorize the request into one of 5 types. This determines the **enforcement level** — how strictly routing must be followed.
79
+
80
+ | Request Type | Keywords / Signals | Enforcement | Action |
81
+ |---|---|---|---|
82
+ | `CODE_CHANGE` | "build", "implement", "add", "create", "fix", "refactor", "update code" | **FULL** | cook mandatory, no exceptions |
83
+ | `QUESTION` | "what is", "how does", "explain", "why" | **LITE** | Check if a skill has domain knowledge first; answer directly if no skill matches |
84
+ | `DEBUG_REQUEST` | "error", "bug", "not working", "broken", "crash", "fails" | **FULL** | debug skill mandatory |
85
+ | `REVIEW_REQUEST` | "review", "check", "audit", "look at this code" | **FULL** | review skill mandatory |
86
+ | `EXPLORE` | "find", "search", "where is", "show me", "list" | **LITE** | scout if codebase-related; answer directly if general |
87
+
88
+ **Enforcement levels:**
89
+ - **FULL** MUST route through a skill. Writing code without skill invocation = protocol violation.
90
+ - **LITE** SHOULD check if a skill applies. Can answer directly if no skill matches and the response involves no code changes.
91
+
92
+ **Escape hatch**: If request is clearly trivial (< 5 LOC change, single-line fix, user says "just do it"), classify as CODE_CHANGE but cook activates Fast Mode automatically.
93
+
94
+ ### Step 0.3 — Skill Discovery (`/rune list`)
95
+
96
+ If user says `/rune list`, "what skills do I have", "show all skills", "available skills", or "what can rune do":
97
+
98
+ 1. **Scan installed skills**: `Glob` for `skills/*/skill.md` (core L0-L3) and `extensions/*/PACK.md` (L4 packs)
99
+ 2. **Scan paid extensions**: `Glob` for `extensions/pro-*/PACK.md` (Pro/Business packs only present if purchased)
100
+ 3. **Output the catalog** grouped by tier:
101
+
102
+ ```
103
+ ## Rune Skills Catalog
104
+
105
+ ### Core Skills (L0-L3) Always Available
106
+ | Skill | Layer | Description |
107
+ |-------|-------|-------------|
108
+ (list each skill from skills/*/skill.md read name + description from frontmatter)
109
+
110
+ ### Extension Packs (L4) Domain Knowledge
111
+ | Pack | Skills | Trigger |
112
+ |------|--------|---------|
113
+ (list each pack from extensions/*/PACK.md — read name + skill count + trigger commands)
114
+
115
+ ### Pro/Business Packs (if installed)
116
+ | Pack | Skills | Trigger |
117
+ |------|--------|---------|
118
+ (list each pack from extensions/pro-*/PACK.md)
119
+ ```
120
+
121
+ 4. **Tip line at bottom**: "Use `/rune <pack> <skill>` to invoke any skill directly. Use `/rune <pack>` for the full pack workflow."
122
+
123
+ **Filtering**: `/rune list <query>` filters by name or domain keyword (e.g., `/rune list finance` shows only finance-related skills).
124
+
125
+ ### Step 0.5 STOP before responding
126
+
127
+ Before generating ANY response (including clarifying questions), the agent MUST:
128
+
129
+ 1. **Check the request type** from Step 0.25 if FULL enforcement, routing is mandatory
130
+ 2. **Classify the user's intent** using the routing table below
131
+ 3. **Identify which skill(s) match** if even 1% chance a skill applies, invoke it
132
+ 4. **Invoke the skill** via the Skill tool
133
+ 5. **Follow the skill's instructions** the skill dictates the workflow, not the agent
134
+
135
+ ### Step 1 Intent Classification (Progressive Disclosure)
136
+
137
+ Skills are organized into 3 tiers for discoverability. **Tier 1 skills handle 90% of user requests.**
138
+
139
+ #### Tier 1 Primary Entry Points (User-Facing)
140
+
141
+ These 5 skills are the main interface. Most user intents route here first:
142
+
143
+ | User Intent | Route To | When |
144
+ |---|---|---|
145
+ | Build / implement / add feature / fix bug | `rune:cook` | Any code change request |
146
+ | Large multi-part task / parallel work | `rune:team` | 5+ files or 3+ modules |
147
+ | Deploy + launch + marketing | `rune:launch` | Ship to production |
148
+ | Legacy code / rescue / modernize | `rune:rescue` | Old/messy codebase |
149
+ | Check project health / full audit | `rune:audit` | Quality assessment |
150
+ | New project / bootstrap / scaffold | `rune:scaffold` | Greenfield project creation |
151
+
152
+ **Default route**: If unclear, route to `rune:cook`. Cook handles 70% of all requests.
153
+
154
+ #### Tier 2 Power User Skills (Direct Invocation)
155
+
156
+ For users who know exactly what they want:
157
+
158
+ | User Intent | Route To | Priority |
159
+ |---|---|---|
160
+ | Plan / design / architect | `rune:plan` | L2 — requires opus |
161
+ | Brainstorm / explore ideas | `rune:brainstorm` | L2 before plan |
162
+ | Review code / check quality | `rune:review` | L2 |
163
+ | Write tests | `rune:test` | L2 — TDD |
164
+ | Refactor | `rune:surgeon` | L2 — incremental |
165
+ | Deploy (without marketing) | `rune:deploy` | L2 |
166
+ | Security concern | `rune:sentinel` | L2 — opus for critical |
167
+ | Performance issue | `rune:perf` | L2 |
168
+ | Database change | `rune:db` | L2 |
169
+ | Received code review / PR feedback | `rune:review-intake` | L2 |
170
+ | Protect / audit / document business logic | `rune:logic-guardian` | L2 |
171
+ | Create / edit a Rune skill | `rune:skill-forge` | L2 requires opus |
172
+ | Incident / outage | `rune:incident` | L2 |
173
+ | UI/UX design | `rune:design` | L2 |
174
+ | Fix bug / debug only (no fix) | `rune:debug` `rune:fix` | L2 chain |
175
+ | Marketing assets only | `rune:marketing` | L2 |
176
+ | Gather requirements / BA / elicit needs | `rune:ba` | L2 — requires opus |
177
+ | Generate / update docs | `rune:docs` | L2 |
178
+ | Build MCP server | `rune:mcp-builder` | L2 |
179
+ | Red-team / challenge a plan / stress-test | `rune:adversary` | L2 — requires opus |
180
+
181
+ #### Tier 3 Internal Skills (Called by Other Skills)
182
+
183
+ These are rarely invoked directly they're called by Tier 1/2 skills:
184
+
185
+ | Skill | Called By | Purpose |
186
+ |---|---|---|
187
+ | `rune:scout` | cook, plan, team | Codebase scanning |
188
+ | `rune:fix` | debug, cook | Apply code changes |
189
+ | `rune:preflight` | cook | Quality gate |
190
+ | `rune:verification` | cook, fix | Run lint/test/build |
191
+ | `rune:hallucination-guard` | cook, fix | Verify imports |
192
+ | `rune:completion-gate` | cook | Validate claims |
193
+ | `rune:sentinel-env` | cook, scaffold, onboard | Environment pre-flight |
194
+ | `rune:research` / `rune:docs-seeker` | any | Look up docs |
195
+ | `rune:session-bridge` | cook, team | Save context (in-session state handoff) |
196
+ | `rune:journal` | cook, team | Persistent work log within a session |
197
+ | `rune:neural-memory` | cook, team, any L1/L2 | Cross-session cognitive persistence via Neural Memory MCP — semantic complement to session-bridge and journal |
198
+ | `rune:git` | cook, scaffold, team, launch | Semantic commits, PRs, branches |
199
+ | `rune:doc-processor` | docs, marketing | PDF/DOCX/XLSX/PPTX generation |
200
+ | "Done" / "ship it" / "xong" | — | `rune:verification` → commit |
201
+ | "recall", "remember", "brain", "nmem", "cross-project memory" | `rune:neural-memory` | Retrieve or persist cross-session context |
202
+
203
+ #### Tier 4Domain Extension Packs (L4)
204
+
205
+ When user intent matches a domain-specific pattern or user explicitly invokes an L4 trigger command, route to the L4 pack.
206
+
207
+ **Split pack loading** (context-efficient): First `Read` the pack's PACK.md index. If the index contains `format: split` in its frontmatter metadata, it is a split pack — the index lists skills in a table but skill content lives in separate files under `skills/`. Match user intent to the specific skill name in the table, then `Read` only that skill file (e.g., `extensions/backend/skills/api-design.md`). This loads ~100-200 lines instead of ~1000+.
208
+
209
+ **Monolith pack loading** (legacy): If no `format: split` marker, the PACK.md contains all skills inline — read it fully and extract the matching `### skill-name` section.
210
+
211
+ | User Intent / Domain Signal | Route To | Pack File |
212
+ |---|---|---|
213
+ | Frontend UI, design system, a11y, animation | `@rune/ui` | `extensions/ui/PACK.md` |
214
+ | API design, auth, middleware, rate limiting | `@rune/backend` | `extensions/backend/PACK.md` |
215
+ | Docker, CI/CD, monitoring, server setup | `@rune/devops` | `extensions/devops/PACK.md` |
216
+ | React Native, Flutter, mobile app, app store | `@rune/mobile` | `extensions/mobile/PACK.md` |
217
+ | OWASP, pentest, secrets, compliance | `@rune/security` | `extensions/security/PACK.md` |
218
+ | Trading, fintech, charts, market data | `@rune/trading` | `extensions/trading/PACK.md` |
219
+ | Multi-tenant, billing, SaaS subscription | `@rune/saas` | `extensions/saas/PACK.md` |
220
+ | Shopify, payments, cart, inventory | `@rune/ecommerce` | `extensions/ecommerce/PACK.md` |
221
+ | LLM, RAG, embeddings, fine-tuning | `@rune/ai-ml` | `extensions/ai-ml/PACK.md` |
222
+ | Three.js, WebGL, game loop, physics | `@rune/gamedev` | `extensions/gamedev/PACK.md` |
223
+ | Blog, CMS, MDX, i18n, SEO | `@rune/content` | `extensions/content/PACK.md` |
224
+ | Analytics, A/B testing, funnels, dashboards | `@rune/analytics` | `extensions/analytics/PACK.md` |
225
+ | Chrome extension, manifest, service worker | `@rune/chrome-ext` | `extensions/chrome-ext/PACK.md` |
226
+ | PRD, roadmap, KPI, release notes, product spec | `@rune-pro/product` | `extensions/pro-product/PACK.md` |
227
+ | Sales outreach, pipeline, call prep, prospecting | `@rune-pro/sales` | `extensions/pro-sales/PACK.md` |
228
+ | Data science, SQL, dashboards, statistical analysis | `@rune-pro/data-science` | `extensions/pro-data-science/PACK.md` |
229
+ | Support tickets, KB, escalation, SLA tracking | `@rune-pro/support` | `extensions/pro-support/PACK.md` |
230
+ | Budget, expense, revenue forecast, P&L, cash flow | `@rune-pro/finance` | `extensions/pro-finance/PACK.md` |
231
+ | Contract review, NDA, compliance, GDPR, IP audit | `@rune-pro/legal` | `extensions/pro-legal/PACK.md` |
232
+
233
+ **L4 routing rules:**
234
+ 1. If user explicitly invokes an L4 trigger (e.g., `/rune rag-patterns`), read the PACK.md index first, then load only the matching skill file (split packs) or extract the matching section (monolith packs)
235
+ 2. If the intent also involves implementation, route to `cook` (L1) first — cook will detect L4 context in Phase 1.5
236
+ 3. L4 packs supplement L1/L2 workflows — they are domain knowledge, not standalone orchestrators
237
+ 4. L4 packs can call L3 utilities (scout, verification) but CANNOT call L1 or L2 skills
238
+ 5. If the L4 pack file is not found on disk, skip silently and proceed with standard routing
239
+ 6. **NEVER load an entire split pack** always load index first, then only the specific skill file needed
240
+
241
+ ### Step 1.5 — File Ownership Matrix (Constraint Inheritance)
242
+
243
+ When the routed skill produces file changes, the **owner skill's constraints** apply to those files even if a different skill (e.g., cook) is the orchestrator.
244
+
245
+ | File Pattern | Owner Skill | Constraints Applied |
246
+ |---|---|---|
247
+ | `*.test.*`, `*.spec.*`, `__tests__/` | `rune:test` | Test patterns, assertions, no `test.skip`, coverage rules |
248
+ | `migrations/`, `schema.*`, `*.prisma` | `rune:db` | Migration safety, rollback script, parameterized queries |
249
+ | `Dockerfile`, `*.yml` (CI/CD), `terraform/` | `rune:deploy` | Deployment checklist, no hardcoded secrets |
250
+ | `docs/*.md`, `README.md`, `CHANGELOG.md` | `rune:docs` | Documentation patterns, no stale references |
251
+ | `SKILL.md`, `PACK.md` | `rune:skill-forge` | Skill template compliance, frontmatter validation |
252
+ | `.env*`, `*secret*`, `*credential*` | `rune:sentinel` | Security scan mandatory, never commit secrets |
253
+ | `*.css`, `*.scss`, `tailwind.config.*` | `@rune/ui` | Design system patterns (if L4 pack installed) |
254
+
255
+ **Ownership rules:**
256
+ 1. Ownership = **constraints apply**, NOT exclusive access. cook can modify test files during Phase 4 as long as test constraints are honored.
257
+ 2. If a file matches multiple patterns, ALL matching constraints apply (union, not exclusive).
258
+ 3. If no pattern matches, the routed skill's own constraints apply (default behavior).
259
+ 4. File ownership is checked DURING implementation, not at routing time — it augments, not replaces, skill routing.
260
+
261
+ ### Step 2 Compound Intent Resolution
262
+
263
+ Many requests combine intents. Route to the HIGHEST-PRIORITY skill first:
264
+
265
+ ```
266
+ Priority: L1 > L2 > L3
267
+ Within same layer: process skills > implementation skills
268
+
269
+ Example: "Add auth and deploy it"
270
+ rune:cook (add auth) FIRST
271
+ rune:deploy SECOND (after cook completes)
272
+
273
+ Example: "Fix the login bug and add tests"
274
+ rune:debug (diagnose) FIRST
275
+ rune:fix (apply fix) SECOND
276
+ → rune:test (add tests) THIRD
277
+
278
+ L4 integration: If cook is the primary route AND a domain pack matches,
279
+ cook handles orchestration while the L4 pack provides domain patterns.
280
+ Both are active — cook for workflow, L4 for domain knowledge.
281
+ ```
282
+
283
+ ### Step 3 Anti-Rationalization Gate
284
+
285
+ The agent MUST NOT bypass routing with these excuses:
286
+
287
+ | Thought | Reality | Action |
288
+ |---|---|---|
289
+ | "This is too simple for a skill" | Simple tasks still benefit from structure | Route it |
290
+ | "I already know how to do this" | Skills have constraints you'll miss | Route it |
291
+ | "Let me just read the file first" | Skills tell you HOW to read | Route first |
292
+ | "I need more context before routing" | Route first, skill will gather context | Route it |
293
+ | "The user just wants a quick answer" | Quick answers can still be wrong | Check routing table |
294
+ | "No skill matches exactly" | Pick closest match, or use scout + plan | Route it |
295
+ | "I'll apply the skill patterns mentally" | Mental application misses constraints | Actually invoke it |
296
+ | "This is just a follow-up" | Follow-ups can change intent | Re-check routing |
297
+
298
+ ### Step 4 — Execute
299
+
300
+ Once routed:
301
+ 1. Announce: "Using `rune:<skill>` to [purpose]"
302
+ 2. Invoke the skill via Skill tool
303
+ 3. Follow the skill's workflow exactly
304
+ 4. If the skill has a checklist/phases, track via TodoWrite
305
+
306
+ ### Step 5 Post-Completion Neural Memory Capture
307
+
308
+ After ANY L1 or L2 workflow completes (cook, team, launch, rescue, scaffold, plan, design, debug, fix, review, deploy, sentinel, perf, db, ba, docs, mcp-builder, etc.):
309
+
310
+ 1. Trigger `rune:neural-memory` in **Capture Mode** automatically
311
+ 2. Save 2–5 memories covering: key decisions made, bugs fixed, patterns applied, architectural choices
312
+ 3. Use rich cognitive language (causal, temporal, decisional) — NOT flat facts
313
+ 4. Tag memories with [project-name, skill-used, topic]
314
+ 5. This step is MANDATORY even if the user did not ask for it
315
+ 6. Exception: skip if the workflow produced zero technical output (e.g., only a clarifying question was asked)
316
+
317
+ **Capture Mode trigger phrase**: "Session artifact — capturing to Neural Memory."
318
+
319
+ ## Routing Exceptions
320
+
321
+ These DO NOT need skill routing:
322
+ - Pure conversational responses ("hello", "thanks")
323
+ - Answering questions about Rune itself (meta-questions)
324
+ - Single-line factual answers with no code impact
325
+ - Resuming an already-active skill workflow
326
+
327
+ ## Proactive Skill Recommendations (One-Hop Max)
328
+
329
+ At the end of a skill's workflow, skill-router MAY suggest a **complementary skill** — limited to ONE recommendation to prevent infinite referral chains.
330
+
331
+ | After This Skill | Suggest | Rationale |
332
+ |-----------------|---------|-----------|
333
+ | `debug` | `review` | Root cause found review the fix area for broader issues |
334
+ | `fix` | `test` | Code changed verify with tests |
335
+ | `plan` | `adversary` | Plan created stress-test before implementation |
336
+ | `test` (GREEN) | `preflight` | Tests pass check for edge cases and completeness |
337
+ | `review` (issues found) | `fix` | Issues identified apply fixes |
338
+ | `sentinel` (findings) | `fix` | Security issues — remediate |
339
+
340
+ #### L4 Extension Auto-Suggest (Domain Context Detection)
341
+
342
+ When routing a request through L1/L2 skills, skill-router SHOULD detect domain signals and suggest relevant L4 packs the user may not know they have:
343
+
344
+ | Domain Signal Detected | Suggest Pack | Announcement |
345
+ |----------------------|-------------|--------------|
346
+ | Financial terms (budget, revenue, P&L, runway, cash flow) | `@rune-pro/finance` | "You have `@rune-pro/finance` with 7 specialized skills. Use `/rune finance` to access." |
347
+ | Legal terms (contract, NDA, compliance, GDPR, IP) | `@rune-pro/legal` | "You have `@rune-pro/legal` with 6 specialized skills. Use `/rune legal` to access." |
348
+ | HR terms (hiring, JD, interview, onboarding, comp) | `@rune-pro/hr` | "You have `@rune-pro/hr` with 7 specialized skills. Use `/rune hr` to access." |
349
+ | Product terms (PRD, roadmap, KPI, release notes) | `@rune-pro/product` | "You have `@rune-pro/product` with 6 specialized skills. Use `/rune product` to access." |
350
+ | Sales terms (pipeline, outreach, prospecting) | `@rune-pro/sales` | "You have `@rune-pro/sales` with 6 specialized skills. Use `/rune sales` to access." |
351
+ | Data terms (SQL, dashboard, statistical, ML eval) | `@rune-pro/data-science` | "You have `@rune-pro/data-science` with 7 specialized skills. Use `/rune data` to access." |
352
+ | Support terms (ticket, KB, escalation, SLA) | `@rune-pro/support` | "You have `@rune-pro/support` with 6 specialized skills. Use `/rune support` to access." |
353
+ | Search terms (enterprise search, knowledge graph) | `@rune-pro/enterprise-search` | "You have `@rune-pro/enterprise-search` with 6 specialized skills. Use `/rune search` to access." |
354
+
355
+ **Auto-suggest rules:**
356
+ 1. Only suggest if the pack's PACK.md **exists on disk** — `Glob` for the pack path first. If not installed, skip silently.
357
+ 2. Suggest ONCE per session per pack do not repeat after user has seen the suggestion.
358
+ 3. Format: brief inline note, not a blocking prompt. User can ignore and continue.
359
+ 4. If user is already inside the pack's workflow, do not re-suggest.
360
+
361
+ **Rules:**
362
+ - Hard limit: 1 hop. NEVER chain recommendations (fix→test→preflight→...). Suggest ONE, let the user decide.
363
+ - Announcement format: "Suggested next: `rune:<skill>` — [1-line reason]. Run it? (skip to continue)"
364
+ - User can disable with "no suggestions" or "just do what I asked"
365
+ - Inside `cook` orchestration: skip recommendations cook already manages transitions
366
+
367
+
368
+ ## Output Format
369
+
370
+ ### Routing Proof (Required in Every Code Response)
371
+
372
+ Every response that involves code changes MUST begin with a routing proof line:
373
+
374
+ ```
375
+ > Routed: rune:<skill> | Type: CODE_CHANGE | Confidence: HIGH
376
+ ```
377
+
378
+ This is NOT optional formatting. It is evidence that routing occurred. If this line is missing from a code response, the response violated skill-router compliance. For LITE enforcement (QUESTION, EXPLORE), the proof line is optional.
379
+
380
+ ### Full Routing Decision (when announcing route)
381
+
382
+ ```
383
+ ## Routing Decision
384
+ - **Intent**: [classified user intent]
385
+ - **Type**: CODE_CHANGE | QUESTION | DEBUG_REQUEST | REVIEW_REQUEST | EXPLORE
386
+ - **Skill**: rune:[skill-name]
387
+ - **Confidence**: HIGH | MEDIUM | LOW
388
+ - **Override**: [routing override applied, if any]
389
+ - **Reason**: [one-line justification for skill selection]
390
+ ```
391
+
392
+ For multi-skill chains:
393
+ ```
394
+ ## Routing Chain
395
+ 1. rune:[skill-1] — [purpose]
396
+ 2. rune:[skill-2] — [purpose]
397
+ 3. rune:[skill-3] — [purpose]
398
+ ```
399
+
400
+ ## Constraints
401
+
402
+ 1. MUST check routing table before EVERY response that involves code, files, or technical decisions
403
+ 2. MUST invoke skill via Skill tool — "mentally applying" a skill is NOT acceptable
404
+ 3. MUST NOT write code without routing through at least one skill first
405
+ 4. MUST NOT skip routing because "it's faster" — speed without correctness wastes more time
406
+ 5. MUST re-route on intent change — if user shifts from "plan" to "implement", switch skills
407
+ 6. MUST announce which skill is being used and why — transparency builds trust
408
+ 7. MUST follow skill's internal workflow, not override it with own judgment
409
+
410
+ ## Sharp Edges
411
+
412
+ | Failure Mode | Severity | Mitigation |
413
+ |---|---|---|
414
+ | Agent writes code without invoking any skill | CRITICAL | Constraint 3: code REQUIRES skill routing. No exceptions. |
415
+ | Agent "mentally applies" skill without invoking | HIGH | Constraint 2: must use Skill tool for full content |
416
+ | Routes to wrong skill, wastes a full workflow | MEDIUM | Step 2 compound resolution + re-route on mismatch |
417
+ | Over-routing trivial tasks (e.g., "what time is it") | LOW | Routing Exceptions section covers non-technical queries |
418
+ | Skill invocation adds latency to simple tasks | LOW | Acceptable trade-off: correctness > speed |
419
+
420
+ ## Done When
421
+
422
+ - This skill is never "done" — it's a persistent routing layer
423
+ - Success = every agent response passes through routing check
424
+ - Failure = any code written without skill invocation
425
+
426
+ ## Self-Verification Trigger (MANDATORY)
427
+
428
+ <HARD-GATE>
429
+ Before EVERY response, complete this 3-point self-check:
430
+
431
+ 1. **Did I classify this request?** (Step 0.25 — what type is it?)
432
+ 2. **Did I route through a skill?** (Step 1-2 — which skill handles this?)
433
+ 3. **Am I about to write code without a skill invocation?** → **STOP. Route first.**
434
+
435
+ If the request type is `CODE_CHANGE` or `DEBUG_REQUEST` (FULL enforcement) and ANY answer is "no":
436
+ → DO NOT RESPOND. Complete routing first.
437
+
438
+ If the request type is `QUESTION` or `EXPLORE` (LITE enforcement):
439
+ → Check if a skill has relevant domain knowledge. If yes, route. If no, respond directly.
440
+
441
+ **User override**: If user explicitly says "skip routing", "just write it", "no process" → respect the override. Log: "User override: routing skipped per explicit request."
442
+ </HARD-GATE>
443
+
444
+ ## Cost Profile
445
+
446
+ ~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.