Skip to content

Agent Monitoring

pertmux detects and monitors AI coding agent instances running in tmux panes across all your sessions.

Currently, opencode is the only supported agent. opencode must be started with --port 0 so pertmux can query its local HTTP server. See Agent Configuration for setup details.

The architecture is pluggable — new agents can be added by implementing the CodingAgent trait. See Extending pertmux and Contributing.

Every 2 seconds (configurable via refresh_interval), the daemon:

  1. Lists all tmux panes across all sessions
  2. Checks each pane’s running process against registered agent process names
  3. For matched panes, discovers the agent’s HTTP server port via process tree inspection
  4. Queries the agent’s API and database for session details
  5. Links each agent pane to its corresponding MR via the worktree path

Each detected agent shows a status badge:

StatusMeaning
BusyAgent is actively working (generating code, running tools)
IdleAgent has finished its current task
RetryAgent encountered an error and is retrying
UnknownStatus could not be determined

Status priority for display: Busy > Retry > Idle > Unknown.

Press a on a worktree with an active opencode session to send commands to the agent — rebase, fix pipeline failures, and more. See Agent Actions for details.

When you select an agent pane, the detail panel shows:

  • Working directory
  • Token usage (input and output tokens)
  • Message count and session duration
  • File changes (files modified, additions, deletions)
  • Todo list with completion status
  • Message timeline with role indicators and text previews

If you don’t configure any forge ([gitlab] or [github]), pertmux runs in agent-only mode — showing a simple list of all detected coding agents grouped by tmux session.