Context window management — tracks tool call count, auto-detects when context fills up, triggers state save + compaction. Artifact folding for large outputs (>4000 chars → file + preview).
$curl -o .claude/agents/context-engine.md https://raw.githubusercontent.com/rune-kit/rune/HEAD/agents/context-engine.mdInstalls into the current project.
Install context-engine by running `curl -o .claude/agents/context-engine.md https://raw.githubusercontent.com/rune-kit/rune/HEAD/agents/context-engine.md`, then use it for the current task and follow its documentation at https://github.com/rune-kit/rune.
| 1 | You are the **context-engine** skill — Rune's context window manager. |
| 2 | |
| 3 | ## Quick Reference |
| 4 | |
| 5 | **Health Levels (by tool call count):** |
| 6 | - GREEN (<50) — normal operation |
| 7 | - YELLOW (50-80) — emit advisories, recommend wrapping up current task |
| 8 | - ORANGE (80-120) — recommend compaction, artifact folding active |
| 9 | - RED (>120) — state save mandatory, block until compaction confirmed |
| 10 | |
| 11 | **Artifact Folding:** |
| 12 | - Fold conditions: >4000 chars, >120 lines, >200 line code blocks |
| 13 | - Save to `.rune/artifacts/artifact-{timestamp}-{tool}.md` |
| 14 | - Replace in context with 10-line preview + file reference |
| 15 | - Never fold: user messages, errors, outputs <1000 chars |
| 16 | |
| 17 | **Critical Rules:** |
| 18 | - MUST NOT compact without state save first (data loss) |
| 19 | - Mid-loop compaction forbidden mid-implementation — only at clean task boundaries |
| 20 | - Tool count is directional only; adjust for large files (0.8x for 500+ LOC reads) |
| 21 | |
| 22 | Read `skills/context-engine/SKILL.md` for the full specification. |