anomalyco / anomalyco/opencode
TUI: expose per-turn working/idle state in the terminal title (OSC 0/2) so terminal multiplexers and tabs can show a status dot
@simonklee is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
The opencode TUI writes the terminal title exactly twice per session: OpenCode at startup and OC | <session title> once the session is named. It never repaints the title per turn, so a terminal tab / multiplexer / external observer cannot tell whether the agent is currently working or waiting for the user.
Why it matters
Tools that drive opencode in a pty (terminal multiplexers, orchestration daemons that show live session status, browser-based terminal tabs) already read OSC 0/2 title sequences as a zero-config status channel. Claude Code, for comparison, repaints its title with a spinner glyph while working and an idle glyph when it is the user's turn — which makes a terminal tab's status dot trivially derivable from the pty stream, with no API polling and no extra protocol.
For opencode today the honest answer is "unknown": opencode session list carries no live turn state, and the TUI emits no state-bearing title or private OSC.
Proposal
One (or both) of:
- Repaint the OSC 0/2 title with a turn-state glyph while a turn is running (e.g. a spinner phase while the model is working, a distinct glyph when the turn ends and it is the user's turn). A ~1s repaint cadence is plenty; the point is a derivable signal, not animation quality.
- Emit a private OSC sequence carrying the turn state (e.g.
OSC 777 ; opencode ; <state>withworking|idle), which external observers can subscribe to without it affecting the visible tab title.
Either keeps the integration surface to "read the pty output" — no sockets, no polling, nothing that breaks under --auto headless use.
Environment
Verified against opencode 1.18.18 (TUI under a real pty): titles observed at startup and once per session, never per turn.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.