opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open skerit opened this issue 2 days ago • 2 comments

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?

skerit avatar Jan 13 '26 10:01 skerit