Skip to content

Agent Configuration

pertmux can monitor AI coding agent instances running in your tmux panes. Agents are enabled by including their section in the config file.

opencode is currently the only supported coding agent. The architecture is pluggable — see Extending pertmux and Contributing if you’d like to add support for another agent.

opencode must be started with the --port 0 flag so it launches its local HTTP server on a random port. pertmux uses this server to query session status.

Terminal window
opencode --port 0

Without --port 0, opencode doesn’t start its HTTP server and pertmux won’t be able to detect its status.

[agent.opencode]
db_path = "~/.local/share/opencode/opencode.db"
KeyTypeDefaultDescription
db_pathstring~/.local/share/opencode/opencode.dbPath to the opencode SQLite database

When an opencode agent is detected in a tmux pane, pertmux displays:

  • Status: Busy, Idle, Retry, or Unknown
  • Session title: The active session name
  • Token usage: Input and output token counts
  • Message count: Total messages in the session
  • Todo list: The agent’s current task progress
  • Message timeline: Recent conversation history

When a worktree has an active opencode session, you can press a to open the agent actions popup. This allows you to send high-level commands to the agent without leaving the dashboard.

Two built-in actions are provided by default:

  • Rebase with upstream: Instructs the agent to rebase the current branch.
  • Check pipeline & fix: Instructs the agent to analyze the latest pipeline failure and attempt a fix.

You can define your own custom actions via [[agent_action]] in your config file, with template variables like {target_branch} and {mr_url} for dynamic prompts. See Agent Actions for full details.

If you don’t need forge integration, you can run pertmux with just agent monitoring:

refresh_interval = 2
[agent.opencode]

This provides a dashboard of all coding agent instances across your tmux sessions without any MR tracking.

pertmux’s architecture is pluggable. New coding agents can be added by implementing the CodingAgent trait. See Extending pertmux for details.