Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>GitHub Copilot Chat Context ViewerNew to Visual Studio Code? Get it now.
GitHub Copilot Chat Context Viewer

GitHub Copilot Chat Context Viewer

Preview

Dhiwakar Kusuma

|
22 installs
| (0) | Free
See exactly what % and which lines of your code GitHub Copilot used as context for your last prompt — across all Copilot agents and models.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

GitHub Copilot Chat Context Viewer

See exactly what your last GitHub Copilot prompt actually sent to the model — the prompt, the files (and which lines), conversation history, system prompt, tools, token usage, and AI Credits — for both the VS Code GitHub Copilot Chat extension and the GitHub Copilot CLI.


⚠️ FOR EDUCATIONAL & REFERENCE PURPOSES ONLY

This extension is provided strictly for learning, transparency, and reference. It reads GitHub Copilot's local debug/session logs to reconstruct what was sent for your last prompt.

It is NOT an official GitHub or Microsoft product, is not affiliated with or endorsed by them, and relies on undocumented log formats that can change or break at any time.

Use it with appropriate precautions: the logs it reads can contain source code, file paths, prompts, and other potentially sensitive workspace data. Review your organization's policies before enabling debug logging or installing third‑party extensions. You are responsible for how you use it. Provided "AS IS", without warranty of any kind (see LICENSE).


Focus & scope

This beta focuses primarily on the in‑IDE GitHub Copilot Chat experience in VS Code. That's where it's most complete: full per‑file line percentages, tool calls/probes, the token dashboard, and the diff/highlight view.

Support for the GitHub Copilot CLI is included as an early addition (prompts, system prompt, conversation, and exact token/AI‑Credit totals), but it does not yet show file‑level percentages.

More improvements are on the way — deeper CLI parity (file/tool‑level context), richer breakdowns, and broader coverage as the underlying log formats allow. Feedback and issues are welcome.

What it shows

  • Prompt — the exact text of the prompt, shown prominently at the top.
  • Last prompt ⇄ Whole session toggle — switch the summary between just the last prompt (default) and the whole session. In Whole session mode the numbers match Copilot's own "Agent Debug" session summary.
  • AI Credits (AIC) — credits consumed, read from copilotUsage in the log, alongside the model and mode.
  • Summary grid (mirrors Agent Debug): Model Turns, Tool Calls, Input Tokens, Output Tokens, Cached Input, Total Tokens, Errors — plus Code Shared for the last prompt. A single prompt usually spans several model requests; these are summed across the turn (or the session).
  • Context‑window usage bar — based on the largest single request (the window is per‑request).
  • Code files shared — a tree of files with a horizontal bar and the exact % of each file's lines that were sent, plus shared/total line counts. Click a file to open it with the shared lines highlighted, or open a side‑by‑side diff.
  • Tokens by source — an estimated split across system prompt, tools, history, file context, tool results, and the prompt.
  • Tool calls / probes — every command the model issued (e.g. read_file, grep_search, session_store_sql) with the command and result shown as separate, readable fields.
  • Other context — conversation history, custom instructions, system prompt, workspace/environment info.

Supported sources

Source How it's read Notes
VS Code GitHub Copilot Chat workspaceStorage/.../GitHub.copilot-chat/debug-logs/<session>/main.jsonl (+ system_prompt/tools files) Full context incl. per‑file line %; tokens/credits exact, per‑source split estimated.
GitHub Copilot CLI ~/.copilot/session-state/<session>/events.jsonl Exact token categories (input/cache/output) and AI Credits; file‑level % not available (the CLI doesn't log it here).

The view automatically follows whichever surface you used most recently.

Install

Option 1 — From the VS Code Marketplace (recommended)

  1. Open the Extensions view: ⇧⌘X (macOS) / Ctrl+Shift+X (Windows/Linux).
  2. Search for GitHub Copilot Chat Context Viewer.
  3. Click Install.

This is a pre‑release (beta) build. If you don't see it, click the ▾ arrow next to the Install button (or the extension's ⚙️ gear) and choose Install Pre‑Release Version.

Option 2 — From a .vsix file (manual)

Use this if you have the .vsix file directly (e.g. a beta build shared with you).

In VS Code:

  1. Open the Extensions view (⇧⌘X / Ctrl+Shift+X).
  2. Click the ⋯ (Views and More Actions) button at the top of the Extensions panel.
  3. Choose Install from VSIX… and select the github-copilot-chat-context-viewer-*.vsix file.

Or from a terminal (use your actual file name):

code --install-extension github-copilot-chat-context-viewer-<version>.vsix

After installing, reload if prompted — or run Developer: Reload Window from the Command Palette (⇧⌘P / Ctrl+Shift+P).

Upgrading from an earlier build? Make sure only one copy is installed — uninstall any older version first, then reload.

One‑time setup (required for VS Code Copilot Chat)

GitHub Copilot only writes the detailed context to disk when its debug logging is enabled:

  1. Install GitHub Copilot + GitHub Copilot Chat and sign in.
  2. Open the Copilot Context icon in the Activity Bar → click "Enable Copilot Debug Logging" (or run the command of the same name). This sets github.copilot.chat.agentDebugLog.fileLogging.enabled to true.
  3. Run Developer: Reload Window.
  4. Send any Copilot prompt. The view refreshes automatically.

Not ready to wire up logs? Run "Copilot Context: Toggle Demo Mode" to explore the UI with a built‑in sample. (The Copilot CLI logs by default — no setup needed for CLI sessions.)

Usage

  • Open the Copilot Context view from the Activity Bar.
  • Use the Last prompt / Whole session toggle at the top to switch the summary scope.
  • Click a file under "Code files shared" to open it with the shared lines highlighted; click the diff action on a row for a side‑by‑side view.
  • Expand a tool call to see the exact command and its result.
  • The toolbar refresh button re‑reads the latest log.

Commands

Command Description
Copilot Context: Refresh Last Prompt Re‑read the log and rebuild the view
Copilot Context: Enable Copilot Debug Logging Turn on debug logging + guide you to set log level
Copilot Context: Highlight Shared Lines For File Pick a file and highlight its shared lines
Copilot Context: Open Shared Context As Diff Pick a file and open the full‑file ↔ shared‑context diff
Copilot Context: Open Detected Log File Open the log file currently being parsed
Copilot Context: Toggle Demo Mode Switch between the sample and real logs

Settings

Setting Default Description
copilotContextViewer.autoRefresh true Poll the log and refresh when a new prompt is detected
copilotContextViewer.autoRefreshIntervalMs 2500 Polling interval (ms)
copilotContextViewer.demoMode false Show the built‑in sample instead of real logs
copilotContextViewer.logPathOverride "" Point at a specific log file or folder
copilotContextViewer.highlightColor rgba(64,200,120,0.18) Color used to highlight shared lines

What's exact vs estimated

  • Exact (read directly from the log): prompt text, model, mode, prompt/cached/output tokens, total tokens, model turns, tool calls, errors, context window, AI Credits, the per‑file line ranges and percentages, and every tool command/result. Multi‑request prompts are summed across the turn (or session).
  • Estimated (clearly labeled in the UI): the "Tokens by source" split. The logs record only the total prompt tokens, not a per‑source breakdown, so each source is approximated at ~4 chars/token and the gap to the exact total is shown as "Tool definitions + overhead". This is an approximation, not ground truth.

Privacy & security

  • Everything stays on your machine. The extension reads local files only and renders them in a local webview. It makes no network requests, sends no telemetry, and uses no eval/shell execution.
  • The logs it reads can contain sensitive content (source code, file paths, prompts). Treat the view — and any screenshots of it — accordingly.
  • The webview escapes log content and runs under a strict Content‑Security‑Policy (scripts limited to a nonce; no remote code).

How it works

There is no public VS Code API that exposes what Copilot sent to the model. However, Copilot Chat and the Copilot CLI write the assembled request to local debug/session logs. This extension locates the most recent session, parses it, maps file context back onto your workspace files to compute percentages, and presents the result. Formats are undocumented and version‑dependent, so the parser is tolerant and degrades gracefully.

Limitations

  • Relies on Copilot's debug logs; fields vary by version. If a format differs, the view shows what it can and notes the rest.
  • Some agent modes gather context via tools/memory rather than reading files — in those cases "0 files" is correct, and the context is shown under tool results / history.
  • Whole‑file attachments are reported against the file's current line count; edits after the prompt can shift counts.
  • For the CLI, usage is logged cumulatively per session, so its totals reflect the whole session rather than a single prompt.

Build from source

npm install
npm run compile      # or: npm run watch
npm test             # runs the parser regression tests
# press F5 in VS Code to launch an Extension Development Host

Package a .vsix:

npm install -g @vscode/vsce
vsce package --pre-release

Release notes

See CHANGELOG.md for the full history. Recent highlights:

  • 0.15.x — Last prompt ⇄ Whole session toggle (prominent, at the top); full Agent‑Debug summary grid (Model Turns, Tool Calls, Input/Output/Cached/Total tokens, Errors); demo mode shows the toggle.
  • 0.14.0 — Token totals now summed across all model requests in a prompt (was reading only the last request); window bar uses the peak request.
  • 0.13.0 — First public beta: dashboard, AI Credits, code‑files tree with line percentages, tokens‑by‑source, tool calls/probes, GitHub Copilot CLI support.

License

MIT. Provided for educational and reference purposes only, "AS IS", without warranty of any kind.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft