Does OpenCode send back all previous reasoning blocks to Claude (or any provider)? #5266

Open
opened 2026-02-16 17:50:42 -05:00 by yindo · 0 comments
Owner

Originally created by @skerit on GitHub (Jan 13, 2026).

Originally assigned to: @thdxr on GitHub.

Question

So I was under the impression that thinking blocks were ephemeral. That older thinking blocks are not used to generate a new response.

But I don't see any sort of "pruning" happening in the OpenCode code, so it seems as if the entire conversation with all the reasoning blocks gets sent back all the time?

Here's where the conversation gets made, right?
https://github.com/anomalyco/opencode/blob/ddd9c71cca1f30a8214174fc10975e2ff3bb4635/packages/opencode/src/session/prompt.ts#L591-L610

And here is the explicit line in MessageV2.toModelMessage that includes reasoning blocks:
https://github.com/anomalyco/opencode/blob/ddd9c71cca1f30a8214174fc10975e2ff3bb4635/packages/opencode/src/session/message-v2.ts#L537-L544

Is this how it is supposed to work?

Or do providers like Anthropic filter these out on their end?

Originally created by @skerit on GitHub (Jan 13, 2026). Originally assigned to: @thdxr on GitHub. ### Question So I was under the impression that _thinking_ blocks were ephemeral. That older thinking blocks are not used to generate a new response. But I don't see any sort of "pruning" happening in the OpenCode code, so it seems as if the entire conversation with all the reasoning blocks gets sent back all the time? Here's where the conversation gets made, right? https://github.com/anomalyco/opencode/blob/ddd9c71cca1f30a8214174fc10975e2ff3bb4635/packages/opencode/src/session/prompt.ts#L591-L610 And here is the explicit line in `MessageV2.toModelMessage` that includes reasoning blocks: https://github.com/anomalyco/opencode/blob/ddd9c71cca1f30a8214174fc10975e2ff3bb4635/packages/opencode/src/session/message-v2.ts#L537-L544 Is this how it is supposed to work? Or do providers like Anthropic filter these out on their end?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5266