Feature request: Configurable auto-compaction threshold (parity with Claude Code)
Summary
Claude Code supports a configurable auto-compaction threshold via the CLAUDE_AUTOCOMPACT_PCT_OVERRIDE environment variable. For example, setting it to 60 triggers automatic context compaction when the context window reaches 60% capacity. This lets power users control the trade-off between context retention and compaction frequency.
Copilot CLI currently has no equivalent. Compaction is only available as a manual /compact slash command, and auto-compaction (if it exists internally) has no user-facing threshold control.
Request
Add a configurable auto-compaction threshold — either as:
-
A
config.jsonsetting:{ "autoCompactThreshold": 0.6 } -
An environment variable (matching Claude Code's pattern):
export COPILOT_AUTOCOMPACT_PCT=60 -
Or both (env var overrides config, like Claude Code does).
Why this matters
- Long sessions with heavy tool use burn through the context window fast. By the time a user notices and runs
/compact, they may have already lost important early context to truncation. - Agentic workflows (fleet mode, sub-agents, multi-step plans) are especially vulnerable — they generate dense tool output that fills the window quickly.
- Power users want control. Some prefer aggressive compaction (20-40%) to keep sessions lean; others prefer late compaction (80%+) to maximize context retention. One size doesn't fit all.
Claude Code reference
Claude Code's implementation:
- Env var:
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60(triggers compaction at 60% context usage) - Set in:
~/.claude/settings.jsonunderenv - Behavior: When context crosses the threshold, Claude Code automatically summarizes the conversation history, preserving key decisions and state while freeing tokens.
This is a simple, high-impact feature that would bring Copilot CLI to parity on context management. Happy to discuss implementation details.
Environment
- Copilot CLI v1.0.34
- macOS (Darwin)
- Heavy daily usage with agentic workflows
This is now supported. You can override the auto-compaction threshold by setting the COPILOT_BACKGROUND_COMPACTION_THRESHOLD environment variable to a ratio between 0 and 1 (for example 0.6 for 60%); the default background auto-compaction trigger is about 80%. If you believe this isn't resolved, please comment with details and we'll take another look.