agentleFS
tellmefrankietellmefrankie/ai-investment-skills/context-budget/SKILL.md

context-budget

Skill14 starsChanged 6 months agoMITView on GitHub

Know how much context window you have left before Claude loses memory mid-task. Stop getting surprised by truncation on long coding sessions. You are 90 minutes into a refactor. Claude has read 15 files, written 400 lines, discussed 3 design decisions. Then it starts forgetting things from the beginning of the conversation. You did not know you were near the limit. Now you are. This skill tracks your context budget and warns you before it runs out. When you are…

60 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-payment-x402, openclaw-persona-forge and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • TironFoxSkill

    agent-payment-x402

    Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.

    Also in 6 projects that use this

  • TironFoxSkill

    openclaw-persona-forge

    为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。

    Also in 5 projects that use this

  • renepfSkill

    orch-pipeline

    Shared orchestration engine for the orch-* skill family. Defines the gated Research-Plan-TDD-Review-Commit pipeline, the size classifier, the agent map, and the two human gates that the orch-* operation skills delegate to. Not usually invoked directly.

    Also in 4 projects that use this

  • Exploration-labsSkill

    token-budget-advisor

    Proactive token budget assessment and task chunking strategy. Use this skill when queries involve multiple large file uploads, requests for comprehensive multi-document analysis, complex multi-step workflows with heavy research (10+ tool calls), phrases like "complete analysis", "full audit", "thorough review", "deep dive", or tasks combining extensive research with large output artifacts. This skill helps assess token consumption risk early and recommend chunking strategies before beginning work.

    Also in 11 projects that use this

  • loulanyueSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 9 projects that use this

  • loulanyueSkill

    santa-method

    Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.

    Also in 9 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 56 edited versions we read keep these.

  • 1

    Distinctive

    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. Very specific:

    When you are near the limit, this skill can generate a CHECKPOINT.md:

    line 61
  2. Distinctive:

    No API keys needed — estimates based on conversation structure

    line 122

“Common” is measured: kept by at least 6 in 10 of the 56 edited versions of this file we could read. “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

Context Budget Tracker

Know how much context window you have left before Claude loses memory mid-task. Stop getting surprised by truncation on long coding sessions.

The problem

You are 90 minutes into a refactor. Claude has read 15 files, written 400 lines, discussed 3 design decisions. Then it starts forgetting things from the beginning of the conversation. You did not know you were near the limit. Now you are.

This skill tracks your context budget and warns you before it runs out.

What it does

  • Estimates tokens used so far in the current session
  • Shows remaining budget as a percentage
  • Recommends when to checkpoint (summarize + start fresh)
  • Identifies which parts of context are most expensive (large file reads, long outputs)
  • Suggests what to prune if you need to extend the session

Usage

Check my context budget.
Estimate tokens used in this session.
Show: used, remaining, percentage, biggest consumers.
Warn me if I am past 70%.

Example Output

Context Budget — Current Session

Model: claude-opus-4-6 (200k token window)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

USAGE ESTIMATE
  Used:       142,000 tokens  (71%)
  Remaining:   58,000 tokens  (29%)
  Status:     YELLOW — consider checkpointing soon

TOP CONSUMERS
  src/options/analyzer.ts     ~18,000 tokens  (full file read x2)
  src/db/schema.ts            ~12,000 tokens  (full file read)
  Conversation history        ~45,000 tokens  (90 messages)
  Code outputs generated      ~38,000 tokens  (4 large code blocks)
  Tool results                ~29,000 tokens  (15 Bash + 8 Read calls)

RECOMMENDATIONS
  You have ~2-3 more large file reads before hitting 90%.

  If you need to continue this session:
  → Ask me to summarize decisions made so far (saves ~30k tokens)
  → Avoid re-reading files already discussed

  If starting fresh:
  → I can write a CHECKPOINT.md with full context to paste into next session

Checkpoint mode

When you are near the limit, this skill can generate a CHECKPOINT.md:

Generate a checkpoint for this session.
Include: what we were building, decisions made, files changed, next steps.
Keep it under 2000 words so it fits in a fresh context window.

Output:

# Session Checkpoint — 2026-05-13 23:14

## What we were building
Refactoring the options scanner to separate real vs lottery calls.
The core insight: options with premium < $0.10 are speculative noise...

## Key decisions
1. Threshold: premium < $0.10 OR delta < 0.05 = lottery
2. Adjusted P/C computed on real volume only, not total OI
3. Anomaly detection baseline unchanged — runs on adjusted ratio

## Files changed
- src/options/analyzer.ts — splitRealVsLottery() added
- src/types/index.ts — LotteryMetrics type added
- tests/options.test.ts — 4 new test cases

## Next steps
- [ ] Add per-expiry breakdown (weekly vs monthly vs LEAPS)
- [ ] Test RXRX edge case: what if ALL options are lottery?
- [ ] PR description needs risk assessment section

## Key context to preserve
The RXRX case: P/C 0.38 raw → 2.37 adjusted. Signal completely inverted.
This is the core motivation for the whole feature.

Paste this at the start of your next session and pick up exactly where you left off.

Budget tiers

UsageStatusRecommendation
0-50%GREENNo action needed
50-70%YELLOWStart planning checkpoint
70-85%ORANGECheckpoint recommended
85-95%REDCheckpoint now, fresh session for next task
95%+CRITICALSummarize immediately

Why this matters

Claude Code sessions fail gracefully — the model does not crash. But degraded context means:

  • Forgetting early decisions → contradicting itself later
  • Losing track of file structure already read
  • Repeating tool calls for files already in context
  • Subtle bugs from incomplete information

A checkpoint every 60-70% of budget prevents all of these.

Requirements

  • Works with any Claude model (context window varies: Haiku 200k, Sonnet 200k, Opus 200k / 1M)
  • No API keys needed — estimates based on conversation structure
  • Token estimates are approximate (±15%) — treat as guidance, not precision

Free

Fully free and open source.

→ https://github.com/tellmefrankie/news-engine

Author

Built after losing 45 minutes of work when Claude forgot the first half of a refactor session. The checkpoint system saved 3 sessions in the first week of use.

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.