Context Slimmer
Scanned@SunDevilATB
npx machina-cli add skill @SunDevilATB/context-slimmer --openclawContext Slimmer
Audit workspace files that load into every message and reduce their token footprint.
Quick Start
# Measure current context cost
bash scripts/measure.sh
# Full audit (outputs recommendations)
bash scripts/measure.sh --audit
Audit Process
For each always-loaded file, evaluate:
- Move to skill — Content only needed for specific tasks (betting config, group chat rules, detailed protocols). Move to a skill or reference file that loads on demand.
- Remove — Outdated info, dead features, completed one-time setup, duplicated content across files.
- Compress — Verbose explanations that could be 1 sentence. If the agent already knows it, cut it.
Rules of Thumb
- If a cron job handles it, remove it from HEARTBEAT.md
- If it's in SOUL.md, don't repeat it in MEMORY.md or AGENTS.md
- If it's in USER.md, don't repeat it in MEMORY.md
- If the agent does it daily, it doesn't need instructions — just a trigger word
- Prefer 1 sentence over 5 bullets saying the same thing
- Target: each file should justify every line's token cost
Expected File Sizes (lean targets)
| File | Target |
|---|---|
| AGENTS.md | < 500 tokens |
| TOOLS.md | < 500 tokens |
| USER.md | < 700 tokens |
| MEMORY.md | < 400 tokens |
| HEARTBEAT.md | < 400 tokens |
| SOUL.md | < 250 tokens |
| IDENTITY.md | < 50 tokens |
| Total | < 2,800 tokens |
Output Format
Report: current size, projected size, savings per file. Include specific recommendations grouped by move/remove/compress.
Overview
Context Slimmer audits always-loaded workspace files (AGENTS.md, TOOLS.md, USER.md, MEMORY.md, HEARTBEAT.md, SOUL.md, IDENTITY.md) to shrink their token footprint. It measures current token cost and provides concrete move, remove, or compress recommendations to optimize the context window and keep lean file sizes.
How This Skill Works
It runs a token-cost measurement (bash scripts/measure.sh) and, with --audit, outputs per-file recommendations. For each file, it evaluates whether content should be moved to a dedicated skill, removed if outdated, or compressed; the final output includes a Report with current size, projected size, and savings per file.
When to Use It
- You need to reduce token usage when the context window is tight or approaching limits.
- Workspace files have grown beyond lean targets and you want measurable reductions.
- On onboarding or scale, you want to minimize loaded content while preserving essential behavior.
- You detect duplication or outdated info across AGENTS.md, MEMORY.md, USER.md, or SOUL.md.
- Preparing for deployment or multi-app usage where token budgets matter.
Quick Start
- Step 1: Run Measure current context cost with bash scripts/measure.sh.
- Step 2: Run Full audit via bash scripts/measure.sh --audit to see recommendations.
- Step 3: Implement Move/Remove/Compress changes and re-measure to verify savings.
Best Practices
- Audit all always-loaded files and prioritize largest files first (e.g., USER.md, MEMORY.md).
- Apply the Move/Remove/Compress taxonomy consistently and document decisions.
- Honor cross-file rules: if content is in SOUL.md, don’t duplicate it in MEMORY.md or AGENTS.md.
- Aim for lean targets and verify token cost reductions with the measure script after changes.
- Run measure.sh before and after changes to quantify savings and adjust as needed.
Example Use Cases
- Move detailed betting rules or group chat protocols from AGENTS.md to a dedicated on-demand skill file.
- Remove outdated cron notes and obsolete features from HEARTBEAT.md to cut noise.
- Compress verbose protocols in IDENTITY.md into concise, one-sentence summaries.
- Consolidate repeated prompts across MEMORY.md and SOUL.md to eliminate duplication.
- Convert daily-use instructions in USER.md into trigger words or lightweight references.