Skip to content

How hivemux works with tmux and Claude Code hooks

hivemux works in layers: Claude Code hooks write each session’s id and state onto its tmux pane, the sidebar reads that state every second and draws the board, tmux keeps processes alive when the terminal closes, and tmux-resurrect restores layouts after a reboot while hivemux types claude --resume <id> in each pane. Everything runs on your computer (a Mac or a Linux machine); there is no server.

Layer Job
Ghostty draws. Every window runs hivemux-attach, which attaches to tmux
tmux keeps processes alive when the terminal closes
tmux-resurrect + continuum saves layouts every 5 minutes, restores on first launch
Claude Code hooks write session id and state onto the tmux pane (hivemux-hook)
sidebar reads that state every second and draws the board (hivemux-sidebar-view)

hivemux setup registers hivemux-hook in ~/.claude/settings.json for eleven Claude Code hook events:

SessionStart, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, PermissionDenied, Notification, Stop, StopFailure, SessionEnd.

Each event records the session id, folder and state on the tmux pane where that Claude runs. Because the state lives on tmux panes, a Claude running outside tmux is not shown, and a Claude started before hivemux was installed appears after its next prompt or tool call.

The sidebar sends a notification when a task needs input or finishes, except for the task you are looking at. It is sent as a terminal notification (OSC 777), so it shows in terminals that support it, such as Ghostty. With the sidebars hidden (prefix b), no notifications come. See Claude Code notifications.

Event tmux sessions and layout Claude conversation
Close a Ghostty window kept keeps running
Quit Ghostty kept keeps running
Mac sleeps (lid closed) kept pauses, then continues
Reboot or crash restored from the last save resumed automatically
End with /exit or Ctrl+D window stays not resumed
  1. hivemux-attach: with no tmux server running, starts one with a temporary session.
  2. tmux-resurrect: recreates sessions, windows, panes and folders from the last snapshot.
  3. hivemux-panes restore: reads the saved pane-to-session list and, in each pane that sits at a shell prompt, changes to the original folder and types claude --resume <id>.
  4. Claude Code: the conversation opens (and registers with Remote Control, if on).
  5. hivemux-attach: attaches to the session you were last looking at.

Sessions you ended with /exit are not resumed. More in Resume Claude Code sessions.

Path What is there
~/.tmux.conf the hivemux block: loads hivemux.tmux and, if chosen, the recommended keys
~/.config/ghostty/config the hivemux block: attaches every Ghostty window to tmux through hivemux-attach
~/.claude/settings.json eleven hivemux hooks and, if chosen, Remote Control for every session
~/.zshrc git installs only: the hivemux bin folder on PATH; after hivemux terminal terminal, a block that starts hivemux in Terminal.app windows
~/.config/kitty/kitty.conf, ~/.config/alacritty/alacritty.toml, the WezTerm config only after hivemux terminal <name>: a marked block that opens every window in hivemux
~/Library/Application Support/iTerm2/DynamicProfiles/hivemux.json only after hivemux terminal iterm: the “hivemux” profile, made iTerm2’s default
~/.local/share/hivemux/ plugins, the pane-to-session list (panes.tsv), the resume log (panes.log), sidebar width and settings, the bee office window, config backups
~/.local/share/hivemux/accounts/<name>/, account, account-projects each added Claude account’s config folder (its login; the rest links to ~/.claude), the account for every project and per project (Claude accounts)
~/.local/share/hivemux/artifacts/ the artifacts list’s index and copies of published files
~/.local/share/tmux/resurrect/ tmux-resurrect layout snapshots

Config changes sit between # >>> hivemux >>> and # <<< hivemux <<< markers, and hivemux uninstall removes exactly those.

hivemux has no server of its own. It runs on your computer and reads Claude Code hook events and tmux state. Its network requests are:

  • fetching the latest Claude Code version when you update Claude (npm registry or Homebrew API)
  • cloning or updating hivemux from GitHub, and, during setup, the tmux-resurrect and tmux-continuum plugins (unless you already have them in ~/.tmux/plugins)
  • ssh or mosh to computers you connect to yourself with hivemux connect
  • installing Ghostty during setup (with Homebrew on a Mac; the distribution’s package or the snap on Linux), only if Ghostty is missing and you say yes
  • on Linux, installing missing packages (tmux, jq, git, perl) with the package manager during setup, only if you say yes
  • with an API key account: checking the key with Anthropic’s API when you add it, and the Python packages of the Agent SDK (claude-agent-sdk, prompt_toolkit, pygments) from PyPI once; the Claudes that go on with the key then talk to Anthropic’s API, as Claude Code does
  • once a day, the latest hivemux version from hivemux.dev and GitHub (Settings → hivemux updates → Never check turns it off)
  • while the bee office runs, its weather: a rough place from your IP (ipinfo.io, else ipapi.co) and the weather there from Open-Meteo, every half hour (⚙ → Weather place sets a city or turns it off)
  • anonymous usage stats, described below

To know how many people use hivemux, it sends one anonymous event a day: “it ran today”, with the hivemux version, the OS and CPU kind, how it was installed (Homebrew, git) and the language. It carries no ID: every event gets a new random one, so two days can’t be tied together, and no person or place is made of it. Nothing is sent before you have seen the notice (hivemux setup, or the sidebar’s i anonymous usage stats line).

Only if you say yes (asked once, in hivemux setup or from that line), it also sends how many times each feature was used since the day before, by name only: a right-click menu item by its key letter (menu.card.r) and a command (cli.connect).

Never sent: paths, project, conversation or account names, API keys, what you type, Claude’s answers.

To turn it off: Settings → Usage stats, hivemux-telemetry ping off, or DO_NOT_TRACK=1 (HIVEMUX_NO_TELEMETRY=1 works too). What is on and what is due to be sent: hivemux-telemetry status. The events go to PostHog.

hivemux.dev counts page views, where visitors came from and clicks, with PostHog. It sets no cookies (a random visitor id is kept in your browser’s local storage), records no sessions, and sends nothing when your browser asks not to be tracked (Do Not Track or Global Privacy Control).

The bee office window talks to a small web server that listens only on 127.0.0.1.

The same scripts run on both. What the two systems do differently is kept in one helper, hivemux-os: opening a file or link (open on macOS, xdg-open on Linux), showing a file in Finder or the file manager (FileManager1 over D-Bus), copying to the clipboard (pbcopy; wl-copy, xclip or xsel, else the terminal’s clipboard through OSC 52), and finding the program a process runs. The bee office window is a small Swift app on a Mac; on Linux the page opens as an app window in a Chromium-family browser, or in the default browser.

For background on running Claude Code in tmux, see Claude Code and tmux.