Reasoning Trace Carry-Forward
For reasoning models, keep the chain-of-thought trace in context within a tool-use episode — but drop it at user-turn boundaries to prevent stale reasoning from accumulating.
reasoning_content in context so the model can reason continuously across tool calls; at the next user turn boundary, drop it and start fresh.Intent & Description
🎯 Intent
For reasoning models that emit a separate reasoning trace, preserve it in context across the same logical task episode (across tool-call/result turns) — but drop it at user-turn boundaries.
📋 Context
You’re using a reasoning-capable model (OpenAI o-series, Claude with extended thinking, DeepSeek-R1) that returns chain-of-thought in a separate reasoning_content field. The agent runs in a tool-use loop: model reasons → calls tool → sees result → reasons again → answers → new user message. Naive approaches either drop all CoT (losing continuity mid-episode) or carry it forward forever (accumulating stale reasoning across unrelated turns).
💡 Solution
Define an episode as: from one user turn to the next user turn, inclusive of all intervening tool calls and tool results. Within an episode, preserve reasoning_content in context concatenation across all turns. At the next user turn boundary, drop reasoning_content from prior episodes. The user-visible content remains in history; only the reasoning trace is episode-scoped.
Real-world Use Case
- The model is a reasoning model that emits a separate reasoning trace (reasoning_content).
- Within an episode (one user turn through all tool calls and results), reasoning context must persist for CoT continuity.
- Reasoning traces should be dropped at user-turn boundaries to avoid stale carryover.
Source
📌 TL;DR
Keep reasoning traces alive within a tool-use episode, drop them at user-turn boundaries — CoT continuity where it matters, no stale reasoning accumulating across unrelated turns.
Advantages
- Tool-using episodes get the full benefit of CoT continuity across multiple tool calls.
- Multi-turn dialogues don’t accumulate stale reasoning from unrelated prior episodes.
- Cheaper than naive forever-preservation of all reasoning traces.
Disadvantages
- Episode boundary detection must be encoded in the agent loop, not the model — it’s your responsibility.
- If the model expects its own past reasoning at a later turn, dropping it breaks that assumption.
- Provider-specific — DeepSeek-style
reasoning_contentneeds adaptation per API.