claude-code - 💡(How to fix) Fix [Feature Request] Configurable auto-compact threshold for earlier context management [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54289Fetched 2026-04-29 06:31:20
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

[{"error":"Error: Tool mcp__sequential-thinking__sequentialthinking not found\n at xP7 (/$bunfs/root/src/entrypoints/cli.js:3113:36240)\n at tA (/$bunfs/root/src/entrypoints/cli.js:497:21131)\n at Mz (/$bunfs/root/src/entrypoints/cli.js:497:39898)\n at F4 (/$bunfs/root/src/entrypoints/cli.js:497:50707)\n at c7H (/$bunfs/root/src/entrypoints/cli.js:497:87769)\n at UJ6 (/$bunfs/root/src/entrypoints/cli.js:497:86724)\n at d7H (/$bunfs/root/src/entrypoints/cli.js:497:86544)\n at fkH (/$bunfs/root/src/entrypoints/cli.js:497:82869)\n at oH (/$bunfs/root/src/entrypoints/cli.js:497:6549)\n at kH (/$bunfs/root/src/entrypoints/cli.js:497:5003…

Root Cause

Bug Description Feature request: configurable auto-compact threshold

Today, auto-compaction only fires near the hard context limit. By that point a lot of useful state has already
been pushed past the cache window, and the compact summary is forced to lose detail because there's just too
much to summarize at once.

Please add:

  1. A user-configurable threshold (e.g. settings.json key
    autoCompactThreshold: 0.4) that triggers compaction when context
    usage exceeds that fraction of the model's window. Same compaction
    behavior, just earlier.

  2. OR: extend the existing PreCompact hook (or add a new
    ContextUsageThreshold hook) that fires with the current usage % so
    users can implement custom-threshold compaction via shell hooks.

Why: I want to compact at ~40% so the model isn't reasoning through a
half-full conversation when it picks up subtle cues. Manual /compact
works but I forget at exactly the moments where remembering matters.

Either path solves it.

Code Example

[{"error":"Error: Tool mcp__sequential-thinking__sequentialthinking not found\n    at xP7 (/$bunfs/root/src/entrypoints/cli.js:3113:36240)\n    at tA (/$bunfs/root/src/entrypoints/cli.js:497:21131)\n    at Mz (/$bunfs/root/src/entrypoints/cli.js:497:39898)\n    at F4 (/$bunfs/root/src/entrypoints/cli.js:497:50707)\n    at c7H (/$bunfs/root/src/entrypoints/cli.js:497:87769)\n    at UJ6 (/$bunfs/root/src/entrypoints/cli.js:497:86724)\n    at d7H (/$bunfs/root/src/entrypoints/cli.js:497:86544)\n    at fkH (/$bunfs/root/src/entrypoints/cli.js:497:82869)\n    at oH (/$bunfs/root/src/entrypoints/cli.js:497:6549)\n    at kH (/$bunfs/root/src/entrypoints/cli.js:497:5003
RAW_BUFFERClick to expand / collapse

Bug Description Feature request: configurable auto-compact threshold

Today, auto-compaction only fires near the hard context limit. By that point a lot of useful state has already
been pushed past the cache window, and the compact summary is forced to lose detail because there's just too
much to summarize at once.

Please add:

  1. A user-configurable threshold (e.g. settings.json key
    autoCompactThreshold: 0.4) that triggers compaction when context
    usage exceeds that fraction of the model's window. Same compaction
    behavior, just earlier.

  2. OR: extend the existing PreCompact hook (or add a new
    ContextUsageThreshold hook) that fires with the current usage % so
    users can implement custom-threshold compaction via shell hooks.

Why: I want to compact at ~40% so the model isn't reasoning through a
half-full conversation when it picks up subtle cues. Manual /compact
works but I forget at exactly the moments where remembering matters.

Either path solves it.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.121
  • Feedback ID: 859f26db-5b55-416f-acff-4479308c0f1a

Errors

[{"error":"Error: Tool mcp__sequential-thinking__sequentialthinking not found\n    at xP7 (/$bunfs/root/src/entrypoints/cli.js:3113:36240)\n    at tA (/$bunfs/root/src/entrypoints/cli.js:497:21131)\n    at Mz (/$bunfs/root/src/entrypoints/cli.js:497:39898)\n    at F4 (/$bunfs/root/src/entrypoints/cli.js:497:50707)\n    at c7H (/$bunfs/root/src/entrypoints/cli.js:497:87769)\n    at UJ6 (/$bunfs/root/src/entrypoints/cli.js:497:86724)\n    at d7H (/$bunfs/root/src/entrypoints/cli.js:497:86544)\n    at fkH (/$bunfs/root/src/entrypoints/cli.js:497:82869)\n    at oH (/$bunfs/root/src/entrypoints/cli.js:497:6549)\n    at kH (/$bunfs/root/src/entrypoints/cli.js:497:5003

Note: Content was truncated.

extent analysis

TL;DR

Implement a user-configurable threshold for auto-compaction to trigger at a specified fraction of the model's window.

Guidance

  • Review the existing settings.json file to determine if a similar configuration option already exists.
  • Consider extending the PreCompact hook or creating a new ContextUsageThreshold hook to allow for custom threshold implementation.
  • Investigate the cli.js file (specifically line 3113) to understand how the autoCompactThreshold could be integrated into the existing compaction logic.
  • Evaluate the feasibility of implementing a temporary workaround using shell hooks to achieve the desired compaction behavior.

Example

No code example can be provided due to the lack of specific implementation details in the issue.

Notes

The provided error message seems unrelated to the requested feature, and the content was truncated, which may limit the ability to provide a comprehensive solution.

Recommendation

Apply workaround: Implement a custom solution using shell hooks to achieve the desired auto-compaction threshold, as the requested feature is not currently available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Feature Request] Configurable auto-compact threshold for earlier context management [1 comments, 2 participants]