Skip to content

[FEATURE]: Adding a session stat command to allow programmatic access to context size and other info for a specific session #19045

Closed as not planned

Description

@calvine

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem: there is no easy way to get the context size of a specific session for monitoring or scripting.

Solution: Add a command onto the session command called stat that accepts a session id and returns info about the session to include the context size of the session at that time and other details. Also allow json formatting of the output via the format flag --format json.

FYI I think this is a unique request from my search of existing issues, but it is similar to this issue

I think this would make creating various harnesses for automated workflow that leverage opencode much easier. I have a working implementation locally. I will attache a screenshot of the output. I am open to changing any of the details (command name, data in the output, etc) just let me know.

Image

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Mar 25, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 25, 2026
  3. github-actions commented on Mar 25, 2026

    @github-actions
    Contributor

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

    Your request has a distinct angle — a CLI session stat subcommand for programmatic/scripting access with JSON output — which may be sufficiently different to stand on its own. But it's worth reviewing those issues to avoid duplicate effort or to potentially combine approaches.

  4. calvine commented on Mar 25, 2026

    @calvine
    Author

    I believe this feature is different from the ones mentioned here. I am looking for a way to get the context size and other details from the cli for ease of scripting, the issues mentioned above all reference showing data in the TUI

  5. assigned and unassigned on Apr 26, 2026
  6. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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