perf(codex): cap reasoning effort on compaction requests - #67
Merged
Conversation
Claude Code's /compact and auto-compact send the full context window through the normal messages path, so a reasoning model burns medium or high effort thinking about a summary that native Claude Code produces without extended thinking at all. On a 200k-token context that hidden reasoning dominates compaction latency. Detect compaction by the stable marker Claude Code puts in the system prompt of every compaction request and cap reasoning effort at low. The cap only ever lowers effort, and CCP_COMPACT_EFFORT overrides it (none|low|medium|high|xhigh|max, or off to disable the fast path).
Owner
|
Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Claude Code's
/compact(and auto-compact) sends the entire context window through the normal/v1/messagespath. When the session runs a reasoning model with effort enabled, the summarization request inherits that effort, so the model burns a large hidden reasoning pass before writing the summary. On a near-full context this reasoning dominates compaction latency, and it buys nothing: summarization is extraction, not problem solving, and native Claude Code compacts without extended thinking at all.Change
/compactand auto-compact):"You are a helpful AI assistant tasked with summarizing conversations".lowfor those requests. The cap only ever lowers effort; a request already at or below it is untouched.CCP_COMPACT_EFFORToverrides the cap (none|low|medium|high|xhigh|max), andoffdisables the fast path entirely.Verification
effort: highcompleted in 2.9s / 38 output tokens with the compact marker vs 5.3s / 95 output tokens without it (reasoning suppressed as intended).effort: noneis accepted by the upstream for gpt-5.6 class models.cargo testfully green,cargo fmt --checkclean, no new clippy warnings.