Interactive Context Inspector, Request Preview, and Optimizer for Copilot Chat
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Summary
Copilot currently provides a context window indicator, but developers have very little visibility into **what context is actually included in a request** or **how the available context budget is allocated**.
I would like to propose an **Interactive Context Inspector** that allows developers to inspect, preview, and optimize the context before a request is sent.
The goal is to make context a transparent, inspectable, and manageable resource instead of a black box.
> This proposal is intentionally different from requests for additional context indicators or token counters. It focuses on giving developers visibility and control over the context that Copilot actually uses.
---
## Problem
In medium and large projects, Copilot may build a request using information from multiple sources, for example:
- Conversation history
- Current editor
- Selected code
- Attached files
- Workspace files
- Git changes
- MCP tools
- Terminal output
- Workspace instructions
- Other automatically collected context
When responses become less accurate or the context window fills up, developers currently have very little insight into questions such as:
- Which files are consuming the most context?
- Why was an important file omitted?
- Why was previous conversation summarized?
- Which MCP server or tool contributes the most?
- What can I safely remove without starting a new chat?
- What exactly is Copilot going to send to the model?
---
## Proposed Feature
Extend the existing Context Window with an interactive **Context Inspector**.
Example:
```text
Context Inspector
Conversation History 62K
Workspace Files 41K
Git Changes 27K
MCP Tools 22K
Terminal Output 11K
Instructions 8K
Pinned Context 7K
Other 4K
```
Each category could be expanded to inspect individual contributors.
Example:
```text
Workspace Files
✓ OrdersService.php 8K
✓ TripsService.php 6K
✓ CustomerPage.tsx 5K
✓ route.ts 4K
...
```
---
## Request Preview
One capability that would be especially valuable is the ability to preview the context before the request is sent.
Example:
```text
This request will include
✓ Current editor
✓ Selected code
✓ OrdersService.php
✓ Chat history (summarized)
✓ Workspace instructions
This request will NOT include
✗ package-lock.json
✗ Previous terminal output
✗ Generated files
✗ Previous Git diff
```
This would make Copilot much more transparent and easier to reason about.
---
## Context Optimizer
Provide a command such as:
```text
Chat: Optimize Context
```
Before sending a request, Copilot could analyze the current context and suggest optimizations.
Example:
```text
Estimated Recovery
48K Tokens
Suggestions
✓ Compress older conversation
(+18K)
✓ Remove stale terminal output
(+8K)
✓ Replace full files with symbol-level context
(+7K)
✓ Exclude generated files
(+9K)
✓ Exclude dependency lockfiles
(+6K)
```
The developer can choose which suggestions to apply.
---
## Pin Important Context
Allow developers to pin context that should never be removed automatically.
Example:
```text
Pinned Context
✓ Current editor
✓ Selected code
✓ Attached files
✓ API specification
✓ Workspace instructions
```
---
## Optional Workspace Rules
Allow repositories to define optional context exclusions.
Example:
```json
{
"chat.context.exclude": [
"**/package-lock.json",
"**/yarn.lock",
"**/dist/**",
"**/.next/**",
"**/generated/**"
]
}
```
---
## Benefits
- Better understanding of how Copilot builds requests.
- More predictable responses.
- Better support for long-running agent sessions.
- Better visibility into context contributors.
- Less need to restart chats because of context limitations.
- Better experience for large repositories and MCP-heavy workflows.
---
## Why this is different from the existing Context Window
The existing Context Window primarily answers:
> "How much context is being used?"
This proposal focuses on different questions:
- What exactly will be sent?
- Where is the context budget being spent?
- What can I optimize?
- What should always stay in context?
- What was excluded from this request?
The goal is to provide developers with transparency and control over Copilot's request composition, rather than only showing overall context usage.
Contributor guide
Assessment
This issue has not been assessed yet.