agentleFS
msiSharifulmsiShariful/claude-token-inspector/skills/token-forecast/SKILL.md

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.

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
  1. Distinctive:

    If the user provided a file path or directory and you can see the file contents or directory listing in context, use actual character …

    line 21
  2. Distinctive:

    Binary / images: not tokenizable — flag as "not readable"

    line 29
  3. Distinctive:

    Start with a forecast headline:

    line 35
  4. Very specific:

    If total after load < 60%: ✅ Safe to load — plenty of budget remaining.

    line 64
  5. Distinctive:

    Ask: "What would you like to forecast?

    line 85

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 rangeLabel
< 1,000Tiny
1,000–5,000Small
5,000–20,000Medium
20,000–60,000Large
60,000–150,000Very large
> 150,000Massive — 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:

FileEst. TokensInclude?
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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.