@rune-kit/rune 2.13.0 → 2.15.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 (96) hide show
  1. package/README.md +31 -12
  2. package/compiler/__tests__/adapter-model-mapping.test.js +152 -0
  3. package/compiler/__tests__/adr-scoring.test.js +91 -0
  4. package/compiler/__tests__/context-md-format.test.js +180 -0
  5. package/compiler/__tests__/context-pack-smell-tests.test.js +215 -0
  6. package/compiler/__tests__/context-preview-signal.test.js +166 -0
  7. package/compiler/__tests__/diversity-score.test.js +117 -0
  8. package/compiler/__tests__/improve-architecture.test.js +171 -0
  9. package/compiler/__tests__/openclaw-adapter.test.js +11 -6
  10. package/compiler/__tests__/oracle-bundle-format.test.js +210 -0
  11. package/compiler/__tests__/oracle-pending-schema.test.js +209 -0
  12. package/compiler/__tests__/out-of-scope-format.test.js +303 -0
  13. package/compiler/__tests__/skill-description-quality.test.js +147 -0
  14. package/compiler/__tests__/zoom-out-output.test.js +112 -0
  15. package/compiler/adapters/antigravity.js +17 -1
  16. package/compiler/adapters/claude.js +4 -0
  17. package/compiler/adapters/codex.js +16 -1
  18. package/compiler/adapters/cursor.js +4 -0
  19. package/compiler/adapters/generic.js +14 -1
  20. package/compiler/adapters/openclaw.js +15 -1
  21. package/compiler/adapters/opencode.js +17 -1
  22. package/compiler/adapters/windsurf.js +4 -0
  23. package/package.json +2 -2
  24. package/skills/adversary/SKILL.md +61 -1
  25. package/skills/adversary/evals.md +79 -0
  26. package/skills/adversary/references/context-bundle-format.md +122 -0
  27. package/skills/adversary/references/oracle-mode.md +116 -0
  28. package/skills/asset-creator/SKILL.md +1 -1
  29. package/skills/audit/SKILL.md +3 -1
  30. package/skills/autopsy/SKILL.md +1 -1
  31. package/skills/ba/SKILL.md +242 -83
  32. package/skills/ba/references/context-md-format.md +136 -0
  33. package/skills/ba/references/explore-first.md +107 -0
  34. package/skills/ba/references/out-of-scope-format.md +152 -0
  35. package/skills/brainstorm/SKILL.md +78 -2
  36. package/skills/brainstorm/references/design-it-twice.md +155 -0
  37. package/skills/browser-pilot/SKILL.md +1 -1
  38. package/skills/completion-gate/SKILL.md +1 -1
  39. package/skills/constraint-check/SKILL.md +1 -1
  40. package/skills/context-engine/SKILL.md +85 -1
  41. package/skills/context-engine/references/preview-gate.md +139 -0
  42. package/skills/context-pack/SKILL.md +68 -25
  43. package/skills/context-pack/evals.md +122 -0
  44. package/skills/context-pack/references/brief-template.md +121 -0
  45. package/skills/context-pack/references/durability-rules.md +109 -0
  46. package/skills/cook/SKILL.md +5 -4
  47. package/skills/db/SKILL.md +1 -1
  48. package/skills/debug/SKILL.md +7 -4
  49. package/skills/dependency-doctor/SKILL.md +1 -1
  50. package/skills/design/SKILL.md +1 -1
  51. package/skills/doc-processor/SKILL.md +1 -1
  52. package/skills/docs/SKILL.md +1 -1
  53. package/skills/docs-seeker/SKILL.md +1 -1
  54. package/skills/fix/SKILL.md +5 -3
  55. package/skills/git/SKILL.md +1 -1
  56. package/skills/hallucination-guard/SKILL.md +1 -1
  57. package/skills/improve-architecture/SKILL.md +275 -0
  58. package/skills/improve-architecture/evals.md +145 -0
  59. package/skills/improve-architecture/references/deepening.md +87 -0
  60. package/skills/improve-architecture/references/interface-design.md +68 -0
  61. package/skills/improve-architecture/references/language.md +81 -0
  62. package/skills/improve-architecture/references/scoring.md +122 -0
  63. package/skills/integrity-check/SKILL.md +1 -1
  64. package/skills/journal/SKILL.md +34 -7
  65. package/skills/journal/references/adr-criteria.md +109 -0
  66. package/skills/logic-guardian/SKILL.md +1 -1
  67. package/skills/marketing/SKILL.md +1 -1
  68. package/skills/mcp-builder/SKILL.md +1 -1
  69. package/skills/onboard/SKILL.md +1 -1
  70. package/skills/perf/SKILL.md +1 -1
  71. package/skills/plan/SKILL.md +1 -1
  72. package/skills/preflight/SKILL.md +1 -1
  73. package/skills/research/SKILL.md +1 -1
  74. package/skills/retro/SKILL.md +1 -1
  75. package/skills/review/SKILL.md +3 -2
  76. package/skills/review-intake/SKILL.md +26 -3
  77. package/skills/safeguard/SKILL.md +1 -1
  78. package/skills/scaffold/SKILL.md +1 -1
  79. package/skills/scout/SKILL.md +33 -1
  80. package/skills/sentinel/SKILL.md +1 -1
  81. package/skills/sentinel-env/SKILL.md +1 -1
  82. package/skills/session-bridge/SKILL.md +91 -4
  83. package/skills/session-bridge/references/detach-protocol.md +111 -0
  84. package/skills/skill-forge/SKILL.md +1 -1
  85. package/skills/slides/SKILL.md +1 -1
  86. package/skills/surgeon/SKILL.md +17 -2
  87. package/skills/team/SKILL.md +3 -0
  88. package/skills/test/SKILL.md +48 -1
  89. package/skills/test/evals.md +137 -0
  90. package/skills/test/references/mocking-policy.md +121 -0
  91. package/skills/test/references/test-quality.md +124 -0
  92. package/skills/test/references/vertical-tdd.md +110 -0
  93. package/skills/trend-scout/SKILL.md +1 -1
  94. package/skills/video-creator/SKILL.md +1 -1
  95. package/skills/watchdog/SKILL.md +1 -1
  96. package/skills/worktree/SKILL.md +1 -1
@@ -0,0 +1,109 @@
1
+ # ADR Criteria — When to Open an ADR
2
+
3
+ ADRs (Architecture Decision Records) are durable. They survive sessions, codebases, and team turnover. That power has a cost: writing one for every minor pick fills the directory with noise, and the genuinely load-bearing decisions get lost.
4
+
5
+ The ADR gate ensures that every entry in `.rune/adr/` *earned* its place.
6
+
7
+ ## The 3-criteria gate
8
+
9
+ An ADR is offered only if **all three** are true:
10
+
11
+ ### 1. Hard to reverse (`reversibility`)
12
+
13
+ Score 1–5: how expensive is it to change your mind later?
14
+
15
+ | Score | Description |
16
+ |-------|-------------|
17
+ | 1 | Reversible next sprint (one PR, no migration) |
18
+ | 2 | Reversible this quarter (a few PRs, simple migration) |
19
+ | 3 | Significant cost (data migration, multi-PR rollout) |
20
+ | 4 | Quarter-or-more to reverse (schema change, integration rewrite) |
21
+ | 5 | Practically irreversible (architectural commitment, lock-in to vendor) |
22
+
23
+ ### 2. Surprising without context (`surprisingness`)
24
+
25
+ Score 1–5: how likely is a future reader to wonder "why did they do it this way?"
26
+
27
+ | Score | Description |
28
+ |-------|-------------|
29
+ | 1 | Obvious — anyone would do it this way |
30
+ | 2 | Common, but with one minor detail |
31
+ | 3 | Mildly unusual — half of practitioners might pick differently |
32
+ | 4 | Strongly counter to common practice |
33
+ | 5 | Rare or counter-intuitive — without explanation, future engineer would "fix" it |
34
+
35
+ ### 3. Real tradeoff (`tradeoff_strength`)
36
+
37
+ Score 1–5: how credible were the rejected alternatives?
38
+
39
+ | Score | Description |
40
+ |-------|-------------|
41
+ | 1 | No real alternative — the obvious thing |
42
+ | 2 | One alternative considered briefly |
43
+ | 3 | 2–3 alternatives evaluated; pick was clear |
44
+ | 4 | Multiple credible alternatives; pick required real analysis |
45
+ | 5 | Genuinely difficult choice; reasonable people disagreed |
46
+
47
+ ### Threshold
48
+
49
+ ```
50
+ score = reversibility + surprisingness + tradeoff_strength # range 3–15
51
+ open_adr = (score >= 11) AND (each axis >= 3)
52
+ ```
53
+
54
+ The "each axis >= 3" rule prevents single-axis cheating. A decision that's hard-to-reverse but obvious AND has no real alternatives (e.g., "we're using SQL for our SQL database") shouldn't be an ADR even if reversibility=5.
55
+
56
+ ## Counter-test (anti-fake)
57
+
58
+ Before opening an ADR, the agent MUST be able to fill in **rejected alternatives + why**. If the agent can't name at least one credible alternative *that was actually considered*, the decision wasn't a real tradeoff. Re-classify as a "convention" — record it in CLAUDE.md or a comment, not in `.rune/adr/`.
59
+
60
+ ```
61
+ Rejected alternative: PostgreSQL JSON columns
62
+ Why rejected: schema migrations harder; no JSON-path indexing in the version we use; team's tooling stack favors structured columns.
63
+ ```
64
+
65
+ If you can't write that section, don't open the ADR.
66
+
67
+ ## ADR file naming
68
+
69
+ Filename includes the score, so future reviewers see at a glance why this one was kept:
70
+
71
+ ```
72
+ .rune/adr/ADR-007-postgres-write-model-s13.md
73
+ .rune/adr/ADR-008-event-sourced-orders-s14.md
74
+ ```
75
+
76
+ Format: `ADR-NNN-<slug>-s<score>.md` where `NNN` is the sequential number and `score` is the 3–15 sum.
77
+
78
+ ## What qualifies (examples)
79
+
80
+ - **Architectural shape**: "We're using a monorepo." "The write model is event-sourced; the read model is projected into Postgres." (s ≈ 12–14)
81
+ - **Integration patterns between modules**: "Ordering and Billing communicate via domain events, not synchronous HTTP." (s ≈ 11–13)
82
+ - **Technology choices that carry lock-in**: database, message bus, auth provider, deployment target — only the ones that would take a quarter to swap out. (s ≈ 11–14)
83
+ - **Boundary-and-scope decisions**: "Customer data is owned by the Customer module; other modules reference it by ID only." The explicit no-s are as valuable as the yes-s. (s ≈ 10–12 — borderline, judge case-by-case)
84
+ - **Deliberate deviations from the obvious path**: "We're using manual SQL instead of an ORM because X." (s ≈ 11–13 — high surprisingness)
85
+ - **Constraints not visible in the code**: "We can't use AWS because of compliance requirements." (s ≈ 11–13)
86
+ - **Rejected alternatives when the rejection is non-obvious**: considered GraphQL, picked REST for subtle reasons. (s ≈ 10–12 — if rejection is documented elsewhere, may not need ADR)
87
+
88
+ ## What does NOT qualify (examples)
89
+
90
+ - "We chose lodash over underscore." (reversibility ≤ 2; not surprising; weak tradeoff) — s ≈ 5
91
+ - "This function uses async/await instead of Promises." (reversibility 1; not surprising; convention) — s ≈ 3
92
+ - "We're using TypeScript." (reversibility 5; not surprising; obvious for the stack) — s ≈ 7
93
+ - "We deferred dark mode." (this is a deferral, not a decision — goes to backlog or `.out-of-scope/`) — N/A
94
+
95
+ ## When score is 8–10 (borderline)
96
+
97
+ Don't auto-open. Ask the user: "This decision scores 9/15 — borderline. Do you want it as an ADR, or is a comment in the code sufficient?" Default to the lighter touch.
98
+
99
+ ## Score gaming detection
100
+
101
+ The score can be inflated, but the counter-test (rejected alternative) cannot be faked without lying about history. If the agent fills out scores ≥ 4 on each axis but can't name a credible rejected alternative, the gate fails and no ADR is opened.
102
+
103
+ `audit` later cross-references ADR scores — if the average score across `.rune/adr/` files is < 11, it flags "ADR inflation" as a quality concern.
104
+
105
+ ## Convention vs Decision
106
+
107
+ Decisions are tradeoffs at fork points. **Conventions are choices everyone makes the same way** — naming, formatting, simple defaults. Conventions go in CLAUDE.md or code style guides, not ADRs.
108
+
109
+ A test: if you can imagine the team coming back next quarter and saying "yeah obvious, of course we did it this way" — it's a convention. If they'd say "wait, why did we do *that*?" — it's a decision and probably qualifies.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: logic-guardian
3
- description: Protects complex business logic from accidental deletion or overwrite. Maintains a logic manifest, enforces pre-edit gates, and validates post-edit diffs.
3
+ description: "Protects complex business logic from accidental deletion or overwrite. Use when editing payment, trading, state-machine, or other load-bearing business logic where a single deleted line can cause silent data corruption. Maintains a logic manifest, enforces pre-edit gates, validates post-edit diffs."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.3.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: marketing
3
- description: Create marketing assets and execute launch strategy. Generates landing copy, social banners, SEO meta, blog posts, and video scripts.
3
+ description: "Create marketing assets and execute launch strategy. Generates landing copy, social banners, SEO meta, blog posts, and video scripts."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.6.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mcp-builder
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).
3
+ description: "Build Model Context Protocol servers from specifications. Use when creating an MCP server for a tool, resource, or service that AI agents should access. Generates tool definitions, resource handlers, and test suites in TypeScript or Python (FastMCP)."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.5.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: onboard
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.
3
+ description: "Auto-generate project context for AI sessions. Use when starting on a new repo for the first time, or when CLAUDE.md / .rune/ context is missing or stale. Scans codebase and creates the setup so every future session starts with full context."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.4.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: perf
3
- description: Performance regression gate. Detects N+1 queries, sync-in-async, missing indexes, memory leaks, and bundle bloat before they reach production.
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
6
  version: "0.3.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: plan
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.
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
6
  version: "1.5.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: preflight
3
- description: Pre-commit quality gate that catches "almost right" code. Goes beyond lintingchecks logic correctness, error handling, regressions, and completeness.
3
+ description: "Pre-commit quality gate that catches 'almost right' code. Use when about to commit auto-fires before commit to validate logic correctness, error handling, regressions, and completeness. Goes beyond linting."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "1.1.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: research
3
- description: Web search and external knowledge lookup. Gathers data on technologies, libraries, best practices, and competitor solutions.
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
6
  version: "0.4.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: retro
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".
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
6
  version: "0.3.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: review
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.
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
6
  version: "1.1.0"
@@ -9,7 +9,7 @@ metadata:
9
9
  group: development
10
10
  tools: "Read, Glob, Grep"
11
11
  emit: review.complete, review.issues
12
- listen: code.changed, docs.updated
12
+ listen: code.changed, docs.updated, context.preview
13
13
  ---
14
14
 
15
15
  # review
@@ -60,6 +60,7 @@ Every review MUST cite at least one specific concern, suggestion, or explicit ap
60
60
  - `review` → `test` — untested edge case found → test writes it
61
61
  - `review` → `fix` — bug found during review → fix applies correction
62
62
  - `review` → `scout` — needs more context → scout finds related code
63
+ - `review` → `improve-architecture` — when reviewer flag mentions "shallow", "wrapper", "indirection", or pass-through pattern
63
64
  - `review` ← `fix` — complex fix requests self-review
64
65
  - `review` → `sentinel` — security-critical code → sentinel deep scan
65
66
 
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  name: review-intake
3
- description: Use when receiving code review feedback, PR comments, or external suggestions before implementing any changes. Prevents blind implementation, enforces verification-first discipline.
3
+ description: "Use when receiving code review feedback, PR comments, or external suggestions before implementing any changes. Prevents blind implementation, enforces verification-first discipline."
4
4
  metadata:
5
5
  author: runedev
6
- version: "1.1.0"
6
+ version: "1.2.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
10
- tools: "Read, Glob, Grep"
10
+ tools: "Read, Write, Edit, Glob, Grep"
11
+ listen: outofscope.match
11
12
  ---
12
13
 
13
14
  # review-intake
@@ -137,6 +138,24 @@ gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies \
137
138
  -f body="Fixed — [description]"
138
139
  ```
139
140
 
141
+ ### Phase 4.5 — Rejection KB Write (when verdict = OUT OF SCOPE)
142
+
143
+ For every item with verdict `OUT OF SCOPE`, write a durable record to `.out-of-scope/`. Oral-only rejections leave no trace and force re-litigation in future sessions.
144
+
145
+ <HARD-GATE>
146
+ Every OUT OF SCOPE verdict MUST produce a `.out-of-scope/<slug>.md` file (or append to an existing one).
147
+ A rejection without a written record is a rejection that didn't happen.
148
+ </HARD-GATE>
149
+
150
+ **Procedure**:
151
+
152
+ 1. Generate `slug` from the rejected concept (kebab-case, lowercase, max 40 chars, recognizable without opening the file).
153
+ 2. Lexical-similarity check: `Glob` `.out-of-scope/*.md`, parse each frontmatter's `concept` + `aliases`, compute overlap with the new slug's tokens. If any existing concept has ≥0.7 overlap → APPEND to that file's `prior_requests` list instead of creating a new one.
154
+ 3. If new file: write the format from [`ba/references/out-of-scope-format.md`](../ba/references/out-of-scope-format.md) — YAML frontmatter (concept / aliases / decision: rejected / rejected_at / rejected_by: review-intake / prior_requests / revisit_if) + Markdown body (concept name, "Why out of scope" reasoning, "What would change our mind" signals).
155
+ 4. The reasoning MUST be substantive — not "we don't want this" but *why*. Reference project scope, technical constraints, or strategic decisions. Reject deferrals ("we're busy") — those don't belong here.
156
+
157
+ Only **enhancement** rejections produce `.out-of-scope/` entries. Bug rejections (won't fix because already fixed / not reproducible / not a bug) get a comment on the issue, not a KB file.
158
+
140
159
  ### Phase 6 — IMPLEMENT
141
160
 
142
161
  Execute in priority order: P0 → P1 → P2 → P3 → P4.
@@ -223,6 +242,9 @@ How to push back:
223
242
  | Implementing 4/6 items, leaving 2 unclear | HIGH | HARD-GATE: all-or-nothing comprehension |
224
243
  | Performative agreement masking misunderstanding | MEDIUM | Banned phrases list + restate-in-own-words requirement |
225
244
  | Fixing tests instead of code to make review pass | HIGH | Defer to `fix` constraints: fix CODE, not TESTS |
245
+ | OUT OF SCOPE verdict with no `.out-of-scope/` file written | HIGH | Phase 4.5 HARD-GATE — oral-only rejections force re-litigation in future sessions |
246
+ | Writing a deferral ("busy this quarter") to `.out-of-scope/` | MEDIUM | Deferrals belong in backlog, not the rejection KB. KB entries must cite durable reasons (scope, tech constraint, strategy) |
247
+ | Creating duplicate `.out-of-scope/` files for the same concept | MEDIUM | Lexical-similarity gate (≥0.7 overlap) — append to existing file's `prior_requests` instead of duplicating |
226
248
 
227
249
  ## Done When
228
250
 
@@ -231,6 +253,7 @@ How to push back:
231
253
  - Verdicts assigned (correct/pushback/yagni/defer)
232
254
  - Approved items implemented in priority order
233
255
  - Tests pass after each individual fix
256
+ - Every OUT OF SCOPE verdict has produced a `.out-of-scope/<slug>.md` file (new or appended)
234
257
  - Review Intake Report emitted
235
258
 
236
259
  ## Returns
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: safeguard
3
- description: Build safety nets before refactoring. Use when running surgeon or any risky refactor that needs a rollback point. Creates characterization tests, boundary markers, config freezes, and rollback points.
3
+ description: "Build safety nets before refactoring. Use when running surgeon or any risky refactor that needs a rollback point. Creates characterization tests, boundary markers, config freezes, and rollback points."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.2.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: scaffold
3
- description: Autonomous project bootstrapper. Generates complete project from a description — structure, code, tests, docs, config. Orchestrates ba → plan → design → fix → test → docs → git in one pipeline. The "0 to production-ready" skill.
3
+ description: "Autonomous project bootstrapper. Generates complete project from a description — structure, code, tests, docs, config. Orchestrates ba → plan → design → fix → test → docs → git in one pipeline. The \"0 to production-ready\" skill."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.1.0"
@@ -3,12 +3,13 @@ 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.3.0"
6
+ version: "0.4.0"
7
7
  layer: L2
8
8
  model: haiku
9
9
  group: creation
10
10
  tools: "Read, Glob, Grep"
11
11
  emit: codebase.scanned
12
+ listen: agent.stuck
12
13
  ---
13
14
 
14
15
  # scout
@@ -117,6 +118,36 @@ Scout's default is "max 10 file reads" — but the real question is whether addi
117
118
  3. Find existing tests with `Glob`: `**/*.test.*`, `**/*.spec.*`, `**/test_*`
118
119
  4. Determine test framework: `jest.config.*`, `vitest.config.*`, `pytest.ini`
119
120
 
121
+ ### Phase 4.5: Zoom-Out Mode
122
+
123
+ Triggered by `mode="zoom-out"` from the caller, OR auto-triggered by listening on `agent.stuck` signal (emitted by `fix` after 2+ failed attempts on the same file, or by `debug` after 3+ disproved hypothesis cycles).
124
+
125
+ When activated, scout produces a 3-layer ascent map:
126
+
127
+ | Layer | What it includes | Cap |
128
+ |-------|------------------|-----|
129
+ | L0 (target) | The stuck file's symbols + immediate imports | unlimited |
130
+ | L1 (siblings) | Files in the same directory + their public exports | 8 files |
131
+ | L2 (callers/neighbors) | Modules that import L0's exports + neighboring modules in the same domain | 8 modules |
132
+
133
+ Output is a Mermaid diagram, NOT just a file list — visual is the value-add when an agent is stuck.
134
+
135
+ ```mermaid
136
+ graph LR
137
+ target[src/auth/login.ts]:::stuck
138
+ target --> dep1[crypto.compare]
139
+ target --> dep2[db.users.get]
140
+ caller1[src/routes/auth.ts] --> target
141
+ caller2[src/middleware/protect.ts] --> target
142
+ sibling1[src/auth/refresh.ts] -.same-dir.- target
143
+ sibling2[src/auth/logout.ts] -.same-dir.- target
144
+ classDef stuck fill:#ff6b6b
145
+ ```
146
+
147
+ **Bounded** — L2 ascent caps at 8 modules. If exceeded, collapse to "showing top 8 by import-frequency". Never blow past the cap silently.
148
+
149
+ After emitting the map, scout returns to its normal Phase 6 (Generate Report) with the zoom-out section as the primary output.
150
+
120
151
  ### Phase 5: Codebase Map (Optional)
121
152
 
122
153
  When called by `cook`, `team`, `onboard`, or `autopsy` (skills that need full project understanding), generate a structured codebase map:
@@ -204,6 +235,7 @@ None — pure scanner using Glob, Grep, Read, and Bash tools directly. Does not
204
235
  - `docs` (L2): scan codebase structure for documentation generation
205
236
  - `logic-guardian` (L2): scan business logic modules for protection mapping
206
237
  - `adversary` (L2): scan codebase before red-team analysis
238
+ - `improve-architecture` (L2): re-scan target module + callers when input context is stale
207
239
 
208
240
  ## Output Format
209
241
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sentinel
3
- description: Automated security gatekeeper. Blocks unsafe code before commit — secret scanning, OWASP top 10, dependency audit, permission checks. A GATE, not a suggestion.
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
6
  version: "1.0.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sentinel-env
3
- description: Environment-aware pre-flight check. Validates OS, runtime versions, installed tools, port availability, env vars, and disk space BEFORE coding starts. Prevents "works on my machine" failures. Like sentinel but for the environment, not the code.
3
+ description: "Environment-aware pre-flight check. Use when starting work in a new environment, switching machines, or when 'works on my machine' bugs surface. Validates OS, runtime versions, installed tools, port availability, env vars, and disk space BEFORE coding starts. Like sentinel but for the environment, not the code."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.3.0"
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  name: session-bridge
3
- description: Universal context persistence across sessions. Auto-saves decisions, conventions, and progress to .rune/ files. Loads state at session start. Use when any skill makes architectural decisions or establishes patterns that must survive session boundaries.
3
+ description: "Universal context persistence across sessions. Auto-saves decisions, conventions, and progress to .rune/ files. Loads state at session start. Use when any skill makes architectural decisions or establishes patterns that must survive session boundaries."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.7.0"
6
+ version: "0.8.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: state
10
10
  tools: "Read, Write, Edit, Glob, Grep"
11
- listen: phase.complete, checkpoint.request
12
- emit: invariants.loaded
11
+ listen: phase.complete, checkpoint.request, oracle.dispatched
12
+ emit: invariants.loaded, oracle.failed
13
13
  ---
14
14
 
15
15
  # session-bridge
@@ -40,6 +40,7 @@ Solve the #1 developer complaint: context loss across sessions. Session-bridge a
40
40
  - `context-engine` (L3): save state before compaction
41
41
  - `context-pack` (L3): coordinate state for sub-agent handoff
42
42
  - `neural-memory` (L3): sync key decisions back to `.rune/` files after Capture Mode
43
+ - `adversary` (L2): (oracle-mode) detach protocol when target model is opus-class for non-blocking dispatch
43
44
 
44
45
  ## State Files Managed
45
46
 
@@ -540,11 +541,86 @@ At Load Mode Step 1, after checking `.rune/*.md` existence, also check for `.run
540
541
  - **Remaining tasks**: [count]
541
542
  ```
542
543
 
544
+ ## Detach Mode (v0.8.0)
545
+
546
+ Triggered by `oracle.dispatched` from `adversary` oracle-mode. Decouples the primary agent from a slow heavy-model call so the agent can continue adjacent work while the second model reasons.
547
+
548
+ **Why**: Opus-class reasoning takes 1-10 minutes wall time. Synchronous waits kill primary-agent throughput, especially in `team` parallel workstreams.
549
+
550
+ ### Step D1 — Receive dispatch
551
+
552
+ When `oracle.dispatched` arrives, payload contains:
553
+ - `sessionId` — caller-provided unique id
554
+ - `triggerSignal` — `agent.stuck` or manual
555
+ - `sourceSkill` — `debug` | `fix` | manual
556
+ - `targetModel` — concrete model name (e.g. `gpt-5-pro`, `gemini-3-pro`, `claude-opus-4-7`)
557
+ - `bundleHash` — sha256 of the bundled context (idempotency key)
558
+
559
+ ### Step D2 — Idempotency check
560
+
561
+ Look up `.rune/oracle-pending/<sessionId>.json` AND any pending file with matching `bundleHash`. If a pending record with status=`pending` and the same `bundleHash` exists, **return the existing sessionId** — do NOT dispatch a duplicate.
562
+
563
+ ### Step D3 — Write pending record
564
+
565
+ Create `.rune/oracle-pending/<sessionId>.json`:
566
+
567
+ ```json
568
+ {
569
+ "sessionId": "oracle-1714234500-abc123",
570
+ "dispatchedAt": "2026-04-27T12:34:56Z",
571
+ "triggerSignal": "agent.stuck",
572
+ "sourceSkill": "debug",
573
+ "targetModel": "claude-opus-4-7",
574
+ "bundleHash": "sha256:9f3a...",
575
+ "status": "pending",
576
+ "timeoutAt": "2026-04-27T12:44:56Z",
577
+ "responseId": null,
578
+ "responseExcerpt": null
579
+ }
580
+ ```
581
+
582
+ `timeoutAt` defaults to `dispatchedAt + 10min`.
583
+
584
+ ### Step D4 — Return control to caller
585
+
586
+ Caller (`adversary`) receives the sessionId and returns to the primary orchestrator. Primary agent (`cook`/`team`) continues adjacent phases.
587
+
588
+ ### Step D5 — Reattach (called by primary agent between phases)
589
+
590
+ Invocation: `session-bridge --reattach <sessionId>` (or via `oracle.dispatched` listen → poll).
591
+
592
+ Behavior:
593
+ 1. Read `.rune/oracle-pending/<sessionId>.json`
594
+ 2. If `status=complete` → return `responseExcerpt` to caller, mark record as consumed
595
+ 3. If `status=pending` AND `now >= timeoutAt` → set `status=failed`, emit `oracle.failed` reason=`timeout`
596
+ 4. If `status=pending` AND `now < timeoutAt` → return `not_ready` to caller, primary agent works on next independent task
597
+
598
+ ### Step D6 — Cleanup
599
+
600
+ On every session start, scan `.rune/oracle-pending/` for records older than 24h. Delete them — they are orphaned.
601
+
602
+ ### Pending Record Schema
603
+
604
+ | Field | Type | Required |
605
+ |-------|------|----------|
606
+ | sessionId | string (matches `^oracle-\d+-[a-z0-9]+$`) | yes |
607
+ | dispatchedAt | ISO 8601 timestamp | yes |
608
+ | triggerSignal | string | yes |
609
+ | sourceSkill | enum: `debug` \| `fix` \| `manual` | yes |
610
+ | targetModel | string | yes |
611
+ | bundleHash | string (matches `^sha256:[a-f0-9]{8,64}$`) | yes |
612
+ | status | enum: `pending` \| `complete` \| `failed` | yes |
613
+ | timeoutAt | ISO 8601 timestamp | yes |
614
+ | responseId | string \| null | yes (null until status=complete) |
615
+ | responseExcerpt | string ≤500 chars \| null | yes |
616
+
543
617
  ## Constraints
544
618
 
545
619
  1. MUST save decisions, conventions, and progress — not just a status line
546
620
  2. MUST verify saved context can be loaded in a fresh session — test the round-trip
547
621
  3. MUST NOT overwrite existing bridge data without merging
622
+ 4. (Detach) MUST be idempotent — same sessionId or bundleHash returns existing record, never dispatches twice
623
+ 5. (Detach) MUST clean up orphaned pending records (age >24h) on session start
548
624
 
549
625
  ## Sharp Edges
550
626
 
@@ -560,6 +636,9 @@ Known failure modes for this skill. Check these before declaring done.
560
636
  | Learnings JSONL grows unbounded | MEDIUM | Auto-compact at 100 entries — keep only latest-winner per key+type |
561
637
  | Checkpoint stale after code changes | MEDIUM | Checkpoint includes git state — if branch/commit differ at resume, warn user that checkpoint may be outdated |
562
638
  | Multiple checkpoints overwrite each other | LOW | By design — only one active checkpoint. Resolved ones archived with date suffix |
639
+ | (Detach) Pending file orphaned forever — process crashed mid-dispatch | MEDIUM | Step D6 cleanup runs every session start; records >24h auto-deleted |
640
+ | (Detach) Two adversary calls dispatch same bundle simultaneously | MEDIUM | Step D2 idempotency: bundleHash-keyed lookup returns existing sessionId |
641
+ | (Detach) Reattach polls indefinitely without timeout | HIGH | Step D5 enforces `timeoutAt` — exceeded → emit `oracle.failed` reason=`timeout`, free the primary agent |
563
642
 
564
643
  ## Done When (Save Mode)
565
644
 
@@ -590,6 +669,14 @@ Known failure modes for this skill. Check these before declaring done.
590
669
  - checkpoint.md written to .rune/
591
670
  - Checkpoint Saved report emitted
592
671
 
672
+ ## Done When (Detach Mode)
673
+
674
+ - Pending record written to `.rune/oracle-pending/<sessionId>.json` with valid schema
675
+ - Idempotency verified: duplicate bundleHash returned existing sessionId, no duplicate dispatch
676
+ - Reattach API returns `complete` / `pending` / `failed` based on record status + timeout
677
+ - Orphan cleanup runs at session start (records >24h deleted)
678
+ - `oracle.failed` emitted with `reason=timeout` if timeoutAt exceeded
679
+
593
680
  ## Cost Profile
594
681
 
595
682
  ~100-300 tokens per save. ~500-1000 tokens per load. Always haiku. Negligible cost.
@@ -0,0 +1,111 @@
1
+ # Detach Protocol — session-bridge oracle-mode integration
2
+
3
+ ## Purpose
4
+
5
+ Decouple the primary AI agent from slow heavy-model second-opinion calls so the agent can continue with adjacent work instead of blocking 1-10 minutes on Opus-class reasoning.
6
+
7
+ ## State Machine
8
+
9
+ ```
10
+ oracle.dispatched
11
+
12
+
13
+ ┌──────────┐
14
+ │ pending │◄────────┐
15
+ └──────────┘ │
16
+ │ │ │ poll (no timeout)
17
+ │ │ │
18
+ reply │ │ timeout │
19
+ arrives │ │ exceeded │
20
+ ▼ ▼ │
21
+ ┌──────────┐ ┌──────────┐ │
22
+ │ complete │ │ failed │ │
23
+ └──────────┘ └──────────┘ │
24
+ │ │ │
25
+ │ │ │
26
+ ▼ ▼ │
27
+ consumed cleaned │
28
+ (caller up after │
29
+ reads 24h │
30
+ response) │
31
+
32
+ ┌────────────────────────┘
33
+
34
+ reattach poll
35
+ (every phase boundary)
36
+ ```
37
+
38
+ ## File Layout
39
+
40
+ ```
41
+ .rune/
42
+ └── oracle-pending/
43
+ ├── oracle-1714234500-abc123.json # active dispatch
44
+ ├── oracle-1714234600-def456.json # active dispatch
45
+ └── oracle-1714150000-old.json # >24h, will be cleaned next session start
46
+ ```
47
+
48
+ One file per dispatch. No master index — directory listing IS the queue.
49
+
50
+ ## Dispatch Flow (D1-D4)
51
+
52
+ 1. **D1 Receive**: `oracle.dispatched` arrives with `{sessionId, triggerSignal, sourceSkill, targetModel, bundleHash}`.
53
+
54
+ 2. **D2 Idempotency**: Glob `.rune/oracle-pending/*.json`. If any pending record matches `bundleHash` → return its `sessionId` to caller. Skip D3-D4.
55
+
56
+ 3. **D3 Write record**: Create `<sessionId>.json` with full schema. `status=pending`, `timeoutAt = dispatchedAt + 10min` (configurable via `RUNE_ORACLE_TIMEOUT_SEC`).
57
+
58
+ 4. **D4 Return control**: Caller (`adversary`) returns the sessionId to its parent (`debug`/`fix`). Parent agent emits its non-blocking continuation marker and resumes adjacent work.
59
+
60
+ ## Reattach Flow (D5)
61
+
62
+ Called by `cook` Phase 4 (between tasks) or `team` workstream coordinator (before next worker dispatch):
63
+
64
+ ```
65
+ session-bridge --reattach <sessionId>
66
+ ```
67
+
68
+ Returns one of:
69
+ - `{ status: "complete", responseExcerpt: "...", responseId: "..." }` — primary agent consumes the reply
70
+ - `{ status: "pending", remainingMs: 234000 }` — primary agent works on next independent task, polls again next phase boundary
71
+ - `{ status: "failed", reason: "timeout" | "rejected" | "no_citations" }` — primary agent continues without second opinion
72
+
73
+ After `complete` is consumed, the record is renamed `<sessionId>.consumed.json` and removed at next cleanup.
74
+
75
+ ## Cleanup Flow (D6)
76
+
77
+ On every session start (load-mode entry), session-bridge scans `.rune/oracle-pending/`:
78
+ - For each `*.json` file: read `dispatchedAt`. If `now - dispatchedAt > 24h`, delete the file
79
+ - Log cleanup count to `session-log.md` (e.g. "cleaned 3 orphaned oracle-pending records")
80
+
81
+ ## Concurrency Considerations
82
+
83
+ **Single primary agent** (typical Claude Code session): no concurrency concern. Sequential reads/writes.
84
+
85
+ **Multi-agent (`team` parallel workstreams)**: each workstream may have its own pending record. Idempotency in D2 prevents two workers from dispatching the same bundle. Different bundles produce different sessionIds → no collision.
86
+
87
+ **File-system write atomicity**: write to `<sessionId>.json.tmp` first, then `fs.rename` to final name (atomic on POSIX, atomic-enough on NTFS for our purposes).
88
+
89
+ ## Failure Modes
90
+
91
+ | Symptom | Likely Cause | Recovery |
92
+ |---------|--------------|----------|
93
+ | Duplicate sessionIds in directory | Hash collision (unlikely) or clock skew | sessionId includes timestamp; collision in same millisecond = caller's bug |
94
+ | Pending record never reaches `complete` | Network failure, model timeout | D5 detects `timeoutAt` exceeded → emit `oracle.failed` reason=`timeout` |
95
+ | Pending record JSON corrupt | Disk full mid-write | D5 read fails → log warning, treat as `failed` reason=`corrupt`, primary continues |
96
+ | Cleanup deletes record while reattach polling | TOCTOU race | D6 only deletes records >24h old; active dispatches (<10min) safe |
97
+
98
+ ## Configuration
99
+
100
+ Environment variables (all optional):
101
+
102
+ - `RUNE_ORACLE_TIMEOUT_SEC` — override default 600s timeout
103
+ - `RUNE_ORACLE_PENDING_DIR` — override `.rune/oracle-pending/` location
104
+ - `RUNE_ORACLE_CLEANUP_HOURS` — override default 24h orphan threshold
105
+
106
+ ## Why Filesystem (vs in-memory queue)
107
+
108
+ 1. **Survives session restart** — if Claude Code session is reloaded mid-dispatch, the pending record is still there
109
+ 2. **No new infra** — no Redis, no SQLite, no external service
110
+ 3. **Inspectable** — user can `cat .rune/oracle-pending/*.json` to debug
111
+ 4. **Cross-process safe** — `team` parallel workstreams in different processes can coordinate via file system
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: skill-forge
3
- description: Use when creating new Rune skills, editing existing skills, or verifying skill quality before deployment. Applies TDD discipline to skill authoring — test before write, verify before ship.
3
+ description: "Use when creating new Rune skills, editing existing skills, or verifying skill quality before deployment. Applies TDD discipline to skill authoring — test before write, verify before ship."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "1.8.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: slides
3
- description: Generate Marp-compatible slide decks from structured JSON schema. Converts context into presentations for tech talks, sprint demos, and tutorials.
3
+ description: "Generate Marp-compatible slide decks from structured JSON schema. Converts context into presentations for tech talks, sprint demos, and tutorials."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.1.0"