Skip to content

Context length issue / better context inspector #2841

Closed as duplicate
Closed as duplicate

Description

@geril07

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?

Activity

  1. github-actions commented on Sep 28, 2025

    @github-actions
    Contributor

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

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

  2. rekram1-node commented on Sep 28, 2025

    @rekram1-node
    Collaborator

    @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.

  3. geril07 commented on Sep 28, 2025

    @geril07
    ContributorAuthor

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions