@rune-kit/rune 2.14.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 (67) hide show
  1. package/README.md +19 -11
  2. package/compiler/__tests__/adapter-model-mapping.test.js +152 -0
  3. package/compiler/__tests__/context-preview-signal.test.js +166 -0
  4. package/compiler/__tests__/oracle-bundle-format.test.js +210 -0
  5. package/compiler/__tests__/oracle-pending-schema.test.js +209 -0
  6. package/compiler/__tests__/skill-description-quality.test.js +147 -0
  7. package/compiler/adapters/antigravity.js +17 -1
  8. package/compiler/adapters/claude.js +4 -0
  9. package/compiler/adapters/codex.js +16 -1
  10. package/compiler/adapters/cursor.js +4 -0
  11. package/compiler/adapters/generic.js +14 -1
  12. package/compiler/adapters/openclaw.js +15 -1
  13. package/compiler/adapters/opencode.js +17 -1
  14. package/compiler/adapters/windsurf.js +4 -0
  15. package/package.json +1 -1
  16. package/skills/adversary/SKILL.md +61 -1
  17. package/skills/adversary/evals.md +79 -0
  18. package/skills/adversary/references/context-bundle-format.md +122 -0
  19. package/skills/adversary/references/oracle-mode.md +116 -0
  20. package/skills/asset-creator/SKILL.md +1 -1
  21. package/skills/audit/SKILL.md +2 -1
  22. package/skills/autopsy/SKILL.md +1 -1
  23. package/skills/ba/SKILL.md +1 -1
  24. package/skills/brainstorm/SKILL.md +1 -1
  25. package/skills/browser-pilot/SKILL.md +1 -1
  26. package/skills/completion-gate/SKILL.md +1 -1
  27. package/skills/constraint-check/SKILL.md +1 -1
  28. package/skills/context-engine/SKILL.md +85 -1
  29. package/skills/context-engine/references/preview-gate.md +139 -0
  30. package/skills/cook/SKILL.md +1 -0
  31. package/skills/db/SKILL.md +1 -1
  32. package/skills/debug/SKILL.md +6 -4
  33. package/skills/dependency-doctor/SKILL.md +1 -1
  34. package/skills/design/SKILL.md +1 -1
  35. package/skills/doc-processor/SKILL.md +1 -1
  36. package/skills/docs/SKILL.md +1 -1
  37. package/skills/docs-seeker/SKILL.md +1 -1
  38. package/skills/fix/SKILL.md +4 -3
  39. package/skills/git/SKILL.md +1 -1
  40. package/skills/hallucination-guard/SKILL.md +1 -1
  41. package/skills/integrity-check/SKILL.md +1 -1
  42. package/skills/journal/SKILL.md +1 -1
  43. package/skills/logic-guardian/SKILL.md +1 -1
  44. package/skills/marketing/SKILL.md +1 -1
  45. package/skills/mcp-builder/SKILL.md +1 -1
  46. package/skills/onboard/SKILL.md +1 -1
  47. package/skills/perf/SKILL.md +1 -1
  48. package/skills/plan/SKILL.md +1 -1
  49. package/skills/preflight/SKILL.md +1 -1
  50. package/skills/research/SKILL.md +1 -1
  51. package/skills/retro/SKILL.md +1 -1
  52. package/skills/review/SKILL.md +2 -2
  53. package/skills/review-intake/SKILL.md +1 -1
  54. package/skills/safeguard/SKILL.md +1 -1
  55. package/skills/scaffold/SKILL.md +1 -1
  56. package/skills/sentinel/SKILL.md +1 -1
  57. package/skills/sentinel-env/SKILL.md +1 -1
  58. package/skills/session-bridge/SKILL.md +91 -4
  59. package/skills/session-bridge/references/detach-protocol.md +111 -0
  60. package/skills/skill-forge/SKILL.md +1 -1
  61. package/skills/slides/SKILL.md +1 -1
  62. package/skills/surgeon/SKILL.md +1 -1
  63. package/skills/team/SKILL.md +3 -0
  64. package/skills/trend-scout/SKILL.md +1 -1
  65. package/skills/video-creator/SKILL.md +1 -1
  66. package/skills/watchdog/SKILL.md +1 -1
  67. package/skills/worktree/SKILL.md +1 -1
@@ -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"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: surgeon
3
- description: Incremental refactorer. Use within a rescue workflow after safeguard has set up safety nets. Refactors ONE module per session using proven patterns — Strangler Fig, Branch by Abstraction, Expand-Migrate-Contract.
3
+ description: "Incremental refactorer. Use within a rescue workflow after safeguard has set up safety nets. Refactors ONE module per session using proven patterns — Strangler Fig, Branch by Abstraction, Expand-Migrate-Contract."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.2.0"
@@ -11,6 +11,7 @@ metadata:
11
11
  group: orchestrator
12
12
  tools: "Read, Write, Edit, Bash, Glob, Grep"
13
13
  emit: phase.complete
14
+ listen: context.preview
14
15
  ---
15
16
 
16
17
  # team
@@ -285,6 +286,8 @@ Mark todo[1] `completed`.
285
286
 
286
287
  Mark todo[2] `in_progress`.
287
288
 
289
+ **3a-pre. Oracle reattach sweep.** Before merge coordination, glob `.rune/oracle-pending/*.json`. For any worker stream that emitted `oracle.dispatched` during Phase 2, invoke `session-bridge --reattach <sessionId>`. Worker streams with `status=pending` past their `timeoutAt` are unblocked via `oracle.failed` so coordination can proceed. Workers with `status=complete` consume the response before merge.
290
+
288
291
  **3a. Check for file conflicts.**
289
292
 
290
293
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: trend-scout
3
- description: Scan market trends, competitor activity, and emerging patterns. Monitors Product Hunt, GitHub Trending, HackerNews, and social platforms.
3
+ description: "Scan market trends, competitor activity, and emerging patterns. Monitors Product Hunt, GitHub Trending, HackerNews, and social platforms."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.2.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: video-creator
3
- description: Video content planning. Writes narration scripts, storyboards, shot lists, and asset checklists. Saves plan to marketing/video-plan.md.
3
+ description: "Video content planning. Writes narration scripts, storyboards, shot lists, and asset checklists. Saves plan to marketing/video-plan.md."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.2.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: watchdog
3
- description: Post-deploy monitoring. Checks if deployed app is healthy — HTTP status, response times, error detection, and smoke test report.
3
+ description: "Post-deploy monitoring. Use when verifying a deployed app is healthy after deploy or launch auto-fires from launch/deploy. Checks HTTP status, response times, error detection, and smoke test report."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.2.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: worktree
3
- description: "Git worktree lifecycle management. Creates isolated workspaces for parallel development, manages branches, handles cleanup. Called by team and cook for parallel isolation."
3
+ description: "Git worktree lifecycle management. Use when team needs parallel isolated workspaces for multi-stream development, or when an experiment must not touch the main working tree. Creates isolated workspaces, manages branches, handles cleanup. Called by team and cook."
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev