@rune-kit/rune 2.6.0 → 2.8.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 (42) hide show
  1. package/README.md +22 -6
  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__/parser.test.js +201 -147
  7. package/compiler/__tests__/skill-index.test.js +218 -218
  8. package/compiler/__tests__/status.test.js +336 -0
  9. package/compiler/__tests__/templates.test.js +245 -0
  10. package/compiler/__tests__/visualizer.test.js +325 -0
  11. package/compiler/adapters/antigravity.js +71 -71
  12. package/compiler/bin/rune.js +444 -355
  13. package/compiler/doctor.js +272 -1
  14. package/compiler/emitter.js +939 -678
  15. package/compiler/parser.js +498 -267
  16. package/compiler/status.js +342 -0
  17. package/compiler/visualizer.js +622 -0
  18. package/package.json +1 -1
  19. package/skills/autopsy/SKILL.md +48 -1
  20. package/skills/completion-gate/SKILL.md +51 -3
  21. package/skills/context-engine/SKILL.md +141 -2
  22. package/skills/cook/SKILL.md +177 -4
  23. package/skills/debug/SKILL.md +50 -1
  24. package/skills/docs/SKILL.md +28 -3
  25. package/skills/fix/SKILL.md +26 -1
  26. package/skills/mcp-builder/SKILL.md +53 -1
  27. package/skills/onboard/SKILL.md +51 -1
  28. package/skills/perf/SKILL.md +34 -1
  29. package/skills/plan/SKILL.md +27 -1
  30. package/skills/preflight/SKILL.md +35 -1
  31. package/skills/research/SKILL.md +24 -1
  32. package/skills/retro/SKILL.md +95 -1
  33. package/skills/review/SKILL.md +45 -1
  34. package/skills/scope-guard/SKILL.md +1 -0
  35. package/skills/scout/SKILL.md +22 -1
  36. package/skills/sentinel/SKILL.md +35 -1
  37. package/skills/sentinel/references/policy-driven-constraints.md +424 -0
  38. package/skills/sentinel-env/SKILL.md +0 -2
  39. package/skills/session-bridge/SKILL.md +57 -2
  40. package/skills/session-bridge/references/evolutionary-memory-patterns.md +312 -0
  41. package/skills/team/SKILL.md +15 -1
  42. package/skills/verification/SKILL.md +0 -2
@@ -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.0"
6
+ version: "0.8.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -68,6 +68,29 @@ Read and fully understand the fix request before touching any file.
68
68
  - If the request is ambiguous or root cause is unclear → call `rune:debug` before proceeding
69
69
  - Note the scope: single function, single file, or multi-file change
70
70
 
71
+ ### Step 1b: Recovery Policy Matrix
72
+
73
+ Before locating code, classify the incoming error/task into a recovery category to determine the right fix strategy. This prevents wasting effort on the wrong approach.
74
+
75
+ | Error Type | Recovery Action | Strategy |
76
+ |------------|----------------|----------|
77
+ | `INPUT_REQUIRED` — missing user input, ambiguous spec | **PROMPT_USER** | Return NEEDS_CONTEXT with specific questions. Do NOT guess. |
78
+ | `INPUT_INVALID` — wrong format, type mismatch, encoding | **AUTO_FIX** | Fix at validation layer. Add schema validation (Zod/Pydantic) if missing. |
79
+ | `TIMEOUT` — operation exceeded time limit | **RETRY** with adjustment | Increase timeout, add retry with exponential backoff, or chunk the operation. |
80
+ | `POLICY_BLOCKED` — security gate, lint rule, contract violation | **ABORT** | Do NOT work around the policy. Report to caller with the specific rule that blocked. |
81
+ | `PERMISSION_DENIED` — auth failure, file access, API scope | **PROMPT_USER** | Cannot fix permissions programmatically. Report exact permission needed. |
82
+ | `DEPENDENCY_ERROR` — missing package, version conflict, broken dep | **AUTO_FIX** | Install missing dep, resolve version conflict, or suggest alternative package. |
83
+ | `LOGIC_ERROR` — wrong output, incorrect calculation, bad algorithm | **INVESTIGATE** | Do NOT auto-fix. Call `rune:debug` — logic errors need root cause analysis. |
84
+ | `ENVIRONMENT_ERROR` — wrong Node/Python version, missing system dep | **PROMPT_USER** | Report exact version/tool needed. Agent cannot change system environment. |
85
+
86
+ **Decision flow**:
87
+ 1. Read the incoming diagnosis/error
88
+ 2. Classify into one of the 8 error types above
89
+ 3. Apply the recovery action — this determines whether to proceed (AUTO_FIX, RETRY), ask (PROMPT_USER), stop (ABORT), or re-diagnose (INVESTIGATE)
90
+ 4. Announce: "Recovery policy: {error_type} → {action}"
91
+
92
+ **Why**: Without a recovery matrix, fix attempts the same strategy (read → change → test) for every error type. A POLICY_BLOCKED error doesn't need code reading — it needs the policy reported. An INPUT_REQUIRED error doesn't need debugging — it needs a question asked. Matching strategy to error type eliminates wasted cycles.
93
+
71
94
  ### Step 2: Locate
72
95
 
73
96
  Find the exact files and lines to change.
@@ -263,6 +286,8 @@ Known failure modes for this skill. Check these before declaring done.
263
286
  | Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
264
287
  | 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
288
  | 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 |
289
+ | 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 |
290
+ | Applying same fix strategy to every error type | MEDIUM | Step 1b Recovery Policy Matrix: classify error type FIRST — POLICY_BLOCKED needs reporting not fixing, INPUT_REQUIRED needs questions not code |
266
291
 
267
292
  ## Done When
268
293
 
@@ -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.3.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
@@ -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.3.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
@@ -3,7 +3,7 @@ name: perf
3
3
  description: Performance regression gate. Detects N+1 queries, sync-in-async, missing indexes, memory leaks, and bundle bloat before they reach production.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -242,6 +242,39 @@ Emit structured report:
242
242
  ### Verdict: PASS | WARN | BLOCK
243
243
  ```
244
244
 
245
+ ### Step 8.5 — Token Budget Tracking (AI-Powered Apps)
246
+
247
+ For projects that call AI APIs (detected via imports of `anthropic`, `openai`, `@anthropic-ai/sdk`, `@ai-sdk/core`, `langchain`, `llamaindex`, or `fastmcp`), audit token usage patterns per operation type.
248
+
249
+ **Scan for:**
250
+
251
+ | Pattern | Finding | Impact |
252
+ |---------|---------|--------|
253
+ | AI call inside a loop without batching | `TOKEN_LOOP — [file:line] — AI call in loop over [collection] — batch or parallelize` | Cost scales linearly with collection size |
254
+ | No token usage tracking | `NO_TOKEN_TRACKING — [file:line] — AI response usage not captured — add cost logging` | Invisible spend, no budget control |
255
+ | Expensive model for simple tasks | `MODEL_MISMATCH — [file:line] — using [opus/gpt-4] for [classification/extraction] — use [haiku/gpt-4.1-mini]` | 10-30x cost difference for same result |
256
+ | Missing max_tokens on open-ended prompts | `UNBOUNDED_TOKENS — [file:line] — no max_tokens on [call] — add limit to prevent runaway cost` | Single call can consume entire budget |
257
+ | Duplicate AI calls for same input | `DUPLICATE_AI_CALL — [file:line] — same prompt sent to [provider] without caching — add response cache` | Wasted tokens on redundant calls |
258
+
259
+ **Per-Operation Cost Awareness:**
260
+
261
+ When token tracking IS present, analyze the operation type breakdown:
262
+
263
+ ```
264
+ Operation Type Avg Tokens Frequency Monthly Est.
265
+ ─────────────────────────────────────────────────────────────
266
+ Chat (primary) 2,500 in/800 out high $X.XX
267
+ Background notes 500 in/200 out per-chat $X.XX
268
+ Summarization 1,500 in/300 out periodic $X.XX
269
+ Classification 200 in/50 out high $X.XX
270
+ ─────────────────────────────────────────────────────────────
271
+ Total estimated monthly $X.XX
272
+ ```
273
+
274
+ **Report this under a `### AI Token Budget` subsection** in the Perf Report. Only include when AI API usage detected — skip entirely for non-AI projects.
275
+
276
+ **Key insight**: The most impactful optimization is often **model selection per operation** — using a cheaper model for background tasks (summarization, classification, metadata extraction) while reserving expensive models for primary user-facing interactions. A 10x cost reduction on 60% of calls = 6x overall savings.
277
+
245
278
  ## Output Format
246
279
 
247
280
  ```
@@ -3,7 +3,7 @@ name: plan
3
3
  description: Create structured implementation plans from requirements. Produces master plan + phase files for enterprise-scale project management. Master plan = overview (<80 lines). Phase files = execution detail (<150 lines each). Each session handles 1 phase. Uses opus for deep reasoning.
4
4
  metadata:
5
5
  author: runedev
6
- version: "1.1.0"
6
+ version: "1.2.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: creation
@@ -260,6 +260,30 @@ After spec approved → transition to Implementation Mode.
260
260
 
261
261
  Every plan output — master plan, phase file, or inline plan — MUST end with an **Outcome Block** containing: What Was Planned + Immediate Next Action (single action, imperative) + How to Measure table (at least one shell command).
262
262
 
263
+ ## Change Stacking (Overlap Detection)
264
+
265
+ When producing phase files with wave-based task grouping, every task MUST declare dependency metadata:
266
+
267
+ ```markdown
268
+ ### Task: Implement auth middleware
269
+ - **File**: `src/middleware/auth.ts` — new
270
+ - **touches**: [src/middleware/auth.ts, src/types/auth.d.ts]
271
+ - **provides**: [AuthMiddleware, verifyToken()]
272
+ - **requires**: [UserModel from Wave 1]
273
+ - **depends_on**: [task-1a]
274
+ ```
275
+
276
+ **Pre-dispatch validation** (run after all tasks written, before presenting plan):
277
+
278
+ | Check | Detection | Action |
279
+ |-------|-----------|--------|
280
+ | **File overlap** | Same file in `touches[]` of 2+ tasks in same wave | BLOCK — move to sequential waves or merge tasks |
281
+ | **Missing dependency** | Task A's `requires[]` not in any prior task's `provides[]` | BLOCK — add missing task or fix dependency chain |
282
+ | **Cycle detection** | Task A `depends_on` B, B `depends_on` A | BLOCK — decompose into smaller tasks to break cycle |
283
+ | **Orphaned provides** | Task declares `provides[]` but no future task `requires[]` it | WARN — may indicate dead code or missing consumer task |
284
+
285
+ **Skip if**: Inline plan (trivial task), single-phase plan, or all tasks are strictly sequential.
286
+
263
287
  ## Constraints
264
288
 
265
289
  1. MUST produce master plan + phase files for non-trivial tasks (3+ phases OR 5+ files OR 100+ LOC)
@@ -309,6 +333,8 @@ Every plan output — master plan, phase file, or inline plan — MUST end with
309
333
  | Recommending shortcut approach without Completeness Score | MEDIUM | Step 5.5: every alternative needs X/10 Completeness score + dual effort estimate (human vs AI). "Saves 70 LOC" is not a reason when AI makes the delta cost minutes |
310
334
  | Plan output missing Outcome Block | MEDIUM | Every plan output MUST end with Outcome Block (What Was Planned + Immediate Next Action + How to Measure) — executor drift when omitted |
311
335
  | Outcome Block "Next Action" is a list, not one action | LOW | One action only — ambiguity about where to start causes re-analysis and lost context |
336
+ | Overlapping file ownership across parallel phases/streams | HIGH | Change Stacking: every task declares `touches[]` — overlap detection flags same file in 2+ tasks before execution |
337
+ | Missing dependency between tasks that share artifacts | HIGH | Every task declares `provides[]` and `requires[]` — cycle detection + missing dep check before dispatch |
312
338
 
313
339
  ## Self-Validation
314
340
 
@@ -3,7 +3,7 @@ name: preflight
3
3
  description: Pre-commit quality gate that catches "almost right" code. Goes beyond linting — checks logic correctness, error handling, regressions, and completeness.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.6.0"
6
+ version: "0.7.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -237,6 +237,40 @@ When a domain pack is installed (e.g., `@rune-pro/finance`, `@rune-pro/legal`),
237
237
  - `src/billing/invoice.ts:42` — WARN: price calculation uses `toFixed(2)` instead of `Intl.NumberFormat`
238
238
  ```
239
239
 
240
+ ### Step 4.6 — Organization Approval Requirements (Business)
241
+
242
+ If `.rune/org/org.md` exists, load organization approval workflows and enforce them as additional quality gates.
243
+
244
+ 1. `Read` `.rune/org/org.md` and extract `## Policies`, `## Approval Flows`, and `## Governance Level`
245
+ 2. Apply organization-level quality requirements:
246
+
247
+ | Org Policy | Preflight Check | Severity |
248
+ |------------|----------------|----------|
249
+ | `minimum_reviewers` | Verify PR has required reviewer count before merge | WARN: "Org requires {N} reviewers" |
250
+ | `self-merge_allowed` | If "Never" or "No", flag self-merge attempts | BLOCK if org prohibits |
251
+ | `required_checks` | Verify all org-required checks (tests, security scan, type check, lint) are passing | BLOCK if missing |
252
+ | `staging_required` | If "Yes", verify staging deployment exists before production | WARN if no staging step |
253
+ | `feature_flags` | If "Required for user-facing changes", flag new UI without feature flag | WARN |
254
+ | `cross-domain_changes` | If changes span multiple team domains, require reviewer from each | WARN |
255
+
256
+ 3. Load `## Approval Flows > ### Feature Launch` and display the required approval chain:
257
+ - Output: "Org approval chain: {flow}" so developer knows the full pipeline
258
+ - If governance level is "Maximum", flag any attempt to skip gates
259
+
260
+ 4. Append org findings under `### Organization Requirements` section:
261
+
262
+ ```
263
+ ### Organization Requirements
264
+ - **Org template**: [startup|mid-size|enterprise]
265
+ - **Governance level**: [Minimal|Moderate|Maximum]
266
+ - **Minimum reviewers**: 2 (1 must be director+)
267
+ - **Required checks**: tests (≥80% coverage), security scan, type check, lint
268
+ - **Approval chain**: contributor proposes → lead reviews → vp approves → deploy
269
+ - WARN: Self-merge not allowed per org policy
270
+ ```
271
+
272
+ If `.rune/org/org.md` does not exist, skip and log INFO: "no org config, organization requirements check skipped".
273
+
240
274
  ### Step 4.8 — Preflight Composite Score
241
275
 
242
276
  After all domain hooks (Step 4.5) and completeness checks (Step 4) complete, compute a **Preflight Health Score** to make the verdict numeric and comparable across runs.
@@ -3,7 +3,7 @@ name: research
3
3
  description: Web search and external knowledge lookup. Gathers data on technologies, libraries, best practices, and competitor solutions.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.3.0"
6
+ version: "0.4.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: knowledge
@@ -67,6 +67,29 @@ Call `WebSearch` for each query. Collect result titles, URLs, and snippets. Iden
67
67
  - **Diversity: never select 3+ URLs from the same domain** — spread across source types
68
68
 
69
69
 
70
+ ### Step 2b — Diminishing Returns Detection
71
+
72
+ After each WebSearch call, evaluate whether additional searches are productive:
73
+
74
+ **Track across search results**:
75
+ - **Entity set**: Extract key entities from each result set (library names, API names, version numbers, technique names, company names)
76
+ - **New entity ratio**: `new_entities_in_this_search / total_entities_found_so_far`
77
+ - **Result overlap**: How many URLs from this search were already seen in previous searches
78
+
79
+ | Signal | Threshold | Action |
80
+ |--------|-----------|--------|
81
+ | New entity ratio < 10% | Last search added almost nothing new | Skip remaining queries, proceed to Step 3 with existing results |
82
+ | Result overlap > 60% | Most URLs already fetched or seen | Skip this query's results entirely |
83
+ | All 3 queries return same top 3 URLs | Search space is exhausted | Proceed directly to Step 3 — more queries won't help |
84
+
85
+ **Report when triggered**:
86
+ ```
87
+ Note: Research saturation reached after [N] searches — [M] unique entities found.
88
+ Additional queries showed <10% new information. Proceeding with synthesis.
89
+ ```
90
+
91
+ **Why**: Research skills commonly waste 2-3 WebFetch calls on pages that repeat information already gathered. Saturation detection saves tool calls and context tokens while preserving research quality — the first 3 sources typically contain 90%+ of available information.
92
+
70
93
  ### Step 3 — Deep Dive
71
94
 
72
95
  Call `WebFetch` on the top 3-5 URLs identified in Step 2. Hard limit: **max 5 WebFetch calls** per research invocation. For each fetched page:
@@ -3,7 +3,7 @@ name: retro
3
3
  description: Engineering retrospective. Analyzes commit history, work patterns, and code quality metrics with trend tracking. Per-person breakdowns, shipping streaks, and actionable improvements. Use when asked for "retro", "weekly review", "what did we ship", or "engineering retrospective".
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.1.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: knowledge
@@ -28,6 +28,7 @@ Retro is ENCOURAGING but CANDID. Every critique is anchored in specific commits,
28
28
  - `/rune retro 14d` — sprint retro (2 weeks)
29
29
  - `/rune retro 30d` — monthly review
30
30
  - `/rune retro compare` — current vs previous period side-by-side
31
+ - `/rune retro --business` — cross-domain executive retrospective with HTML report (Business tier)
31
32
  - Called by `audit` (L2) for engineering health dimension
32
33
  - Auto-suggest: end of work week (Friday sessions)
33
34
 
@@ -226,6 +227,60 @@ Structure (~800-1500 words — concise, not a novel):
226
227
 
227
228
  **Tone**: Encouraging but candid. Specific and concrete. Anchored in actual commits, not vague impressions. Every critique paired with a specific suggestion.
228
229
 
230
+ ## Milestone Progressive Analysis
231
+
232
+ At specific project milestones, retro automatically generates a **deeper analysis** with a different focal point per milestone. This goes beyond the standard weekly retro — it's a reflective checkpoint on the project's evolution.
233
+
234
+ ### Milestone Detection
235
+
236
+ Count total retro snapshots in `.rune/retros/` (each represents ~1 retro session). Trigger milestone analysis when count reaches:
237
+
238
+ | Milestone | Retro Count | Focal Point | Depth |
239
+ |-----------|------------|-------------|-------|
240
+ | First Month | 4 | **Foundations** — Are conventions solid? Is the architecture scaling? Are early decisions holding? | Standard + foundation review |
241
+ | Quarter | 12 | **Patterns** — What recurring themes emerged? Which areas churn most? Is technical debt growing or shrinking? | Standard + theme extraction |
242
+ | Half Year | 24 | **Growth** — How has the codebase evolved? Are the original architectural bets paying off? What would you do differently? | Standard + architecture review |
243
+ | One Year | 50 | **Maturity** — Full project health assessment. Velocity trends over time. Team growth patterns. Knowledge distribution. | Standard + full evolution timeline |
244
+
245
+ ### Milestone Execution
246
+
247
+ When a milestone is detected (retro count matches a threshold for the first time):
248
+
249
+ 1. **Announce**: `"🏁 Milestone: [name] ([count] retros). Generating deep analysis..."`
250
+ 2. **Load history**: Read ALL `.rune/retros/*.json` snapshots (not just the most recent)
251
+ 3. **Compute evolution metrics**: Plot key metrics over time (commits/week, test ratio, fix ratio, session depth)
252
+ 4. **Focal analysis**: Generate the milestone-specific analysis based on the focal point column above
253
+ 5. **Trend narrative**: Write a 300-500 word narrative on how the project has evolved, anchored in actual data
254
+ 6. **Save**: Write milestone report to `.rune/retros/{YYYY-MM-DD}-milestone-{name}.md`
255
+
256
+ ### Milestone Report Structure
257
+
258
+ ```markdown
259
+ ## Milestone: [name] — [date]
260
+
261
+ ### Evolution Timeline
262
+ [ASCII chart or table showing key metrics across all retro snapshots]
263
+
264
+ ### [Focal Point] Analysis
265
+ [300-500 words anchored in data — specific commits, files, metrics]
266
+
267
+ ### What's Working
268
+ - [pattern that's improving, with evidence]
269
+
270
+ ### What Needs Attention
271
+ - [pattern that's degrading, with evidence]
272
+
273
+ ### Recommendations
274
+ - [1-3 concrete actions based on the focal analysis]
275
+ ```
276
+
277
+ ### Rules
278
+
279
+ - Milestone analysis is **additive** — it runs ON TOP of the standard retro, not instead of it
280
+ - Each milestone triggers ONCE — check if `.rune/retros/*-milestone-{name}.md` already exists before generating
281
+ - If retro history is sparse (gaps >30 days), note this in the report — trends may be unreliable
282
+ - Milestone analysis does NOT count toward the retro's normal output — it's a separate artifact
283
+
229
284
  ## Compare Mode
230
285
 
231
286
  When invoked as `/rune retro compare`:
@@ -247,6 +302,45 @@ SELF-VALIDATION (run before emitting report):
247
302
  - [ ] No code was modified — retro is read-only
248
303
  ```
249
304
 
305
+ ## Business Mode (--business)
306
+
307
+ When invoked as `/rune retro --business`, generate a cross-domain executive retrospective with HTML output. Requires Business tier (`.rune/org/org.md` should exist).
308
+
309
+ ### Business Data Sources
310
+
311
+ Pull from all installed domain packs:
312
+ - **Engineering**: git history (commits, velocity, test ratio, fix ratio, hotspots)
313
+ - **Revenue** (@rune-pro/sales): pipeline metrics, deal velocity, churn risk
314
+ - **Support** (@rune-pro/support): ticket volume, SLA compliance, CSAT
315
+ - **Finance** (@rune-business/finance): burn rate, runway, budget variance
316
+ - **Compliance** (@rune-business/legal): framework status, audit dates, open items
317
+
318
+ ### Business Execution Steps
319
+
320
+ 1. **Gather**: Run standard retro Steps 1-10 for engineering data
321
+ 2. **Org Context**: Read `.rune/org/org.md` for team structure and governance level
322
+ 3. **Cross-Domain KPIs**: Aggregate metrics from domain signal history (`.rune/signals/`)
323
+ 4. **Team Health**: Score each team from org config on velocity, quality, morale
324
+ 5. **Compliance**: Check compliance frameworks from org security policies
325
+ 6. **HTML Render**: Load `report-templates/retro-business.html` from Business pack and populate all `{{placeholder}}` fields with computed data
326
+ 7. **Save**: Write HTML to `.rune/retros/{YYYY-MM-DD}-business.html`
327
+ 8. **Also save** JSON snapshot (same as standard retro) for trend tracking
328
+
329
+ ### Business Output
330
+
331
+ ```
332
+ .rune/retros/2026-03-30-business.html — Self-contained HTML report
333
+ .rune/retros/2026-03-30.json — Machine-readable metrics
334
+ ```
335
+
336
+ The HTML report includes: KPI cards with trend deltas, domain performance bars (engineering, revenue, support, finance), team health table, compliance status, key insights (wins + risks), and is printable to PDF via Ctrl+P.
337
+
338
+ ### Graceful Degradation
339
+
340
+ - If no Business pack installed: skip business mode, fall back to standard retro
341
+ - If domain data unavailable: show "No data" for that domain, don't fail
342
+ - If `.rune/org/org.md` missing: use generic team structure, WARN in report
343
+
250
344
  ## Constraints
251
345
 
252
346
  1. MUST NOT modify any code — retro is read-only analysis
@@ -3,7 +3,7 @@ name: review
3
3
  description: Code quality review — patterns, security, performance, correctness. Finds bugs, suggests improvements, triggers fix for issues found. Escalates to opus for security-critical code.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.5.0"
6
+ version: "0.6.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -252,6 +252,47 @@ Produce a structured severity-ranked report.
252
252
  - Include a Positive Notes section (good patterns observed)
253
253
  - Include a Verdict: APPROVE | REQUEST CHANGES | NEEDS DISCUSSION
254
254
 
255
+ ### Step 6.5: Fix-First Triage
256
+
257
+ > From gstack (garrytan/gstack, 50.9k★): "Reviews that produce 20 findings and delegate all to the user waste everyone's time."
258
+
259
+ Classify each finding as **AUTO-FIX** or **ASK** before reporting:
260
+
261
+ | Category | Auto-Fix? | Examples |
262
+ |----------|-----------|---------|
263
+ | Dead imports, unused variables | AUTO-FIX | `import { foo } from './bar'` where foo is never used |
264
+ | Missing error handling on obvious paths | AUTO-FIX | `await fetch()` without try/catch in production code |
265
+ | Console.log in production code | AUTO-FIX | Remove `console.log` from non-CLI production files |
266
+ | Architectural concern, trade-off | ASK | "This bypasses the auth middleware — intentional?" |
267
+ | Ambiguous intent | ASK | "Is this fallback behavior correct for null users?" |
268
+ | Style/convention disagreement | ASK | "Project uses camelCase but this file uses snake_case" |
269
+
270
+ **After classification:**
271
+ - Apply AUTO-FIX findings directly via `rune:fix` — include all in a single batch
272
+ - Collect ASK findings into ONE `AskUserQuestion` — not 5 separate questions
273
+ - Report both: "Auto-fixed 4 issues. 2 findings need your input: [...]"
274
+
275
+ **Rationalization prevention**: "This looks fine" is NOT acceptable without evidence. If you can't cite a specific file:line or convention that justifies the code, flag it as UNVERIFIED — don't rationalize away uncertainty.
276
+
277
+ ### Step 6.6: Scope Drift Detection
278
+
279
+ > From gstack (garrytan/gstack, 50.9k★): "Intent vs diff catches scope creep that plan-based guards miss."
280
+
281
+ After reviewing code, compare **stated intent** vs **actual diff**:
282
+
283
+ 1. Read the originating source: TODO list, PR description, commit messages, or plan file
284
+ 2. Extract stated intent: "what was this change supposed to do?"
285
+ 3. Run `git diff --stat` to see actual file changes
286
+ 4. Compare:
287
+
288
+ | Result | Meaning | Action |
289
+ |--------|---------|--------|
290
+ | **CLEAN** | All changed files serve the stated intent | Note in report |
291
+ | **DRIFT** | 1-2 files changed that don't relate to stated intent | WARN — "These files were modified but aren't mentioned in the task: [list]" |
292
+ | **REQUIREMENTS_MISSING** | Stated intent mentions files/features not in the diff | WARN — "Task mentions X but it's not in the diff" |
293
+
294
+ **This is informational, not blocking.** Scope drift is common and sometimes intentional — but making it visible prevents silent creep.
295
+
255
296
  After reporting:
256
297
  - If any CRITICAL findings: call `rune:fix` immediately with the finding details
257
298
  - If any HIGH findings: call `rune:fix` with the finding details
@@ -476,6 +517,9 @@ When `cook` or `ship` checks review status: compare review commit hash with curr
476
517
  | Suggesting "add X" without checking if X is used | MEDIUM | YAGNI pushback: grep codebase for the suggested feature → if uncalled anywhere → respond "Not called anywhere. Remove? (YAGNI)". Valid pushback, not laziness |
477
518
  | Adding abstractions "for future flexibility" | MEDIUM | Three similar lines > premature abstraction. Only abstract when there are 3+ concrete callers today |
478
519
  | Missing cross-phase integration check at phase boundary | MEDIUM | When reviewing a phase completion: check orphaned exports, uncalled routes, auth gaps, E2E flow continuity. Delegate to completion-gate Step 4.5 |
520
+ | Review loop exceeds 3 iterations without resolution | MEDIUM | Cap at 3 review loops. After 3rd iteration with unresolved findings → surface to user with "these findings persist after 3 fix attempts — needs human decision" |
521
+ | Auto-fixing something that should have been ASK | HIGH | When in doubt, ASK. AUTO-FIX only for mechanical issues (dead imports, console.log). Anything involving intent or trade-offs = ASK |
522
+ | Scope drift flagged on intentional refactoring | LOW | Scope drift is informational, not blocking. User can override with "intentional" — don't re-flag after override |
479
523
 
480
524
  ## Done When
481
525
 
@@ -136,6 +136,7 @@ Known failure modes for this skill. Check these before declaring done.
136
136
  | Classifying lock file changes as out-of-scope | LOW | package-lock.json, yarn.lock, Cargo.lock are always IN_SCOPE |
137
137
  | SIGNIFICANT CREEP threshold applied to 1-2 unplanned files | LOW | MINOR = 1-2 files, SIGNIFICANT = 3+ files — don't escalate prematurely |
138
138
  | Plan not loadable (no TodoWrite, no progress.md) | MEDIUM | Ask calling skill for plan as text description before proceeding |
139
+ | Scope check against plan but not against stated intent | MEDIUM | Plan-based scope guard catches file drift; review Step 6.6 (Scope Drift Detection) catches intent drift. Both should run for full coverage |
139
140
 
140
141
  ## Done When
141
142
 
@@ -3,7 +3,7 @@ name: scout
3
3
  description: "Fast codebase scanner. Use when any skill needs codebase context. Finds files, patterns, dependencies, project structure. Pure read-only — never modifies files."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: haiku
9
9
  group: creation
@@ -79,6 +79,27 @@ Based on the scan request, run focused searches:
79
79
 
80
80
  **Verification gate**: At least 1 relevant file found, OR confirm the target does not exist.
81
81
 
82
+ #### Info Saturation Detection (Know When to Stop)
83
+
84
+ Scout's default is "max 10 file reads" — but the real question is whether additional reads are productive. Track saturation across Phase 2 searches:
85
+
86
+ **Entity tracking**: As you scan files, extract key entities (function names, class names, imports, API endpoints, config keys). Maintain a running set of discovered entities.
87
+
88
+ | Signal | Threshold | Meaning | Action |
89
+ |--------|-----------|---------|--------|
90
+ | **New entity ratio** | Last 2 file reads added <2 new entities | Search is exhausted for this domain | STOP scanning, move to Phase 3 |
91
+ | **Content similarity** | Last 2 files share >70% of the same imports/patterns | Files are in the same module, redundant reads | Skip remaining files in this directory |
92
+ | **Query variation** | 3+ Glob/Grep queries with different patterns all return the same files | All search angles converge | Domain is fully mapped, proceed |
93
+
94
+ **When saturation detected**: Emit in Scout Report:
95
+ ```
96
+ ### Saturation
97
+ - Reached after [N] file reads — last 2 reads added [M] new entities
98
+ - Recommendation: synthesize_and_report (further scanning unlikely to yield new insights)
99
+ ```
100
+
101
+ **Why**: Without saturation detection, scout reads its full budget of 10 files even when 3 files already contain everything needed. This wastes context tokens and delays the calling skill. Early saturation detection returns control faster.
102
+
82
103
  ### Phase 3: Dependency Mapping
83
104
 
84
105
  1. Use `Grep` to find import/require/use statements in identified files
@@ -3,7 +3,7 @@ name: sentinel
3
3
  description: Automated security gatekeeper. Blocks unsafe code before commit — secret scanning, OWASP top 10, dependency audit, permission checks. A GATE, not a suggestion.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.8.0"
6
+ version: "0.9.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -198,6 +198,40 @@ If `.rune/contract.md` exists, validate staged changes against project contract
198
198
 
199
199
  If `.rune/contract.md` does not exist, skip and log INFO: "no project contract, contract validation skipped".
200
200
 
201
+ ### Step 4.86 — Organization Policy Enforcement (Business)
202
+
203
+ If `.rune/org/org.md` exists, load organization security policies and enforce them as additional gates.
204
+
205
+ 1. `Read` `.rune/org/org.md` and extract the `## Policies > ### Security` section
206
+ 2. For each org security policy, validate staged changes:
207
+
208
+ | Org Policy | Check | Severity |
209
+ |------------|-------|----------|
210
+ | `dependency_audit_frequency` | Verify audit cadence matches org requirement | WARN if overdue |
211
+ | `secret_rotation` | Flag secrets older than org-defined rotation period | WARN |
212
+ | `compliance_frameworks` | Ensure listed frameworks (SOC2, GDPR, HIPAA, PCI-DSS) checks are active | WARN if missing |
213
+ | `penetration_testing` | Log when last pentest was conducted vs org schedule | INFO |
214
+ | `separation_of_duties` | Verify commit author ≠ PR approver when org requires it | BLOCK if violated |
215
+
216
+ 3. Check `## Policies > ### Code Review` for minimum reviewer requirements:
217
+ - If org requires N reviewers, include in report: "Org policy requires {N} reviewer(s)"
218
+ - If org requires security reviewer for auth/data paths, flag auth-touching changes
219
+
220
+ 4. Check `## Policies > ### Deployment` for deploy window and feature flag requirements:
221
+ - If org requires feature flags for user-facing changes, flag new UI code without feature flag wrapper
222
+
223
+ 5. Append org policy findings to the sentinel report under `### Organization Policy` section
224
+
225
+ ```
226
+ ### Organization Policy
227
+ - **Org template**: [startup|mid-size|enterprise]
228
+ - **Governance level**: [Minimal|Moderate|Maximum]
229
+ - `auth/login.ts` — WARN: org requires security reviewer for auth paths (Policy: Code Review)
230
+ - Deploy window: Weekdays 09:00-16:00 (org policy)
231
+ ```
232
+
233
+ If `.rune/org/org.md` does not exist, skip and log INFO: "no org config, organization policy check skipped".
234
+
201
235
  ### Step 4.9 — Six-Gate Finding Validation
202
236
 
203
237
  Before reporting ANY finding as BLOCK or WARN, it MUST pass through these 6 gates. Any gate failure → downgrade to INFO or discard. This prevents hallucinated vulnerabilities from blocking real work.