Skip to content

TUI: Support custom statusline command (like Claude Code's statusLine config) #46775

Closed as duplicate

Description

@dsriram3194

Feature Request

Is your feature request related to a problem? Please describe.

Claude Code supports a custom statusline via a statusLine.command setting in settings.json that pipes JSON session data (model, cost, context window usage, git info, transcript path) to a user-supplied shell script. This lets users render a rich two-line status bar showing:

  • Model name
  • Repo + branch + git status (ahead/behind, dirty flag)
  • Lines added/removed
  • Context window usage as a visual brick bar + percentage
  • Session duration
  • Session cost (computed from token usage at model-specific rates)

I recently migrated from Claude Code to OpenCode and this is the one feature I miss. OpenCode's built-in status bar shows the model name and token count, but it is not customizable — I cannot add git status, context bricks, cost, or duration.

Describe the solution you'd like

Add a statusline key to tui.json (or opencode.json) that accepts a command, similar to Claude Code's approach:

// tui.json
{
  "$schema": "https://opencode.ai/tui.json",
  "statusline": {
    "command": "~/.config/opencode/statusline.sh",
    "padding": 0
  }
}

The command would receive session data as JSON on stdin (model, token usage, cost, git info, working directory, session duration) and its stdout would be rendered as the status line at the bottom of the TUI.

Describe alternatives you've considered

  1. Plugin events — The plugin system has tui.toast.show and tui.prompt.append but no tui.statusline.render hook. A plugin event for statusline rendering could work, but a command-based approach (like Claude Code) is simpler for users who just want to port an existing shell script.

  2. Built-in enrichment — Expanding the built-in status bar to show git status and cost would help, but wouldn't allow user customization (e.g., custom colors, model-specific pricing overrides, context bricks).

Additional context

For reference, Claude Code's statusline spec: the command receives JSON on stdin with fields like model.display_name, model.id, cost.total_cost_usd, cost.total_duration_ms, context_window.context_window_size, context_window.current_usage.*, workspace.current_dir, and transcript_path. The script writes ANSI-colored text to stdout.

This is especially useful for users on custom model gateways (e.g., HelloFresh's AI Model Router) where the gateway sends zeroed cost/usage fields for non-Anthropic models — a custom script can fall back to reading the transcript JSONL to compute real token counts and cost at published rates.

Happy to help test or provide my existing 250-line statusline script as a reference implementation.

Activity

  1. github-actions commented on Sep 2, 2026

    @github-actions
    Contributor

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

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