GitHub Copilot Chat Context ViewerSee 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.
Focus & scopeThis 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
Supported sources
The view automatically follows whichever surface you used most recently. InstallOption 1 — From the VS Code Marketplace (recommended)
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
|
| 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.