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

|
3 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

Copilot 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 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 the extension is most complete: full per‑file line percentages, tool calls/probes, 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

  • A dashboard for the last prompt: the prompt text, AI Credits consumed, prompt / cached / output tokens, context‑window usage, and number of code files shared.
  • 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 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 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

From a .vsix file (current / beta)

  1. Download copilot-context-viewer-<version>.vsix.
  2. In VS Code: open the Extensions view → click the … menu (top‑right) → Install from VSIX… → select the file.
    • Or from a terminal: code --install-extension copilot-context-viewer-<version>.vsix
  3. Run Developer: Reload Window (Command Palette, ⇧⌘P / Ctrl+Shift+P).

From the Marketplace (once published)

Search "Copilot Context Viewer" in the Extensions view and click Install. Because this is a pre‑release, enable "Install Pre‑Release Versions" from the extension's gear menu if you want beta builds.

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.
  • 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.
  • 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, context window, AI Credits, the per‑file line ranges and percentages, and every tool command/result.
  • 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.

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            # or: vsce package --pre-release

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.

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