@rune-kit/rune 2.4.0 → 2.7.0

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 (49) hide show
  1. package/README.md +47 -17
  2. package/compiler/__tests__/executive-dashboards.test.js +285 -0
  3. package/compiler/__tests__/inject.test.js +128 -0
  4. package/compiler/__tests__/orchestrators.test.js +151 -0
  5. package/compiler/__tests__/org-templates.test.js +447 -0
  6. package/compiler/__tests__/pack-split.test.js +141 -1
  7. package/compiler/__tests__/parser.test.js +147 -1
  8. package/compiler/__tests__/scripts-bundling.test.js +10 -11
  9. package/compiler/__tests__/skill-index.test.js +218 -0
  10. package/compiler/__tests__/status.test.js +336 -0
  11. package/compiler/__tests__/templates.test.js +245 -0
  12. package/compiler/__tests__/visualizer.test.js +325 -0
  13. package/compiler/adapters/antigravity.js +18 -4
  14. package/compiler/bin/rune.js +90 -1
  15. package/compiler/doctor.js +283 -2
  16. package/compiler/emitter.js +490 -17
  17. package/compiler/parser.js +255 -4
  18. package/compiler/status.js +342 -0
  19. package/compiler/visualizer.js +622 -0
  20. package/hooks/hooks.json +12 -0
  21. package/hooks/intent-router/index.cjs +108 -0
  22. package/hooks/pre-tool-guard/index.cjs +177 -68
  23. package/package.json +63 -63
  24. package/skills/autopsy/SKILL.md +48 -1
  25. package/skills/brainstorm/SKILL.md +2 -0
  26. package/skills/completion-gate/SKILL.md +26 -1
  27. package/skills/context-engine/SKILL.md +93 -2
  28. package/skills/cook/SKILL.md +794 -648
  29. package/skills/debug/SKILL.md +409 -392
  30. package/skills/deploy/SKILL.md +2 -0
  31. package/skills/docs/SKILL.md +28 -3
  32. package/skills/fix/SKILL.md +284 -281
  33. package/skills/mcp-builder/SKILL.md +53 -1
  34. package/skills/onboard/SKILL.md +58 -1
  35. package/skills/perf/SKILL.md +34 -1
  36. package/skills/plan/SKILL.md +372 -342
  37. package/skills/preflight/SKILL.md +396 -360
  38. package/skills/retro/SKILL.md +95 -1
  39. package/skills/review/SKILL.md +535 -489
  40. package/skills/scope-guard/SKILL.md +1 -0
  41. package/skills/scout/SKILL.md +1 -0
  42. package/skills/sentinel/SKILL.md +353 -299
  43. package/skills/sentinel/references/policy-driven-constraints.md +424 -0
  44. package/skills/session-bridge/SKILL.md +58 -2
  45. package/skills/session-bridge/references/evolutionary-memory-patterns.md +312 -0
  46. package/skills/team/SKILL.md +16 -1
  47. package/skills/test/SKILL.md +587 -585
  48. package/skills/verification/SKILL.md +1 -0
  49. package/skills/watchdog/SKILL.md +2 -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.6.0"
7
+ version: "0.8.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: state
@@ -145,6 +145,79 @@ When loading context for a task (Phase 1 of cook, or onboard), use a 4-phase ret
145
145
 
146
146
  **Key rule**: Stop at 3 high-relevance files, not 10 mediocre ones. Quality > quantity for context loading.
147
147
 
148
+ ## Compaction Technique: Structured Summary with Continuation Point
149
+
150
+ When compaction is triggered (RED or approved ORANGE), generate a **structured summary** that replaces the full conversation history while preserving therapeutic continuity — the ability to resume exactly where work left off.
151
+
152
+ ### Summary Structure
153
+
154
+ The compaction summary MUST include these sections in order:
155
+
156
+ ```markdown
157
+ ## Compaction Summary (generated at [tool call count])
158
+
159
+ ### Topics Covered
160
+ - [bullet list of distinct topics/tasks worked on this session]
161
+
162
+ ### Key Decisions Made
163
+ - [decision]: [rationale] — affects [files/modules]
164
+
165
+ ### Active Threads
166
+ - [what was being worked on when compaction triggered — the "where we are now" anchor]
167
+ - Current file: [path], current function/section: [name]
168
+ - Partial progress: [what's done vs what remains in the immediate task]
169
+
170
+ ### Emotional/Priority Context
171
+ - [user urgency level, blocking issues, deadlines mentioned]
172
+ - [any user frustrations or preferences expressed this session]
173
+
174
+ ### Continuation Point
175
+ > Resume: [exact next action to take — not vague "continue working" but specific "implement the validation logic in src/auth/validate.ts:47 using the Zod schema defined in Step 2"]
176
+ ```
177
+
178
+ ### Why This Structure
179
+
180
+ Most compaction loses the **continuation point** — the agent knows WHAT was discussed but not WHERE to resume. The "Active Threads" and "Continuation Point" sections solve this by preserving:
181
+ 1. The exact file and function being edited
182
+ 2. What's done vs remaining in the current micro-task
183
+ 3. The specific next action (not a summary of the plan, but the next concrete step)
184
+
185
+ ### Rules
186
+
187
+ - Summary MUST be <500 tokens — if longer, you're summarizing too much detail
188
+ - "Active Threads" section is the most critical — get this wrong and the agent restarts from scratch
189
+ - Never include full file contents in the summary — only paths and line references
190
+ - Include user tone/urgency signals — these are lost in pure technical summaries
191
+
192
+ ## Incremental Stream Processing
193
+
194
+ When processing streaming LLM output (e.g., in skills that invoke AI calls or process tool output incrementally), use **sentence-level buffering** instead of waiting for the full response:
195
+
196
+ ### Pattern: Buffer → Detect Boundary → Act
197
+
198
+ ```
199
+ 1. ACCUMULATE: Feed incoming chunks into a text buffer
200
+ 2. DETECT: Check for sentence boundaries:
201
+ - Primary: 40+ chars ending in . ! ? ; :
202
+ - Secondary: paragraph break (\n\n) with 15+ chars accumulated
203
+ - Never split mid-word or mid-code-block
204
+ 3. EXTRACT: Remove the complete sentence from the buffer
205
+ 4. ACT: Process the extracted sentence immediately (e.g., queue for TTS, parse for structured data, update progress display)
206
+ 5. CONTINUE: Keep accumulating the next sentence while processing the current one
207
+ ```
208
+
209
+ ### When to Use
210
+
211
+ - **Skills that stream AI responses to the user**: process and display incrementally instead of waiting for the full response
212
+ - **Background note-taking**: extract key points from streaming output as they arrive
213
+ - **Progress reporting**: detect milestone keywords in streaming output to update progress
214
+
215
+ ### When NOT to Use
216
+
217
+ - **Code generation**: wait for the full code block — partial code is useless
218
+ - **JSON output**: accumulate until the closing brace — partial JSON can't be parsed
219
+ - **Short responses** (<100 chars expected): overhead of boundary detection exceeds benefit
220
+
148
221
  ## Context Health Levels
149
222
 
150
223
  ```
@@ -182,7 +255,7 @@ When ORANGE or RED is reached, use this table to determine whether compaction is
182
255
  | Research → Planning | YES | Research findings summarize well; key decisions survive |
183
256
  | Planning → Implementation | YES | Plan is in files (.rune/plan-*.md); context can reload from artifacts |
184
257
  | 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 |
258
+ | Mid-implementation (Phase 4) | **CONDITIONAL** | Safe ONLY at task boundaries within Phase 4 (after a file is fully written + tested). Never mid-file-edit. See Mid-Loop Compaction below |
186
259
  | After failed approach → Pivot | YES | Failed approach should be discarded; fresh context helps |
187
260
  | Quality (Phase 5) → Verify | **NO** | Quality findings reference specific file:line in current context |
188
261
  | After commit (Phase 7) | YES | Work is persisted in git; safe boundary |
@@ -190,6 +263,22 @@ When ORANGE or RED is reached, use this table to determine whether compaction is
190
263
  **What survives compaction**: Task description, file paths mentioned, key decisions, plan reference, current phase.
191
264
  **What is lost**: Full file contents read, intermediate reasoning, exact error messages, tool output details.
192
265
 
266
+ ### Mid-Loop Compaction (Phase 4 Emergency)
267
+
268
+ > From goclaw (nextlevelbuilder/goclaw, 832★): "Compact during run, not just at session boundary."
269
+
270
+ When context hits RED during Phase 4 (implementation), compaction IS possible at **clean split points**:
271
+
272
+ 1. **Find a clean boundary**: completed task within the phase (file fully written + tests pass for that file)
273
+ 2. **Flush state first**: call `session-bridge` to save progress, then call `neural-memory` to capture decisions
274
+ 3. **Split 70/30**: preserve 70% of remaining context for continuation, summarize 30% of completed work
275
+ 4. **Never break tool pairs**: compaction MUST NOT split a `tool_use` from its `tool_result` — always keep pairs together
276
+ 5. **Inject continuation marker**: after compaction, include: "Resuming Phase 4. Tasks [1-3] complete. Currently on task 4. Plan file: `.rune/plan-X-phaseN.md`"
277
+
278
+ **Timeout fallback**: If clean boundary can't be found within 30 seconds, create `.rune/.continue-here.md` and pause instead.
279
+
280
+ **Skip if**: Context is ORANGE (not RED), or fewer than 3 tasks remain in the phase.
281
+
193
282
  ## Context Budget Audit (Baseline Cost Awareness)
194
283
 
195
284
  MCP tool schemas and agent descriptions consume significant baseline context before any work begins. This section helps identify and reduce invisible context waste.
@@ -251,6 +340,8 @@ Known failure modes for this skill. Check these before declaring done.
251
340
  | Injecting stale context from previous session without marking it historical | HIGH | Constraint 3: all loaded context must include session date marker |
252
341
  | Premature compaction from over-estimated utilization | MEDIUM | Tool count is directional only — sessions with heavy Read calls may need lower thresholds; only block at confirmed RED |
253
342
  | Not activating large-file adjustment on Python/Java codebases | MEDIUM | Track Read calls returning >500 lines; if ≥3 occur, switch to adjusted (0.8x) thresholds for the session |
343
+ | Mid-loop compaction breaks tool_use/tool_result pair | CRITICAL | Always keep tool pairs together — splitting causes orphaned results and context corruption |
344
+ | Mid-loop compaction without flushing state first | HIGH | session-bridge + neural-memory MUST run before compaction — losing unsaved decisions is worse than hitting context limit |
254
345
 
255
346
  ## Done When
256
347