Feature Request: Export /compact session summary to a physical workspace file for deterministic context curation
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Description
The current implementation of the `/compact` command in GitHub Copilot Chat successfully reduces context bloat, but it operates entirely as an opaque, internal process. The user has no visibility into what information is retained or discarded during the compaction phase.
Given the 5-to-10-minute cache expiration (see #321551 ) currently enforcing 100% cache-miss penalties on idle sessions, relying on internal, non-deterministic context management is highly inefficient. This forces users to start a new chat unnecessarily if they want to clean the entire context.
### Problem Statement
1. **Opaque Context:** When a session is compacted, the resulting summary remains in the internal context window. Developers cannot verify if critical constraints, architectural decisions, or bugs identified earlier in the session were accurately preserved.
2. **Token Inefficiency:** When the cache drops after an idle period (e.g., while reading documentation or running tests), resuming the session requires re-sending a large, unverified context payload.
3. **No Resumability:** No clean way to pause or handoff a complex debugging session at the end of the day and bootstrap a fresh agent the next morning without carrying over hidden bloat without opening a new chat.
### Proposed Solution
Provide an explicit context compaction command (e.g., `/compact-to-file` or `/export`) that writes the LLM's summarized session state into a reachable file within the workspace (e.g., `summary.md`).
**Expected Workflow:**
1. User invokes `/compact-to-file`.
2. Copilot summarizes the current conversational state and architectural context.
3. The output is written to a designated markdown file in the workspace.
4. The user can manually review, curate, prune, and verify the generated file.
5. The user clears the current chat session and starts a clean session, explicitly referencing only the curated `copilot-summary.md` file as the baseline context.
### Impact and Benefits
* **Deterministic Control:** Allows to enforce accuracy and remove irrelevant items before feeding the context back to the agent.
* **Token Penalty Reduction:** Drastically shrinks the payload size required to warm up a cold cache, saving time and background computation costs. This also avoids polluting chat history by avoiding opening a new chat just to "clear" the context fully.
* **Session Portability:** Enables persisting an agent's "mental state" across branch switches, IDE reloads, or overnight breaks.
Contributor guide
Assessment
This issue has not been assessed yet.