Skip to content
    ↑↓ select↵ openesc close
    SolitudeRA

    Tui Context

    opencode-tui-context·v1.0.1·Memory & Context

    OpenCode TUI plugin that renders session context-window usage as a segmented bar in the sidebar

    GitHub stars

    0

    Monthly installs

    170

    10 in 7 days

    Composite score

    33.4

    Multi-signal model

    Last commit

    12 days ago

    2026-09-22

    Install and configure

    opencode.json

    Writes to this project's opencode.json — applies to this repository only.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-tui-context@1.0.1"]
    }

    OpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.

    See context usage and token composition at a glance in the OpenCode sidebar.

    License: MIT OpenCode: >=1.18.0

    English · 简体中文 · 日本語

    Illustrative context panel with window usage above and token composition below.

    Illustration with sample data; actual colors follow your OpenCode theme, except for the yellow output segment.

    • Two views: context-window capacity and a breakdown of reported tokens.
    • Fits your sidebar: bars and legends adapt to the available width.
    • No extra model calls: reads existing usage data without a tokenizer or credentials.

    Quick start

    Requires OpenCode >=1.18.0. Installation and activation have been verified on Windows with OpenCode 1.18.31.

    opencode plugin -g opencode-tui-context
    

    OpenCode downloads the prebuilt plugin and adds it to the global tui.json; no local build is needed.

    Restart OpenCode, open a session, and show the sidebar. The Context panel displays usage after an assistant response reports positive output tokens. Until then, it shows no assistant turns yet.

    • For a project-only installation, omit -g.
    • For ZIP/source installation or migration from a local copy, see the user guide.
    • Seeing two Context panels? Follow the built-in panel instructions.

    Reading the panel

    • Top bar: used, reserved, and free context-window space. Reserved space is a display estimate based on the model's output limit; it does not reserve tokens in OpenCode.
    • Bottom bar: the used tokens split into cache, prompt, reasoning, and output. It shows composition, so it can be full while the top bar still has free space.
    Bar Legend Segment Meaning
    Overview u used Total used tokens
    Overview r reserved Remaining output reservation (estimated)
    Overview f free Space remaining after usage and reservation
    Composition c cached Cache-read tokens
    Composition p prompt Input + cache-write tokens
    Composition t think Reasoning tokens
    Composition o out Output tokens

    The panel reflects the latest assistant message reporting positive output tokens. It is not cumulative session usage or an exact count of the next prompt.

    See the user guide for segment meanings and calculation details.

    Optional configuration

    The defaults work without additional configuration. To hide the legends, edit the existing plugin entry in tui.json (not opencode.json):

    {
      "plugin": [
        ["opencode-tui-context", { "showLegend": false }]
      ]
    }
    

    Keep your other settings and plugins. Preserve an existing @version suffix if you want to stay on that version; edit the entry rather than adding a second copy.

    Option Default Purpose
    showLegend true Show token legends when space permits.
    exclude [] Hide selected segments and their legends.
    barWidth 24 Initial outer panel width; measured sidebar width takes over. Not a fixed bar width.

    Restart OpenCode after changes. The full configuration reference lists supported segments and option behavior.

    Documentation and support

    • User guide: other installation methods, configuration, calculations, troubleshooting, updates, and removal.
    • Contributing: development setup, checks, and source layout.
    • Release guide: packaging and publishing for maintainers.
    • Report an issue: include your OpenCode version, OS, and steps to reproduce.

    License

    MIT © opencode-tui-context contributors.

    Similar plugins