@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.
- package/README.md +31 -12
- package/compiler/__tests__/adapter-model-mapping.test.js +152 -0
- package/compiler/__tests__/adr-scoring.test.js +91 -0
- package/compiler/__tests__/context-md-format.test.js +180 -0
- package/compiler/__tests__/context-pack-smell-tests.test.js +215 -0
- package/compiler/__tests__/context-preview-signal.test.js +166 -0
- package/compiler/__tests__/diversity-score.test.js +117 -0
- package/compiler/__tests__/improve-architecture.test.js +171 -0
- package/compiler/__tests__/openclaw-adapter.test.js +11 -6
- package/compiler/__tests__/oracle-bundle-format.test.js +210 -0
- package/compiler/__tests__/oracle-pending-schema.test.js +209 -0
- package/compiler/__tests__/out-of-scope-format.test.js +303 -0
- package/compiler/__tests__/skill-description-quality.test.js +147 -0
- package/compiler/__tests__/zoom-out-output.test.js +112 -0
- package/compiler/adapters/antigravity.js +17 -1
- package/compiler/adapters/claude.js +4 -0
- package/compiler/adapters/codex.js +16 -1
- package/compiler/adapters/cursor.js +4 -0
- package/compiler/adapters/generic.js +14 -1
- package/compiler/adapters/openclaw.js +15 -1
- package/compiler/adapters/opencode.js +17 -1
- package/compiler/adapters/windsurf.js +4 -0
- package/package.json +2 -2
- package/skills/adversary/SKILL.md +61 -1
- package/skills/adversary/evals.md +79 -0
- package/skills/adversary/references/context-bundle-format.md +122 -0
- package/skills/adversary/references/oracle-mode.md +116 -0
- package/skills/asset-creator/SKILL.md +1 -1
- package/skills/audit/SKILL.md +3 -1
- package/skills/autopsy/SKILL.md +1 -1
- package/skills/ba/SKILL.md +242 -83
- package/skills/ba/references/context-md-format.md +136 -0
- package/skills/ba/references/explore-first.md +107 -0
- package/skills/ba/references/out-of-scope-format.md +152 -0
- package/skills/brainstorm/SKILL.md +78 -2
- package/skills/brainstorm/references/design-it-twice.md +155 -0
- package/skills/browser-pilot/SKILL.md +1 -1
- package/skills/completion-gate/SKILL.md +1 -1
- package/skills/constraint-check/SKILL.md +1 -1
- package/skills/context-engine/SKILL.md +85 -1
- package/skills/context-engine/references/preview-gate.md +139 -0
- package/skills/context-pack/SKILL.md +68 -25
- package/skills/context-pack/evals.md +122 -0
- package/skills/context-pack/references/brief-template.md +121 -0
- package/skills/context-pack/references/durability-rules.md +109 -0
- package/skills/cook/SKILL.md +5 -4
- package/skills/db/SKILL.md +1 -1
- package/skills/debug/SKILL.md +7 -4
- package/skills/dependency-doctor/SKILL.md +1 -1
- package/skills/design/SKILL.md +1 -1
- package/skills/doc-processor/SKILL.md +1 -1
- package/skills/docs/SKILL.md +1 -1
- package/skills/docs-seeker/SKILL.md +1 -1
- package/skills/fix/SKILL.md +5 -3
- package/skills/git/SKILL.md +1 -1
- package/skills/hallucination-guard/SKILL.md +1 -1
- package/skills/improve-architecture/SKILL.md +275 -0
- package/skills/improve-architecture/evals.md +145 -0
- package/skills/improve-architecture/references/deepening.md +87 -0
- package/skills/improve-architecture/references/interface-design.md +68 -0
- package/skills/improve-architecture/references/language.md +81 -0
- package/skills/improve-architecture/references/scoring.md +122 -0
- package/skills/integrity-check/SKILL.md +1 -1
- package/skills/journal/SKILL.md +34 -7
- package/skills/journal/references/adr-criteria.md +109 -0
- package/skills/logic-guardian/SKILL.md +1 -1
- package/skills/marketing/SKILL.md +1 -1
- package/skills/mcp-builder/SKILL.md +1 -1
- package/skills/onboard/SKILL.md +1 -1
- package/skills/perf/SKILL.md +1 -1
- package/skills/plan/SKILL.md +1 -1
- package/skills/preflight/SKILL.md +1 -1
- package/skills/research/SKILL.md +1 -1
- package/skills/retro/SKILL.md +1 -1
- package/skills/review/SKILL.md +3 -2
- package/skills/review-intake/SKILL.md +26 -3
- package/skills/safeguard/SKILL.md +1 -1
- package/skills/scaffold/SKILL.md +1 -1
- package/skills/scout/SKILL.md +33 -1
- package/skills/sentinel/SKILL.md +1 -1
- package/skills/sentinel-env/SKILL.md +1 -1
- package/skills/session-bridge/SKILL.md +91 -4
- package/skills/session-bridge/references/detach-protocol.md +111 -0
- package/skills/skill-forge/SKILL.md +1 -1
- package/skills/slides/SKILL.md +1 -1
- package/skills/surgeon/SKILL.md +17 -2
- package/skills/team/SKILL.md +3 -0
- package/skills/test/SKILL.md +48 -1
- package/skills/test/evals.md +137 -0
- package/skills/test/references/mocking-policy.md +121 -0
- package/skills/test/references/test-quality.md +124 -0
- package/skills/test/references/vertical-tdd.md +110 -0
- package/skills/trend-scout/SKILL.md +1 -1
- package/skills/video-creator/SKILL.md +1 -1
- package/skills/watchdog/SKILL.md +1 -1
- package/skills/worktree/SKILL.md +1 -1
|
@@ -26,10 +26,22 @@
|
|
|
26
26
|
*
|
|
27
27
|
* Reference codex-imagen repo (darkamenosa/codex-imagen) documents the
|
|
28
28
|
* de-facto in-the-wild convention this adapter formalizes.
|
|
29
|
+
*
|
|
30
|
+
* MODEL TIER MAPPING (v2.15+):
|
|
31
|
+
* OpenClaw is provider-agnostic — emits semantic tier hints in the
|
|
32
|
+
* markdown header. Skill frontmatter `model: opus|sonnet|haiku` is
|
|
33
|
+
* translated to `tier:heavy|mid|light`. The OpenClaw runtime resolves
|
|
34
|
+
* the tier to its configured provider model.
|
|
29
35
|
*/
|
|
30
36
|
|
|
31
37
|
import { BRANDING_FOOTER } from '../transforms/branding.js';
|
|
32
38
|
|
|
39
|
+
const MODEL_MAP = {
|
|
40
|
+
opus: 'tier:heavy',
|
|
41
|
+
sonnet: 'tier:mid',
|
|
42
|
+
haiku: 'tier:light',
|
|
43
|
+
};
|
|
44
|
+
|
|
33
45
|
const TOOL_MAP = {
|
|
34
46
|
Read: 'read_file',
|
|
35
47
|
Write: 'write_file',
|
|
@@ -60,7 +72,9 @@ export default {
|
|
|
60
72
|
},
|
|
61
73
|
|
|
62
74
|
generateHeader(skill) {
|
|
63
|
-
|
|
75
|
+
const translatedModel = skill.model ? MODEL_MAP[skill.model] || skill.model : null;
|
|
76
|
+
const modelSuffix = translatedModel ? ` | model: ${translatedModel}` : '';
|
|
77
|
+
return `# rune-${skill.name}\n\n> Rune ${skill.layer} Skill | ${skill.group}${modelSuffix}\n\n`;
|
|
64
78
|
},
|
|
65
79
|
|
|
66
80
|
generateFooter() {
|
|
@@ -16,10 +16,22 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @see https://opencode.ai/docs/skills/
|
|
18
18
|
* @see https://opencode.ai/docs/agents/
|
|
19
|
+
*
|
|
20
|
+
* MODEL TIER MAPPING (v2.15+):
|
|
21
|
+
* OpenCode is provider-agnostic — emits semantic tier hints rather than
|
|
22
|
+
* concrete model names. Skill frontmatter `model: opus|sonnet|haiku` is
|
|
23
|
+
* translated to `tier:heavy|mid|light`. The OpenCode IDE resolves the
|
|
24
|
+
* tier to its configured provider model.
|
|
19
25
|
*/
|
|
20
26
|
|
|
21
27
|
import { BRANDING_FOOTER } from '../transforms/branding.js';
|
|
22
28
|
|
|
29
|
+
const MODEL_MAP = {
|
|
30
|
+
opus: 'tier:heavy',
|
|
31
|
+
sonnet: 'tier:mid',
|
|
32
|
+
haiku: 'tier:light',
|
|
33
|
+
};
|
|
34
|
+
|
|
23
35
|
const TOOL_MAP = {
|
|
24
36
|
Read: 'read the file',
|
|
25
37
|
Write: 'write/create the file',
|
|
@@ -55,7 +67,11 @@ export default {
|
|
|
55
67
|
|
|
56
68
|
generateHeader(skill) {
|
|
57
69
|
const desc = (skill.description || '').replace(/"/g, '\\"');
|
|
58
|
-
|
|
70
|
+
const lines = ['---', `name: rune-${skill.name}`, `description: "${desc}"`];
|
|
71
|
+
const translatedModel = skill.model ? MODEL_MAP[skill.model] || skill.model : null;
|
|
72
|
+
if (translatedModel) lines.push(`model: ${translatedModel}`);
|
|
73
|
+
lines.push('---', '', '');
|
|
74
|
+
return lines.join('\n');
|
|
59
75
|
},
|
|
60
76
|
|
|
61
77
|
generateFooter() {
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Emits .md rule files for .windsurf/rules/ directory.
|
|
5
5
|
* Uses prose references for cross-skill mesh (no @file support).
|
|
6
|
+
*
|
|
7
|
+
* MODEL TIER MAPPING (v2.15+):
|
|
8
|
+
* No-op. Windsurf's Anthropic API integration understands `model: opus|sonnet|haiku`
|
|
9
|
+
* natively. No translation required.
|
|
6
10
|
*/
|
|
7
11
|
|
|
8
12
|
import { BRANDING_FOOTER } from '../transforms/branding.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rune-kit/rune",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.15.0",
|
|
4
|
+
"description": "63-skill mesh for AI coding assistants — runtime auto-discipline via native hooks (Claude/Cursor/Windsurf/Antigravity), 5-layer architecture, 215+ connections, multi-platform compiler.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"rune": "./compiler/bin/rune.js"
|
|
@@ -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.
|
|
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"
|
package/skills/audit/SKILL.md
CHANGED
|
@@ -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
|
|
@@ -30,6 +31,7 @@ Comprehensive project health audit across 8 dimensions (7 project + 1 mesh analy
|
|
|
30
31
|
- `dependency-doctor` (L3): Phase 1 — vulnerability scan and outdated dependency check
|
|
31
32
|
- `sentinel` (L2): Phase 2 — security audit (OWASP Top 10, secrets, config)
|
|
32
33
|
- `autopsy` (L2): Phase 3 — code quality and complexity assessment
|
|
34
|
+
- `improve-architecture` (L2): Phase 3.5 — architecture sub-score (depth / leverage / locality across top modules)
|
|
33
35
|
- `perf` (L2): Phase 4 — performance regression check
|
|
34
36
|
- `db` (L2): Phase 5 — database health dimension (schema, migrations, indexes)
|
|
35
37
|
- `journal` (L3): record audit date, overall score, and verdict
|
package/skills/autopsy/SKILL.md
CHANGED
|
@@ -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"
|