← Back to PRs

#13512: feat(context-pruning): add stripThinking option to strip thinking blocks from older messages

by 1kuna open 2026-02-10 16:34 View on GitHub →
agents stale
Problem: reasoning models with extended thinking keep large thinking blocks in history, and cache-ttl pruning never removes them, so old thinking consumes context. Add contextPruning.stripThinking to remove thinking blocks outside keepLastAssistants during pruning. It leaves a blank text block if stripping empties the assistant content and preserves the recent tail. Default is false and tests cover stripThinking on and off plus tail preservation. Testing: existing + new tests pass; verified with Claude Opus 4.6 and thinkingDefault: high. References #13519

Most Similar PRs