@rune-kit/rune 2.14.0 → 2.16.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 (74) hide show
  1. package/README.md +31 -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 +149 -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 +2 -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 +73 -5
  24. package/skills/ba/references/synthesis-mode.md +105 -0
  25. package/skills/brainstorm/SKILL.md +1 -1
  26. package/skills/browser-pilot/SKILL.md +1 -1
  27. package/skills/completion-gate/SKILL.md +1 -1
  28. package/skills/constraint-check/SKILL.md +1 -1
  29. package/skills/context-engine/SKILL.md +119 -2
  30. package/skills/context-engine/references/caveman-mode.md +107 -0
  31. package/skills/context-engine/references/preview-gate.md +139 -0
  32. package/skills/context-pack/SKILL.md +22 -1
  33. package/skills/context-pack/references/agent-brief.md +194 -0
  34. package/skills/cook/SKILL.md +3 -2
  35. package/skills/db/SKILL.md +1 -1
  36. package/skills/debug/SKILL.md +22 -6
  37. package/skills/debug/references/feedback-loop-ladder.md +62 -0
  38. package/skills/dependency-doctor/SKILL.md +1 -1
  39. package/skills/design/SKILL.md +1 -1
  40. package/skills/doc-processor/SKILL.md +1 -1
  41. package/skills/docs/SKILL.md +1 -1
  42. package/skills/docs-seeker/SKILL.md +1 -1
  43. package/skills/fix/SKILL.md +4 -3
  44. package/skills/git/SKILL.md +1 -1
  45. package/skills/hallucination-guard/SKILL.md +1 -1
  46. package/skills/integrity-check/SKILL.md +1 -1
  47. package/skills/journal/SKILL.md +1 -1
  48. package/skills/logic-guardian/SKILL.md +1 -1
  49. package/skills/marketing/SKILL.md +1 -1
  50. package/skills/mcp-builder/SKILL.md +1 -1
  51. package/skills/onboard/SKILL.md +1 -1
  52. package/skills/perf/SKILL.md +1 -1
  53. package/skills/plan/SKILL.md +10 -5
  54. package/skills/plan/references/vertical-slice.md +79 -0
  55. package/skills/preflight/SKILL.md +1 -1
  56. package/skills/research/SKILL.md +1 -1
  57. package/skills/retro/SKILL.md +1 -1
  58. package/skills/review/SKILL.md +2 -2
  59. package/skills/review-intake/SKILL.md +27 -7
  60. package/skills/review-intake/references/issue-triage.md +202 -0
  61. package/skills/safeguard/SKILL.md +1 -1
  62. package/skills/scaffold/SKILL.md +1 -1
  63. package/skills/sentinel/SKILL.md +1 -1
  64. package/skills/sentinel-env/SKILL.md +1 -1
  65. package/skills/session-bridge/SKILL.md +91 -4
  66. package/skills/session-bridge/references/detach-protocol.md +111 -0
  67. package/skills/skill-forge/SKILL.md +1 -1
  68. package/skills/slides/SKILL.md +1 -1
  69. package/skills/surgeon/SKILL.md +3 -1
  70. package/skills/team/SKILL.md +5 -0
  71. package/skills/trend-scout/SKILL.md +1 -1
  72. package/skills/video-creator/SKILL.md +1 -1
  73. package/skills/watchdog/SKILL.md +1 -1
  74. package/skills/worktree/SKILL.md +1 -1
@@ -3,11 +3,13 @@ name: adversary
3
3
  description: "Pre-implementation red-team analysis. Use when a plan is high-risk, critical path, or expensive to reverse. Challenges plans before code is written — finds edge cases, security holes, scalability bottlenecks, error propagation risks, and integration conflicts. Catches flaws at plan time (10x cheaper than post-implementation)."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.1.0"
6
+ version: "0.2.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: quality
10
10
  tools: "Read, Glob, Grep"
11
+ emit: oracle.dispatched, oracle.response, oracle.failed
12
+ listen: agent.stuck, context.preview
11
13
  ---
12
14
 
13
15
  # adversary
@@ -37,12 +39,16 @@ Every finding MUST reference the specific plan section, file, or assumption it c
37
39
  - `scout` (L2): find existing code that might conflict with planned changes
38
40
  - `docs-seeker` (L3): verify framework/API assumptions in the plan are correct and current
39
41
  - `hallucination-guard` (L3): verify that APIs, packages, or patterns referenced in the plan actually exist
42
+ - `context-engine` (L3): (oracle-mode) emit `context.preview` before bundle build to gate token cost
43
+ - `session-bridge` (L3): (oracle-mode) detach protocol when target model is opus-class for non-blocking dispatch
40
44
 
41
45
  ## Called By (inbound)
42
46
 
43
47
  - `cook` (L1): Phase 2.5 — after plan approval, before TDD
44
48
  - `plan` (L2): optional post-step for critical features
45
49
  - `team` (L1): when decomposing large tasks, adversary validates the decomposition
50
+ - `debug` (L2): (oracle-mode) listens to `agent.stuck` from debug after 3 disproved hypotheses
51
+ - `fix` (L2): (oracle-mode) listens to `agent.stuck` from fix after 2+ failed attempts
46
52
  - User: `/rune adversary` direct invocation
47
53
 
48
54
  ## Cross-Hub Connections
@@ -229,6 +235,54 @@ Trigger: plan modifies < 3 files AND no auth/payment/data logic.
229
235
  Steps 2 and 5 only (security + integration). Used when `sentinel` requests adversarial pre-analysis.
230
236
  Trigger: plan involves auth, crypto, payment, or user data handling.
231
237
 
238
+ ### Mode: oracle (v0.2.0)
239
+
240
+ **Triggered by**: `agent.stuck` signal — emitted by `debug` (after 3 disproved hypotheses) or `fix` (after 2+ failed attempts on the same file).
241
+
242
+ **Purpose**: Break confirmation-bias loops. The same agent that read `auth.ts` 3 times has formed a theory it cannot un-form. Oracle-mode dispatches a stateless second-model pass with explicit "no prior context" framing, breaking the semantic loop that `scout`'s zoom-out mode (structural pivot) cannot.
243
+
244
+ **When NOT to use**:
245
+ - Single hypothesis cycle — escalate only after 3 cycles in `debug` or 2 attempts in `fix`
246
+ - Trivial single-file bugs — overhead exceeds value
247
+ - When the user already knows the answer — they're trying to validate, not diagnose
248
+
249
+ **Protocol**:
250
+
251
+ 1. **Pre-bundle gate** — emit `context.preview` to `context-engine` first; abort if action=block
252
+ 2. **Build context bundle** — see `references/context-bundle-format.md` for exact format
253
+ 3. **Dispatch** — emit `oracle.dispatched` signal; route via `session-bridge` detach if target model is opus-class (non-blocking)
254
+ 4. **Wait for response** — synchronous if model is sonnet-class, polled via `.rune/oracle-pending/<id>.json` if opus-class
255
+ 5. **Validate response** — every claim MUST cite file:line. Strip + warn on uncited claims (`oracle.failed` if all claims uncited)
256
+ 6. **Emit response** — `oracle.response` carries the validated diagnosis, consumed by `debug`/`fix` to override or refine their current hypothesis
257
+
258
+ **Bundle format** (mandatory regex-validated):
259
+
260
+ ```
261
+ [SYSTEM] You are Oracle, a focused one-shot problem solver. You have NO prior context — assume zero project knowledge. Cite file:line for every claim. Reject any claim you cannot ground in the provided files.
262
+
263
+ [USER] <agent stuck after N hypothesis cycles. What is the most likely root cause not yet considered?>
264
+
265
+ ### File 1: <relative/path/to/file.ts>
266
+ <file content, normalized whitespace, max 4k chars per file>
267
+
268
+ ### File 2: <...>
269
+ <...>
270
+ ```
271
+
272
+ **Hard caps**:
273
+ - Bundle ≤ 100k tokens (estimated via char count × 0.25)
274
+ - Per-file ≤ 4k chars (truncate with explicit `... [truncated]` marker)
275
+ - Max 12 files per bundle (force caller to prune larger sets)
276
+
277
+ **Response contract** — Oracle reply MUST contain:
278
+ - A primary diagnosis (1-3 sentences)
279
+ - At least 1 file:line citation per claim
280
+ - An action recommendation (specific edit, additional file to read, hypothesis to test)
281
+
282
+ Replies failing this contract are rejected — `oracle.failed` emitted, primary agent continues without second opinion.
283
+
284
+ See `references/oracle-mode.md` for the full protocol and integration with `debug`/`fix`.
285
+
232
286
  ## Constraints
233
287
 
234
288
  1. MUST challenge every plan — no rubber-stamping. At minimum, one finding per analyzed dimension
@@ -238,6 +292,8 @@ Trigger: plan involves auth, crypto, payment, or user data handling.
238
292
  5. MUST use concrete attack scenarios, not vague warnings ("could be a problem" is NOT a finding)
239
293
  6. MUST NOT block on MEDIUM/LOW findings — only CRITICAL and HIGH trigger REVISE verdict
240
294
  7. MUST include Strength Notes — adversary finds weaknesses AND acknowledges what's well-designed
295
+ 8. (oracle-mode) MUST emit `context.preview` BEFORE building the bundle — abort if context-engine action=block
296
+ 9. (oracle-mode) MUST validate every Oracle reply citation against the provided files — reject uncited claims as `oracle.failed`
241
297
 
242
298
  ## Mesh Gates
243
299
 
@@ -256,6 +312,9 @@ Trigger: plan involves auth, crypto, payment, or user data handling.
256
312
  | Missing context — challenging plan without understanding existing codebase | HIGH | Step 0 MUST load existing code context via scout before challenging |
257
313
  | Scope creep — reviewing existing code quality instead of plan quality | MEDIUM | Adversary reviews THE PLAN, not the codebase. Existing code is context only |
258
314
  | Redundancy with review/preflight — duplicating post-implementation checks | MEDIUM | Adversary operates PRE-implementation only. Never run adversary on existing code |
315
+ | (oracle-mode) Bundle exceeds token cap — caller didn't prune | HIGH | Caller MUST run `context.preview` first; adversary fails fast with `oracle.failed` instead of silently truncating signal |
316
+ | (oracle-mode) Oracle reply has no citations — model improvised | CRITICAL | Reject reply with `oracle.failed`. Primary agent continues without second opinion (better than acting on hallucination) |
317
+ | (oracle-mode) Loop: oracle reply triggers another `agent.stuck` | HIGH | Cap at 1 oracle dispatch per primary-agent stuck cycle. Subsequent stucks must escalate to user |
259
318
 
260
319
  ## Done When
261
320
 
@@ -265,6 +324,7 @@ Trigger: plan involves auth, crypto, payment, or user data handling.
265
324
  - Verdict rendered: REVISE, HARDEN, or PROCEED
266
325
  - Findings formatted for consumption by cook Phase 3 (if PROCEED) or plan (if REVISE)
267
326
  - Strength Notes section acknowledges well-designed aspects of the plan
327
+ - (oracle-mode) If dispatched: response cited file:line for each claim, or `oracle.failed` emitted with rejection reason
268
328
 
269
329
  ## Returns
270
330
 
@@ -0,0 +1,79 @@
1
+ # Adversary — Evaluation Scenarios
2
+
3
+ Synthetic scenarios for verifying adversary skill behavior. Each eval has setup, expected behavior, and pass/fail criteria.
4
+
5
+ ## E01: Full red-team on payment plan (happy path)
6
+
7
+ **Setup**: User provides plan to add Stripe checkout flow with webhook handlers.
8
+
9
+ **Expected**:
10
+ - All 5 dimensions analyzed
11
+ - Security findings include: webhook signature verification, idempotency keys, amount tampering
12
+ - Integration findings include: existing user-account schema, order state machine
13
+ - Verdict: HARDEN (specific remediations applied to plan)
14
+ - Strength Notes acknowledges any well-specified parts
15
+
16
+ **Pass criteria**: Report has ≥1 finding per dimension, ≥3 CRITICAL/HIGH findings on auth/payment specifics, sentinel called for crypto verification.
17
+
18
+ ## E02: Quick Challenge mode
19
+
20
+ **Setup**: Plan modifies 2 files, no auth/payment logic.
21
+
22
+ **Expected**:
23
+ - Steps 3-4 (scalability, error propagation) skipped
24
+ - Edge cases + security + integration analyzed
25
+ - Report explicitly states "Quick Challenge mode used — scale/error analysis skipped"
26
+
27
+ **Pass criteria**: 3-dimension analysis only; report header notes mode.
28
+
29
+ ## E03: Rubber-stamp resistance
30
+
31
+ **Setup**: User says "this plan is approved by the team, just confirm it's fine."
32
+
33
+ **Expected**:
34
+ - Adversary STILL produces ≥1 finding per analyzed dimension
35
+ - Does NOT skip dimensions because user is confident
36
+ - Does NOT downgrade severity because user is confident
37
+ - Strength Notes can acknowledge team review, but findings remain unchanged
38
+
39
+ **Pass criteria**: Report has same finding count as if user said nothing.
40
+
41
+ ## E04: Oracle-mode happy path (v0.2.0)
42
+
43
+ **Setup**: `debug` emits `agent.stuck` after 3 disproved hypotheses on `src/auth/login.ts:127` (intermittent 401). Bundle contains: login.ts, middleware/auth.ts, session.ts, error log excerpt.
44
+
45
+ **Expected**:
46
+ - Adversary listens to `agent.stuck`, dispatches oracle-mode
47
+ - `context.preview` emitted FIRST → context-engine returns action=proceed
48
+ - Bundle built per `context-bundle-format.md` (regex-validated)
49
+ - `oracle.dispatched` emitted with `{sessionId, sourceSkill: debug, targetModel}`
50
+ - Reply received and validated — every claim has file:line citation
51
+ - `oracle.response` emitted with diagnosis + recommendation + confidence
52
+ - `debug` Phase 4 consumes the response, treats as new hypothesis H_oracle
53
+
54
+ **Pass criteria**: All 4 signals fire in order (`context.preview` → `oracle.dispatched` → `oracle.response`); reply citations all reference files present in the bundle.
55
+
56
+ ## E05: Oracle-mode bundle overflow
57
+
58
+ **Setup**: `debug` emits `agent.stuck` with 25 files in scope (totaling 600k chars).
59
+
60
+ **Expected**:
61
+ - `context.preview` emitted, returns action=block (>100k token estimate)
62
+ - Adversary aborts with `oracle.failed` reason=`context_budget_exceeded`
63
+ - Primary `debug` agent continues without second opinion
64
+ - User sees clear advisory: "Bundle too large — prune file scope and retry"
65
+
66
+ **Pass criteria**: No `oracle.dispatched` emitted; `oracle.failed` carries the budget reason.
67
+
68
+ ## E06: Oracle-mode jailbreak (uncited reply)
69
+
70
+ **Setup**: Oracle reply ignores citation requirement, returns 4 plausible-sounding diagnoses with zero file:line references.
71
+
72
+ **Expected**:
73
+ - Adversary validates reply per `context-bundle-format.md` reply contract
74
+ - Every claim found uncited → reply rejected
75
+ - `oracle.failed` emitted with reason=`no_citations`
76
+ - Primary agent continues without second opinion (better than acting on hallucination)
77
+ - User sees advisory: "Oracle reply lacked citations — discarded"
78
+
79
+ **Pass criteria**: No `oracle.response` emitted; `oracle.failed` carries `no_citations` reason; downstream `debug`/`fix` does not consume the rejected reply.
@@ -0,0 +1,122 @@
1
+ # Oracle Context Bundle Format
2
+
3
+ ## Purpose
4
+
5
+ Define the exact, regex-validated format for context bundles dispatched by adversary oracle-mode. Strict format ensures the second model receives consistent input regardless of which primary agent (debug/fix/manual) triggered the dispatch.
6
+
7
+ ## Bundle Structure
8
+
9
+ ```
10
+ [SYSTEM] You are Oracle, a focused one-shot problem solver. You have NO prior context — assume zero project knowledge. Cite file:line for every claim. Reject any claim you cannot ground in the provided files.
11
+
12
+ [USER] <problem statement — see USER section spec below>
13
+
14
+ ### File 1: <relative/path/to/file>
15
+ <file content, normalized whitespace, max 4k chars per file>
16
+
17
+ ### File 2: <relative/path/to/file>
18
+ <...>
19
+
20
+ ### File N: <relative/path/to/file>
21
+ <...>
22
+ ```
23
+
24
+ ## Section Specs
25
+
26
+ ### `[SYSTEM]` line
27
+
28
+ **Required**, **exact text**:
29
+
30
+ ```
31
+ [SYSTEM] You are Oracle, a focused one-shot problem solver. You have NO prior context — assume zero project knowledge. Cite file:line for every claim. Reject any claim you cannot ground in the provided files.
32
+ ```
33
+
34
+ Validation regex: `^\[SYSTEM\] You are Oracle, a focused one-shot problem solver\.`
35
+
36
+ The framing is invariant. Do not attempt to "improve" it per-call — the second model must receive the same role-priming every time.
37
+
38
+ ### `[USER]` line
39
+
40
+ **Required**, **template-driven** based on trigger source:
41
+
42
+ | Source | Template |
43
+ |--------|----------|
44
+ | `debug` agent.stuck | `[USER] Agent stuck after <N> hypothesis cycles. Disproved: <H1>; <H2>; <H3>. Error: <error_summary>. What is the most likely root cause not yet considered?` |
45
+ | `fix` agent.stuck | `[USER] Agent stuck after <N> failed fix attempts on <file>. Each attempt's tests failed with: <test_failure_summary>. What is the most likely cause of the test failure?` |
46
+ | Manual | `[USER] <free-form problem statement, max 500 chars>` |
47
+
48
+ Validation regex: `^\[USER\] .{20,2000}$`
49
+
50
+ ### `### File <N>` blocks
51
+
52
+ **Optional** (zero files allowed for purely conceptual questions, but typical: 3-12 files).
53
+
54
+ Format per block:
55
+ - Header: `### File <N>: <relative-path>` — N starts at 1, increments by 1
56
+ - Body: file content, normalized whitespace (collapse 3+ blank lines to 2, trim trailing whitespace per line)
57
+ - Body cap: 4000 characters. If file exceeds, truncate at the most recent line boundary before 4000 chars and append `... [truncated]` on its own line
58
+
59
+ Validation regex per header: `^### File \d+: [^\n]+$`
60
+
61
+ ## Hard Caps
62
+
63
+ | Cap | Limit | Behavior on exceed |
64
+ |-----|-------|---------------------|
65
+ | Total bundle (chars) | 400,000 (~100k tokens) | Reject before dispatch — `oracle.failed` reason=`bundle_too_large` |
66
+ | Per file (chars) | 4,000 | Truncate with `... [truncated]` marker |
67
+ | File count | 12 | Reject before dispatch — caller MUST prune via `context.preview` first |
68
+ | `[USER]` length | 2,000 chars | Truncate at sentence boundary |
69
+
70
+ ## Whitespace Normalization
71
+
72
+ Applied to every file body:
73
+
74
+ 1. Replace `\r\n` with `\n`
75
+ 2. Collapse 3+ consecutive newlines into 2 (`\n\n\n+` → `\n\n`)
76
+ 3. Trim trailing whitespace on each line (preserve indentation)
77
+ 4. Remove tab characters from line ends only (preserve leading tabs)
78
+
79
+ Code blocks (lines between matching ` ``` ` fences) are exempt from collapse — preserve internal blank lines exactly.
80
+
81
+ ## Forbidden Content
82
+
83
+ The following content MUST be stripped before bundle build:
84
+
85
+ - Lines matching `process\.env\.[A-Z_]+\s*=\s*["'][^"']+["']` (env-var assignments with secrets)
86
+ - Lines matching `(api[_-]?key|secret|password|token)\s*[:=]\s*["'][^"']{8,}["']` (hardcoded creds)
87
+ - Lines matching `Authorization:\s*Bearer\s+\S{20,}` (auth headers in test fixtures)
88
+
89
+ If any match found: replace value with `<REDACTED>` and continue. Do not abort dispatch — bundle still useful for diagnosis with credentials redacted.
90
+
91
+ ## Reply Contract (validation post-dispatch)
92
+
93
+ The Oracle reply MUST satisfy:
94
+
95
+ 1. **Diagnosis present** — at least one paragraph stating primary cause
96
+ 2. **Citations present** — at least 1 `<file>:<line>` reference per non-trivial claim
97
+ 3. **Citations valid** — every cited file appears in the bundle's `### File N` blocks
98
+ 4. **Recommendation present** — concrete next action (specific edit, file to read, hypothesis to test)
99
+ 5. **No "I am unable to" responses** — if Oracle truly cannot diagnose, it MUST say "Insufficient context" + name what additional file/info would help
100
+
101
+ Failures of (1)-(4) emit `oracle.failed` with the corresponding reason.
102
+ Failure of (5) accepted but downgrades `oracle.response.confidence` to `low`.
103
+
104
+ ## Example (compact)
105
+
106
+ ```
107
+ [SYSTEM] You are Oracle, a focused one-shot problem solver. You have NO prior context — assume zero project knowledge. Cite file:line for every claim. Reject any claim you cannot ground in the provided files.
108
+
109
+ [USER] Agent stuck after 3 hypothesis cycles. Disproved: race condition on user.session; stale cache in middleware; bad type cast in handler. Error: 401 Unauthorized intermittent on POST /api/orders. What is the most likely root cause not yet considered?
110
+
111
+ ### File 1: src/api/orders.ts
112
+ import { auth } from './middleware/auth';
113
+ ... [content] ...
114
+
115
+ ### File 2: src/middleware/auth.ts
116
+ ... [content] ...
117
+
118
+ ### File 3: src/services/session.ts
119
+ ... [content] ...
120
+ ```
121
+
122
+ The reply, post-validation, becomes the payload of `oracle.response`.
@@ -0,0 +1,116 @@
1
+ # Adversary Oracle-Mode
2
+
3
+ ## Purpose
4
+
5
+ Break the confirmation-bias loop that traps a single agent reading the same files repeatedly. After 3 disproved hypotheses in `debug` or 2+ failed attempts in `fix`, the agent has read the same files multiple times and formed a theory it cannot un-form. Oracle-mode dispatches a stateless second-model pass with explicit "no prior context" framing.
6
+
7
+ This is a **semantic** pivot. `scout`'s zoom-out mode is the **structural** pivot (look at adjacent modules). Both fire on the same `agent.stuck` signal; both run; the agent receives both perspectives.
8
+
9
+ ## When to Dispatch
10
+
11
+ | Trigger | Source | Threshold |
12
+ |---------|--------|-----------|
13
+ | 3 hypothesis cycles disproved | `debug` | After 3rd disproved hypothesis emits `agent.stuck` |
14
+ | 2 fix attempts on same file failed | `fix` | After 2nd attempt's tests fail emits `agent.stuck` |
15
+
16
+ Oracle-mode listens to `agent.stuck` and starts the dispatch flow automatically. Manual invocation: `/rune adversary --mode=oracle`.
17
+
18
+ ## When NOT to Dispatch
19
+
20
+ - Single hypothesis cycle — escalate only after threshold reached
21
+ - Trivial single-file bugs — overhead exceeds value
22
+ - Recurring loop on the same `agent.stuck` from the same root cause — cap at 1 oracle dispatch per stuck cycle
23
+
24
+ ## Protocol (6 steps)
25
+
26
+ ### 1. Pre-bundle gate
27
+
28
+ Emit `context.preview` to `context-engine` with the planned file list and prompt. If `context-engine` returns `action: block` (>100k token estimate), abort with `oracle.failed` reason=`context_budget_exceeded` and let primary agent continue without escalation.
29
+
30
+ ### 2. Build the bundle
31
+
32
+ See `context-bundle-format.md` for the regex-validated format. Hard caps:
33
+ - Bundle ≤ 100k tokens (estimated via char count × 0.25)
34
+ - Per-file ≤ 4k chars (truncate with explicit `... [truncated]` marker)
35
+ - Max 12 files per bundle (force caller to prune larger sets)
36
+
37
+ ### 3. Dispatch
38
+
39
+ Emit `oracle.dispatched` carrying `{sessionId, triggerSignal, sourceSkill, targetModel, bundleHash}`. If `targetModel` is opus-class (or non-Anthropic equivalent), route via `session-bridge` detach so primary agent can continue adjacent work.
40
+
41
+ ### 4. Wait for response
42
+
43
+ | Target model | Protocol |
44
+ |--------------|----------|
45
+ | sonnet-class (gpt-5, gemini-3-flash, claude-sonnet) | Synchronous — block until reply or 60s timeout |
46
+ | opus-class (gpt-5-pro, gemini-3-pro, claude-opus-4-7) | Async — primary agent continues; poll `.rune/oracle-pending/<sessionId>.json` between phases |
47
+
48
+ ### 5. Validate response
49
+
50
+ Every claim in the Oracle reply MUST cite file:line. Specifically:
51
+ - Reject reply if **all** claims are uncited → emit `oracle.failed` reason=`no_citations`
52
+ - Strip and warn on individual uncited claims if at least 1 is cited (best-effort acceptance)
53
+ - Verify cited file:line exists in the bundle (no hallucinated paths) → emit `oracle.failed` reason=`hallucinated_citation` if violated
54
+
55
+ ### 6. Emit response
56
+
57
+ Emit `oracle.response` carrying:
58
+ - `diagnosis` — primary cause (1-3 sentences)
59
+ - `citations` — list of `{file, line, claim}` triples
60
+ - `recommendation` — next action (specific edit, additional file to read, hypothesis to test)
61
+ - `confidence` — `high | medium | low`
62
+
63
+ Consumed by:
64
+ - `debug` Phase 4 — overrides current hypothesis, re-runs from new starting point
65
+ - `fix` Phase 3 — applies the recommended edit (still routes through normal validation gates)
66
+
67
+ ## Integration with debug
68
+
69
+ ```
70
+ debug Phase 1-3: form + test hypotheses
71
+ debug Phase 3 (3rd disproved):
72
+ emit agent.stuck
73
+
74
+ adversary oracle-mode (this skill):
75
+ emit context.preview → context-engine
76
+ emit oracle.dispatched → session-bridge (if opus)
77
+ ... reply ...
78
+ emit oracle.response
79
+
80
+ debug Phase 4:
81
+ consume oracle.response
82
+ treat as new hypothesis H_oracle
83
+ test H_oracle directly (skip 3-cycle gate since it's externally validated)
84
+ ```
85
+
86
+ ## Integration with fix
87
+
88
+ ```
89
+ fix Phase 2-3: apply edit + verify
90
+ fix Phase 3 (2nd attempt fails):
91
+ emit agent.stuck
92
+
93
+ adversary oracle-mode:
94
+ bundle: error output + last 2 attempt diffs + target file
95
+ ... reply ...
96
+ emit oracle.response
97
+
98
+ fix Phase 4:
99
+ consume oracle.response.recommendation
100
+ apply the recommended edit (if confidence=high)
101
+ or hand back to debug if recommendation=needs_more_diagnosis
102
+ ```
103
+
104
+ ## Failure Modes
105
+
106
+ | Symptom | Reason | Action |
107
+ |---------|--------|--------|
108
+ | Bundle exceeds 100k tokens | Caller didn't prune | `oracle.failed` reason=`bundle_too_large`; suggest user reduce file scope |
109
+ | Reply has zero citations | Model improvised | `oracle.failed` reason=`no_citations`; primary agent continues without second opinion |
110
+ | Reply cites a file not in bundle | Hallucination | `oracle.failed` reason=`hallucinated_citation`; reply discarded |
111
+ | Reply triggers another `agent.stuck` | Recursive loop | Cap at 1 dispatch per stuck cycle; subsequent stucks escalate to user |
112
+ | Network timeout | Detach mode failure | Cleanup `oracle-pending/<id>.json` after 10min; emit `oracle.failed` reason=`timeout` |
113
+
114
+ ## Cost Profile
115
+
116
+ Bundle build: ~200 tokens overhead per file (header + truncation markers). Reply parsing: ~100 tokens. Net cost per dispatch is dominated by the second-model invocation itself (4k-100k tokens), justified only when `agent.stuck` threshold is hit — confirming the loop is real, not a noise event.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: asset-creator
3
- description: Creates code-based visual assets — SVG icons, OG image HTML templates, social banners, and icon sets. Outputs files with usage instructions.
3
+ description: "Creates code-based visual assets — SVG icons, OG image HTML templates, social banners, and icon sets. Outputs files with usage instructions."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.2.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: audit
3
- description: Comprehensive project audit — security, dependencies, code quality, architecture, performance, infra, docs, and mesh analytics. Delegates to specialist skills and generates an 8-dimension health score.
3
+ description: "Comprehensive project audit — security, dependencies, code quality, architecture, performance, infra, docs, and mesh analytics. Delegates to specialist skills and generates an 8-dimension health score."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.4.0"
@@ -9,6 +9,7 @@ metadata:
9
9
  group: quality
10
10
  tools: "Read, Bash, Glob, Grep"
11
11
  emit: audit.complete
12
+ listen: context.preview
12
13
  ---
13
14
 
14
15
  # audit
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: autopsy
3
- description: Full codebase health assessment. Use when diagnosing project health or starting a rescue workflow on legacy code. Analyzes complexity, dependencies, dead code, tech debt, and git hotspots. Produces a health score and rescue plan.
3
+ description: "Full codebase health assessment. Use when diagnosing project health or starting a rescue workflow on legacy code. Analyzes complexity, dependencies, dead code, tech debt, and git hotspots. Produces a health score and rescue plan."
4
4
  metadata:
5
5
  author: runedev
6
6
  version: "0.4.0"
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: ba
3
- description: Business Analyst agent. Deeply understands user requirements before any planning or coding begins. Asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document that plan and cook consume.
3
+ description: "Business Analyst agent. Use when starting a new feature requiring requirements elicitation BEFORE plan or cook. Asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document that plan and cook consume."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.11.0"
6
+ version: "0.13.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: creation
10
- tools: "Read, Glob, Grep"
11
- emit: outofscope.match
10
+ tools: "Read, Write, Glob, Grep"
11
+ emit: outofscope.match, outofscope.recorded
12
12
  ---
13
13
 
14
14
  # ba
@@ -73,7 +73,26 @@ If Refactor → light version (Step 1 + Step 4 only). Skip Steps 2, 2.5, 3, 5, 6
73
73
 
74
74
  If existing codebase → invoke `rune:scout` for context before proceeding.
75
75
 
76
- ### Step 1.5Out-of-Scope Match Check
76
+ ### Step 1.4Synthesis Trigger Check
77
+ <MUST-READ path="references/synthesis-mode.md" trigger="when prior conversation already contains rich requirement context (pasted spec, > 1000 words discussion, continuation session, filled issue template)"/>
78
+
79
+ Before proceeding to elicitation, check whether the requirements are **already in context**. Re-asking what the user already told you is the second-most expensive bug.
80
+
81
+ Activate **Synthesis Mode** instead of standard elicitation if ANY of:
82
+
83
+ | Signal | Threshold |
84
+ |--------|-----------|
85
+ | User pasted a spec / PRD / brief | > 200 words describing the feature |
86
+ | Conversation has > 1000 words on this feature | Sufficient context already gathered |
87
+ | User said "synthesize" / "I already explained" / "just write the spec" | Explicit synthesis request |
88
+ | Continuation — `.rune/features/<name>/requirements.md` exists with prior answers | Re-elicitation would duplicate |
89
+ | Issue tracker has filled-in template (problem, story, acceptance criteria) | Source already structured |
90
+
91
+ In Synthesis Mode: extract answers from existing context, draft the Requirements Document with **source citations** for every section, then **confirm** rather than re-interview. Ask follow-ups ONLY on the 1-2 dimensions with genuine gaps. Skip steps 2, 2.5 if all 5 dimensions are filled or partial-but-acceptable.
92
+
93
+ Workflow detail + anti-patterns: [references/synthesis-mode.md](references/synthesis-mode.md).
94
+
95
+ ### Step 1.5 — Out-of-Scope Match Check (READ)
77
96
 
78
97
  Before any elicitation, check whether the request matches a concept previously rejected.
79
98
 
@@ -99,6 +118,50 @@ If verdict is exact-match AND user accepts the prior rejection → end the BA se
99
118
 
100
119
  Format reference: [references/out-of-scope-format.md](references/out-of-scope-format.md).
101
120
 
121
+ ### Step 1.6 — Mid-Elicitation Reject WRITE Path
122
+
123
+ If the user **explicitly rejects** the feature at any point during elicitation (Steps 2-3) — common phrases: "scrap it", "actually nah, don't build this", "we won't do this", "kill the feature", "drop it" — STOP elicitation and **write a `.out-of-scope/<slug>.md` record** before ending the session.
124
+
125
+ Without this WRITE path, oral rejections vanish — the next session re-asks the same questions and the user has to re-reject. Step 1.5 (READ) only catches matches against existing files; Step 1.6 (WRITE) is what produces those files in the first place.
126
+
127
+ <HARD-GATE>
128
+ Mid-elicitation rejection MUST produce a `.out-of-scope/<slug>.md` file before session end.
129
+ A rejection without a written record is a rejection that didn't happen.
130
+ </HARD-GATE>
131
+
132
+ **Procedure**:
133
+
134
+ 1. **Confirm rejection is durable, not deferral**. Ask one clarifier:
135
+ > "Just to record this correctly: is this **out of scope** (project doesn't want this), or **deferred** (not now but maybe later)? Out-of-scope gets recorded so we don't re-litigate; deferred goes to backlog instead."
136
+
137
+ - If **deferred** → route to backlog (no `.out-of-scope/` write), end session with a one-line note
138
+ - If **out-of-scope** → continue to step 2
139
+
140
+ 2. **Capture the durable reason**. Ask:
141
+ > "What's the reason this is out of scope? (project scope, technical constraint, strategic decision — not a temporary circumstance)"
142
+
143
+ If the user gives a temporary reason ("we're busy"), reframe: "That's a deferral — should I route to backlog instead?"
144
+
145
+ 3. **Generate slug** (kebab-case, ≤40 chars, recognizable without opening the file).
146
+
147
+ 4. **Lexical-similarity check**: `Glob` `.out-of-scope/*.md`, parse each frontmatter's `concept` + `aliases`, compute overlap. If any existing concept has ≥0.7 overlap → APPEND to that file's `prior_requests` list and mark `rejected_by: ba` for this round. Do NOT create a duplicate.
148
+
149
+ 5. **Write the file** using the format in [`references/out-of-scope-format.md`](references/out-of-scope-format.md):
150
+ - YAML frontmatter (`concept`, `aliases`, `decision: rejected`, `rejected_at`, `rejected_by: ba`, `prior_requests`, optional `revisit_if`)
151
+ - Markdown body: concept name, "Why out of scope" (substantive reasoning from step 2), "What would change our mind" (if user volunteered signals)
152
+
153
+ 6. **Emit `outofscope.recorded`** signal carrying `{slug, rejected_by: ba, prior_requests_count}` so downstream skills know a new rejection landed.
154
+
155
+ 7. **End BA session** with one-line summary:
156
+ > "Recorded as out of scope in `.out-of-scope/<slug>.md`. Future similar requests will surface this. Override anytime by editing the file."
157
+
158
+ **When NOT to write**:
159
+
160
+ - User merely defers ("not now") → backlog, not `.out-of-scope/`
161
+ - User rejects a single requirement within a larger feature → adjust requirements doc Boundaries section, don't write a whole rejection file (the feature is still in scope)
162
+ - Bug rejections (already fixed, not reproducible) → not BA's job; route to incident or close the issue
163
+ - The match was already exact (≥0.8) and Step 1.5 surfaced it — user accepting the prior rejection just appends to `prior_requests` of the existing file (handled in Step 1.5 path)
164
+
102
165
  ### Step 2.0 — Explore-First Pre-Check (HARD-GATE)
103
166
 
104
167
  Before emitting ANY of the 5 elicitation questions, run the 4-item pre-check on each intended question:
@@ -663,6 +726,11 @@ Known failure modes for this skill. Check these before declaring done.
663
726
  | User asserts behavior; agent records user's version without grep verification | HIGH | Step 2.6 HARD-GATE: every "the system does X" assertion gets grep'd; conflicts surface to user before recording |
664
727
  | Silently re-defining an existing CONTEXT.md term | HIGH | Step 7.5 conflict gate: ≥0.7 overlap → user chooses merge/rename/keep-distinct |
665
728
  | Auto-creating an empty CONTEXT.md when no terms emerged | LOW | Lazy creation rule: only write when there's a non-trivial term to record |
729
+ | Mid-elicitation rejection ("scrap it") that ends the session without writing `.out-of-scope/` | CRITICAL | Step 1.6 HARD-GATE: explicit rejection MUST produce `.out-of-scope/<slug>.md` before session end — oral rejections vanish, force re-litigation next session |
730
+ | Writing `.out-of-scope/` for a deferral instead of routing to backlog | MEDIUM | Step 1.6 procedure step 1: confirm "out of scope" vs "deferred" — temporary reasons go to backlog, not the rejection KB |
731
+ | Running 5-question elicitation when conversation already contains rich context | HIGH | Step 1.4: synthesis-trigger check fires before Step 2 — pasted spec / >1000 words / continuation / explicit "synthesize" → switch to Synthesis Mode (extract + cite + confirm), don't re-interview |
732
+ | Synthesizing requirements without source citations | HIGH | Synthesis Mode requires citing source for every dimension (user message N, pasted doc, continuation file). User cannot verify interpretation without citations |
733
+ | Auto-handoff to plan after synthesis without explicit user "go"/"locked" confirmation | HIGH | Synthesis is interpretation, not transcription. Without explicit confirmation, drift becomes a downstream bug |
666
734
  | Asking inferable questions ("what stack are you using?") without first checking package.json | HIGH | Step 2.0 HARD-GATE — every question requires prior tool-call evidence (Read/Glob/Grep) or explicit unavailability declaration |
667
735
  | Re-asking a question already answered earlier in the conversation | MEDIUM | Step 2.0 check 4 — cache and reuse, never re-ask |
668
736