sw-context-diet
Skill1 starsChanged 39 days agoMITView on GitHub
Keeps the agent's context window lean so long work stays sharp and cheap. Moves bulky reading into subagents, saves state to files before compaction, trims loaded skills/tools/memory, and summarizes instead of pasting. Use when a session gets long or slow, before a big multi-file task, when the agent starts forgetting earlier decisions, when tool output is huge, or when the user mentions tokens, cost, context, or "it's getting confused".
In this repository9 other files it gives its agents.
- stillwrightSkill
- sw-deep-searchSkill
- sw-forgeSkill
- sw-launchSkill
- sw-onboardSkill
- sw-radarSkill
- sw-scoutSkill
- sw-verifySkill
- sw-workerSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Read narrow: Search first, then read only the lines needed.
- Very specific: line 29
Decide once: Write decisions into the run's plan.md or log so they survive compaction.
- Very specific: line 38
Every installed skill, tool and MCP server adds its description to every session.
- Distinctive: line 44
When asked, say in one line where context is going (largest consumers) and what was trimmed.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context diet
sw below is the Stillwright binary. If sw is not on PATH, follow the install note in the stillwright skill (ask the user first; never install unattended).
Quality drops and cost rises as context fills: early decisions get lost and huge outputs crowd out the task. Treat context as the scarcest resource in the run.
Anthropic's own measurements (platform.claude.com, "optimizing for cost"): trimming inputs saves 21–26%, pruning tool results over 2K characters saves 39% on long runs, compacting at 90K instead of 150K tokens cuts cost per request by 70%.
While working
- Delegate reading. Wide searches, long files and logs go to a subagent that returns only the answer (paths, line numbers, the one relevant excerpt).
- Read narrow. Search first, then read only the lines needed. Don't reread files you just wrote.
- Cap tool output. Pipe through
head,tail,grep, or--quietflags. Summarize results in one line instead of carrying them forward. - Decide once. Write decisions into the run's
plan.mdor log so they survive compaction.
Before context runs out (around 80% full)
- Save state:
sw run log latest event=checkpoint note="<where we are, next step>"and updateplan.md. - Compact or start a fresh session; resume with
sw run status.
Trim what's loaded
Every installed skill, tool and MCP server adds its description to every session. Review
what's loaded: keep the ones used weekly, uninstall or disable the rest (they stay findable
through sw-scout). Keep memory indexes to one line per entry, details in separate files.
Report
When asked, say in one line where context is going (largest consumers) and what was trimmed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

