Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Model Context LensNew to Visual Studio Code? Get it now.
Model Context Lens

Model Context Lens

SidSoftStudio

|
1 install
| (0) | Free
See what fills your AI agent's context window — Claude Code (exact /context split) and GitHub Copilot — plus tools, MCP servers, skills, subagents, token spend and history, natively in VS Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Model Context Lens

See what's filling your AI agent's context window, natively in VS Code. It works with Claude Code (the exact /context split: system prompt, system tools, MCP tools, skills, memory files, messages) and with GitHub Copilot Chat. For both it shows which tools, MCP servers, skills and subagents were called, plus token spend, cost and history.

Model Context Lens: Claude Code, GitHub Copilot and History views

Supported agents

Agent Context % Category split Tools / MCP / subagents Spend
Claude Code (VS Code extension or CLI) ✅ exact, live ✅ exact (headless /context) ✅ tokens + $ (API list price)
GitHub Copilot Chat in VS Code (Free/Pro/Pro+/Business) ✅ from promptTokens / modelConfiguration.contextSize ➖ Copilot doesn't record one (prompt vs. history is estimated) ✅ incl. MCP server, runSubagent, chat modes tokens + premium requests (credits)
Copilot via VS Code agent host / Copilot CLI (~/.copilot/session-state) ✅ exact (maxPromptTokens) ◐ System prompt measured, tools/env estimated ✅ + durations, hooks exact tokens incl. cache + premium requests
Copilot + OTel file (optional) ✅ ➖ ✅ + tool durations + exact cache read/write split

Copilot data comes from VS Code's local chat storage (%APPDATA%\Code\User\workspaceStorage\<hash>\chatSessions\). No setup, nothing leaves your machine. Run Model Context Lens: Enable Detailed GitHub Copilot Telemetry to also turn on Copilot Chat's built-in OpenTelemetry file exporter. That adds cache split and tool timing; prompt content is not captured. Older Copilot builds don't record token counts. For those chats you'll see prompts and tools, but not tokens.

Features

  • Context: the same category breakdown as Claude Code's /context, with a segmented bar. The deferred tool rows and the autocompact buffer are included. It updates live as you work.
  • Plan usage: 5-hour and weekly limit bars. Requires the optional live bridge.
  • Tools: built-in tools, MCP grouped by server and tool, subagents and slash commands. Each entry shows its call count, average duration, output tokens and errors. Configured MCP servers that you never call are flagged as idle.
  • Skills: the skills you invoked, plus skills that are loaded but never used, with the context tokens each one costs.
  • What's in Messages: which tool results, prompts and replies are filling the conversation.
  • Context over time: a chart of context size per API call, with compaction markers and the autocompact threshold.
  • Token spend: input, cache write (5m/1h), cache read, output, cache hit %, subagent share, and estimated cost at API list prices.
  • History (Today/7d/30d/All, this workspace or all projects): sessions, tokens, cost, a daily chart, and top tools, MCP servers, skills and subagents.
  • Status bar: shows something like $(pulse) 16% · 164.7k/1M, with a tooltip table. It turns orange above 65% and red above 85%.

How it gets the data

Source What it gives Cost
Transcript JSONL (~/.claude/projects/<project>/<session>.jsonl) Exact API token usage per call, tool calls, skills, MCP, subagents, compactions. Read incrementally. Nothing. Zero setup.
Headless /context (claude -p "/context" --resume <id> --fork-session --no-session-persistence) Exact category split, MCP tool, skill and memory tables Local command only: no API call and no tokens. The session is not modified.
Optional live bridge (status line) Exact window size, used %, 5h/7d plan limits Chains your existing statusLine. Restored on uninstall.

Fixed categories (system prompt, tools, skills, memory) come from /context. They don't change mid-session. Messages comes from the latest API-reported usage, so the view stays both exact and live.

Works with the Claude Code VS Code extension and with the CLI. Both write the same transcripts.

Develop & test

npm install
npm test          # 19 unit tests (parser, /context parser, breakdown, pricing, history, bridge)
npm run preview   # writes preview/index.html — open in a browser, no VS Code needed

Press F5 in VS Code to open an Extension Development Host. Then click the Model Context Lens icon in the activity bar. With no Claude session in that folder, click Try with a demo session (or run Model Context Lens: Create Demo Session). That writes synthetic transcripts to the extension's storage, not to ~/.claude, and adds live turns over about 20 seconds.

Package and install locally (or download the VSIX from the latest GitHub Release):

npm run package                                   # → model-context-lens-<version>.vsix
code --install-extension model-context-lens-<version>.vsix

Settings

contextLens.claudeConfigDirs, claudePath, exactBreakdown (auto/manual/off), contextWindow, autocompactBuffer, pricing, showCost, statusBar, followLatestSession.

Cost is an API-equivalent estimate at list prices. On Pro/Max plans it is not your bill. Override prices with contextLens.pricing.

Releasing

CI (.github/workflows/ci.yml) runs the tests and builds a VSIX on every push and pull request. You can download it from the run's artifacts.

To publish, bump the version and push the tag:

npm version patch        # updates package.json and creates tag vX.Y.Z
git push --follow-tags

.github/workflows/release.yml then runs the tests, builds the VSIX, creates a GitHub Release with it attached, and publishes it:

  • to the VS Code Marketplace if the VSCE_PAT repository secret is set (Azure DevOps PAT, scope Marketplace → Manage, all organizations);
  • to Open VSX (Cursor, Windsurf, VSCodium) if the OVSX_PAT secret is set.

Without those secrets the release still builds the VSIX and attaches it to the GitHub Release; nothing is published.

License

MIT © SidSoftStudio

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft