@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
@@ -4,7 +4,7 @@ description: "Context window management. Auto-triggered when context is filling
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "0.4.0"
7
+ version: "0.6.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: state
@@ -130,6 +130,21 @@ In addition to tool-call counting, monitor context window percentage when availa
130
130
  Debounce: emit advisory max once per 5 tool calls to avoid noise.
131
131
  Tool-call thresholds (Steps 1-2) remain the primary signal. Percentage advisory is supplementary — use when CLI status bar data is available.
132
132
 
133
+ ## Iterative Retrieval (Context-Loading Strategy)
134
+
135
+ When loading context for a task (Phase 1 of cook, or onboard), use a 4-phase retrieval loop instead of loading everything at once:
136
+
137
+ ```
138
+ 1. DISPATCH (broad): Search with initial task keywords → get 5-10 candidate files
139
+ 2. EVALUATE: Score each file's relevance (0-1). Note codebase-specific terminology discovered
140
+ 3. REFINE: Use discovered terms to search again with better keywords
141
+ 4. LOOP: Repeat max 3 cycles. STOP when 3 high-relevance files found (not 10 mediocre ones)
142
+ ```
143
+
144
+ **Why**: The first search cycle reveals codebase-specific terms (custom class names, project conventions, internal APIs) that produce much better results in cycle 2. Loading 3 deeply relevant files beats loading 10 surface-level matches.
145
+
146
+ **Key rule**: Stop at 3 high-relevance files, not 10 mediocre ones. Quality > quantity for context loading.
147
+
133
148
  ## Context Health Levels
134
149
 
135
150
  ```
@@ -158,6 +173,67 @@ Note: These are tool call counts, NOT token percentages. Claude Code does not ex
158
173
  - Blockers: [if any]
159
174
  ```
160
175
 
176
+ ## Strategic Compact Decision Table
177
+
178
+ When ORANGE or RED is reached, use this table to determine whether compaction is safe at the current boundary:
179
+
180
+ | Transition | Compact? | Reason |
181
+ |-----------|----------|--------|
182
+ | Research → Planning | YES | Research findings summarize well; key decisions survive |
183
+ | Planning → Implementation | YES | Plan is in files (.rune/plan-*.md); context can reload from artifacts |
184
+ | Debug → Next feature | YES | Debug findings are in Debug Report; fix has the diagnosis |
185
+ | Mid-implementation (Phase 4) | **NO** | Losing file paths, partial changes, and test state is catastrophic |
186
+ | After failed approach → Pivot | YES | Failed approach should be discarded; fresh context helps |
187
+ | Quality (Phase 5) → Verify | **NO** | Quality findings reference specific file:line in current context |
188
+ | After commit (Phase 7) | YES | Work is persisted in git; safe boundary |
189
+
190
+ **What survives compaction**: Task description, file paths mentioned, key decisions, plan reference, current phase.
191
+ **What is lost**: Full file contents read, intermediate reasoning, exact error messages, tool output details.
192
+
193
+ ## Context Budget Audit (Baseline Cost Awareness)
194
+
195
+ MCP tool schemas and agent descriptions consume significant baseline context before any work begins. This section helps identify and reduce invisible context waste.
196
+
197
+ ### Token Cost Reference
198
+
199
+ | Source | Approx. Cost | Loaded When |
200
+ |--------|-------------|-------------|
201
+ | Each MCP tool schema | ~500 tokens | Session start (always) |
202
+ | Each agent description | ~200-400 tokens | Every `Task()` invocation |
203
+ | CLAUDE.md | ~100-2000 tokens | Session start (always) |
204
+ | Skill SKILL.md (full load) | ~500-3000 tokens | When skill is invoked |
205
+
206
+ ### Budget Rules
207
+
208
+ | Rule | Threshold | Action |
209
+ |------|-----------|--------|
210
+ | Max MCP servers | <10 active | Disable unused MCP servers in settings |
211
+ | Max MCP tools | <80 total | Remove or consolidate bloated MCP servers |
212
+ | Agent descriptions | Only load needed | Use specific `subagent_type` to avoid loading all descriptions |
213
+ | CLAUDE.md size | <150 lines | Move detailed docs to `.rune/` files, keep CLAUDE.md as index |
214
+
215
+ ### Audit Procedure
216
+
217
+ When context health is YELLOW or worse, or when onboard detects >80 MCP tools:
218
+
219
+ 1. Count total MCP tool schemas loaded (from session start messages)
220
+ 2. Count agent descriptions available
221
+ 3. Estimate baseline cost: `(tools × 500) + (agents × 300) + CLAUDE.md tokens`
222
+ 4. If baseline >15% of estimated context window → flag as **Context Budget Warning**
223
+ 5. Rank MCP servers by tool count — suggest disabling servers with most tools and least usage
224
+
225
+ ### Report Addition
226
+
227
+ When Context Budget Warning fires, append to Context Health report:
228
+
229
+ ```
230
+ ### Context Budget
231
+ - **Baseline cost**: ~[N]k tokens ([X]% of estimated window)
232
+ - **MCP tools loaded**: [count] across [N] servers
233
+ - **Top consumers**: [server1] ([N] tools), [server2] ([N] tools)
234
+ - **Recommendation**: Disable [server] to save ~[N]k tokens
235
+ ```
236
+
161
237
  ## Constraints
162
238
 
163
239
  1. MUST preserve context fidelity — no summarizing away critical details
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: context-pack
3
+ description: "Creates structured handoff briefings between agents. Packages task context, constraints, and progress into a compact packet that subagents can consume without re-reading the full conversation. Prevents the 'lost context' problem in multi-agent delegation."
4
+ user-invocable: false
5
+ metadata:
6
+ author: runedev
7
+ version: "0.1.0"
8
+ layer: L3
9
+ model: haiku
10
+ group: state
11
+ tools: "Read, Glob, Grep"
12
+ ---
13
+
14
+ # context-pack
15
+
16
+ ## Purpose
17
+
18
+ When a parent agent delegates work to a subagent, critical context gets lost — the subagent starts fresh without knowing what was tried, what failed, what constraints apply, or what the parent already decided. Context-pack solves this by creating structured handoff briefings (context packets) that compress the essential information into a compact, parseable format. The packet is small enough to fit in a subagent's system prompt but complete enough to prevent redundant work and constraint violations.
19
+
20
+ ## Triggers
21
+
22
+ - Called by `cook`, `team`, `rescue` before spawning subagents
23
+ - Called by any L1/L2 skill that delegates work to another skill
24
+ - Manual: when user says "hand off", "delegate", "split this task"
25
+
26
+ ## Calls (outbound)
27
+
28
+ - `session-bridge` (L3): read persisted state for inclusion in packet
29
+ - `context-engine` (L3): check current context budget before deciding packet size
30
+
31
+ ## Called By (inbound)
32
+
33
+ - `cook` (L1): before Phase 2-5 subagent spawning
34
+ - `team` (L1): before dispatching parallel workstreams
35
+ - `rescue` (L1): before delegating module-level refactoring
36
+ - `scaffold` (L1): before delegating component generation
37
+ - Any L2 skill that spawns subagents
38
+
39
+ ## Data Flow
40
+
41
+ ### Feeds Into →
42
+
43
+ - All subagent invocations: context packet → subagent system prompt
44
+ - `completion-gate` (L3): packet's success criteria → claim validation baseline
45
+
46
+ ### Fed By ←
47
+
48
+ - Parent agent conversation: decisions, constraints, failed attempts
49
+ - `session-bridge` (L3): persisted state from prior sessions
50
+ - `plan` (L2): phase files with task breakdowns
51
+
52
+ ## Workflow
53
+
54
+ 1. **COLLECT** — Gather context from the current conversation:
55
+ - Task description and user intent
56
+ - Decisions already made (and WHY)
57
+ - Constraints and hard-stops
58
+ - Failed attempts (what NOT to do)
59
+ - Files already read or modified
60
+ - Current progress state
61
+
62
+ 2. **COMPRESS** — Reduce to essential information:
63
+ - Strip conversational noise
64
+ - Deduplicate repeated context
65
+ - Prioritize by relevance to the delegated task
66
+ - Target: <500 tokens for simple tasks, <1500 tokens for complex
67
+
68
+ 3. **STRUCTURE** — Format as a context packet (see Output Format)
69
+
70
+ 4. **VALIDATE** — Check packet completeness:
71
+ - Does it include the task goal?
72
+ - Does it include constraints that could cause failure?
73
+ - Does it include what was already tried?
74
+ - Is it small enough for the target agent's context budget?
75
+
76
+ ## Output Format
77
+
78
+ ```markdown
79
+ ## Context Packet
80
+
81
+ **Task**: [One-line description of what the subagent must do]
82
+ **Parent**: [Which skill/agent is delegating]
83
+ **Scope**: [Specific files, modules, or boundaries]
84
+
85
+ ### Decisions Made
86
+ - [Decision 1]: [choice] — because [reason]
87
+ - [Decision 2]: [choice] — because [reason]
88
+
89
+ ### Constraints
90
+ - MUST: [requirement 1]
91
+ - MUST NOT: [prohibition 1]
92
+ - BLOCKED BY: [dependency, if any]
93
+
94
+ ### Already Tried
95
+ - [Approach that failed] — [why it failed]
96
+
97
+ ### Files Touched
98
+ - `path/to/file.ts` — [what was done / what needs doing]
99
+
100
+ ### Success Criteria
101
+ - [ ] [Verifiable criterion 1]
102
+ - [ ] [Verifiable criterion 2]
103
+
104
+ ### Progress
105
+ - [What's done so far, if partial handoff]
106
+ ```
107
+
108
+ ## Returns
109
+
110
+ | Field | Type | Description |
111
+ |-------|------|-------------|
112
+ | `packet` | markdown | Structured context packet ready for subagent injection |
113
+ | `token_estimate` | number | Estimated token count of the packet |
114
+ | `completeness` | enum | `full` / `partial` / `minimal` — how much context was captured |
115
+ | `warnings` | string[] | Missing context that could cause subagent failure |
116
+
117
+ ## Constraints
118
+
119
+ 1. MUST include task goal and success criteria — subagent needs to know when it's done
120
+ 2. MUST include failed attempts — prevents subagent from repeating mistakes
121
+ 3. MUST include hard-stop constraints — prevents constraint violations in delegated work
122
+ 4. MUST NOT exceed 2000 tokens — context packets that are too large defeat the purpose
123
+ 5. MUST NOT include full file contents — use file paths and summaries instead
124
+ 6. MUST NOT fabricate context — only include information from the actual conversation
125
+
126
+ ## Sharp Edges
127
+
128
+ | Failure Mode | Severity | Mitigation |
129
+ |---|---|---|
130
+ | Packet too large (>2000 tokens) | HIGH | Compress aggressively — file paths not contents, decisions not discussions |
131
+ | Missing constraint causes subagent violation | CRITICAL | Always scan for MUST/MUST NOT in parent conversation |
132
+ | Stale context from prior session included | MEDIUM | Cross-check session-bridge state with current files |
133
+ | Over-constraining subagent with parent's approach | MEDIUM | Include constraints and goals, not implementation approach (unless approach is the constraint) |
134
+
135
+ ## Self-Validation
136
+
137
+ ```
138
+ SELF-VALIDATION (run before emitting output):
139
+ - [ ] Packet includes a clear task goal
140
+ - [ ] Packet includes success criteria (verifiable, not vague)
141
+ - [ ] All MUST/MUST NOT constraints from parent are present
142
+ - [ ] Failed attempts are listed (if any exist)
143
+ - [ ] Token estimate is under 2000
144
+ - [ ] No full file contents embedded (paths only)
145
+ IF ANY check fails → fix before reporting done. Do NOT defer to completion-gate.
146
+ ```
147
+
148
+ ## Done When
149
+
150
+ - Context packet emitted in structured format
151
+ - Token estimate calculated and within budget
152
+ - All constraints from parent conversation captured
153
+ - Completeness level assessed honestly
154
+ - Self-Validation checklist: all checks passed
155
+
156
+ ## Cost Profile
157
+
158
+ ~200-500 input tokens (scanning conversation) + ~300-800 output tokens (generating packet). Haiku model — minimal cost per invocation.
159
+
160
+ **Scope guardrail**: Do not implement code changes, run tests, or modify files. Only produce context packets for handoff. If asked to do more, defer to the delegated skill.