@rune-kit/rune 2.7.0 → 2.8.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 CHANGED
@@ -83,16 +83,21 @@ _Methodology: Claude Code CLI headless mode (`claude -p --output-format json`),
83
83
 
84
84
  ---
85
85
 
86
- ## What's New (v2.7.0)
86
+ ## What's New (v2.8.0)
87
+
88
+ - **Anti-Loop Intelligence** — 7 core skills enriched with execution loop detection, saturation analysis, error pattern matching, artifact folding, budget-aware progression, and recovery policy routing
89
+ - **cook v2.1.0** — observation/effect ratio tracking (detects stuck agents reading without writing) + budget-aware phase progression with hard caps on replans, quality retries, and session tool calls
90
+ - **completion-gate v1.8.0** — execution loop audit: classifies tool calls as observation vs effect, flags imbalanced ratios and repeating sequences in gate reports
91
+ - **scout v0.3.0** — info saturation detection: tracks entity discovery rate and content similarity to stop scanning when diminishing returns detected
92
+ - **research v0.4.0** — diminishing returns detection: monitors new-entity ratio and result overlap across searches to skip redundant queries
93
+ - **context-engine v0.9.0** — artifact folding: large tool outputs (>4000 chars or >120 lines) saved to `.rune/artifacts/` with compact preview in context
94
+ - **debug v1.0.0** — known error pattern catalog: 8 error archetypes (STATELESS_LOSS, MODULE_NOT_FOUND, TYPE_MISMATCH, ASYNC_DEADLOCK, etc.) with recovery hints + error fingerprinting for dedup
95
+ - **fix v0.8.0** — recovery policy matrix: classifies errors into 8 types (INPUT_REQUIRED→PROMPT_USER, TIMEOUT→RETRY, POLICY_BLOCKED→ABORT, etc.) before attempting fixes
96
+ - **Source attribution cleanup** — removed all enrichment credit lines from skill files to reduce context noise
97
+
98
+ ### Previous (v2.7.0)
87
99
 
88
100
  - **Deep Knowledge** — 8 core skills enriched with battle-tested patterns: context compaction, structured cumulative memory, milestone analysis, multi-provider adapters, AI-driven interview, prompt-as-API-contract, token budget tracking, incremental stream processing
89
- - **context-engine v0.8.0** — structured compaction summaries with continuation point anchoring + sentence-level stream processing pattern
90
- - **session-bridge v0.5.0** — cumulative project notes (`.rune/cumulative-notes.md`) for living institutional memory across sessions
91
- - **retro v0.3.0** — milestone progressive analysis at project thresholds (4/12/24/50 retros) with focal-point depth scaling
92
- - **mcp-builder v0.4.0** — multi-provider adapter pattern reference with discriminated StreamChunk union + dual-model cost config
93
- - **onboard v0.4.0** — AI-driven conversational interview mode (`--interview`) for ambiguous or complex projects
94
- - **perf v0.3.0** — token budget tracking for AI-powered apps (loop detection, model mismatch, unbounded tokens, duplicate calls)
95
- - **cook v2.0.0** — prompt-as-API-contract pattern for structured sub-skill output
96
101
  - **946 Tests** — compiler + signals + hooks + scripts + status + visualizer validation
97
102
 
98
103
  ### Previous (v2.6.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rune-kit/rune",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "61-skill mesh for AI coding assistants — 5-layer architecture, 200+ connections, 8 platforms (Claude Code, Cursor, Windsurf, Antigravity, Codex, OpenCode, OpenClaw, Generic)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,7 +4,7 @@ description: "Validates agent claims against evidence trail. Catches 'done' with
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "1.7.0"
7
+ version: "1.8.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: validation
@@ -91,6 +91,30 @@ Why: Self-Validation catches domain-specific quality issues that generic claim m
91
91
  If a skill has Self-Validation and ANY check is UNCONFIRMED or CONTRADICTED → overall verdict cannot be CONFIRMED, even if all explicit claims pass.
92
92
  </HARD-GATE>
93
93
 
94
+ ### Step 1d — Execution Loop Audit
95
+
96
+ Before validating claims, audit the agent's tool call pattern for execution loops that indicate the agent was stuck but didn't report it:
97
+
98
+ **Classify the agent's tool calls** from this workflow into two categories:
99
+
100
+ | Category | Tools | Expected in Phase 4 |
101
+ |----------|-------|---------------------|
102
+ | **Observation** | Read, Grep, Glob, Bash(grep/ls/cat) | <40% of calls |
103
+ | **Effect** | Write, Edit, Bash(build/test/npm) | >60% of calls |
104
+
105
+ **Loop patterns to detect**:
106
+
107
+ | Pattern | Detection | Verdict Impact |
108
+ |---------|-----------|----------------|
109
+ | **Observation chain**: 6+ consecutive observation tools in Phase 4 | Count longest observation-only streak | Add WARN: "Agent had {N}-call observation streak during implementation — possible analysis paralysis" |
110
+ | **Low effect ratio**: <20% effect calls during Phase 4 | `effect_calls / total_calls` | Add WARN: "Only {X}% of Phase 4 calls were writes — agent may have been stuck" |
111
+ | **Repeating tool pattern**: Same tool+args called 3+ times | Hash tool+args, count duplicates | Add WARN: "Agent called {tool}({args}) {N} times — possible loop" |
112
+ | **Budget overrun**: Phase 4 exceeded 50 tool calls for a single-file task | Count Phase 4 calls vs files changed | Add WARN: "50+ tool calls for {N} files changed — disproportionate effort" |
113
+
114
+ **Scoring impact**: Loop warnings don't change individual claim verdicts but ARE included in the Completion Gate Report under a new `### Execution Efficiency` section. This gives the calling orchestrator signal about whether the agent's process was healthy, not just whether the output was correct.
115
+
116
+ **Skip if**: Nano/Fast rigor — not enough tool calls to meaningfully analyze.
117
+
94
118
  ### Step 2 — Match Evidence
95
119
 
96
120
  For each claim, look for corresponding evidence in the conversation context:
@@ -167,8 +191,6 @@ UNCONFIRMED — 1 claim lacks evidence, 1 contradicted. Cannot proceed to commit
167
191
 
168
192
  ### Step 4.5 — Cross-Phase Integration Check
169
193
 
170
- > From GSD (gsd-build/get-shit-done, 30.8k★): "Phase boundaries are where integration bugs hide."
171
-
172
194
  When validating a completed phase in a multi-phase plan, check for integration gaps between phases:
173
195
 
174
196
  1. **Orphaned exports** — files/functions created in this phase that claim to be used by future phases (see `## Cross-Phase Context → Exports`) but are not yet importable:
@@ -269,6 +291,7 @@ Completion Gate Report with status (CONFIRMED/UNCONFIRMED/CONTRADICTED), claim v
269
291
  | Partial completion claimed as full — 80% done but "implemented" | HIGH | Adversarial checklist: check for partial completion, scope mismatch, evidence-claim alignment |
270
292
  | Self-Validation skipped — skill has checks but gate ignores them | HIGH | Step 1c: extract Self-Validation from skill's SKILL.md, treat each as implicit claim. Missing = UNCONFIRMED |
271
293
  | Plan says done but phase file has unchecked tasks | HIGH | Step 5.5: diff changed files vs phase plan's Files Touched + Tasks sections |
294
+ | Agent stuck in observation loop but claims "implemented" | HIGH | Step 1d: Execution Loop Audit detects low effect ratio and observation chains — flags in report even if claims pass |
272
295
 
273
296
  ## Done When
274
297
 
@@ -4,7 +4,7 @@ description: "Context window management. Auto-triggered when context is filling
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "0.8.0"
7
+ version: "0.9.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: state
@@ -218,6 +218,54 @@ When processing streaming LLM output (e.g., in skills that invoke AI calls or pr
218
218
  - **JSON output**: accumulate until the closing brace — partial JSON can't be parsed
219
219
  - **Short responses** (<100 chars expected): overhead of boundary detection exceeds benefit
220
220
 
221
+ ## Artifact Folding (Large Output Management)
222
+
223
+ When tool results are excessively large, they consume disproportionate context without proportionate value. **Artifact folding** saves the full output to a file and replaces it in context with a compact preview.
224
+
225
+ ### When to Fold
226
+
227
+ | Condition | Action |
228
+ |-----------|--------|
229
+ | Tool output > 4000 characters | Fold to artifact |
230
+ | Tool output > 120 lines | Fold to artifact |
231
+ | Multiple tool outputs from the same command class (e.g., 5+ Grep results) | Fold all into single artifact |
232
+ | Code block output > 200 lines | Fold to artifact |
233
+
234
+ ### Folding Procedure
235
+
236
+ 1. **Save full output** to `.rune/artifacts/artifact-{timestamp}-{tool}.md`:
237
+ ```markdown
238
+ # Artifact: {tool_name} output
239
+ Generated: {timestamp}
240
+ Command: {tool_call_summary}
241
+
242
+ {full_output}
243
+ ```
244
+
245
+ 2. **Replace in context** with a compact preview:
246
+ ```
247
+ [FOLDED: {tool_name} output — {line_count} lines, {char_count} chars]
248
+ Preview (first 10 lines):
249
+ {first_10_lines}
250
+ ...
251
+ Full output: .rune/artifacts/artifact-{timestamp}-{tool}.md
252
+ Use Read to access the full artifact if needed.
253
+ ```
254
+
255
+ 3. **On compaction**: Artifact files survive compaction — the continuation summary references them by path. This means large outputs are preserved across compaction boundaries without consuming context.
256
+
257
+ ### Rules
258
+
259
+ - **Never fold user messages** — only tool outputs
260
+ - **Never fold error outputs** — errors need full visibility for debugging
261
+ - **Never fold outputs < 1000 chars** — folding overhead exceeds savings
262
+ - **Fold preemptively in YELLOW/ORANGE** — don't wait for RED to start managing output size
263
+ - **Clean up artifacts** at session end: artifacts older than the current session can be deleted (they're already in git history or irrelevant)
264
+
265
+ ### Why
266
+
267
+ A single `Grep` across a large codebase can return 3000+ lines. Without folding, this consumes ~4000 tokens of context — often more than the rest of the conversation combined. Folding preserves the information (accessible via Read) while keeping context lean. Combined with the Structured Summary compaction technique, artifact folding enables much longer productive sessions.
268
+
221
269
  ## Context Health Levels
222
270
 
223
271
  ```
@@ -5,7 +5,7 @@ context: fork
5
5
  agent: general-purpose
6
6
  metadata:
7
7
  author: runedev
8
- version: "2.0.0"
8
+ version: "2.1.0"
9
9
  layer: L1
10
10
  model: sonnet
11
11
  group: orchestrator
@@ -634,6 +634,46 @@ Stuck patterns (all banned):
634
634
  A wrong first attempt that produces feedback beats perfect understanding that never ships.
635
635
  </HARD-GATE>
636
636
 
637
+ ### Observation/Effect Ratio Tracking
638
+
639
+ Track every tool call during Phase 4 (IMPLEMENT) as either **observation** (read-only) or **effect** (modifies state):
640
+
641
+ | Category | Tool Examples |
642
+ |----------|--------------|
643
+ | **Observation** | Read, Grep, Glob, Bash(grep/ls/cat/git log) |
644
+ | **Effect** | Write, Edit, Bash(npm/build/test/mkdir) |
645
+
646
+ **Detection rules** (check every 8 tool calls during Phase 4):
647
+
648
+ | Pattern | Threshold | Signal | Action |
649
+ |---------|-----------|--------|--------|
650
+ | **Observation chain** | 6+ consecutive observation tools with zero effects | Agent is stuck reading, not building | Inject: "OBSERVATION LOOP — 6 reads without writing. Act on what you know or report BLOCKED." |
651
+ | **Low effect ratio** | In last 10 calls, effects < 15% | Agent is in analysis mode, not implementation | Inject: "Effect ratio below 15%. Phase 4 is IMPLEMENT — write code, don't just read it." |
652
+ | **Diminishing returns** | Last 3 observations found <2 new relevant facts combined | Searching is no longer productive | Inject: "Diminishing returns — last 3 reads added nothing new. Synthesize and act." |
653
+ | **Repeating sequences** | A-B-A-B or A-B-C-A-B-C pattern across 6+ calls | Circular behavior | Inject: "REPEATING SEQUENCE detected. Break the cycle — try a different approach or report BLOCKED." |
654
+
655
+ **Important**: These are injected as advisor messages, not hard blocks. The agent can continue if it has good reason, but the message forces conscious acknowledgment of the pattern.
656
+
657
+ **Skip if**: Phase 1 (UNDERSTAND) — observation-heavy is expected during research. Only track during Phase 4+ where effects should dominate.
658
+
659
+ ### Budget-Aware Phase Progression
660
+
661
+ Beyond the existing Exit Conditions (MAX_DEBUG_LOOPS, MAX_QUALITY_LOOPS, etc.), track **cumulative budget** across the entire cook session:
662
+
663
+ | Budget | Limit | What Happens at Limit |
664
+ |--------|-------|----------------------|
665
+ | **Phase 4 react budget** | 15 tool calls per task within Phase 4 | Force: move to next task or report partial completion |
666
+ | **Global replan budget** | 2 replans per session (Phase 4 Step 6) | Force: proceed with current plan or escalate to user |
667
+ | **Quality retry budget** | 3 total quality re-runs across 5a-5d | Force: ship with known issues documented, don't loop |
668
+ | **Total session tool calls** | 150 calls | Force: save state via session-bridge, compact or pause |
669
+
670
+ **Hard override rules**:
671
+ - If react budget exhausted for a task but task is IN_PROGRESS → force CONTINUE to next task (don't re-attempt)
672
+ - If replan budget exhausted but plan still failing → force escalation (don't attempt 3rd replan)
673
+ - If quality retry budget exhausted → emit concerns in Cook Report, proceed to commit with documented caveats
674
+
675
+ **Why**: Without hard budgets, agents get trapped in local optimization loops — retrying the same failing approach indefinitely. Budget constraints force escalation or acceptance of partial results, which is always better than an infinite loop.
676
+
637
677
  ### Hash-Based Tool Loop Detection
638
678
 
639
679
  <MUST-READ path="references/loop-detection.md" trigger="when same tool+args+result appears to be repeating"/>
@@ -3,7 +3,7 @@ name: debug
3
3
  description: Root cause analysis for bugs and unexpected behavior. Traces errors through code, uses structured reasoning, and hands off to fix when cause is found. Core of the debug↔fix mesh.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.9.0"
6
+ version: "1.0.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -178,6 +178,38 @@ After successful root cause identification (Step 5), append entry:
178
178
 
179
179
  This prevents re-debugging the same issue across sessions.
180
180
 
181
+ ### Step 2d: Known Error Pattern Matching
182
+
183
+ Before forming hypotheses, match the error against common **error archetypes**. If a match is found, skip directly to the known fix approach — no hypothesis cycling needed.
184
+
185
+ **Error Pattern Catalog**:
186
+
187
+ | Pattern ID | Detection (Error Type + Keywords) | Root Cause | Recovery Hint |
188
+ |------------|----------------------------------|------------|---------------|
189
+ | `STATELESS_LOSS` | `NameError` / `ReferenceError` + variable defined in previous step | Execution context doesn't persist between tool calls | "Combine all variable definitions and usage in a single code block" |
190
+ | `MODULE_NOT_FOUND` | `ModuleNotFoundError` / `Cannot find module` | Dependency not installed or wrong import path | "Check package.json/requirements.txt. Install missing dep, then retry" |
191
+ | `TYPE_MISMATCH` | `TypeError` + "undefined is not a function" / "has no attribute" | Wrong type passed through chain — object where primitive expected or vice versa | "Trace the value backward: where was it created? What type was intended?" |
192
+ | `ASYNC_DEADLOCK` | `TimeoutError` / `Promise` + hang / `await` missing | Async/await misuse — missing await, blocking in async, unresolved promise | "Check: missing await? Blocking call in async context? Unresolved promise chain?" |
193
+ | `PATH_MISMATCH` | `ENOENT` / `FileNotFoundError` + path string in error | Relative vs absolute path, or CWD differs from expected | "Print resolved path. Check CWD. Use path.resolve() or Path.resolve()" |
194
+ | `ENCODING_ISSUE` | `UnicodeDecodeError` / `SyntaxError` + quotes/special chars | Non-ASCII characters in code or data (curly quotes, BOM, etc.) | "Check for smart quotes, BOM markers, or non-ASCII in the file. Use `file` command to check encoding" |
195
+ | `ENV_MISSING` | `KeyError` / "undefined" + env var name | Environment variable not set or .env not loaded | "Check .env file exists and is loaded. Verify var name matches exactly (case-sensitive)" |
196
+ | `CIRCULAR_IMPORT` | `ImportError` + "partially initialized" / "circular" | Module A imports B imports A | "Restructure: move shared types to a third module, or use lazy imports" |
197
+
198
+ **Matching rules**:
199
+ - Match on error type + 2+ keywords from the Detection column
200
+ - If matched: report the pattern ID and recovery hint in the Debug Report, then proceed to test the known fix approach as H1 (highest priority hypothesis)
201
+ - If NOT matched: proceed to Step 3 (form hypotheses from scratch)
202
+
203
+ **Error fingerprinting**: When comparing errors across hypothesis cycles, normalize these elements before comparison:
204
+ - Line numbers → `<LINE>`
205
+ - File paths → `<PATH>`
206
+ - Variable/function names → `<IDENT>`
207
+ - Timestamps → `<TIME>`
208
+
209
+ Two errors with the same fingerprint after normalization are the SAME error — don't re-investigate, the previous hypothesis result still applies.
210
+
211
+ **Catalog growth**: After each successful debug (Step 5), check: does this error pattern match any existing catalog entry? If not, and the root cause is generalizable (not project-specific), suggest adding it to the catalog via a note in the Debug Report: "New pattern candidate: [pattern] — consider adding to error catalog."
212
+
181
213
  ### Step 3: Form Hypotheses
182
214
 
183
215
  List exactly 2-3 possible root causes — no more, no fewer.
@@ -390,6 +422,8 @@ Debug returns one of four statuses to its caller (cook, fix, test, surgeon). The
390
422
  | Running same test 3x with same failure without code change | MEDIUM | True stuck loop — no progress possible. Hand off to fix with current incomplete diagnosis |
391
423
  | Scope creep via debug — "while investigating, also fix X" | HIGH | Step 1.5 Scope Lock: lock edits to narrowest affected directory. Fix recommendations MUST stay within boundary. Expand only with user confirmation |
392
424
  | Debug report recommends touching 5+ unrelated files | HIGH | Symptom of fixing at crash sites instead of source. Backward trace (Step 2) to find origin. If truly 5+ files → likely architectural issue → escalate via 3-Fix Rule |
425
+ | Re-investigating known error patterns from scratch | MEDIUM | Step 2d: match error against Known Error Pattern Catalog first — skip hypothesis cycling for recognized patterns |
426
+ | Same error fingerprint across cycles treated as different errors | MEDIUM | Step 2d: normalize line numbers, paths, variable names before comparison — same fingerprint = same error |
393
427
 
394
428
  ## Done When
395
429
 
@@ -3,7 +3,7 @@ name: fix
3
3
  description: Apply code changes and fixes. Writes implementation code, applies bug fixes, and verifies changes with tests. Core action hub in the development mesh.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.7.0"
6
+ version: "0.8.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -68,6 +68,29 @@ Read and fully understand the fix request before touching any file.
68
68
  - If the request is ambiguous or root cause is unclear → call `rune:debug` before proceeding
69
69
  - Note the scope: single function, single file, or multi-file change
70
70
 
71
+ ### Step 1b: Recovery Policy Matrix
72
+
73
+ Before locating code, classify the incoming error/task into a recovery category to determine the right fix strategy. This prevents wasting effort on the wrong approach.
74
+
75
+ | Error Type | Recovery Action | Strategy |
76
+ |------------|----------------|----------|
77
+ | `INPUT_REQUIRED` — missing user input, ambiguous spec | **PROMPT_USER** | Return NEEDS_CONTEXT with specific questions. Do NOT guess. |
78
+ | `INPUT_INVALID` — wrong format, type mismatch, encoding | **AUTO_FIX** | Fix at validation layer. Add schema validation (Zod/Pydantic) if missing. |
79
+ | `TIMEOUT` — operation exceeded time limit | **RETRY** with adjustment | Increase timeout, add retry with exponential backoff, or chunk the operation. |
80
+ | `POLICY_BLOCKED` — security gate, lint rule, contract violation | **ABORT** | Do NOT work around the policy. Report to caller with the specific rule that blocked. |
81
+ | `PERMISSION_DENIED` — auth failure, file access, API scope | **PROMPT_USER** | Cannot fix permissions programmatically. Report exact permission needed. |
82
+ | `DEPENDENCY_ERROR` — missing package, version conflict, broken dep | **AUTO_FIX** | Install missing dep, resolve version conflict, or suggest alternative package. |
83
+ | `LOGIC_ERROR` — wrong output, incorrect calculation, bad algorithm | **INVESTIGATE** | Do NOT auto-fix. Call `rune:debug` — logic errors need root cause analysis. |
84
+ | `ENVIRONMENT_ERROR` — wrong Node/Python version, missing system dep | **PROMPT_USER** | Report exact version/tool needed. Agent cannot change system environment. |
85
+
86
+ **Decision flow**:
87
+ 1. Read the incoming diagnosis/error
88
+ 2. Classify into one of the 8 error types above
89
+ 3. Apply the recovery action — this determines whether to proceed (AUTO_FIX, RETRY), ask (PROMPT_USER), stop (ABORT), or re-diagnose (INVESTIGATE)
90
+ 4. Announce: "Recovery policy: {error_type} → {action}"
91
+
92
+ **Why**: Without a recovery matrix, fix attempts the same strategy (read → change → test) for every error type. A POLICY_BLOCKED error doesn't need code reading — it needs the policy reported. An INPUT_REQUIRED error doesn't need debugging — it needs a question asked. Matching strategy to error type eliminates wasted cycles.
93
+
71
94
  ### Step 2: Locate
72
95
 
73
96
  Find the exact files and lines to change.
@@ -264,6 +287,7 @@ Known failure modes for this skill. Check these before declaring done.
264
287
  | Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests pass — premature cleanup erases failure history |
265
288
  | Runaway fix loop — 20+ fixes without checking quality decay | HIGH | Step 4.5: WTF-likelihood self-regulation. >20% risk = STOP. Hard cap 30 fixes/session. Each fix adds risk — diminishing returns after ~15 |
266
289
  | Each fix creates a new bug elsewhere — whack-a-mole | CRITICAL | Tight coupling signal. STOP fixing → escalate to debug with note "each fix creates new failure — suspect structural issue". Debug will route to plan for redesign |
290
+ | Applying same fix strategy to every error type | MEDIUM | Step 1b Recovery Policy Matrix: classify error type FIRST — POLICY_BLOCKED needs reporting not fixing, INPUT_REQUIRED needs questions not code |
267
291
 
268
292
  ## Done When
269
293
 
@@ -262,8 +262,6 @@ Every plan output — master plan, phase file, or inline plan — MUST end with
262
262
 
263
263
  ## Change Stacking (Overlap Detection)
264
264
 
265
- > From OpenSpec (Fission-AI/OpenSpec, 32.8k★): "Dependencies without metadata create phantom coupling."
266
-
267
265
  When producing phase files with wave-based task grouping, every task MUST declare dependency metadata:
268
266
 
269
267
  ```markdown
@@ -3,7 +3,7 @@ name: research
3
3
  description: Web search and external knowledge lookup. Gathers data on technologies, libraries, best practices, and competitor solutions.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.3.0"
6
+ version: "0.4.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: knowledge
@@ -67,6 +67,29 @@ Call `WebSearch` for each query. Collect result titles, URLs, and snippets. Iden
67
67
  - **Diversity: never select 3+ URLs from the same domain** — spread across source types
68
68
 
69
69
 
70
+ ### Step 2b — Diminishing Returns Detection
71
+
72
+ After each WebSearch call, evaluate whether additional searches are productive:
73
+
74
+ **Track across search results**:
75
+ - **Entity set**: Extract key entities from each result set (library names, API names, version numbers, technique names, company names)
76
+ - **New entity ratio**: `new_entities_in_this_search / total_entities_found_so_far`
77
+ - **Result overlap**: How many URLs from this search were already seen in previous searches
78
+
79
+ | Signal | Threshold | Action |
80
+ |--------|-----------|--------|
81
+ | New entity ratio < 10% | Last search added almost nothing new | Skip remaining queries, proceed to Step 3 with existing results |
82
+ | Result overlap > 60% | Most URLs already fetched or seen | Skip this query's results entirely |
83
+ | All 3 queries return same top 3 URLs | Search space is exhausted | Proceed directly to Step 3 — more queries won't help |
84
+
85
+ **Report when triggered**:
86
+ ```
87
+ Note: Research saturation reached after [N] searches — [M] unique entities found.
88
+ Additional queries showed <10% new information. Proceeding with synthesis.
89
+ ```
90
+
91
+ **Why**: Research skills commonly waste 2-3 WebFetch calls on pages that repeat information already gathered. Saturation detection saves tool calls and context tokens while preserving research quality — the first 3 sources typically contain 90%+ of available information.
92
+
70
93
  ### Step 3 — Deep Dive
71
94
 
72
95
  Call `WebFetch` on the top 3-5 URLs identified in Step 2. Hard limit: **max 5 WebFetch calls** per research invocation. For each fetched page:
@@ -3,7 +3,7 @@ name: scout
3
3
  description: "Fast codebase scanner. Use when any skill needs codebase context. Finds files, patterns, dependencies, project structure. Pure read-only — never modifies files."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: haiku
9
9
  group: creation
@@ -79,6 +79,27 @@ Based on the scan request, run focused searches:
79
79
 
80
80
  **Verification gate**: At least 1 relevant file found, OR confirm the target does not exist.
81
81
 
82
+ #### Info Saturation Detection (Know When to Stop)
83
+
84
+ Scout's default is "max 10 file reads" — but the real question is whether additional reads are productive. Track saturation across Phase 2 searches:
85
+
86
+ **Entity tracking**: As you scan files, extract key entities (function names, class names, imports, API endpoints, config keys). Maintain a running set of discovered entities.
87
+
88
+ | Signal | Threshold | Meaning | Action |
89
+ |--------|-----------|---------|--------|
90
+ | **New entity ratio** | Last 2 file reads added <2 new entities | Search is exhausted for this domain | STOP scanning, move to Phase 3 |
91
+ | **Content similarity** | Last 2 files share >70% of the same imports/patterns | Files are in the same module, redundant reads | Skip remaining files in this directory |
92
+ | **Query variation** | 3+ Glob/Grep queries with different patterns all return the same files | All search angles converge | Domain is fully mapped, proceed |
93
+
94
+ **When saturation detected**: Emit in Scout Report:
95
+ ```
96
+ ### Saturation
97
+ - Reached after [N] file reads — last 2 reads added [M] new entities
98
+ - Recommendation: synthesize_and_report (further scanning unlikely to yield new insights)
99
+ ```
100
+
101
+ **Why**: Without saturation detection, scout reads its full budget of 10 files even when 3 files already contain everything needed. This wastes context tokens and delays the calling skill. Early saturation detection returns control faster.
102
+
82
103
  ### Phase 3: Dependency Mapping
83
104
 
84
105
  1. Use `Grep` to find import/require/use statements in identified files
@@ -112,8 +112,6 @@ Detect and verify tools the project depends on:
112
112
  5. **Build tools**: Check for `turbo.json` (turborepo), `nx.json` (Nx), `Makefile`, etc.
113
113
 
114
114
  6. **Hard dependencies** — tools the project WRAPS (not just uses as dev dependency):
115
- > From CLI-Anything (HKUDS/CLI-Anything, 17.4k★): "The software is a required dependency, not optional."
116
-
117
115
  Scan for evidence that the project wraps an external tool:
118
116
  - `Grep` for `shutil.which(`, `which `, `command -v ` → project looks up an executable at runtime
119
117
  - `Grep` for `subprocess.run(`, `child_process.exec(`, `Deno.Command(` → project invokes external CLI
@@ -101,8 +101,6 @@ Compile all results into the structured report. Update all TodoWrite items to co
101
101
 
102
102
  ### 3-Level Artifact Verification
103
103
 
104
- > From GSD (gsd-build/get-shit-done, 30.8k★): "Task done ≠ Goal achieved."
105
-
106
104
  Every file created or modified during implementation must pass ALL 3 levels:
107
105
 
108
106
  **Level 1 — EXISTS**: File is on disk, non-empty.