|
| 1 | +--- |
| 2 | +name: heavy-context-budget |
| 3 | +description: Keep coordinator and leaf context lean-batch reads, cap logs, use execute_code to filter-so swarms stay fast and within token limits. |
| 4 | +version: 0.1.0 |
| 5 | +author: CodeGraphTheory |
| 6 | +license: MIT |
| 7 | +metadata: |
| 8 | + hermes: |
| 9 | + tags: [heavy-coder, performance, context, coordinator] |
| 10 | + related_skills: |
| 11 | + - heavy-explore-first |
| 12 | + - heavy-pre-dispatch-enrich |
| 13 | + - heavy-leaf-brief |
| 14 | +--- |
| 15 | + |
| 16 | +# Heavy context budget |
| 17 | + |
| 18 | +## Overview |
| 19 | + |
| 20 | +Heavy Coder optimizes swarm **breadth** (parallel leaves). Coordinator and leaf **depth** (megabyte pastes) destroys latency and blows injection caps (`heavy_coder.max_injected_plan_chars`). This skill is the token discipline for coordinators and for text placed in `delegate_task` context. |
| 21 | + |
| 22 | +## When to Use |
| 23 | + |
| 24 | +- Every explore and pre-dispatch enrich turn |
| 25 | +- Before pasting CI logs, stack traces, or `read_file` output into chat or leaf context |
| 26 | +- Large monorepos or many candidate summaries at synthesis |
| 27 | + |
| 28 | +## Coordinator rules |
| 29 | + |
| 30 | +### Batch independent I/O |
| 31 | + |
| 32 | +- Multiple `read_file` / `search_files` / read-only `terminal` in **one turn** when inputs do not depend on each other. |
| 33 | +- Do not read file A, wait, read file B, wait-batch. |
| 34 | + |
| 35 | +### Cap pasted material |
| 36 | + |
| 37 | +| Material | Max in context/chat | |
| 38 | +|----------|---------------------| |
| 39 | +| Stack trace / test failure | ~80 lines or 4 KB | |
| 40 | +| Full file body | Use `offset`/`limit`; cite `path:line` | |
| 41 | +| Directory listings | `search_files` with `limit` | |
| 42 | +| Candidate summaries at synthesis | Bullets: files, commands, exit codes | |
| 43 | + |
| 44 | +### Filter before paste |
| 45 | + |
| 46 | +Use `execute_code` when you need to: |
| 47 | + |
| 48 | +- Ripgrep and return only matching lines + numbers |
| 49 | +- Parse JSON test output for failures only |
| 50 | +- Count/dedupe paths across candidates |
| 51 | + |
| 52 | +### Skills loading |
| 53 | + |
| 54 | +- Load **only** skills for the current phase (router → enrich → dispatch → synthesize → ship). |
| 55 | +- Do not load the full heavy skill catalog every turn. |
| 56 | + |
| 57 | +### Leaf context |
| 58 | + |
| 59 | +- Profile default `leaf_toolsets: [terminal, file]`-no `web` unless needed. |
| 60 | +- Point to plan file path instead of duplicating full user essay in eight contexts. |
| 61 | + |
| 62 | +## Slim injection alignment |
| 63 | + |
| 64 | +Hooks use `slim_delegate_context` and compact chat injection. Coordinator enrich (`heavy-pre-dispatch-enrich`) adds **high-signal** bytes only-touch map, repro excerpt, evidence bar-not narrative repetition. |
| 65 | + |
| 66 | +## Done when |
| 67 | + |
| 68 | +- No leaf `context` contains a full-file dump unless that file is the entire task scope (<200 lines) |
| 69 | +- Chat responses use references (`path:line`) instead of reproducing whole modules |
| 70 | +- Logs in context are truncated with note "truncated; run X for full" |
| 71 | + |
| 72 | +## Anti-patterns |
| 73 | + |
| 74 | +| Symptom | Fix | |
| 75 | +|---------|-----| |
| 76 | +| Injection truncated by hooks | Shorter enrich block; move detail to disk plan | |
| 77 | +| Eight copies of same 2 KB task | Shared enrich block once per leaf | |
| 78 | +| Coordinator summarizes without reading | Batch read touch map first | |
| 79 | + |
| 80 | +## Docs |
| 81 | + |
| 82 | +- [composer-hermes-swarms.md](../../docs/composer-hermes-swarms.md) |
0 commit comments