Skip to content

feat(swarm): muxa swarm — a fleet command center that dispatches work#65

Open
jiunbae wants to merge 1 commit into
mainfrom
feat/muxa-swarm
Open

feat(swarm): muxa swarm — a fleet command center that dispatches work#65
jiunbae wants to merge 1 commit into
mainfrom
feat/muxa-swarm

Conversation

@jiunbae

@jiunbae jiunbae commented Jul 20, 2026

Copy link
Copy Markdown
Member

What

Adds muxa swarm, a fullscreen TUI that steps up from muxa's per-session views (watch, dashboard) to a fleet-level command center. This is the first concrete step in the "agent + tmux helper → agent swarm manager" repositioning: the dashboard/TUIs were observation-only; swarm adds command.

Every tracked agent becomes a node in a swarm map, clustered by project (cwd) or tmux session, rendered as a state-colored grid with a live fleet-status readout (● working ▶ input ◆ choice ■ error … N need you). It wears muxa's signature violet brand accent, unifying the CLI with the BarShelf menu-bar widget.

Dispatch — you can give the swarm work

key action
Enter / p compose a prompt for the selected agent
b broadcast one prompt to a marked squad (Space to mark), or to every input-blocked agent when nothing is marked
x / K abort the current turn / terminate — behind a confirm popup
o jump to the selected tmux pane on exit
g toggle grouping (project ↔ session) · Tab jumps clusters · ? help

Dispatch reuses the existing trusted side effects rather than reinventing them:

  • tmux send-keys via watch::dispatch_quick_action for pane agents
  • IPC write_session / terminate_session for muxa-owned PTY sessions

PTY surfaces win over the legacy pane field so a pty:* agent is never driven as a tmux pane it doesn't own. No new dependencies.

Design

Pure board/target logic is factored out of the TUI so it's testable without a daemon or terminal:

  • build_swarm_data — snapshot → clustered, urgency-sorted board + fleet tally
  • broadcast_targets — marked squad, else the input-blocked set
  • DispatchTarget::for_agent — PTY-over-pane routing

Testing

  • 9 new unit tests (fleet tally/attention, paneless filtering, project grouping, most-urgent-cluster-first sort, broadcast target resolution both ways, PTY-over-pane routing, width-aware truncation, duration formatting)
  • cargo test --workspace — green (unit + e2e once bins are built)
  • cargo clippy --workspace --all-targets -- -D warnings — clean (incl. pedantic)
  • cargo fmt --all -- --check — clean

Notes / follow-ups

  • Live updates use a 1s snapshot poll (matches muxa dashboard); a push-based subscribe() stream is a natural follow-up.
  • Broadcast/prompt injection is intentionally non-destructive (the composer is the deliberate step); abort/terminate keep the confirm gate.
  • Next rungs on the ladder: dispatching new agents (SpawnSession), a task/goal queue, and a web-dashboard swarm map with the same violet identity.

🤖 Generated with Claude Code

`muxa swarm` is a fullscreen TUI that steps up from per-session views to a
fleet-level command center: every tracked agent is a node in a swarm,
clustered by project (cwd) or tmux session, rendered as a state-colored map
with a live fleet-status readout. It carries muxa's signature violet brand
accent (unifying the CLI with the BarShelf widget).

Beyond observing, it dispatches work:

- Enter / p  compose a prompt for the selected agent
- b          broadcast one prompt to a marked squad (Space to mark), or to
             every input-blocked agent when nothing is marked
- x / K      abort the current turn / terminate, behind a confirm popup
- o          jump to the selected tmux pane on exit

Dispatch reuses the existing trusted side effects rather than reinventing
them: tmux `send-keys` via `watch::dispatch_quick_action` for pane agents,
and IPC `write_session` / `terminate_session` for muxa-owned PTY sessions.
No new dependencies.

Pure board/target logic (`build_swarm_data`, `broadcast_targets`,
`DispatchTarget::for_agent`) is factored out and unit-tested (9 tests):
fleet tally, paneless filtering, project grouping, urgency sort, broadcast
target resolution, PTY-over-pane routing, width-aware truncation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant