Skip to content

[Feature]: Make stale Claude resume-compaction token threshold configurable #19823

Closed as not planned

Description

@sergeivad

Problem

T3 Code offers Compact on a Claude thread after its prompt cache expires once the thread reaches 100,000 tokens. The chip defaults to compact-before-send, so pressing Enter after returning to an idle session first compacts the existing conversation and only then sends the typed message.

I often work with long-lived coding-agent threads, including models with a 1M-token context window. At 100K, there may still be plenty of useful context and headroom. I want to preserve architectural decisions and other details rather than accidentally replace the history with a summary.

The threshold is currently hardcoded:

// apps/web/src/components/chat/ContextWindowMeter.logic.ts
const CLAUDE_RESUME_COMPACTION_TOKENS = 100_000;

This is different from Claude's Settings → Providers → Claude → Auto-compact after. Setting that to, say, 300K or 500K does not change when the stale-thread Compact chip appears.

Proposal

Add a setting for the resume-compaction suggestion threshold, separate from the existing auto-compaction setting.

  • Suggested UI: Settings → Providers → Claude → Suggest compaction on resume after [token count].
  • Keep 100,000 as the default for backward compatibility.
  • Allow higher thresholds, e.g. 300,000 or 500,000, particularly for 1M-context models.
  • Ideally also allow Never, so users who prefer to manage compaction manually can disable the suggestion.
  • Only offer the stale-session Compact chip when both conditions are met: the prompt cache has expired and the configured token threshold has been reached.

This would preserve the existing cache-expiry behavior while letting users choose how early the suggestion becomes relevant.

Example

With a configured threshold of 300,000 tokens:

  1. Work in a Claude thread until it reaches 120K tokens.
  2. Leave it idle until the prompt cache expires.
  3. Return and send a prompt. No Compact chip should appear, and the prompt is sent with full history.
  4. Later, when the thread reaches 320K tokens and becomes stale again, the existing Compact suggestion can appear.

Why not just use "Auto-compact after"?

That setting controls when Claude compacts due to context usage. The stale-resume chip is a separate T3 Code decision based on a fixed 100K threshold and cache TTL. Users configuring one should not have to assume it controls the other.

Related discussions

The question of whether Compact should be on by default is already being discussed in Ideas #17170 and was raised in #17467 / #19182. A persistent Full by default preference would also help avoid accidental compaction, but this request is intentionally narrower: let users configure the 100K threshold independently.

Thanks!

Activity

  1. juliusmarminge commented on Oct 15, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    This is a feature request. Please continue it in Ideas — the closest open thread is #17170 (opt out of stale-Claude compact-before-send); #18659 already floated a configurable resume-compaction token threshold as an optional addition there.

  2. domvo commented on Oct 20, 2026

    @domvo

    I feel like this almost deserves a bug label rather than an enhancement label. I've already triggered numerous compactions unintentionally.

  3. PedroNavHur commented on Oct 31, 2026

    @PedroNavHur
    Contributor

    We'd like this setting too, from the other direction.

    Since the Compact chip and "Before the cache expires" idle compaction now share one fixed minimum (200,000 tokens, COMPACTION_SUGGESTION_MIN_TOKENS), a single per-instance setting next to Compact idle threads would serve both camps: people on 1M windows could raise it, and people who want idle compaction earlier could lower it to 100K, Claude Code's own floor for idleCompaction.

    We compact idle Claude threads at 100K with an external script on four machines, because the built-in mode won't go below 200K. Over the last 14 days it compacted 254 threads. 205 of them were between 100K and 200K, and 189 of those got another message afterward, so each would otherwise have paid a cold re-read of its whole context. With the minimum configurable we could drop the script and use the built-in mode.

    Would a PR adding this setting be welcome?


    Posted by Claude Code (claude-opus-5-5) via T3 Code triage.

  4. juliusmarminge commented on Nov 12, 2026

    @juliusmarminge
    Member

    Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.

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

    enhancementRequested improvement or new capability.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions