tmux-agents-status-opencodeOpenCode lifecycle adapter for tmux-agents-status
0
138
近 7 天 5
33.2
生态多维模型
4 天前
2026-08-16
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["tmux-agents-status-opencode@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["tmux-agents-status-opencode@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D tmux-agents-status-opencodeopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Show coding-agent activity in the tmux status bar, including active turns and unread results in other panes, windows or sessions.
•working?waiting for input✓finished!failed or cancelled- Unread results stay highlighted until you visit their pane

You can also customize the displayed glyphs. No background daemon is required. Agent adapters report lifecycle events to the tmux plugin only when state changes.
Requirements
- tmux 3.1 or newer on Linux or macOS
- At least one supported agent, running directly inside a tmux pane:
- Pi 0.81.1+
- OpenCode 1.15.11+
- Claude Code 2.1.79+
- Codex 0.145.0+
Install
Install the tmux plugin and the adapter for each agent you use.
1. Configure tmux
Install with TPM
Add this before TPM's run line in ~/.tmux.conf:
set -g @plugin 'hiback/tmux-agents-status'
Reload tmux, then press prefix + I.
Install without TPM
git clone https://github.com/hiback/tmux-agents-status.git "$HOME/.tmux/plugins/tmux-agents-status"
Add this to ~/.tmux.conf:
run-shell ~/.tmux/plugins/tmux-agents-status/tmux-agents-status.tmux
Add the status fragments
Loading the plugin does not change your status bar. Keep your existing formats and add these fragments once:
- Insert
#{E:@tmux-agents-status-window}where you want agent glyphs in bothwindow-status-formatandwindow-status-current-format. - Insert
#{E:@tmux-agents-status-other-sessions}anywhere instatus-right.
For example:
set -g window-status-format '#I:#W#{E:@tmux-agents-status-window}'
set -g window-status-current-format '#I:#W#{E:@tmux-agents-status-window}'
set -g status-right '#{E:@tmux-agents-status-other-sessions}#S %H:%M'
Each nonempty fragment inherits the foreground, background, and text attributes
active at its insertion point, then restores them for following text. A style
configured below acts as a partial overlay, so an fg-only state style keeps the
enclosing background and attributes.
To select tmux's default style instead of the enclosing inline style, put
#[default] immediately before the fragment:
set -g status-right '#[default]#{E:@tmux-agents-status-other-sessions}#S %H:%M'
Apply the configuration:
tmux source-file "$HOME/.tmux.conf"
2. Install your agent adapter
Pi
Install the published npm package:
pi install npm:tmux-agents-status-pi
Enter /reload in Pi or restart it.
# Update
pi update --extensions
# Uninstall
pi remove npm:tmux-agents-status-pi
OpenCode
Install the published npm package globally:
opencode plugin --global tmux-agents-status-opencode
Restart OpenCode after installation or update.
# Update
opencode plugin --global --force tmux-agents-status-opencode
OpenCode currently has no plugin removal command. To uninstall, remove only tmux-agents-status-opencode from the plugin array in your global opencode.json or opencode.jsonc.
Claude Code
claude plugin marketplace add hiback/tmux-agents-status
claude plugin install tmux-agents-status@tmux-agents-status --scope user
Restart Claude Code after installation.
# Update
claude plugin update tmux-agents-status@tmux-agents-status --scope user
# Uninstall
claude plugin uninstall tmux-agents-status@tmux-agents-status --scope user
Codex
codex plugin marketplace add hiback/tmux-agents-status
codex plugin add tmux-agents-status@tmux-agents-status
Start Codex inside tmux and approve its hook review. You can also use /hooks to review and trust the exact tmux-agents-status hook. The adapter remains inactive until trusted.
# Update
codex plugin marketplace upgrade tmux-agents-status
codex plugin add tmux-agents-status@tmux-agents-status
# Uninstall
codex plugin remove tmux-agents-status@tmux-agents-status
Adapters run as your user. Install them only from sources you trust.
Customize
Set options in ~/.tmux.conf before the TPM run line or manual run-shell line:
set -g @tmux-agents-status-running-glyph 'RUN'
set -g @tmux-agents-status-running-style 'fg=blue,bold'
set -g @tmux-agents-status-unread-style 'reverse,bold'
| Option | Default | Purpose |
|---|---|---|
@tmux-agents-status-running-glyph |
• |
Working |
@tmux-agents-status-running-style |
fg=cyan |
Working style |
@tmux-agents-status-waiting-glyph |
? |
Waiting |
@tmux-agents-status-waiting-style |
fg=yellow |
Waiting style |
@tmux-agents-status-completed-glyph |
✓ |
Finished |
@tmux-agents-status-completed-style |
fg=green |
Finished style |
@tmux-agents-status-failed-glyph |
! |
Failed |
@tmux-agents-status-failed-style |
fg=red |
Failed style |
@tmux-agents-status-unread-style |
reverse,bold |
Unread-result style |
Set a glyph to an empty string to hide that state. Styles are literal,
single-line tmux 3.1 visual style lists without #[...]. Commas and ASCII spaces
separate terms. The accepted terms are:
default,none,fg=<colour>, andbg=<colour>;bright,bold,dim,underscore,blink,reverse,hidden,italics,strikethrough,overline,double-underscore,curly-underscore,dotted-underscore, anddashed-underscore, plus each attribute'sno-prefixed form such asnobold;- tmux 3.1 literal colours: the eight named and eight bright named colours,
aliases
0–7and90–97,colour0–colour255,default,terminal, and six-digit#RRGGBBvalues.
Names are case-insensitive. Unknown terms and layout or default-scope controls
are ignored token by token. A style containing #{...}, #(...), a short
format alias such as #S, or nested #[...] syntax is ignored in full.
Filtering affects rendering only and never rewrites the stored option.
Behavior
The window fragment shows tracked agents in the current window. The other-session fragment shows active turns and unread results from other tmux sessions. Closing a pane clears its status.
| Agent | Working | Waiting | Finished | Failed |
|---|---|---|---|---|
| Pi | yes | — | yes | yes |
| OpenCode | yes | yes | yes | yes |
| Claude Code | yes | yes | yes | API errors only |
| Codex | yes | approvals only | yes | — |
Unsupported states are not guessed. Adapters exchange lifecycle identifiers only; they do not inspect or store prompts, responses, transcripts, model text, tool arguments, or pane content.
Update or uninstall the tmux plugin
With TPM, press prefix + U to update. For a manual installation:
git -C "$HOME/.tmux/plugins/tmux-agents-status" pull
tmux source-file "$HOME/.tmux.conf"
Before uninstalling, clean up plugin-owned tmux state:
~/.tmux/plugins/tmux-agents-status/scripts/uninstall
Then remove the printed configuration entries and uninstall through TPM or delete the clone. Agent adapters must be removed separately.
Troubleshooting
If no status appears:
- Confirm the tmux plugin and your agent adapter are both installed.
- Confirm both fragment strings appear in
~/.tmux.confexactly once. - Run
tmux source-file "$HOME/.tmux.conf". - Reload or restart the agent. For Codex, also trust the hook in
/hooks. - Start a turn inside tmux and allow about one second for the first update.
Adapters stay inactive outside tmux, when the core is missing or incompatible, and in Pi print, JSON, or RPC modes.
Limitations
- One directly running main agent per pane is supported; subagents and background work do not own panes.
- The agent and tmux must run on the same host.
- Some agents do not expose every lifecycle state shown above.
- Nested tmux, SSH aggregation, and Windows are not supported.
- tmux 3.0 and older are unsupported; load, runtime, cleanup, and uninstall behavior on those versions is outside the compatibility contract.
- tmux has only one pushed-default slot, not a nestable style stack. If an
enclosing format uses a later
default,push-default, orpop-default, put the fragment at the end of that scope or explicitly reapply the desired style afterward.