Skip to content

Feature request: Configurable auto-compaction threshold (parity with Claude Code) #3026

@dezgit2025

Description

@dezgit2025

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:

  1. A config.json setting:

    {
      "autoCompactThreshold": 0.6
    }
  2. An environment variable (matching Claude Code's pattern):

    export COPILOT_AUTOCOMPACT_PCT=60
  3. 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.json under env
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configurationConfig files, instruction files, settings, and environment variablesarea:context-memoryContext window, memory, compaction, checkpoints, and instruction loading
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions