@rune-kit/rune 2.6.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.
- package/README.md +17 -6
- package/compiler/__tests__/executive-dashboards.test.js +285 -0
- package/compiler/__tests__/inject.test.js +128 -0
- package/compiler/__tests__/orchestrators.test.js +151 -0
- package/compiler/__tests__/org-templates.test.js +447 -0
- package/compiler/__tests__/parser.test.js +201 -147
- package/compiler/__tests__/skill-index.test.js +218 -218
- package/compiler/__tests__/status.test.js +336 -0
- package/compiler/__tests__/templates.test.js +245 -0
- package/compiler/__tests__/visualizer.test.js +325 -0
- package/compiler/adapters/antigravity.js +71 -71
- package/compiler/bin/rune.js +444 -355
- package/compiler/doctor.js +272 -1
- package/compiler/emitter.js +939 -678
- package/compiler/parser.js +498 -267
- package/compiler/status.js +342 -0
- package/compiler/visualizer.js +622 -0
- package/package.json +1 -1
- package/skills/autopsy/SKILL.md +48 -1
- package/skills/completion-gate/SKILL.md +26 -1
- package/skills/context-engine/SKILL.md +93 -2
- package/skills/cook/SKILL.md +137 -4
- package/skills/debug/SKILL.md +16 -1
- package/skills/docs/SKILL.md +28 -3
- package/skills/fix/SKILL.md +2 -1
- package/skills/mcp-builder/SKILL.md +53 -1
- package/skills/onboard/SKILL.md +51 -1
- package/skills/perf/SKILL.md +34 -1
- package/skills/plan/SKILL.md +29 -1
- package/skills/preflight/SKILL.md +35 -1
- package/skills/retro/SKILL.md +95 -1
- package/skills/review/SKILL.md +45 -1
- package/skills/scope-guard/SKILL.md +1 -0
- package/skills/sentinel/SKILL.md +35 -1
- package/skills/sentinel/references/policy-driven-constraints.md +424 -0
- package/skills/session-bridge/SKILL.md +57 -2
- package/skills/session-bridge/references/evolutionary-memory-patterns.md +312 -0
- package/skills/team/SKILL.md +15 -1
|
@@ -4,7 +4,7 @@ description: "Validates agent claims against evidence trail. Catches 'done' with
|
|
|
4
4
|
user-invocable: false
|
|
5
5
|
metadata:
|
|
6
6
|
author: runedev
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.7.0"
|
|
8
8
|
layer: L3
|
|
9
9
|
model: haiku
|
|
10
10
|
group: validation
|
|
@@ -210,6 +210,29 @@ Before emitting verdict, verify evidence quality:
|
|
|
210
210
|
| Quote matches claim exactly | CONFIRMED |
|
|
211
211
|
| Quote contradicts claim | CONTRADICTED |
|
|
212
212
|
|
|
213
|
+
### Step 5.5 — Plan Diff Check
|
|
214
|
+
|
|
215
|
+
When validating a phase within a master plan, diff actual changes against the phase plan file:
|
|
216
|
+
|
|
217
|
+
1. **Read the active phase plan** — `Glob` for `.rune/plan-*-phase*.md` matching the current phase
|
|
218
|
+
2. **Extract `## Files Touched`** — build a list of expected files (new/modify/delete)
|
|
219
|
+
3. **Extract `## Tasks`** — build a list of all `- [ ]` and `- [x]` items
|
|
220
|
+
4. **Compare against actual changes** — `git diff --name-only` (or file system scan)
|
|
221
|
+
5. **Report**:
|
|
222
|
+
|
|
223
|
+
| Check | Status |
|
|
224
|
+
|-------|--------|
|
|
225
|
+
| Unchecked task in phase plan (`- [ ]` still exists) | **INCOMPLETE** — task was not done |
|
|
226
|
+
| File in plan's "Files Touched" but not in actual diff | **MISSING** — planned file was never touched |
|
|
227
|
+
| File in actual diff but NOT in plan's "Files Touched" | **UNPLANNED** — scope creep (warn, not block) |
|
|
228
|
+
| All tasks `[x]` AND all planned files touched | **PLAN-ALIGNED** |
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Plan Diff: PLAN-ALIGNED | INCOMPLETE (2 unchecked tasks) | MISSING (1 file never touched)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Skip if**: No active phase plan found (single-task, no master plan). **MANDATORY** for multi-phase master plans.
|
|
235
|
+
|
|
213
236
|
## Verdict Rules
|
|
214
237
|
|
|
215
238
|
```
|
|
@@ -245,6 +268,7 @@ Completion Gate Report with status (CONFIRMED/UNCONFIRMED/CONTRADICTED), claim v
|
|
|
245
268
|
| Rubber-stamping — all CONFIRMED without scrutiny | HIGH | Default-FAIL mindset: actively seek 3-5 issues. Zero issues = red flag, apply skeptic sweep on weakest 2 claims |
|
|
246
269
|
| Partial completion claimed as full — 80% done but "implemented" | HIGH | Adversarial checklist: check for partial completion, scope mismatch, evidence-claim alignment |
|
|
247
270
|
| Self-Validation skipped — skill has checks but gate ignores them | HIGH | Step 1c: extract Self-Validation from skill's SKILL.md, treat each as implicit claim. Missing = UNCONFIRMED |
|
|
271
|
+
| Plan says done but phase file has unchecked tasks | HIGH | Step 5.5: diff changed files vs phase plan's Files Touched + Tasks sections |
|
|
248
272
|
|
|
249
273
|
## Done When
|
|
250
274
|
|
|
@@ -252,6 +276,7 @@ Completion Gate Report with status (CONFIRMED/UNCONFIRMED/CONTRADICTED), claim v
|
|
|
252
276
|
- Each claim matched against tool output evidence
|
|
253
277
|
- Verdict table emitted with claim/evidence/verdict for each item
|
|
254
278
|
- All 3 verification axes (Completeness/Correctness/Coherence) have at least one claim checked
|
|
279
|
+
- Plan diff check passed (if multi-phase): all tasks checked, all planned files touched
|
|
255
280
|
- Overall verdict: CONFIRMED / UNCONFIRMED / CONTRADICTED
|
|
256
281
|
- If not CONFIRMED: specific gaps listed with remediation steps
|
|
257
282
|
|
|
@@ -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.
|
|
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) | **
|
|
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
|
|
package/skills/cook/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ context: fork
|
|
|
5
5
|
agent: general-purpose
|
|
6
6
|
metadata:
|
|
7
7
|
author: runedev
|
|
8
|
-
version: "
|
|
8
|
+
version: "2.0.0"
|
|
9
9
|
layer: L1
|
|
10
10
|
model: sonnet
|
|
11
11
|
group: orchestrator
|
|
@@ -39,14 +39,41 @@ Cook supports predefined workflow chains for common task types. Use these as sho
|
|
|
39
39
|
/rune cook security → Full pipeline + sentinel@opus + sast (all phases, security-escalated)
|
|
40
40
|
/rune cook hotfix → Minimal: fix → verify → commit (Phase 4 → 6 → 7, skip scout if user provides context)
|
|
41
41
|
/rune cook nano → Trivial: do → verify → done (no phases, ≤3 steps)
|
|
42
|
+
/rune cook --template <name> → Load pre-built workflow template from installed Pro/Business packs
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
### Template Workflows (Pro/Business)
|
|
46
|
+
|
|
47
|
+
When `--template <name>` is provided, cook loads a pre-built workflow template instead of auto-detecting:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/rune cook --template product-discovery → Pro: stakeholder interviews → problem framing → competitive → spec → validation
|
|
51
|
+
/rune cook --template product-launch → Pro: spec lock → implement → quality gates → staged rollout → announcement
|
|
52
|
+
/rune cook --template product-iteration → Pro: metrics review → feedback synthesis → re-prioritize → implement → measure
|
|
53
|
+
/rune cook --template data-exploration → Pro: data profiling → hypotheses → statistical testing → visualization → report
|
|
54
|
+
/rune cook --template data-pipeline → Pro: schema design → ETL → quality gates → deploy → monitoring
|
|
55
|
+
/rune cook --template sales-outreach-campaign → Pro: prospect research → messaging → sequence → A/B test → launch
|
|
56
|
+
/rune cook --template sales-deal-review → Pro: account deep-dive → risk assessment → competitive strategy → action plan
|
|
57
|
+
/rune cook --template support-incident-response → Pro: triage → diagnose → fix → verify → postmortem → KB update
|
|
58
|
+
/rune cook --template support-kb-refresh → Pro: audit → gap analysis → draft → review → publish
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Template resolution**: Templates are `.md` files in `extensions/pro-*/templates/` or `extensions/business-*/templates/`. Each template defines: phases, skill connections, mesh signals, and acceptance criteria. The compiler includes templates in pack output during build.
|
|
62
|
+
|
|
63
|
+
**When --template is used**:
|
|
64
|
+
1. Skip Phase 1.5 (auto-detection) — template pre-selects domain and pack
|
|
65
|
+
2. Skip Phase 1.7 (workflow matching) — template IS the workflow
|
|
66
|
+
3. Load template phases as the master plan (Phase 2 becomes "review template plan" not "create plan")
|
|
67
|
+
4. Execute each template phase in order, invoking declared skills
|
|
68
|
+
5. Emit template's declared signals on completion
|
|
69
|
+
|
|
44
70
|
**Chain selection**: If user invokes `/rune cook` without a chain type, auto-detect from the task description:
|
|
45
71
|
- Contains "bug", "fix", "broken", "error" → `bugfix`
|
|
46
72
|
- Contains "refactor", "clean", "restructure" → `refactor`
|
|
47
73
|
- Contains "security", "auth", "vulnerability", "CVE" → `security`
|
|
48
74
|
- Contains "urgent", "hotfix", "production" → `hotfix`
|
|
49
75
|
- Contains "quick", "just", "chỉ cần", "copy", "move", "rename", "bump" → `nano`
|
|
76
|
+
- Contains `--template` → load template workflow (see above)
|
|
50
77
|
- Default → `feature`
|
|
51
78
|
|
|
52
79
|
## Phase Skip Rules
|
|
@@ -177,7 +204,11 @@ Skip if: bug fix with clear repro steps | user said "just do it" | fast mode + <
|
|
|
177
204
|
5. Invoke scout to scan the codebase (Glob + Grep + Read on relevant files)
|
|
178
205
|
6. Summarize: what exists, project conventions, files likely to change, active decision constraints
|
|
179
206
|
7. **Python async detection**: if Python project detected, `Grep` for async indicators (`async def`, `await`, `aiosqlite`, `aiohttp`, `asyncio.run`). If ≥3 matches → flag as **"async-first Python"** — new code defaults to `async def`
|
|
180
|
-
8.
|
|
207
|
+
8. **Explore-Before-Commit**: If scout reveals multiple viable approaches (e.g., 2+ libraries, 2+ architectural patterns), do NOT commit to an approach yet. Instead:
|
|
208
|
+
- List alternatives with 1-line trade-off each
|
|
209
|
+
- Flag to Phase 2 (plan) for formal comparison
|
|
210
|
+
- Separating "thinking" (Phase 1) from "committing" (Phase 2) prevents premature lock-in
|
|
211
|
+
9. Mark Phase 1 as `completed`
|
|
181
212
|
|
|
182
213
|
**Gate**: If scout finds the feature already exists → STOP and inform user.
|
|
183
214
|
|
|
@@ -212,7 +243,15 @@ After scout completes, check if the detected tech stack or task description matc
|
|
|
212
243
|
|
|
213
244
|
## Phase 0: RESUME CHECK (Before Phase 1)
|
|
214
245
|
|
|
215
|
-
**Goal**: Detect if a master plan already exists for this task. If so, skip Phase 1-2 and resume
|
|
246
|
+
**Goal**: Detect if a master plan already exists for this task, or if a `--template` was specified. If so, skip Phase 1-2 and resume/load the workflow.
|
|
247
|
+
|
|
248
|
+
**Step 0.4 — Template Detection**: If user passed `--template <name>`:
|
|
249
|
+
1. Search installed pack templates for the name: `Glob` for `extensions/*/templates/<name>.md` and `extensions/pro-*/templates/<name>.md`
|
|
250
|
+
2. If found: `Read` the template file → parse phases, signals, connections, acceptance criteria
|
|
251
|
+
3. Generate a master plan from the template: each template phase becomes a plan phase
|
|
252
|
+
4. Write plan files to `.rune/plan-<template-name>.md` + `.rune/plan-<template-name>-phaseN.md`
|
|
253
|
+
5. Announce "Loading template: <name> (<pack>)" → skip Phase 1, 1.5, 1.7, 2 → proceed to Phase 4 with Phase 1 of the template
|
|
254
|
+
6. If template not found: warn user and fall through to normal workflow
|
|
216
255
|
|
|
217
256
|
**Step 0.5 — Cross-Project Recall**: Call `neural-memory` (Recall Mode) with 3-5 topics relevant to the current task. Always prefix queries with the project name (e.g., `"ProjectName auth pattern"` not `"auth pattern"`).
|
|
218
257
|
|
|
@@ -427,7 +466,15 @@ Before entering ANY Phase N+1, assert: Phase N `completed` in TodoWrite | gate c
|
|
|
427
466
|
2. Save to `.rune/decisions.md` (approach + trade-offs), `.rune/progress.md` (task complete), `.rune/conventions.md` (new patterns)
|
|
428
467
|
3. **Skill metrics** → `.rune/metrics/skills.json`: increment phase run/skip counts, quality gate results, debug loop counts under `cook` key
|
|
429
468
|
4. **Routing overrides** (H3): if Phase 4 hit max loops for an error pattern → write rule to `.rune/metrics/routing-overrides.json`. Max 10 active rules.
|
|
430
|
-
5. **Step 8.5 —
|
|
469
|
+
5. **Step 8.5 — Cross-Cutting Sweep**: After commit, check if this phase changed stats (skill count, test count, signal count, pack count, layer counts). If ANY stat changed:
|
|
470
|
+
- [ ] `README.md` — stats, badges, feature list
|
|
471
|
+
- [ ] `docs/index.html` (landing page) — meta tags, hero badge, install section, mesh stats, footer
|
|
472
|
+
- [ ] `dashboard.html` (if local) — KPI cards, test count, skill tabs, layer counts
|
|
473
|
+
- [ ] `CLAUDE.md` — commands, test count, skill list
|
|
474
|
+
- [ ] `MEMORY.md` — milestones, version info
|
|
475
|
+
|
|
476
|
+
**Skip if**: No stats changed (pure refactor, docs-only, style change). **MANDATORY** if any numeric stat in README differs from actual.
|
|
477
|
+
6. **Step 8.6 — Capture Learnings**: `neural-memory` (Capture Mode) — 2-5 memories: architecture decisions, patterns, error root-causes, trade-offs. Cognitive language (causal/decisional/comparative). Tags: `[project, tech, topic]`. Priority 5 routine / 7-8 decisions / 9-10 critical errors.
|
|
431
478
|
6. Mark Phase 8 as `completed`
|
|
432
479
|
|
|
433
480
|
## Autonomous Loop Patterns
|
|
@@ -487,6 +534,56 @@ If ambiguous between Cancel and Steer → ask user: "Did you mean stop, or chang
|
|
|
487
534
|
Hard caps: MAX_DEBUG_LOOPS=3, MAX_QUALITY_LOOPS=2, MAX_REPLAN=1, MAX_PIVOT=1, MAX_FIXES=30, WTF_THRESHOLD=20%.
|
|
488
535
|
Escalation chain: debug-fix (3x) → re-plan (1x) → brainstorm rescue (1x) → THEN escalate to user.
|
|
489
536
|
|
|
537
|
+
### Structured Escalation Report
|
|
538
|
+
|
|
539
|
+
> From agency-agents (msitarzewski/agency-agents, 50.8k★): "After 3 retry failures, structured escalation prevents cargo-cult retrying."
|
|
540
|
+
|
|
541
|
+
When escalation chain exhausts (all retries hit) or cook returns `BLOCKED`, produce a Structured Escalation Report instead of a vague "I can't do this":
|
|
542
|
+
|
|
543
|
+
```markdown
|
|
544
|
+
## Escalation Report
|
|
545
|
+
- **Task**: [original task description]
|
|
546
|
+
- **Status**: BLOCKED
|
|
547
|
+
- **Attempts**: [count] across [N] phases
|
|
548
|
+
|
|
549
|
+
### Failure History
|
|
550
|
+
| # | Approach | Phase | Outcome | Root Cause |
|
|
551
|
+
|---|---------|-------|---------|------------|
|
|
552
|
+
| 1 | Direct fix | Phase 4 | Tests fail — null ref in auth.ts:42 | Missing user context |
|
|
553
|
+
| 2 | Re-plan with guard clause | Phase 4 | Build fails — circular import | Guard approach introduces cycle |
|
|
554
|
+
| 3 | Brainstorm rescue → adapter pattern | Phase 4 | Tests pass but perf regression 3x | Adapter adds indirection overhead |
|
|
555
|
+
|
|
556
|
+
### Root Cause Analysis
|
|
557
|
+
[1-2 sentences: why ALL approaches failed — is it architectural, environmental, or requirements-level?]
|
|
558
|
+
|
|
559
|
+
### Recommended Resolutions (pick one)
|
|
560
|
+
1. **Reassign** — different skill/agent with fresh context
|
|
561
|
+
2. **Decompose** — break into smaller sub-tasks that CAN succeed independently
|
|
562
|
+
3. **Revise requirements** — relax constraint X to unblock (specify which)
|
|
563
|
+
4. **Accept partial** — ship what works, defer blocked portion
|
|
564
|
+
5. **Defer** — park this task, work on something else first
|
|
565
|
+
|
|
566
|
+
### Impact Assessment
|
|
567
|
+
- **Blocked by this**: [downstream tasks/phases that depend on this]
|
|
568
|
+
- **Not blocked**: [independent work that can continue]
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
<HARD-GATE>
|
|
572
|
+
"Bad work is worse than no work." Cook MUST produce this report rather than attempting a 4th variant of a failing approach. Escalating is not failure — shipping broken code is.
|
|
573
|
+
</HARD-GATE>
|
|
574
|
+
|
|
575
|
+
### Subagent Question Gate
|
|
576
|
+
|
|
577
|
+
> From superpowers (obra/superpowers, 84k★): "Subagents that start work without asking questions produce the wrong thing 40% of the time."
|
|
578
|
+
|
|
579
|
+
Before dispatching a sub-skill (fix, test, review) for a non-trivial task (3+ files OR ambiguous scope):
|
|
580
|
+
|
|
581
|
+
1. **Invite questions**: Include in the handoff: "Before starting, ask up to 3 clarifying questions if anything is unclear."
|
|
582
|
+
2. **Answer before work**: If the sub-skill returns questions → answer them, THEN re-dispatch with answers included.
|
|
583
|
+
3. **Skip if**: Fast/Nano rigor, single-file fix, or sub-skill is haiku-tier (too cheap to gate).
|
|
584
|
+
|
|
585
|
+
This prevents the #1 parallel work failure: sub-skill assumes wrong interpretation, builds 500 LOC, then gets rejected in review.
|
|
586
|
+
|
|
490
587
|
### Subagent Status Protocol
|
|
491
588
|
|
|
492
589
|
<MUST-READ path="references/subagent-status.md" trigger="when cook or any sub-skill needs to return a status"/>
|
|
@@ -615,6 +712,42 @@ Mentally track tool call fingerprints. 3 identical calls → WARN. 5 identical c
|
|
|
615
712
|
| Quality Gate | preflight + sentinel + review before Phase 7 | Fix findings, re-run |
|
|
616
713
|
| Verification Gate | lint + types + tests + build green before commit | Fix, re-run |
|
|
617
714
|
|
|
715
|
+
## Structured Output Contract (Prompt-as-API Pattern)
|
|
716
|
+
|
|
717
|
+
When cook invokes sub-skills that produce structured output (e.g., `ba` for requirements, `plan` for implementation plans, `test` for test specs), use the **Prompt-as-API-Contract** pattern: specify the exact output schema in the invocation prompt so the sub-skill returns machine-parseable results, not free-form prose.
|
|
718
|
+
|
|
719
|
+
### Pattern
|
|
720
|
+
|
|
721
|
+
```
|
|
722
|
+
INVOCATION: "Analyze [X] and return results as JSON matching this schema:
|
|
723
|
+
{
|
|
724
|
+
"insights": [{ "id": string, "category": string, "description": string, "actionable": string }],
|
|
725
|
+
"confidence": number,
|
|
726
|
+
"next_steps": string[]
|
|
727
|
+
}
|
|
728
|
+
Do NOT include explanatory text outside the JSON block."
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
### When to Apply
|
|
732
|
+
|
|
733
|
+
| Phase | Sub-skill | Output Contract |
|
|
734
|
+
|-------|-----------|----------------|
|
|
735
|
+
| Phase 1 | `ba` | `{ requirements: [{id, priority, description, acceptance_criteria}], ambiguities: string[] }` |
|
|
736
|
+
| Phase 2 | `plan` | `{ phases: [{name, tasks: [{description, files, effort}], dependencies}] }` |
|
|
737
|
+
| Phase 3 | `test` | `{ test_cases: [{name, type, file, assertion}], coverage_targets: string[] }` |
|
|
738
|
+
| Phase 5 | `review` | `{ findings: [{severity, file, line, description, fix}], verdict: "PASS"|"WARN"|"BLOCK" }` |
|
|
739
|
+
|
|
740
|
+
### Rules
|
|
741
|
+
|
|
742
|
+
- Include 1-2 concrete examples in the prompt — examples are worth more than schema descriptions
|
|
743
|
+
- Always specify "Do NOT include explanatory text outside the JSON/markdown block" — LLMs default to wrapping structured output in prose
|
|
744
|
+
- When the output will be consumed by another skill (not displayed to user), ALWAYS use this pattern
|
|
745
|
+
- When the output will be displayed to the user, use markdown format instead — humans don't read JSON
|
|
746
|
+
|
|
747
|
+
### Why
|
|
748
|
+
|
|
749
|
+
Free-form sub-skill output forces the calling skill to parse natural language — fragile and lossy. Structured contracts make skill-to-skill communication reliable, enable automated validation, and reduce the tokens wasted on parsing instructions.
|
|
750
|
+
|
|
618
751
|
## Output Format
|
|
619
752
|
|
|
620
753
|
<MUST-READ path="references/output-format.md" trigger="before emitting the Cook Report at end of any session"/>
|
package/skills/debug/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: debug
|
|
|
3
3
|
description: Root cause analysis for bugs and unexpected behavior. Traces errors through code, uses structured reasoning, and hands off to fix when cause is found. Core of the debug↔fix mesh.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.9.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: development
|
|
@@ -232,6 +232,21 @@ Track fix attempts in the Debug Report. If this is attempt N>1 for the same symp
|
|
|
232
232
|
- Explain why the previous fix didn't hold
|
|
233
233
|
- If N=3: trigger the escalation gate above — classify and route accordingly
|
|
234
234
|
|
|
235
|
+
### 3+ Fixes as Architectural Signal
|
|
236
|
+
|
|
237
|
+
> From superpowers (obra/superpowers, 84k★): "Each fix revealing new problems elsewhere = structural issue, not a bug hunt."
|
|
238
|
+
|
|
239
|
+
When 3+ **distinct** fixes fail (not retries of the same fix), STOP treating it as a bug:
|
|
240
|
+
|
|
241
|
+
| Signal | Interpretation | Next Step |
|
|
242
|
+
|--------|---------------|-----------|
|
|
243
|
+
| Same blocker each time (API limit, platform gap) | Wrong approach | `brainstorm(mode="rescue")` — need fundamentally different path |
|
|
244
|
+
| Different bugs each fix (null → race → type) | Wrong architecture | `plan` redesign — module has structural problems |
|
|
245
|
+
| Each fix creates a new bug elsewhere | Tight coupling | The module boundary is wrong — need to redraw boundaries before fixing |
|
|
246
|
+
| Fix works locally but fails in integration | Missing contract | Cross-module interface is undefined — add explicit contracts first |
|
|
247
|
+
|
|
248
|
+
**Key insight**: After 3 failures, question the DESIGN, not the CODE. "Try harder" is never the right answer at this point.
|
|
249
|
+
|
|
235
250
|
### Step 7: Report
|
|
236
251
|
|
|
237
252
|
Produce structured output and hand off to rune:fix.
|
package/skills/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: docs
|
|
|
3
3
|
description: Auto-generate and maintain project documentation. Creates README, API docs, architecture docs, changelogs, and keeps them in sync with code changes. The "docs are never outdated" skill.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.3.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: delivery
|
|
@@ -174,9 +174,32 @@ Never silently remove doc content. If code was deleted, mark the doc section as
|
|
|
174
174
|
|
|
175
175
|
Delegate to `rune:git changelog` to produce a changelog entry from commits since last docs update.
|
|
176
176
|
|
|
177
|
-
#### Step 4 —
|
|
177
|
+
#### Step 4 — Cross-Doc Consistency Pass
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
> From gstack (garrytan/gstack, 50.9k★): "Cross-document consistency prevents the #2 docs problem: docs that exist but contradict each other."
|
|
180
|
+
|
|
181
|
+
After updating any doc, verify consistency across all project documentation:
|
|
182
|
+
|
|
183
|
+
| Check | Files | What to Compare |
|
|
184
|
+
|-------|-------|----------------|
|
|
185
|
+
| **Version numbers** | README, CLAUDE.md, package.json, CHANGELOG | Must all match current version |
|
|
186
|
+
| **Feature lists** | README, landing page, CLAUDE.md | Same features listed (may differ in detail level) |
|
|
187
|
+
| **Stats** | README, CLAUDE.md, landing page, dashboard | Skill count, test count, signal count must match |
|
|
188
|
+
| **Commands** | README, CLAUDE.md, docs/ | Same commands with same flags |
|
|
189
|
+
| **Tech stack** | README, ARCHITECTURE.md, CLAUDE.md | Consistent framework/library references |
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
Cross-Doc Consistency:
|
|
193
|
+
- [x] README.md ↔ CLAUDE.md: versions match, commands match
|
|
194
|
+
- [x] README.md ↔ docs/index.html: stats match, features match
|
|
195
|
+
- [ ] README.md says "61 skills" but CLAUDE.md says "59" → FIX CLAUDE.md
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Fix inconsistencies immediately** — don't just report them. Update the stale doc to match the source of truth (usually the code or the most recently updated doc).
|
|
199
|
+
|
|
200
|
+
#### Step 5 — Report
|
|
201
|
+
|
|
202
|
+
Show user: what was updated, what was added, what was flagged for review. Include Cross-Doc Consistency results.
|
|
180
203
|
|
|
181
204
|
### API Mode
|
|
182
205
|
|
|
@@ -316,6 +339,8 @@ Docs Update Report:
|
|
|
316
339
|
| API docs with wrong request/response shapes | HIGH | Extract from Zod/Pydantic/TypeScript types, not from memory |
|
|
317
340
|
| Missing Quick Start section | MEDIUM | Constraint 4: every README has Quick Start |
|
|
318
341
|
| Changelog with orphan PR links | LOW | Validate PR numbers exist before linking |
|
|
342
|
+
| Cross-document inconsistency (README says X, CLAUDE.md says Y) | HIGH | Step 7: Cross-Doc Consistency Pass — verify stats, versions, and feature lists match across all docs |
|
|
343
|
+
| Updating one doc but not others (stats drift) | HIGH | After any doc update, sweep all related docs for stale stats — especially README ↔ CLAUDE.md ↔ landing page |
|
|
319
344
|
|
|
320
345
|
## Done When
|
|
321
346
|
|
package/skills/fix/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: fix
|
|
|
3
3
|
description: Apply code changes and fixes. Writes implementation code, applies bug fixes, and verifies changes with tests. Core action hub in the development mesh.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.7.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: development
|
|
@@ -263,6 +263,7 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
263
263
|
| Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
|
|
264
264
|
| Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests pass — premature cleanup erases failure history |
|
|
265
265
|
| Runaway fix loop — 20+ fixes without checking quality decay | HIGH | Step 4.5: WTF-likelihood self-regulation. >20% risk = STOP. Hard cap 30 fixes/session. Each fix adds risk — diminishing returns after ~15 |
|
|
266
|
+
| Each fix creates a new bug elsewhere — whack-a-mole | CRITICAL | Tight coupling signal. STOP fixing → escalate to debug with note "each fix creates new failure — suspect structural issue". Debug will route to plan for redesign |
|
|
266
267
|
|
|
267
268
|
## Done When
|
|
268
269
|
|
|
@@ -3,7 +3,7 @@ name: mcp-builder
|
|
|
3
3
|
description: Build Model Context Protocol servers from specifications. Generates tool definitions, resource handlers, and test suites for MCP servers in TypeScript or Python (FastMCP).
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.4.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: creation
|
|
@@ -321,6 +321,58 @@ mcp-server-<name>/
|
|
|
321
321
|
- Installation: Claude Code, Cursor, Windsurf config snippets
|
|
322
322
|
- Configuration reference (env vars with descriptions)
|
|
323
323
|
|
|
324
|
+
## Reference Pattern: Multi-Provider Adapter
|
|
325
|
+
|
|
326
|
+
When the MCP server needs to call multiple AI providers (e.g., both Anthropic and OpenAI), use the **Provider Adapter** pattern to normalize different APIs behind a unified interface.
|
|
327
|
+
|
|
328
|
+
### Interface
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
interface ProviderAdapter {
|
|
332
|
+
formatRequest(params: RequestParams): { url: string; init: RequestInit };
|
|
333
|
+
parseResponse(data: unknown): { content: string; usage: TokenUsage | null };
|
|
334
|
+
formatStreamRequest(params: RequestParams): { url: string; init: RequestInit };
|
|
335
|
+
parseSSEEvent(eventType: string, data: string): StreamChunk | null;
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Discriminated Union for Stream Chunks
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
type StreamChunk =
|
|
343
|
+
| { type: "thinking"; content: string }
|
|
344
|
+
| { type: "text"; content: string }
|
|
345
|
+
| { type: "done" }
|
|
346
|
+
| { type: "done_with_usage"; usage: TokenUsage }
|
|
347
|
+
| { type: "usage_delta"; inputTokens?: number; outputTokens?: number }
|
|
348
|
+
| { type: "error"; message: string };
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### When to Apply
|
|
352
|
+
|
|
353
|
+
- MCP server wraps multiple AI providers (e.g., a router server that dispatches to Claude, GPT, or local models)
|
|
354
|
+
- MCP server aggregates responses from multiple APIs with different response formats
|
|
355
|
+
- MCP server needs to support streaming from providers with different SSE event schemas
|
|
356
|
+
|
|
357
|
+
### Key Implementation Notes
|
|
358
|
+
|
|
359
|
+
- Each provider adapter handles its own SSE event types (Anthropic: `content_block_delta`, `message_start`; OpenAI: `response.output_text.delta`, `[DONE]`)
|
|
360
|
+
- Buffer management for SSE: handle incomplete lines, track event types, manage abort signals
|
|
361
|
+
- Provider-specific prompt tuning: some models benefit from additional constraints (e.g., "Maximum 2-3 paragraphs" for verbose models)
|
|
362
|
+
- Per-provider token tracking: normalize different usage reporting formats into a single `TokenUsage` type
|
|
363
|
+
|
|
364
|
+
### Cost-Aware Model Selection
|
|
365
|
+
|
|
366
|
+
When building MCP servers that call AI providers, support **dual-model configuration** — allow users to specify a primary model for critical operations and a cheaper model for background tasks (summarization, classification, metadata extraction). This avoids burning expensive API credits on tasks that don't need maximum quality.
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
// config.ts
|
|
370
|
+
const config = {
|
|
371
|
+
primaryModel: process.env.PRIMARY_MODEL || 'claude-sonnet-4-20250514',
|
|
372
|
+
backgroundModel: process.env.BACKGROUND_MODEL || 'claude-haiku-4-5-20251001',
|
|
373
|
+
};
|
|
374
|
+
```
|
|
375
|
+
|
|
324
376
|
## Constraints
|
|
325
377
|
|
|
326
378
|
1. MUST validate all tool inputs with Zod (TS) or Pydantic (Python) — never trust AI-provided inputs
|
package/skills/onboard/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: onboard
|
|
|
3
3
|
description: Auto-generate project context for AI sessions. Scans codebase, creates CLAUDE.md and .rune/ setup so every future session starts with full context.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.4.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: quality
|
|
@@ -227,6 +227,56 @@ Audit the project's baseline context cost from MCP servers and agent configurati
|
|
|
227
227
|
|
|
228
228
|
**Skip if**: Total MCP tools ≤80 AND CLAUDE.md ≤150 lines (healthy baseline).
|
|
229
229
|
|
|
230
|
+
### Step 6e — AI-Driven Interview (Optional, User-Initiated)
|
|
231
|
+
|
|
232
|
+
When invoked as `/rune onboard --interview` or when the project is too ambiguous for automated detection (e.g., no package.json, no clear entry point, mixed languages), switch to **conversational onboarding** — the AI asks targeted questions instead of relying solely on file scanning.
|
|
233
|
+
|
|
234
|
+
#### Interview Flow
|
|
235
|
+
|
|
236
|
+
Ask 5-8 questions in sequence, adapting based on answers. Start broad, narrow based on responses:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
Q1: "What does this project do in one sentence?"
|
|
240
|
+
→ Captures purpose (README may be missing or outdated)
|
|
241
|
+
|
|
242
|
+
Q2: "Who uses this — internal team, external users, or both?"
|
|
243
|
+
→ Determines audience, affects DEVELOPER-GUIDE.md tone
|
|
244
|
+
|
|
245
|
+
Q3: "What's the main entry point — where does execution start?"
|
|
246
|
+
→ Bypasses file scanning for complex monorepos
|
|
247
|
+
|
|
248
|
+
Q4: "What commands do you use daily? (dev server, tests, build)"
|
|
249
|
+
→ Gets verified commands instead of guessing from config files
|
|
250
|
+
|
|
251
|
+
Q5: "Any areas of the codebase you'd warn a new developer about?"
|
|
252
|
+
→ Captures tribal knowledge that no scan can detect
|
|
253
|
+
|
|
254
|
+
Q6: "Are there external services this depends on? (databases, APIs, queues)"
|
|
255
|
+
→ Maps integration points for Architecture Map
|
|
256
|
+
|
|
257
|
+
Q7: "What's the deployment story — how does code get to production?"
|
|
258
|
+
→ Captures CI/CD context
|
|
259
|
+
|
|
260
|
+
Q8 (conditional): "Anything else a new session should know that's not in the code?"
|
|
261
|
+
→ Catches edge cases, workarounds, known issues
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Interview Rules
|
|
265
|
+
|
|
266
|
+
- **Adapt**: Skip questions that were already answered by earlier responses. If Q1 reveals "it's a Next.js app", don't ask about the framework.
|
|
267
|
+
- **Validate**: Cross-reference answers with actual file scan results. If user says "we use Jest" but `vitest.config.ts` exists, ask to clarify.
|
|
268
|
+
- **Merge**: Interview answers supplement (not replace) automated scan. Scan provides facts, interview provides context and intent.
|
|
269
|
+
- **Store**: Save interview responses as high-confidence entries in `.rune/conventions.md` and `.rune/cumulative-notes.md` (tagged `[from-interview]`)
|
|
270
|
+
|
|
271
|
+
#### When to Auto-Suggest Interview
|
|
272
|
+
|
|
273
|
+
Suggest switching to interview mode (but don't force it) when:
|
|
274
|
+
- Step 2 produces 3+ "unknown" fields in tech stack detection
|
|
275
|
+
- Project has no README.md and no package.json/pyproject.toml/Cargo.toml
|
|
276
|
+
- Project appears to be a monorepo with 3+ distinct sub-projects
|
|
277
|
+
|
|
278
|
+
Output: `"ℹ️ This project is hard to auto-detect. Run /rune onboard --interview for guided setup."`
|
|
279
|
+
|
|
230
280
|
### Step 7 — Commit
|
|
231
281
|
Use `Bash` to stage and commit the generated files:
|
|
232
282
|
```bash
|