Context length issue / better context inspector #1867

Closed
opened 2026-02-16 17:33:01 -05:00 by yindo · 3 comments
Owner

Originally created by @geril07 on GitHub (Sep 28, 2025).

There is an example of pretty simple session.json
There is a 1 call saying hello to the agent inside the opencode sources. And even with that, the context length is already 10k.
If I dump the entire session.json file into the OpenRouter chat, context length will be 5k, half of it.

Are there any hidden data sent to the provider/model which is not tracked inside session file?

Originally created by @geril07 on GitHub (Sep 28, 2025). There is an example of pretty simple [session.json](https://github.com/user-attachments/files/22582513/session.json) There is a 1 call saying hello to the agent inside the `opencode` sources. And even with that, the context length is already 10k. If I dump the entire `session.json` file into the OpenRouter chat, context length will be 5k, half of it. Are there any hidden data sent to the provider/model which is not tracked inside session file?
yindo closed this issue 2026-02-16 17:33:01 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 28, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2666: [Question] detailed per-interaction telemetry (token counts and input composition) for opencode-model communications - discusses detailed token tracking and visibility into what's sent to the model
  • #2637: [Feature Request] Configuration to Limit Input Tokens per Request - specifically addresses context length management and control over token consumption

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 28, 2025): This issue might be a duplicate of existing issues. Please check: - #2666: [Question] detailed per-interaction telemetry (token counts and input composition) for opencode-model communications - discusses detailed token tracking and visibility into what's sent to the model - #2637: [Feature Request] Configuration to Limit Input Tokens per Request - specifically addresses context length management and control over token consumption Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Sep 28, 2025):

@geril07 what is likely causing extra context that isn't necessarily in the session.json is the tool definitions (along with mcp server tools if you have any).

opencode ships with a variety of tools by default, each one has a JSON input schema, a name, a description, and then often a description for the different fields that can be passed to it.

Due to that these do require additional tokens / cost and wouldn't be present when interacting just directly with llm without any tools. So that probably explains the context difference.

@rekram1-node commented on GitHub (Sep 28, 2025): @geril07 what is likely causing extra context that isn't necessarily in the session.json is the tool definitions (along with mcp server tools if you have any). opencode ships with a variety of tools by default, each one has a JSON input schema, a name, a description, and then often a description for the different fields that can be passed to it. Due to that these do require additional tokens / cost and wouldn't be present when interacting just directly with llm without any tools. So that probably explains the context difference.
Author
Owner

@geril07 commented on GitHub (Sep 28, 2025):

Yeah, that's logical. It would be nice to have an option to inspect the entire context, which was requested in #2666.
Closing as a duplicate then, thanks.

@geril07 commented on GitHub (Sep 28, 2025): Yeah, that's logical. It would be nice to have an option to inspect the entire context, which was requested in #2666. Closing as a duplicate then, thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1867