Skip to main content

Claude Fleet Monitor

PyPI version Downloads License Python

Fleet monitoring for Claude Code and Codex sessions. See all your running agent sessions at a glance, get notified when one needs input, and jump to the right terminal tab instantly.

Features

  • TUI Dashboard -- Textual-based interactive UI with search/filter, status-colored rows, and click-to-focus
  • tongs Plugin -- embeds as a screen in tongs via the TongsPlugin ABC
  • Process Discovery -- finds running Claude Code and Codex sessions cross-platform even before hooks fire
  • MCP Server -- Claude Code and Codex sessions can query fleet status programmatically
  • Terminal Focus -- switch to a session's tab and raise the window, across 8 supported terminals
  • Desktop Notifications -- notify-send alerts when a session has been idle for over 2 minutes
  • Hooks Integration -- Claude Code and Codex hooks emit real-time status (running, idle, waiting, error) per session
  • Per-Session Terminal Detection -- each session captures its terminal type at hook time, not at focus time

Supported Terminals

Terminal Tab Switching Window Raise Nested Support
KDE Konsole Yes (qdbus) Yes (KWin) --
tmux Yes (tmux CLI) Via parent terminal Yes
zellij Yes (zellij CLI) Via parent terminal Yes
GNOME Terminal No Yes (xdotool) --
iTerm2 Yes (osascript) Yes (osascript) --
macOS Terminal Yes (osascript) Yes (osascript) --
Windows Terminal No Yes (pywinctl) --
Generic fallback No Best effort --

Nested terminals (e.g. tmux inside Konsole) are handled automatically: the focus command switches the tmux pane, then detects the parent terminal via process tree walking and raises that window too.

Install

pip install claude-fleet-monitor
claude-fleet install

Or install from source:

git clone https://github.com/andre-motta/claude-fleet-monitor.git
cd claude-fleet-monitor
pip install .
claude-fleet install

The installer updates Claude Code's ~/.claude/settings.json, writes Codex hooks to ~/.codex/hooks.json, and registers the fleet MCP server with both agents. Restart your sessions after the first install. Codex requires you to review and trust the installed hooks through /hooks before they run.

tongs Integration

To use the fleet monitor as a plugin inside tongs:

pip install claude-fleet-monitor[tongs]

Then launch tongs and open the command palette (Ctrl+P) to find "Fleet Monitor".

Upgrading

pip install --upgrade claude-fleet-monitor

No need to re-run claude-fleet install or restart sessions. Hooks and MCP server point to pip-installed entry points, so upgrades take effect immediately.

Dependencies

  • python3 >= 3.10
  • textual >= 1.0

Optional (for terminal focus):

  • qdbus -- Konsole tab switching (KDE)
  • xdotool -- GNOME Terminal / X11 window focus
  • pywinctl -- Windows Terminal window focus
  • notify-send -- desktop notifications (Linux)

Usage

TUI Dashboard

claude-fleet monitor              # default 2s refresh
claude-fleet monitor --refresh 5  # 5s refresh

Navigate with arrow keys or mouse. Press Enter or click a row to focus that session's terminal. Press / to search/filter by repo name, detail, or status. Press q to quit.

Focus a Session

claude-fleet focus autofix         # by repo name
claude-fleet focus 2467709         # by PID
claude-fleet focus abc123          # by session ID prefix

The focus command reads the session's stored terminal type and uses the right API. Works across Konsole, tmux, iTerm2, and others.

Quick Status (no TUI)

claude-fleet status

MCP Tools

Any Claude Code or Codex session with the fleet MCP server can use these tools:

Tool Description
fleet_status All sessions with summary counts
fleet_session Single session detail by ID or prefix
fleet_sessions_needing_attention Sessions idle over 2 minutes or waiting for input
fleet_focus Focus terminal tab for a session
fleet_cleanup Remove stale ended session files

Ask your agent: "what sessions are running?" or "focus on the autofix session".

How It Works

                                                              <-- MCP server
Claude Code sessions --\                                      <-- TUI monitor
  (hooks per event)     |                                      <-- tongs plugin
                       |-- write --> ~/.claude/fleet/*.json    <-- CLI status
Codex sessions --------|                                      <-- focus command
  (hooks per event)     |
                       /
  (process discovery) -
  1. Hooks fire on Claude Code and Codex events (start, prompt, tool use, stop, permission request, end)
  2. Each hook captures the session's terminal type and PID, writes to ~/.claude/fleet/
  3. Process discovery scans for claude and codex processes cross-platform to find sessions without hooks
  4. Consumers (TUI, MCP, tongs plugin, CLI, focus) read the JSON files
  5. Focus reads the session's terminal field and dispatches to the right terminal API

Terminal Detection Flow

Hook fires inside session
  --> detect terminal via env vars (TMUX, KONSOLE_VERSION, ITERM_SESSION_ID, ...)
  --> capture terminal-specific env (socket paths, DBus service, session IDs)
  --> store in fleet JSON: {"terminal": "tmux", "terminal_env": {"TMUX": "..."}}

Focus command reads session JSON
  --> get_terminal_api("tmux") --> TmuxAPI
  --> find_tab(pid) --> switch_tab() --> raise_window()
  --> for nested terminals: detect parent terminal, chain to parent API

Session States

State Meaning
STARTED Session just began
RUNNING Processing a prompt or using tools
IDLE Finished responding, waiting for next prompt
WAITING Blocked on permission request or user input
ERROR Turn failed (API error)
ENDED Session closed
DISCOVERED Found via process scan, no hook data yet

Architecture

src/claude_fleet_monitor/
    models.py           # SessionStatus enum, FleetSession dataclass
    hook.py             # Claude Code and Codex hook handler
    discovery.py        # Process discovery, session file I/O
    tui.py              # Textual standalone app (FleetMonitorApp)
    cli.py              # claude-fleet CLI entry point
    focus.py            # Session lookup + terminal focus dispatch
    mcp_server.py       # FastMCP server
    tongs_plugin.py     # TongsPlugin ABC implementation
    widgets/
        session_table.py  # SessionTable(DataTable) widget
    views/
        fleet_screen.py   # FleetScreen(Screen) for tongs
    terminal_apis/
        base.py           # TerminalAPI ABC
        konsole.py        # KDE Konsole
        tmux.py           # tmux
        zellij.py         # zellij
        gnome.py          # GNOME Terminal
        iterm2.py         # iTerm2
        macos_terminal.py # macOS Terminal.app
        windows_terminal.py # Windows Terminal
        generic.py        # Fallback

Known Limitations

  • Same-name tabs in different windows (Konsole/KDE): When multiple sessions share the same repo name and live in different Konsole windows, the focus command will switch to the correct tab but may raise the wrong window. Workaround: keep same-name sessions grouped in the same Konsole window.
  • Wayland window activation: On Wayland/KDE, window raising uses KWin scripting via DBus. Other Wayland compositors may not support programmatic window activation.
  • GNOME Terminal / Windows Terminal: No tab switching API available; window raise only.

Configuration

Environment Variables

Variable Default Description
FLEET_DIR ~/.claude/fleet Shared directory for Claude Code and Codex session status files

Uninstall

claude-fleet uninstall              # removes hooks, MCP config, and data
claude-fleet uninstall --keep-data  # keeps ~/.claude/fleet/

Contributing

See CONTRIBUTING.md for development setup, code style, and PR process.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_fleet_monitor-0.6.0.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_fleet_monitor-0.6.0-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

Details for the file claude_fleet_monitor-0.6.0.tar.gz.

File metadata

  • Download URL: claude_fleet_monitor-0.6.0.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for claude_fleet_monitor-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e5200a8fb5b251c9c8bc51d8a9a25aaccd1c326f191fad7c27c8298540cbb9b0
MD5 7a41a667fc628b26f749fb1020f5980f
BLAKE2b-256 05cbc85c1b16cf28ecf7087793afb9d4970ad0c57cac3c790c698fbaf9b8d96d

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_fleet_monitor-0.6.0.tar.gz:

Publisher: publish.yml on andre-motta/claude-fleet-monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_fleet_monitor-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_fleet_monitor-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41577e69ffb6fc1931b1a1f5d99df431770c32ee8b2463da1e2503f5a329b7de
MD5 50f69cab7e11f5c2f15c70e07c3a176d
BLAKE2b-256 905532cd2f4bce8bf2033d680f8bec37a99fb089ab23adf8ab1be10d9a0f2bc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_fleet_monitor-0.6.0-py3-none-any.whl:

Publisher: publish.yml on andre-motta/claude-fleet-monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page