@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.
- package/README.md +31 -11
- package/compiler/__tests__/adapter-model-mapping.test.js +152 -0
- package/compiler/__tests__/context-preview-signal.test.js +166 -0
- package/compiler/__tests__/oracle-bundle-format.test.js +210 -0
- package/compiler/__tests__/oracle-pending-schema.test.js +209 -0
- package/compiler/__tests__/skill-description-quality.test.js +149 -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 -1
- 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 +2 -1
- package/skills/autopsy/SKILL.md +1 -1
- package/skills/ba/SKILL.md +73 -5
- package/skills/ba/references/synthesis-mode.md +105 -0
- package/skills/brainstorm/SKILL.md +1 -1
- 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 +119 -2
- package/skills/context-engine/references/caveman-mode.md +107 -0
- package/skills/context-engine/references/preview-gate.md +139 -0
- package/skills/context-pack/SKILL.md +22 -1
- package/skills/context-pack/references/agent-brief.md +194 -0
- package/skills/cook/SKILL.md +3 -2
- package/skills/db/SKILL.md +1 -1
- package/skills/debug/SKILL.md +22 -6
- package/skills/debug/references/feedback-loop-ladder.md +62 -0
- 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 +4 -3
- package/skills/git/SKILL.md +1 -1
- package/skills/hallucination-guard/SKILL.md +1 -1
- package/skills/integrity-check/SKILL.md +1 -1
- package/skills/journal/SKILL.md +1 -1
- 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 +10 -5
- package/skills/plan/references/vertical-slice.md +79 -0
- 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 +2 -2
- package/skills/review-intake/SKILL.md +27 -7
- package/skills/review-intake/references/issue-triage.md +202 -0
- package/skills/safeguard/SKILL.md +1 -1
- package/skills/scaffold/SKILL.md +1 -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 +3 -1
- package/skills/team/SKILL.md +5 -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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Synthesis Mode (Chat → Requirements Without Re-Interview)
|
|
2
|
+
|
|
3
|
+
When the conversation already contains rich context — user described the feature in detail, pasted a spec, or worked through requirements iteratively — running the 5 Questions again wastes attention and breaks rapport. Synthesis mode extracts the Requirements Document from existing context, then **confirms** rather than re-interviewing.
|
|
4
|
+
|
|
5
|
+
> Re-asking what the user already told you is the second-most expensive bug after wrong requirements. The first is wrong requirements shipped correctly.
|
|
6
|
+
|
|
7
|
+
## When to use synthesis (skip the 5 Questions)
|
|
8
|
+
|
|
9
|
+
Trigger synthesis instead of elicitation if ANY of:
|
|
10
|
+
|
|
11
|
+
| Signal | Threshold |
|
|
12
|
+
|--------|-----------|
|
|
13
|
+
| User pasted a spec / PRD / brief | Any document > 200 words describing the feature |
|
|
14
|
+
| Conversation has > 1000 words discussing this feature | Sufficient context already gathered |
|
|
15
|
+
| User said "I already explained — just write the spec" / "synthesize" / "build the requirements" | Explicit synthesis request |
|
|
16
|
+
| Session is a continuation — prior session captured most answers in `.rune/features/<name>/requirements.md` | Re-elicitation would duplicate |
|
|
17
|
+
| Issue tracker / external ticket has filled-in template (problem, user story, acceptance criteria) | Source already structured |
|
|
18
|
+
|
|
19
|
+
If NONE match → fall back to standard elicitation (Step 2 — 5 Questions).
|
|
20
|
+
|
|
21
|
+
## Synthesis workflow
|
|
22
|
+
|
|
23
|
+
### Step S1 — Sweep context
|
|
24
|
+
|
|
25
|
+
Pull from in this order:
|
|
26
|
+
1. The current conversation (every message from user, in order)
|
|
27
|
+
2. Pasted documents (spec, PRD, ticket body)
|
|
28
|
+
3. `.rune/features/<feature>/requirements.md` if continuation
|
|
29
|
+
4. Codebase signals (only if needed for inference — `package.json`, `README.md`)
|
|
30
|
+
|
|
31
|
+
### Step S2 — Extract answers to the 5 dimensions
|
|
32
|
+
|
|
33
|
+
Map existing context onto the same 5 dimensions used in elicitation:
|
|
34
|
+
|
|
35
|
+
| Dimension | Where to look |
|
|
36
|
+
|-----------|---------------|
|
|
37
|
+
| **WHO** (user, technical level, surrounding workflow) | "users who...", personas, role mentions |
|
|
38
|
+
| **WHAT** (specific outcome, definition of done) | Acceptance criteria, "should", "must", success metrics |
|
|
39
|
+
| **WHY** (problem, consequence of not building) | "because", "to avoid", problem statement, motivation |
|
|
40
|
+
| **BOUNDARIES** (out of scope) | "not", "won't", "later", "v2", "future" |
|
|
41
|
+
| **CONSTRAINTS** (tech, perf, security, deadline) | Tech stack mentions, perf targets, deadlines, integrations |
|
|
42
|
+
|
|
43
|
+
For each dimension, mark **filled** | **partial** | **gap**.
|
|
44
|
+
|
|
45
|
+
### Step S3 — Identify ONLY the gaps
|
|
46
|
+
|
|
47
|
+
If all 5 dimensions are **filled** or **partial-but-acceptable** → skip directly to Step S4. No questions.
|
|
48
|
+
|
|
49
|
+
If 1-2 dimensions are **gap** → ask ONLY those questions, single round, multiple-choice format. Never ask all 5 over again.
|
|
50
|
+
|
|
51
|
+
If 3+ dimensions are **gap** → synthesis context wasn't actually rich; fall back to standard elicitation (Step 2).
|
|
52
|
+
|
|
53
|
+
### Step S4 — Draft Requirements Document
|
|
54
|
+
|
|
55
|
+
Use the standard Requirements Document format (same as elicitation output). For every dimension, cite the source:
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
### Who
|
|
59
|
+
[Synthesized statement]
|
|
60
|
+
|
|
61
|
+
> _Source: user message at [timestamp/turn], "..."_
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Citations are mandatory in synthesis mode — they let the user verify nothing was misread or invented.
|
|
65
|
+
|
|
66
|
+
### Step S5 — Confirm, don't re-elicit
|
|
67
|
+
|
|
68
|
+
Present the Requirements Document with this exact framing:
|
|
69
|
+
|
|
70
|
+
> "I synthesized requirements from our conversation. **Read each section** — if anything is wrong or missing, tell me which line. If it's correct, say 'go' and I'll lock it for plan."
|
|
71
|
+
|
|
72
|
+
Wait for explicit confirmation. Do NOT auto-proceed to plan handoff.
|
|
73
|
+
|
|
74
|
+
User responses:
|
|
75
|
+
- `"go"` / `"locked"` / `"correct"` → emit Requirements Document, hand off to plan
|
|
76
|
+
- `"section X is wrong"` → revise that section only, re-confirm
|
|
77
|
+
- `"add Y"` / `"actually..."` → treat as additional gap; ask multiple-choice if specific, otherwise add to Open Questions
|
|
78
|
+
|
|
79
|
+
## Anti-patterns
|
|
80
|
+
|
|
81
|
+
| Anti-pattern | Why it fails |
|
|
82
|
+
|--------------|--------------|
|
|
83
|
+
| Running 5 Questions after user pasted a 500-word spec | Burns trust — user already gave you the answers |
|
|
84
|
+
| Synthesizing without citations | User can't verify; one misread becomes a downstream bug |
|
|
85
|
+
| Auto-proceeding to plan after synthesis without confirmation | Synthesis is interpretation, not transcription. Confirmation prevents drift. |
|
|
86
|
+
| Asking all 5 questions even when 4 dimensions are filled | Defeats the purpose. Ask 1, not 5. |
|
|
87
|
+
| Treating "looks fine" as confirmation | Need explicit "go" or "locked" — vague approval = ambiguous handoff |
|
|
88
|
+
|
|
89
|
+
## Integration with Step 1 (Intake & Classify)
|
|
90
|
+
|
|
91
|
+
After classifying requirement type, branch:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Feature Request | Greenfield | Integration:
|
|
95
|
+
→ Check synthesis triggers
|
|
96
|
+
→ All filled (S2): synthesize + confirm (S4-S5)
|
|
97
|
+
→ Partial (1-2 gaps): synthesize + targeted questions (S3-S5)
|
|
98
|
+
→ Mostly empty (3+ gaps): fall back to standard elicitation (Step 2)
|
|
99
|
+
Bug Fix:
|
|
100
|
+
→ Skip BA entirely
|
|
101
|
+
Refactor:
|
|
102
|
+
→ Light BA (synthesis usually fits)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Synthesis mode is **opt-in via context detection**, not via user flag — the trigger is "rich context exists", not "user asked for it". The user shouldn't have to know which mode is active.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainstorm
|
|
3
|
-
description: Creative ideation and solution exploration. Generates multiple approaches with trade-offs, uses structured frameworks (SCAMPER, First Principles), and hands off to plan for structuring.
|
|
3
|
+
description: "Creative ideation and solution exploration. Generates multiple approaches with trade-offs, uses structured frameworks (SCAMPER, First Principles), and hands off to plan for structuring."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.6.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: browser-pilot
|
|
3
|
-
description: Playwright browser automation. Navigates URLs, takes screenshots, checks accessibility tree, interacts with UI elements, and reports findings.
|
|
3
|
+
description: "Playwright browser automation. Navigates URLs, takes screenshots, checks accessibility tree, interacts with UI elements, and reports findings."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.2.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: completion-gate
|
|
3
|
-
description: "Validates agent claims against evidence trail. Catches 'done' without proof, 'tests pass' without output, 'fixed' without verification. Called by cook and team
|
|
3
|
+
description: "Validates agent claims against evidence trail. Use when verifying an agent has actually done what it claims — auto-fires at workflow end. Catches 'done' without proof, 'tests pass' without output, 'fixed' without verification. Called by cook and team."
|
|
4
4
|
user-invocable: false
|
|
5
5
|
metadata:
|
|
6
6
|
author: runedev
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: constraint-check
|
|
3
|
-
description: "Meta-validator for HARD-GATEs.
|
|
3
|
+
description: "Meta-validator for HARD-GATEs. Use when auditing whether a skill's mandatory constraints were actually followed during a workflow (not just claimed). Called by cook, team, and audit for discipline compliance."
|
|
4
4
|
user-invocable: false
|
|
5
5
|
metadata:
|
|
6
6
|
author: runedev
|
|
@@ -4,11 +4,12 @@ description: "Context window management. Auto-triggered when context is filling
|
|
|
4
4
|
user-invocable: false
|
|
5
5
|
metadata:
|
|
6
6
|
author: runedev
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.2.0"
|
|
8
8
|
layer: L3
|
|
9
9
|
model: haiku
|
|
10
10
|
group: state
|
|
11
11
|
tools: "Read, Glob, Grep"
|
|
12
|
+
emit: context.preview, output.density.set
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
# context-engine
|
|
@@ -49,6 +50,7 @@ Context-engine also manages **behavioral mode injection** via `contexts/` direct
|
|
|
49
50
|
- `rescue` (L1): between refactoring sessions for state persistence
|
|
50
51
|
- `context-pack` (L3): when packaging context for sub-agent handoff
|
|
51
52
|
- `session-bridge` (L3): coordinates with context-engine for compaction timing
|
|
53
|
+
- `adversary` (L2): (oracle-mode) emit `context.preview` before bundle build to gate token cost
|
|
52
54
|
|
|
53
55
|
## Execution
|
|
54
56
|
|
|
@@ -101,9 +103,11 @@ Emit recommendation to the calling orchestrator:
|
|
|
101
103
|
|
|
102
104
|
Identify the next safe boundary (end of current loop iteration, end of current file being processed) and flag it.
|
|
103
105
|
|
|
106
|
+
**Auto-activate Caveman Output Mode** (see `references/caveman-mode.md`) — emit `output.density.set` with `mode=caveman, scope=session, source=context-orange`. Reduces output token cost ~75% with no information loss; persists until /compact returns context to GREEN. Manual override (`/caveman` or "stop caveman") always wins.
|
|
107
|
+
|
|
104
108
|
### Step 5 — If RED
|
|
105
109
|
|
|
106
|
-
Immediately trigger state save via `rune:session-bridge` (Save Mode) before any compaction occurs.
|
|
110
|
+
Immediately trigger state save via `rune:session-bridge` (Save Mode) before any compaction occurs. If caveman mode was not already active from ORANGE, emit `output.density.set` with `mode=caveman, scope=session, source=context-red` now.
|
|
107
111
|
|
|
108
112
|
Pass to session-bridge:
|
|
109
113
|
- Current task and phase description
|
|
@@ -375,11 +379,117 @@ When Context Budget Warning fires, append to Context Health report:
|
|
|
375
379
|
- **Recommendation**: Disable [server] to save ~[N]k tokens
|
|
376
380
|
```
|
|
377
381
|
|
|
382
|
+
## Output Density Mode (Caveman)
|
|
383
|
+
<MUST-READ path="references/caveman-mode.md" trigger="when context reaches ORANGE/RED OR user says 'caveman'/'be brief'/'less tokens'"/>
|
|
384
|
+
|
|
385
|
+
Caveman is a terse output mode that strips filler, articles, hedging, and pleasantries while preserving full technical accuracy. ~75% output token reduction with no information loss when applied per the rules in `references/caveman-mode.md`.
|
|
386
|
+
|
|
387
|
+
### Activation triggers
|
|
388
|
+
|
|
389
|
+
| Trigger | Source | Persistence |
|
|
390
|
+
|---------|--------|-------------|
|
|
391
|
+
| Context health = ORANGE or RED | Auto from Step 4-5 above | Until `/compact` returns to GREEN |
|
|
392
|
+
| User says "caveman" / "/caveman" / "be brief" / "less tokens" | Explicit user signal | Until "stop caveman" / "normal mode" |
|
|
393
|
+
| Per-workstream override (e.g., `team` worker exceeds output budget) | Per-workstream scope | Scoped to that workstream only |
|
|
394
|
+
|
|
395
|
+
Auto-activation emits `output.density.set` signal carrying `{mode: caveman, scope, source}`. Orchestrators (cook, team, rescue) honor the signal for the duration of their session.
|
|
396
|
+
|
|
397
|
+
### Auto-clarity exceptions (revert ONE response, then resume)
|
|
398
|
+
|
|
399
|
+
- Security warnings (data loss, credential exposure)
|
|
400
|
+
- Confirmations of irreversible actions (`rm -rf`, force-push, drop table, prod deploy)
|
|
401
|
+
- Multi-step sequences where fragment ordering risks misreading
|
|
402
|
+
- User says "explain" / "clarify" / repeats the same question
|
|
403
|
+
- Root-cause diagnosis where cause-and-effect chains need grammatical structure
|
|
404
|
+
|
|
405
|
+
### Anti-pattern
|
|
406
|
+
|
|
407
|
+
Caveman in the FIRST response of a task. The user can't calibrate severity from a single output yet — verbose first response is fine. Caveman starts on response 2+.
|
|
408
|
+
|
|
409
|
+
## Mode: preview (v1.1.0)
|
|
410
|
+
|
|
411
|
+
Pre-flight cost check for expensive escalations. Caller (`adversary` oracle-mode, `team` workstream spawn, `review` multi-file, `audit` cross-pack) MUST emit `context.preview` BEFORE building the bundle, so context-engine can estimate token cost and gate the dispatch against a per-caller threshold.
|
|
412
|
+
|
|
413
|
+
### Why
|
|
414
|
+
|
|
415
|
+
Without preview, callers learn about budget overruns AFTER the bundle is built and dispatched — too late to prune. `team` parallel workstreams especially can blow $20 of Opus tokens in a single session if context bundles are unchecked.
|
|
416
|
+
|
|
417
|
+
### Token Estimation (no tokenizer dep)
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
estimated_tokens = total_chars × 0.25
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Char count includes the `[SYSTEM]` line, `[USER]` line, and all `### File N:` blocks per `references/preview-gate.md`. The 0.25 ratio is calibrated for English code/markdown — overestimates Japanese/Chinese, underestimates highly-repetitive content. Both error directions are safe (overestimate → over-cautious block; underestimate → caller still hits dispatch-time hard cap).
|
|
424
|
+
|
|
425
|
+
### Threshold Defaults (per caller)
|
|
426
|
+
|
|
427
|
+
| Caller | warn-at (tokens) | block-at (tokens) |
|
|
428
|
+
|--------|------------------|-------------------|
|
|
429
|
+
| `adversary` oracle-mode | 50k | 100k |
|
|
430
|
+
| `team` parallel workstream (per worker) | 30k | 80k |
|
|
431
|
+
| `review` multi-file | 40k | 100k |
|
|
432
|
+
| `audit` cross-pack | 60k | 120k |
|
|
433
|
+
|
|
434
|
+
Caller passes its identity in the preview request; context-engine resolves to the correct threshold.
|
|
435
|
+
|
|
436
|
+
### Action Enum
|
|
437
|
+
|
|
438
|
+
`context.preview` payload includes a single `action` field:
|
|
439
|
+
|
|
440
|
+
| Action | Meaning | Caller behavior |
|
|
441
|
+
|--------|---------|-----------------|
|
|
442
|
+
| `proceed` | Under warn threshold | Continue without warning |
|
|
443
|
+
| `warn` | Between warn and block | Log warning to user, continue |
|
|
444
|
+
| `block` | At or over block threshold | Abort dispatch, emit caller-specific failure (e.g. `oracle.failed` reason=`context_budget_exceeded`) |
|
|
445
|
+
|
|
446
|
+
### Signal Payload Schema
|
|
447
|
+
|
|
448
|
+
```yaml
|
|
449
|
+
context.preview:
|
|
450
|
+
caller: adversary | team | review | audit
|
|
451
|
+
estimated_tokens: <int>
|
|
452
|
+
file_count: <int>
|
|
453
|
+
top_5_files_by_size:
|
|
454
|
+
- { path: <string>, chars: <int> }
|
|
455
|
+
threshold:
|
|
456
|
+
warn_at: <int>
|
|
457
|
+
block_at: <int>
|
|
458
|
+
action: proceed | warn | block
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Step P1 — Receive request
|
|
462
|
+
|
|
463
|
+
Caller invokes context-engine with: caller-id, file list (paths + char counts), prompt char count.
|
|
464
|
+
|
|
465
|
+
### Step P2 — Estimate
|
|
466
|
+
|
|
467
|
+
Sum total chars, multiply by 0.25, identify top 5 files by size.
|
|
468
|
+
|
|
469
|
+
### Step P3 — Resolve threshold
|
|
470
|
+
|
|
471
|
+
Look up caller in threshold table (defaults above; override via `RUNE_CONTEXT_THRESHOLDS_<CALLER>` env var).
|
|
472
|
+
|
|
473
|
+
### Step P4 — Determine action
|
|
474
|
+
|
|
475
|
+
```
|
|
476
|
+
if estimated_tokens >= block_at: action = block
|
|
477
|
+
elif estimated_tokens >= warn_at: action = warn
|
|
478
|
+
else: action = proceed
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Step P5 — Emit
|
|
482
|
+
|
|
483
|
+
Emit `context.preview` with full payload. Caller decides whether to proceed.
|
|
484
|
+
|
|
485
|
+
See `references/preview-gate.md` for tunable points and integration with each caller.
|
|
486
|
+
|
|
378
487
|
## Constraints
|
|
379
488
|
|
|
380
489
|
1. MUST preserve context fidelity — no summarizing away critical details
|
|
381
490
|
2. MUST flag context conflicts between skills — never silently pick one
|
|
382
491
|
3. MUST NOT inject stale context from previous sessions without marking it as historical
|
|
492
|
+
4. (preview) MUST emit `context.preview` BEFORE bundle-building begins (not after) — late emission defeats the gate purpose
|
|
383
493
|
|
|
384
494
|
## Sharp Edges
|
|
385
495
|
|
|
@@ -394,6 +504,12 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
394
504
|
| Not activating large-file adjustment on Python/Java codebases | MEDIUM | Track Read calls returning >500 lines; if ≥3 occur, switch to adjusted (0.8x) thresholds for the session |
|
|
395
505
|
| Mid-loop compaction breaks tool_use/tool_result pair | CRITICAL | Always keep tool pairs together — splitting causes orphaned results and context corruption |
|
|
396
506
|
| Mid-loop compaction without flushing state first | HIGH | session-bridge + neural-memory MUST run before compaction — losing unsaved decisions is worse than hitting context limit |
|
|
507
|
+
| (preview) Caller bundles before requesting preview | HIGH | Constraint 4 enforces order; reject preview-after-build calls with explicit error |
|
|
508
|
+
| (preview) Estimated tokens off by 2x for non-English content | LOW | Document calibration in `references/preview-gate.md`; safe both directions (block-too-eager or block-too-late but hard cap at dispatch saves us) |
|
|
509
|
+
| Caveman activated in first response of a task | MEDIUM | First response = user calibration baseline. Verbose first; caveman from response 2+ (see `references/caveman-mode.md`) |
|
|
510
|
+
| Caveman compresses code blocks or error messages | CRITICAL | Caveman strips filler ONLY. Code, errors, paths, technical terms stay verbatim. Compression of those = wrong fix |
|
|
511
|
+
| Caveman drift back to verbose mid-session | MEDIUM | Once activated, persists every response until explicit deactivation. Drift defeats the token savings |
|
|
512
|
+
| Caveman during destructive-action confirmation | HIGH | Auto-clarity exception: revert ONE response for security/irreversible-action confirmations, then resume |
|
|
397
513
|
|
|
398
514
|
## Done When
|
|
399
515
|
|
|
@@ -402,6 +518,7 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
402
518
|
- Appropriate advisory emitted matching health level (no advisory for GREEN)
|
|
403
519
|
- If RED: session-bridge called and confirmed saved before compaction signal
|
|
404
520
|
- Context Health Report emitted with tool count, status, and recommendation
|
|
521
|
+
- (preview-mode) `context.preview` emitted with `action` ∈ `proceed | warn | block` BEFORE caller builds its bundle
|
|
405
522
|
|
|
406
523
|
## Cost Profile
|
|
407
524
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Caveman Output Mode
|
|
2
|
+
|
|
3
|
+
A terse output mode that strips filler, articles, and pleasantries while preserving full technical accuracy. Reduces output token cost by ~75% with no information loss when applied correctly.
|
|
4
|
+
|
|
5
|
+
> "All technical substance stays. Only fluff dies."
|
|
6
|
+
|
|
7
|
+
## When to activate
|
|
8
|
+
|
|
9
|
+
| Trigger | Source | Persistence |
|
|
10
|
+
|---------|--------|-------------|
|
|
11
|
+
| User says "caveman", "caveman mode", "be brief", "less tokens" | Explicit user signal | Until user says "stop caveman" / "normal mode" |
|
|
12
|
+
| Context health = ORANGE or RED | Auto from `context-engine` Step 4-5 | Until context returns to GREEN after compaction |
|
|
13
|
+
| Output budget exceeded for a workstream (e.g., team parallel worker) | Per-workstream override | Scoped to that workstream |
|
|
14
|
+
|
|
15
|
+
Once active, **every response stays in caveman mode** until explicit deactivation. No drift back to verbose mid-session.
|
|
16
|
+
|
|
17
|
+
## What dies
|
|
18
|
+
|
|
19
|
+
- Articles: `a`, `an`, `the`
|
|
20
|
+
- Filler: `just`, `really`, `basically`, `actually`, `simply`, `essentially`, `you can see that`
|
|
21
|
+
- Pleasantries: `Sure!`, `Certainly`, `Of course`, `Happy to help`, `Great question`, `Let me`
|
|
22
|
+
- Hedging: `I think`, `it seems`, `probably`, `might want to consider`
|
|
23
|
+
- Connective bloat: `In order to`, `with regard to`, `at this point in time`
|
|
24
|
+
- Restating the user's question
|
|
25
|
+
|
|
26
|
+
## What stays (untouched)
|
|
27
|
+
|
|
28
|
+
- Code blocks — exact, unmodified
|
|
29
|
+
- Error messages — quoted verbatim
|
|
30
|
+
- Technical terms — full names, no abbreviation if ambiguous
|
|
31
|
+
- File paths and identifiers
|
|
32
|
+
- Numbers, units, version strings
|
|
33
|
+
|
|
34
|
+
## Techniques allowed
|
|
35
|
+
|
|
36
|
+
| Technique | Example |
|
|
37
|
+
|-----------|---------|
|
|
38
|
+
| Sentence fragments | `Fixed.` instead of `I have fixed it.` |
|
|
39
|
+
| Short synonyms | `big` not `extensive`, `use` not `utilize` |
|
|
40
|
+
| Common abbreviations | `DB`, `auth`, `config`, `req`/`res`, `fn`, `impl`, `repo`, `env` |
|
|
41
|
+
| Arrow notation for causality | `null input → crash at line 42 → fix: validate before parse` |
|
|
42
|
+
| Skeleton pattern | `[thing] [action] [reason]. [next step].` |
|
|
43
|
+
| Bullet over paragraph | List 3 things instead of writing a paragraph about them |
|
|
44
|
+
|
|
45
|
+
## Auto-clarity exceptions (revert temporarily)
|
|
46
|
+
|
|
47
|
+
Drop caveman for ONE response, then resume. Triggers:
|
|
48
|
+
|
|
49
|
+
| Situation | Why revert |
|
|
50
|
+
|-----------|------------|
|
|
51
|
+
| Security warning (data loss, credential exposure, destructive command) | Fragments risk underweighting severity |
|
|
52
|
+
| Confirming an irreversible action (`rm -rf`, force-push, drop table, deploy to prod) | User must understand what they're approving |
|
|
53
|
+
| Multi-step sequence where order matters | Fragment ordering can be misread |
|
|
54
|
+
| User says "explain" / "clarify" / repeats the same question | They want more, not less |
|
|
55
|
+
| Diagnosis of a hard bug — root cause needs grammatical structure to be unambiguous | Cause-and-effect chains break in fragments |
|
|
56
|
+
|
|
57
|
+
## Token savings (calibration)
|
|
58
|
+
|
|
59
|
+
| Mode | Sample output for "explain X" | Tokens |
|
|
60
|
+
|------|-------------------------------|--------|
|
|
61
|
+
| Verbose | `Sure! So basically, the X function is responsible for handling the case where...` | ~80 |
|
|
62
|
+
| Caveman | `X handles [case]. Fails on [edge]. Fix: [action].` | ~20 |
|
|
63
|
+
|
|
64
|
+
Expect 60-80% reduction on conversational responses. Code/docs/error messages are unaffected (they were already pure information).
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
### Verbose
|
|
69
|
+
> Sure! So I've taken a look at the auth middleware and it seems like the issue might be that the token validation function is being called before the token is actually parsed. Basically what's happening is that we're trying to validate something that doesn't exist yet, which is causing the null reference error you're seeing.
|
|
70
|
+
|
|
71
|
+
### Caveman
|
|
72
|
+
> Auth middleware: `validate(token)` called before parse → null ref. Fix: parse first, then validate.
|
|
73
|
+
|
|
74
|
+
### Verbose
|
|
75
|
+
> Great question! Let me explain how this works. The retry logic is implemented using exponential backoff, which means that each retry waits longer than the previous one.
|
|
76
|
+
|
|
77
|
+
### Caveman
|
|
78
|
+
> Retry uses exponential backoff. Each attempt waits longer than last.
|
|
79
|
+
|
|
80
|
+
### Caveman with security exception
|
|
81
|
+
> Caveman normally — but for this one: **Warning**: `git push --force` will overwrite the remote `main` branch. This destroys any commits other developers have pushed in the meantime. Confirm explicitly before I run it.
|
|
82
|
+
>
|
|
83
|
+
> [next response resumes caveman]
|
|
84
|
+
|
|
85
|
+
## Integration with context-engine
|
|
86
|
+
|
|
87
|
+
Auto-activation flow (Step 4 ORANGE / Step 5 RED):
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
1. context-engine detects ORANGE/RED
|
|
91
|
+
2. Emit advisory: "Context [X]%. Activating caveman output mode."
|
|
92
|
+
3. Set session flag: caveman_active = true
|
|
93
|
+
4. All subsequent responses honor caveman rules
|
|
94
|
+
5. On /compact + return to GREEN: emit "Caveman mode released" — back to normal
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Manual override always wins: if user says "/caveman" while GREEN, activate; if user says "stop caveman" while RED, respect it (but emit warning that context is critical).
|
|
98
|
+
|
|
99
|
+
## Anti-patterns
|
|
100
|
+
|
|
101
|
+
| Anti-pattern | Why it fails |
|
|
102
|
+
|--------------|--------------|
|
|
103
|
+
| Compressing code or error messages | Information loss → wrong fix |
|
|
104
|
+
| Using rare abbreviations the user might not know | Saves tokens, costs comprehension |
|
|
105
|
+
| Caveman during security/destructive confirmation | User skips reading because format signals "low importance" |
|
|
106
|
+
| Drifting back to verbose after a few turns | Mode must persist — drift defeats the purpose |
|
|
107
|
+
| Caveman in the FIRST response of a task | User can't calibrate severity from the first output yet — verbose first response is fine |
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Context Preview Gate
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Pre-flight cost check for expensive escalations. Before any caller bundles a large context for dispatch (oracle-mode second-opinion, parallel workstream spawn, multi-file review, cross-pack audit), `context-engine` emits `context.preview` with a token-cost estimate and an action recommendation. The caller decides whether to proceed, warn, or abort.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
Without a preview gate:
|
|
10
|
+
- Callers learn about budget overruns only after dispatch — too late to prune
|
|
11
|
+
- `team` parallel workstreams can blow $20 of Opus tokens silently
|
|
12
|
+
- Users have no way to enforce per-call cost ceilings
|
|
13
|
+
|
|
14
|
+
With the preview gate:
|
|
15
|
+
- Costs are visible at decision time, not bill time
|
|
16
|
+
- Per-caller thresholds enforce different budgets per use case
|
|
17
|
+
- Hard `block` action prevents accidental runaway
|
|
18
|
+
|
|
19
|
+
## Token Estimation
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
estimated_tokens = total_chars × 0.25
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Where `total_chars` includes:
|
|
26
|
+
- The bundle's `[SYSTEM]` line
|
|
27
|
+
- The `[USER]` problem statement
|
|
28
|
+
- Every `### File N: <path>` header
|
|
29
|
+
- Every file body (post-truncation, post-redaction)
|
|
30
|
+
|
|
31
|
+
The `0.25` ratio is calibrated for English code/markdown:
|
|
32
|
+
|
|
33
|
+
| Content type | Calibration |
|
|
34
|
+
|--------------|-------------|
|
|
35
|
+
| English code (TypeScript/Python/JS) | accurate ±10% |
|
|
36
|
+
| English markdown / docs | accurate ±5% |
|
|
37
|
+
| Japanese / Chinese / Korean | underestimates by 30-50% |
|
|
38
|
+
| Highly-repetitive (lots of imports) | overestimates by 20-30% |
|
|
39
|
+
|
|
40
|
+
Both error directions are safe:
|
|
41
|
+
- Overestimate → over-cautious block, caller can manually override
|
|
42
|
+
- Underestimate → caller still hits the dispatch-time hard cap (e.g. adversary's 100k token limit) and aborts with `oracle.failed`
|
|
43
|
+
|
|
44
|
+
## Threshold Defaults
|
|
45
|
+
|
|
46
|
+
| Caller | warn-at | block-at | Rationale |
|
|
47
|
+
|--------|---------|----------|-----------|
|
|
48
|
+
| `adversary` oracle-mode | 50,000 | 100,000 | Single-shot diagnosis; 100k matches second-model context budget |
|
|
49
|
+
| `team` parallel workstream (per worker) | 30,000 | 80,000 | Per-worker; total may be 5x if 5 workers spawn |
|
|
50
|
+
| `review` multi-file | 40,000 | 100,000 | Code review benefits from breadth; cap protects opus budget |
|
|
51
|
+
| `audit` cross-pack | 60,000 | 120,000 | Audit is intentionally broad; raised cap reflects intent |
|
|
52
|
+
|
|
53
|
+
### Override
|
|
54
|
+
|
|
55
|
+
Set environment variables to override per-caller thresholds:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
RUNE_CONTEXT_THRESHOLDS_ADVERSARY=warn:60000,block:120000
|
|
59
|
+
RUNE_CONTEXT_THRESHOLDS_TEAM=warn:40000,block:100000
|
|
60
|
+
RUNE_CONTEXT_THRESHOLDS_REVIEW=warn:50000,block:130000
|
|
61
|
+
RUNE_CONTEXT_THRESHOLDS_AUDIT=warn:80000,block:150000
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Action Decision
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
if estimated_tokens >= block_at:
|
|
68
|
+
action = "block"
|
|
69
|
+
elif estimated_tokens >= warn_at:
|
|
70
|
+
action = "warn"
|
|
71
|
+
else:
|
|
72
|
+
action = "proceed"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Caller Integration
|
|
76
|
+
|
|
77
|
+
### `adversary` oracle-mode
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Phase 0 (pre-bundle): emit context.preview { caller: adversary, files: [...], prompt: "..." }
|
|
81
|
+
context-engine returns { action: "proceed" } → continue with bundle build
|
|
82
|
+
context-engine returns { action: "warn" } → log warning, continue
|
|
83
|
+
context-engine returns { action: "block" } → abort, emit oracle.failed reason=context_budget_exceeded
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `team` parallel workstream
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Phase 2 ASSIGN (per worker): emit context.preview { caller: team, files: [...] }
|
|
90
|
+
proceed → spawn worker
|
|
91
|
+
warn → log warning, spawn worker
|
|
92
|
+
block → reduce worker scope or split into 2 smaller workers
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### `review` multi-file
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Entry step: emit context.preview { caller: review, files: [...] }
|
|
99
|
+
proceed → run review
|
|
100
|
+
warn → log warning, run review
|
|
101
|
+
block → ask user to narrow file scope (e.g. specific subdirectory)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### `audit` cross-pack
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Entry step: emit context.preview { caller: audit, files: [...] }
|
|
108
|
+
proceed → run audit
|
|
109
|
+
warn → log warning, run audit
|
|
110
|
+
block → reduce audit scope (e.g. one pack at a time)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Signal Payload
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
context.preview:
|
|
117
|
+
caller: adversary | team | review | audit
|
|
118
|
+
estimated_tokens: 73000
|
|
119
|
+
file_count: 8
|
|
120
|
+
top_5_files_by_size:
|
|
121
|
+
- { path: "src/auth/login.ts", chars: 12400 }
|
|
122
|
+
- { path: "src/middleware/auth.ts", chars: 9800 }
|
|
123
|
+
- { path: "src/services/session.ts", chars: 8200 }
|
|
124
|
+
- { path: "tests/auth.test.ts", chars: 6100 }
|
|
125
|
+
- { path: "src/types/user.ts", chars: 4500 }
|
|
126
|
+
threshold:
|
|
127
|
+
warn_at: 50000
|
|
128
|
+
block_at: 100000
|
|
129
|
+
action: warn
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Failure Modes
|
|
133
|
+
|
|
134
|
+
| Symptom | Reason | Mitigation |
|
|
135
|
+
|---------|--------|------------|
|
|
136
|
+
| Caller bundles before preview | Caller didn't follow contract | context-engine rejects late preview requests with explicit error |
|
|
137
|
+
| Estimate way off for non-English content | Tokenizer ratio assumes English | Document limitation; safe both directions due to dispatch-time hard cap |
|
|
138
|
+
| Block action ignored by caller | Caller bug | Each caller's Done When MUST verify `action != block` before dispatch |
|
|
139
|
+
| Threshold env-var malformed | User typo | context-engine logs warning, falls back to default |
|
|
@@ -4,7 +4,7 @@ description: "Creates structured handoff briefings between agents. Use when dele
|
|
|
4
4
|
user-invocable: false
|
|
5
5
|
metadata:
|
|
6
6
|
author: runedev
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.3.0"
|
|
8
8
|
layer: L3
|
|
9
9
|
model: haiku
|
|
10
10
|
group: state
|
|
@@ -134,6 +134,24 @@ When a parent agent delegates work to a subagent, critical context gets lost —
|
|
|
134
134
|
|
|
135
135
|
Full template + worked examples: [references/brief-template.md](references/brief-template.md).
|
|
136
136
|
|
|
137
|
+
## Variant: Agent Brief (Async / Durable Handoff)
|
|
138
|
+
<MUST-READ path="references/agent-brief.md" trigger="when handing off to an AFK agent, an issue tracker queue, autopilot, or any receiver that may execute hours/days later"/>
|
|
139
|
+
|
|
140
|
+
The standard packet (above) is for **immediate** sub-agent dispatch in the same session. When the handoff target is async — issue tracker, scheduled cron agent, `rune:autopilot` (Pro) for multi-session work, or any receiver that may execute hours or days later — switch to the **agent brief** variant.
|
|
141
|
+
|
|
142
|
+
Agent brief adds two durability principles on top of the standard packet:
|
|
143
|
+
|
|
144
|
+
1. **Durability over precision** — describe interfaces, types, and behavioral contracts. NEVER reference line numbers in narrative. File paths only in `### Files Touched` (locator-only, may rename).
|
|
145
|
+
2. **Behavioral, not procedural** — describe WHAT the system should do, not HOW to implement it. The async agent will explore the codebase fresh.
|
|
146
|
+
|
|
147
|
+
Additional BLOCK-tier checks for agent briefs (on top of the standard smell tests):
|
|
148
|
+
- `**Category:**` line present (`bug` / `enhancement` / `refactor`)
|
|
149
|
+
- Both `**Current behavior:**` and `**Desired behavior:**` sections present
|
|
150
|
+
- Acceptance criteria are independently testable (each pass/fail alone)
|
|
151
|
+
- `**Key interfaces:**` names types/functions, not file paths
|
|
152
|
+
|
|
153
|
+
Full template + worked examples: [references/agent-brief.md](references/agent-brief.md).
|
|
154
|
+
|
|
137
155
|
## Returns
|
|
138
156
|
|
|
139
157
|
| Field | Type | Description |
|
|
@@ -169,6 +187,9 @@ Full template + worked examples: [references/brief-template.md](references/brief
|
|
|
169
187
|
| Missing Type Surface section for non-trivial task | HIGH | Mandatory for tasks >= 300 tokens; the durable spine is what survives file moves |
|
|
170
188
|
| Missing Out of scope section | HIGH | Always required (even "(none)"); completion-gate rejects briefs without it |
|
|
171
189
|
| Acceptance Criteria using shape verbs ("is defined", "has property") | MEDIUM | Rewrite to behavior verbs from the whitelist |
|
|
190
|
+
| Async handoff (issue tracker / autopilot / scheduled run) emitted as standard packet | HIGH | Switch to agent-brief variant (`references/agent-brief.md`) — standard packet rots when receiver runs hours/days later. Brief adds durability rules: behavioral not procedural, no line numbers in narrative |
|
|
191
|
+
| Agent brief with file:line references in narrative ("change `auth.ts:42`") | CRITICAL | Brief BLOCK gate — line numbers go stale on first edit. Reference type names, function signatures, contracts instead. File paths only in `### Files Touched` |
|
|
192
|
+
| Agent brief without `**Current behavior:**` AND `**Desired behavior:**` split | HIGH | Brief BLOCK gate — without the delta explicit, async agent cannot verify when work is done |
|
|
172
193
|
|
|
173
194
|
## Self-Validation
|
|
174
195
|
|