AI AI Toolkit
China AI tip

After Burning 500 Million Tokens, My New Trick for Slimming Down Skill Context in Codex and Claude Code

📰 公众号:卡尔的AI沃茨 📅 2026-08-05

Core Highlights

Only after burning through roughly 500 million tokens in practice did a heavy user discover the root of the problem: in agentic coding tools such as Codex and Claude Code, the more than 300 Skills he had installed would automatically load into context at the start of every new session, and that Skill list alone consumed about 9.9k tokens. Put simply, the vast majority of Skills are never used in the vast majority of sessions, yet they constantly occupy the precious context window, and this hidden overhead has long been ignored by most users. The discovery reframes context budgeting as a first-class engineering concern rather than an afterthought, and it shows how easily small per-session costs compound into enormous totals once you operate at scale across many sessions and many days. The author estimates that without intervention the waste would only grow as more community Skills get installed every week, turning a tidy workstation into a quietly expensive one that nobody notices until the bill arrives at month's end, by which point the habit is already baked into daily routine.

What Happened

The author's slimming approach was not to delete Skills, but to "down-weight" the Skill list. Through a layered index, he made the session load only a minimal catalog at startup, with the actual Skill content fetched lazily on demand. Based on July's usage intensity, the redundant Skill list devoured roughly 400 to 500 million tokens of context space across the month. This overhead both drives up cost and dilutes the attention weight of genuinely relevant information, directly causing the model to become "dumber the longer the conversation runs." After identifying the issue, the author compressed the resident context from nearly ten thousand tokens down to the low hundreds, a reduction that visibly improved response quality in long sessions without sacrificing any Skill functionality that he actually needed. He documented the before-and-after side by side, and the improvement in focus was obvious even on routine refactoring tasks that used to wander off track, which is the kind of mundane work where context pollution hurts most because there is no dramatic failure to notice.

Technical Details

The essence of the problem is context pollution. Agentic tools have a limited context window, and when irrelevant Skill system prompts and examples pile up in the prefix context, the relative share of effective instructions gets compressed, making the model more prone to hallucination or drifting off task. The core of the author's trick is to switch from "full preload" to "index plus on-demand fetch," using a lightweight routing layer to judge which Skills the current task should call. This mechanism does not change the Skill's own function, only its loading timing, so migration cost is extremely low. Concretely, the router can be a small keyword or intent classifier that inspects the user's first message and pulls in only the relevant Skill definitions, leaving the rest dormant on disk until explicitly invoked by a later step. In a real project this might mean a "database" Skill loads only when the prompt mentions a schema, rather than sitting in context for every unrelated task, and that single change can reclaim thousands of tokens over a busy afternoon.

Comparison with Competitors

Compared with traditional IDE plugins that keep all functions resident in memory, the Skill mechanism of Codex and Claude Code is more flexible yet also easier to lose control of. Anthropic and OpenAI have so far offered no official auto-pruning solution for Skills, and this kind of "folk optimization" precisely exposes the blind spot of the official tools in context governance. For teams managing hundreds of Skills, this is a low-cost, high-return engineering practice that is more sustainable than constantly paying to expand the context window. It also hints at a broader market gap: third-party tooling for context hygiene could become its own niche, much as linters emerged decades ago to manage code quality once projects grew past a certain size, and vendors who ignore it leave the door open for community fixes that may eventually become the default everyone expects.

Industry Impact and Use Cases

As agentic coding spreads, the Skills developers install will only multiply, and context bloat will become a widespread pain point. The methodology in this article can be replicated to any tool based on system-prompt injection: turn a static list into a dynamic index. For teams, establishing a grading and lazy-loading spec for Skills is more pragmatic than blindly chasing a larger context window. In essence, it reminds every agent user that context is also a resource that must be accounted for. The broader lesson is that as AI assistants get more capable, the bottleneck shifts from raw intelligence to how well we manage the information we feed them, and a disciplined context budget may matter as much as the model behind it. The teams that internalize this early will scale their agent workflows without watching quality silently decay session after session.