[FEATURE] Lazy-load skill catalog and deferred tool names to reduce per-turn context bloat
Problem Statement
Installing plugins, MCP servers, and skills causes their full catalog (skill names + descriptions, deferred tool names, plugin session-start hook output) to be injected into the system prompt on every turn, even when unused.
With a handful of MCP servers connected (e.g. Linear, PostHog, GitHub, Sentry, claude-in-chrome) and a plugin like Vercel that ships ~40 skills, session-start context is already tens of thousands of tokens before the user types a single message. PostHog alone exposes hundreds of deferred tool names.
In practice this triggers Context limit reached · /compact or /clear to continue within ~10 short messages — even on models advertised with large context windows. Users perceive this as "I barely said anything, why is the context full?" because the bloat is invisible to them and not driven by their own usage.
Proposed Solution
Lazy-load catalogs the same way tool schemas are already deferred. Replace the eager dump with a discovery affordance:
"You have 487 tools across 6 MCP servers and 42 skills available. CallListTools/ListSkillsto see what's available."
The model can then pull catalog entries on demand for the small fraction of turns that actually need them. Specifically:
- Deferred tool names — currently every name is listed in the system reminder. Replace with a count + a
ListToolsdiscovery tool. - Skill names + descriptions — currently injected on every turn. Same treatment: count +
ListSkills. - Plugin session-start hook output — re-injected every turn. Should be one-shot at session start, or cached and only re-surfaced when relevant.
This preserves discoverability (via the discovery tools) while making the per-turn cost proportional to what's actually used.
Alternative Solutions
- Manually disable MCP servers / plugins to shrink the prompt — works but defeats the purpose of having them installed.
/compactfrequently — reactive and lossy.- Use a model with a larger context window — pushes the problem out but doesn't fix the proportionality issue. A 1M-context model still wastes tokens on unused catalog entries every turn.
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
- User installs the Vercel plugin (~40 skills) and connects 3–5 MCP servers (Linear, PostHog, GitHub, Sentry, claude-in-chrome).
- User starts a fresh session and asks a routine coding question, attaches one screenshot.
- After ~5–10 short exchanges, hits
Context limit reached. - User has not invoked any plugin skill or MCP tool — the bloat is entirely from catalog injection.
With lazy loading: the same session would only pay the cost of the specific tools/skills actually invoked.
Additional Context
The deferred tools mechanism already exists for tool schemas — that's a strong precedent that the design recognizes the problem. Extending the same pattern to tool names and skill catalogs is a natural next step.
Observed in a session running on Opus 4.7 (1M context) where context was exhausted within ~10 short messages, despite the nominal capacity. Inspection of the system prompt showed:
- Deferred tool names list: hundreds of entries (PostHog ~250, Linear ~50, GitHub ~30, etc.)
- Skill catalog: ~40 entries with one-line descriptions each
- Plugin session-start blobs (Vercel knowledge update, music plugin status) re-injected every turn
- Two CLAUDE.md files, MEMORY.md index
None of these scaled with user messages, but they all contributed to the budget every turn.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗