Skip to content

Feature: configurable auto-compaction threshold (token window / percentage), like Claude Code's autoCompactWindow #1159

Open

Description

@TIANCHEDN

Problem

Auto-compaction thresholds are hard-coded as percentages of the model's context window, with no way to set a fixed token budget:

Trigger Fires at Configurable?
Tier 1 tool-call trim 50% of window only via compact-mode=fast
Tier 2 tool-call trim 80% of window only via compact-mode=fast
Tier 3 summarization 90% of window no

Only compact-mode (default / fast) exists in the config registry (cmd config list). There is no token-window or percentage override setting, and no documented env var for it.

Concrete consequence: on a 1M-context model such as deepseek/deepseek-v4.1-flash-fast, summarization does not fire until ~900K tokens. Users who want to compact at e.g. 500K (for response quality and predictable per-turn cost) have to run /compact by hand every time.

Comparison

Claude Code exposes this as a first-class setting:

  • autoCompactWindow — a token window from 100000 to 1000000
  • CLAUDE_AUTOCOMPACT_PCT_OVERRIDE — percentage override 1–100 (can only lower the default threshold)
  • an on/off toggle

Proposal

Expose an absolute threshold, either of these (both would be ideal):

  • compact-window — token budget (e.g. 100000–1000000); summarization fires at 90% of it, consistent with current tier math
  • compact-threshold — percentage of the model window (1–100), read live like compact-mode

Requirements:

  • settable via cmd config set and settings.json, user scope
  • values clamp to the active model's window; a model switch recalibrates as it does today
  • applies from the next compaction check (same live-reload semantics as compact-mode)

Environment

  • Command Code v1.91.0
  • Ubuntu 24.04 (headless, SSH + tmux)
  • Model in use: deepseek/deepseek-v4.1-flash-fast (1M context)

References

Activity

  1. vipulgupta2048 commented on Nov 18, 2026

    @vipulgupta2048
    Member

    Thanks for opening the feature request, already have a PR for this @TIANCHEDN Should be getting live soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions