Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture Overview

Muster is organized as a Cargo workspace with three crates:

crates/
├── muster/         # Library — tmux bindings, profiles, theming, control mode
├── muster-cli/     # CLI binary
└── muster-notify/  # macOS notification helper (minimal binary for Muster.app bundle)

Design Principles

  1. tmux is the runtime — muster is an organizational layer on top of tmux, not a replacement
  2. Library-first — the CLI is a thin consumer of the muster library crate; the API is designed to support GUI applications without modification
  3. No application state — running session metadata lives in tmux user options, not in files
  4. Push-based sync — control mode provides structured notifications; no polling for state

Library Modules

ModulePurpose
tmux::clientCommand execution, output parsing, session/window CRUD
tmux::controlControl mode connection, event stream parsing (MusterEvent)
tmux::typesTmuxSession, TmuxWindow, SessionInfo
config::profileProfile CRUD with atomic JSON persistence
config::settingsSettings (tmux path, shell preference)
sessionSession lifecycle — create from profile, destroy
session::themeHex color parsing, dimming, tmux status bar styling
musterMuster facade tying everything together

Data Flow

Commands:    CLI (or GUI) → library → tmux / config
State:       Runtime state always from tmux, metadata from config files
Events:      tmux control mode → library → subscribers

Control mode notifications cover window lifecycle, session lifecycle, and active tab changes. CWD tracking uses tmux’s native pane_current_path with on-demand queries.

Component Diagram

        ┌──────────────┐
        │              │
        │  CLI binary  │
        │   (muster)   │
        │              │
        └──────┬───────┘
               │
        ┌──────▼──────┐
        │             │
        │   muster    │
        │  (library)  │
        │             │
        └──┬───────┬──┘
           │       │
     ┌─────▼──┐ ┌──▼──────────────┐
     │ Config │ │      tmux       │
     │  dir   │ │  (sessions,     │
     │ (JSON) │ │   control mode) │
     └────────┘ └─────────────────┘