[Bug] Unnecessary plugin documentation auto-loaded at session start consuming 35% context window

Status Fixed / completed
Reported on v2.1.110
Maintainer reply None cached
Activity 4 comments · opened Apr 16, 2026 · closed Apr 17, 2026

Bug Description
Title:
Context window bloat: 35% consumed by auto-loaded plugin docs on session start

Description:
## Issue
Session context is being bloated with unnecessary plugin documentation and skill
listings at startup (consuming ~35% of context window), despite plugins being
pre-installed and not actively used in this session.

## What's being loaded

  • superpowers:using-superpowers skill (massive introduction + flow diagram)
  • Complete enumeration of 100+ available skills (skills list)
  • Vercel platform knowledge dump (even on non-Vercel projects)
  • MCP server instructions
  • Multiple system reminders with lengthy examples

## Expected behavior
Plugin documentation should load on-demand (when /skill is invoked or skill is
referenced), not auto-injected at every session start.

## Current behavior
All plugin context is pre-loaded regardless of whether the session will use those
plugins.

## Environment

  • Claude Code version: (check with claude --version)
  • Platform: macOS
  • Plugins enabled: 20 (superpowers, vercel, medusa-dev, expo, etc.)
  • Model: haiku

## Steps to reproduce

  1. Start a new Claude Code session
  2. Check context usage immediately
  3. Observe ~35% is consumed by plugin docs not used in current session

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.110
  • Feedback ID: cfb508c9-2a8d-4667-905a-e0690d9eedad

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/keerthi/.local/share/claude/versions/2.1.110 (expected in multi-process scenarios)\n    at kU_ (/$bunfs/root/src/entrypoints/cli.js:2751:2153)\n    at Mt6 (/$bunfs/root/src/entrypoints/cli.js:2751:1233)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T13:25:32.859Z"},{"error":"Error: Plugin path not found: /Users/keerthi/.claude/plugins/marketplaces/claude-plugins-official/external_plugins/autofix-bot\n    at P91 (/$bunfs/root/src/entrypoints/cli.js:1035:10941)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1035:9256)\n    at async Jz9 (/$bunfs/root/src/entrypoints/cli.js:1035:8470)\n    at async Wz9 (/$bunfs/root/src/entrypoints/cli.js:1035:20463)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1035:21911)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:8364:6468)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T13:25:33.443Z"},{"error":"Error: Failed to clone repository for git-subdir source: Cloning into '/Users/keerthi/.claude/plugins/cache/temp_subdir_1776345933448_p17a0l.clone'...\ngit@github.com: Permission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n    at w91 (/$bunfs/root/src/entrypoints/cli.js:1029:54012)\n    at async NtH (/$bunfs/root/src/entrypoints/cli.js:1029:56341)\n    at async P91 (/$bunfs/root/src/entrypoints/cli.js:1035:11949)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1035:9256)\n    at async Jz9 (/$bunfs/root/src/entrypoints/cli.js:1035:8470)\n    at async Wz9 (/$bunfs/root/src/entrypoints/cli.js:1035:20463)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1035:21911)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:8364:6468)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T13:25:34.403Z"},{"error":"Error: Failed to clone repository for git-subdir source: Cloning into '/Users/keerthi/.claude/plugins/cache/temp_subdir_1776345933444_org2qd.clone'...\ngit@github.com: Permission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n    at w91 (/$bunfs/root/src/entrypoints/cli.js:1029:54012)\n    at async NtH (/$bunfs/root/src/entrypoints/cli.js:1029:56341)\n    at async P91 (/$bunfs/root/src/entrypoints/cli.js:1035:11949)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1035:9256)\n    at async Jz9 (/$bunfs/root/src/entrypoints/cli.js:1035:8470)\n    at async Wz9 (/$bunfs/root/src/entrypoints/cli.js:1035:20463)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1035:21911)\n    at async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:8364:6468)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T13:25:34.403Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/keerthi/Downloads/dev/clipd_review.\n    at call (/$bunfs/root/src/entrypoints/cli.js:4732:7630)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T13:31:38.294Z"}]

View original on GitHub ↗

4 Comments

0xbrainkid · 6 months ago

35% of the context window consumed by auto-loaded plugin documentation at session start — before any user message — is a significant capability overhead. The token budget spent on skill listings, platform knowledge, and MCP instructions that may never be used in this session is not recoverable and reduces the effective context available for actual work.

From an agent capability perspective, this is a version of the "eagerly loaded tools" problem documented in #49073 (Desktop always loads MCP tool schemas, 4x baseline vs CLI). The same principle applies: capability documentation that is not needed for the current session should not consume the session's context budget upfront.

The fix is lazy loading at multiple levels:

  1. Skill listings should not enumerate 100+ available skills at startup. The skill list is available via / autocomplete and the Skill tool — it does not need to be in the system context. Remove it entirely from the session context; skills load their documentation when invoked.
  1. Platform knowledge dumps (Vercel, etc.) should only load when the agent detects the project is relevant. A package.json scan at session start that checks for Vercel dependencies before injecting Vercel knowledge would reduce false-positive context injection.
  1. MCP server instructions should follow the same lazy loading as MCP tool schemas — load when the tool is first called, not at session start.
  1. Plugin "using X" introductions should only inject when the user invokes a plugin command. A session that never uses the superpowers plugin should not carry its introduction in context for the entire session.

The 35% overhead compounds across every turn via the prompt cache — reducing startup context by 35% would meaningfully extend session lifetime before compaction.

github-actions[bot] · 6 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14882
  2. https://github.com/anthropics/claude-code/issues/44371

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

junaidtitan · 6 months ago

35% of context consumed before you even type a message is painful, especially on Haiku where the window is already tight. With 20 plugins installed, the auto-loaded docs add up fast.

Cozempic can help here in two ways. First, cozempic current --diagnose shows you exactly what's consuming context with a full breakdown, so you can identify which plugins are the worst offenders. Second, the pruning strategies trim oversized content in the session including injected documentation that accumulates over turns:

pip install cozempic
cozempic current --diagnose  # see what's eating your context
cozempic treat --rx standard # prune the bloat

This won't prevent the initial load (that's an upstream issue — plugin docs should be lazy-loaded as you said), but it reduces the ongoing cost as that documentation gets duplicated across turns and tool results. On sessions with heavy plugin use we typically see significant reductions.

https://github.com/Ruya-AI/cozempic

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.