context-cost
Skill1 starsChanged 5 months agoMITView on GitHub
Report harness context overhead (KB, words, estimated tokens) for a given path by walking the directory tree and collecting all CLAUDE.md, agents.md, and @-import files the harness auto-loads. Use when the user types /context-cost or /ctx-cost, or wants to know what files are loading into context.
In this repository11 other files it gives its agents.
- agent-teamsSkill
- convert-prompt-to-saillSkill
- dirtree-checkSkill
- model-catalog-refreshSkill
- model-prefs-assignSkill
- model-prefsSkill
- model-prefs-testSkill
- saill-to-englishSkill
- test-agent-teamsSkill
- test_saill_in_skillSkill
- try-my-promptSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
If the script is not found, report its expected location and stop.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Skill: /context-cost
Model preference: #lowcost
Report how much context overhead the harness will auto-load for a given path — walking up the directory tree and collecting every CLAUDE.md, CLAUDE.local.md, agents.md, and @-import file pulled in at session start.
Arguments
/context-cost [path]
path— optional; defaults to the current working directory if omitted.
Step-by-step execution
Step 1 — Locate the script
Find context_cost.py in the bin/ directory of the SAILL repo. If you are running from within a tested_implementation directory, the script is at ../../bin/context_cost.py relative to your working directory. If running from the repo root, it is at bin/context_cost.py.
Run:
python <path-to-bin>/context_cost.py <target-path> --jsonIf the script is not found, report its expected location and stop.
Step 2 — Parse and format the output
The JSON structure is:
{
"path": "...",
"files": [
{"level": N, "path": "...", "kb": N, "words": N, "tokens": N, "imported_by": "..." or null}
],
"total_kb": N,
"total_words": N,
"total_tokens": N
}Step 3 — Present the report
3.1 Print: Context overhead for: <path>
3.2 Print a table sorted by level (outermost first):
Level File KB Words ~Tokens
----- -------------------------------- ----- ------ -------
0 CLAUDE.md 1.2 210 280
1 agents.md 3.4 580 775
(imported by CLAUDE.md)Show (imported by <basename>) on a sub-line when imported_by is non-null.
3.3 Print totals:
Total: N files — X.X KB — Y words — ~Z tokens3.4 Threshold flags:
- If
total_tokens>= 20000:[WARN] High context load: ~Z tokens. Consider trimming @-imports. - Else if
total_tokens>= 8000:[NOTE] Moderate context load: ~Z tokens. Worth reviewing. - Otherwise: no flag.
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.

