token-forecast
Skill4 starsChanged 20 days agoMITView on GitHub
Estimate how many tokens a file, directory, URL, or pasted content would add to your context before you load it. Use before opening large files or reading external content to avoid blowing your context budget.
In this repository7 other files it gives its agents.
- context-healthSkill
- find-bloatSkill
- history-trimSkill
- inspect-contextSkill
- mcp-auditSkill
- slim-instructionsSkill
- suggest-splitSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
If the user provided a file path or directory and you can see the file contents or directory listing in context, use actual character …
- Distinctive: line 29
Binary / images: not tokenizable — flag as "not readable"
- Distinctive: line 35
Start with a forecast headline:
- Very specific: line 64
If total after load < 60%: ✅ Safe to load — plenty of budget remaining.
- Distinctive: line 85
Ask: "What would you like to forecast?
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Token Forecast
Estimate the token cost of something before it enters your context window. Help the user make an informed decision about whether to load it.
What to forecast
The user may provide:
- A file path (e.g.,
src/api/routes.ts) - A directory (e.g.,
src/components/) - A glob pattern (e.g.,
**/*.test.ts) - A URL they plan to fetch
- Pasted content (code block or text they've included in the message)
- A description (e.g., "my node_modules folder")
If the user provided a file path or directory and you can see the file contents or directory listing in context, use actual character counts. Otherwise, use reasonable estimates based on file type and typical sizes.
Estimation method
- Prose / markdown: 1 token ≈ 4 characters
- Dense code (JS, TS, Python, etc.): 1 token ≈ 3.5 characters
- Minified / compiled code: 1 token ≈ 2.5 characters
- JSON / config: 1 token ≈ 3 characters
- Binary / images: not tokenizable — flag as "not readable"
For directories, estimate per file then sum. If the directory is large, sample a few representative files and extrapolate.
Output format
Start with a forecast headline:
📦 Forecast: {name} — ~{N} tokens ({size_label})Size labels:
| Token range | Label |
| < 1,000 | Tiny |
| 1,000–5,000 | Small |
| 5,000–20,000 | Medium |
| 20,000–60,000 | Large |
| 60,000–150,000 | Very large |
| > 150,000 | Massive — likely too big |
Then a budget impact line showing how this fits into the current context:
📊 Budget impact: {current}% used + {forecast}% more = {total}% total (~{remaining_after} tokens remaining after load)Then a recommendation:
{emoji} {recommendation}Recommendation rules:
- If total after load < 60%:
✅ Safe to load — plenty of budget remaining. - If total after load 60–75%:
⚠️ Loadable but context will be getting full. Consider closing other files first. - If total after load 75–90%:
🟠 Risky — you'll have limited room for responses. Load only if essential. - If total after load > 90%:
🔴 Do not load — this will critically fill your context. Use a subsection or start a new conversation.
If it's a directory or multiple files, add a breakdown table:
| File | Est. Tokens | Include? |
routes.ts | ~3,200 | ✅ |
routes.test.ts | ~8,400 | ⚠️ Large |
routes.min.js | ~22,000 | 🔴 Skip |
End with one alternative if the recommendation is not safe:
💡 Alternative: {specific suggestion — e.g., "Read only lines 1–80 of routes.ts", "Use grep to find the function you need instead of loading the whole file"}If no target is specified
Ask: "What would you like to forecast? Provide a file path, paste content, or describe what you're planning to load."
$ARGUMENTS
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.

