[FEATURE]: Native StatusLine Hook for Plugins (Context-Free Display) #8619
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Description
Feature Request: Native StatusLine Hook for Plugins
Problem
Plugins that want to display persistent contextual information (timestamps, git status, session metrics) must inject text into message parts. This causes all injected content to become part of the conversation context sent to the LLM.
For a statusline that displays on every message:
- ~30 tokens consumed per message
- 100-message session = ~3,000 tokens wasted on display-only content
- Reduces effective context window
Attempted Workarounds
We tried using the ignored: true flag on text parts:
| Approach | Result |
|---|---|
ignored: true without IDs |
Validation error (missing id, sessionID, messageID) |
ignored: true with proper IDs |
Part displays, but user's message text disappears |
The ignored flag hides content from both UI and context. There's no "display-only" option.
Proposed Solution
Add a statusLine hook for plugins, similar to Claude Code's implementation:
// Plugin hook
"tui.statusLine"?: (input: StatusLineInput) => Promise<{ text: string }>;Or a config-based approach:
{
"statusLine": {
"type": "command",
"command": "~/.config/opencode/statusline.sh"
}
}Input Data
Provide rich session context:
{
"session_id": "abc123",
"model": { "id": "claude-sonnet-4-20250514", "display_name": "Sonnet" },
"workspace": { "current_dir": "/path/to/project" },
"cost": { "total_cost_usd": 0.0234 },
"context_window": {
"context_window_size": 200000,
"current_usage": { "input_tokens": 8500, "output_tokens": 1200 }
}
}UI Placement
Persistent bar in the TUI (not part of conversation):
┌─────────────────────────────────────────────────┐
│ [conversation content] │
│ > prompt input │
├─────────────────────────────────────────────────┤
│ 🕐 23:28 │ ⎇ main │ Sonnet │ 45% │ $0.02 │
└─────────────────────────────────────────────────┘
Benefits
- Zero context cost - Display-only content doesn't consume tokens
- Rich session data - Plugins can show cost, context %, model info
- Parity with Claude Code - statusLine docs
Related Issues
- [Feature]: Display Project Name and Git Status in TUI #7927 - Display Project Name and Git Status in TUI (similar UI, but built-in not plugin-driven)
- Plugin API for custom sidebar panels #5971 - Plugin API for custom sidebar panels (related plugin API)
Reference
- Plugin demonstrating the limitation: opencode-breadcrumb
- Claude Code statusLine: https://docs.anthropic.com/en/docs/claude-code/statusline
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Jan 15, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
slkiser commentedon Jan 19, 2026
A current work around is using the Toasts.
TheHamkerCat commentedon Jan 31, 2026
@slkiser what did you mean by Toasts? can you point to some resource, i didn't find it in https://opencode.ai/config.json
slkiser commentedon Feb 4, 2026
@TheHamkerCat “Toasts” are a way to show UI-only text without adding it to the chat/context.
In a Opencode plugin, call the TUI toast api with something like:
You can trigger it on events (idle/tool-finish/compact) or a slash command.
It’s not persistent like a statusline, but it a good workaround.
I use it in Opencode Quota to show token usage and quota for different providers.
TheHamkerCat commentedon Feb 5, 2026
@slkiser Thanks, I think i can live with calling quota API every few minutes and showing a toast, for now
guyposka commentedon Feb 8, 2026
+1 from practical usage. I implemented a local plugin workaround and confirmed the gap is specifically a native, single-line status surface in TUI.
Current behavior/workarounds:
tui.showToastworks but always renders with padded multi-line toast UI (not a true statusline).Feature request (concrete API + UX):
tui.statusline.render-> returns a string (or segmented parts)message.updatedsession.statussession.updatedNice-to-have:
This would cover the exact use case that Claude Code's statusline solves, while staying context-free and plugin-driven.
dibstern-work commentedon Feb 16, 2026
#8619 (comment)
@Punchy25 I second this, and I'd add another nice-to-have: allow multi-line status bars
slkiser commentedon Feb 16, 2026
This is misleading, since you can inject messages WITHOUT adding context/token overhead, see the plugin opencode-quota.
In short you have to add two things when injecting into the session transcript :
client.session.prompt({ noReply: true, parts: [...] })so OpenCode shows it without triggering an LLM response.ignored: trueso they’re excluded from future prompt context (no token overhead).diegomarino commentedon Feb 16, 2026
I opened a PR for this: #13885
It implements a template-based status line system that resolves the core problem — zero-token display of session/project data in the TUI. Users define template strings in config, resolved server-side from built-in variables + shell commands + plugin-provided variables.
Out of PR scope:
The visual layout discussion that @Punchy25 and @davidsr2r raised — left/right alignment, multi-line bars, width-aware truncation, segmented rendering. The PR focuses on the data layer: what content is available and how to compose it into strings. The rendering is intentionally simple (single resolved string per target) so that layout decisions can be made separately without being coupled to the variable/template system.
This means a future layout PR could consume the same resolved templates and add segment splitting, alignment, or multi-line rendering on top — without changing the config schema or resolver.
FurryWolfX commentedon Mar 14, 2026
I would also like to display some custom status on the TUI, hoping to merge.
fix(refactor-docs): purge body-verbatim/executor-no-op stale claims; …
docs(refactor): multi-target marketplace design + per-cluster TODO ch…
Be honest about opencode: feature is upstream-pending, not just unshi…
Stop writing speculative opencode statusline keys
github-actions commentedon Jul 6, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
docs: SPEC-0075 terminal statusline (approved) + SPEC-0074 tombstone (#…