Migrate, Dump and Restore
Move your workspaces and agent conversations to another multiplexer, or save them to a file and bring them back after a reboot.
moshi-hook has three commands for your whole multiplexer setup. They carry groups, tabs, split sizes, directories and the names you gave them, plus each agent's conversation and launch settings such as the model and permission mode.
mux migrate needs moshi-hook 0.4.49 or newer. mux dump and mux restore need 0.4.51 or newer. All three run on the host, and work on what's on that host only.
Naming a multiplexer
--from and --to take one of these:
All three commands take --group to work on one group by label or id. Repeat it for more.
Move to another multiplexer
Preview first. --dry-run prints the plan and changes nothing:
$moshi-hook mux migrate --from tmux --to herdr --dry-run$moshi-hook mux migrate --from tmux --to herdr$moshi-hook mux migrate --from herdr:work --to rex --group api
After the plan, you pick which running programs to move and confirm. --yes skips both, leaves every program where it is, and is required without a terminal. An agent that is mid-turn or waiting for an answer is interrupted if you continue.
The target is built first, so a failed build stops nothing. Then each agent is stopped and resumed in its new pane only once it has exited, so one conversation never runs twice.
- The old layout stays. Close it when you're happy. The command prints how, one group at a time, and says what else would end with it.
- Programs are your choice. Each other running program is listed with its exact command. Tick it to stop it and start it in the new pane. Otherwise it keeps running on the old side and the new pane is a shell in the same directory. Pipelines and other users' processes aren't offered, and environment variables set on the command line don't come across.
- Some agents stay behind. An agent with an unknown session id, or with no way to resume by id, keeps running where it is. An agent you just moved can take a few seconds to report its session, so wait before moving it again.
- Launch settings are the ones it started with. A model you changed inside the session isn't picked up.
- Herdr Core has no pane sizes. Panes to or from it get default sizes.
Migration is tested with Claude Code, Codex and Hermes. Other agents use their documented resume commands.
Save a layout and restore it
Dump before a reboot, or any time you want a layout you can return to:
$moshi-hook mux dump --from herdr ~/moshi-layout.json
Dumping only reads, so your agents keep working. The file is readable only by you, because a program's command line can hold a token.
To bring it back, preview, then restore. The target can be the same multiplexer or a different one:
$moshi-hook mux restore --to herdr --dry-run ~/moshi-layout.json$moshi-hook mux restore --to herdr ~/moshi-layout.json
The target must be available first: start Herdr, Herdr Core or Rex yourself. tmux starts on its own.
- A running session is skipped. Restore has nothing to stop, so it won't resume a conversation that is still running, and it checks again just before each resume. Stop the agent, then restore. If moshi-hook can't list running processes, it skips every session.
- Programs need your tick. Saved programs are listed with their exact command and start only if you pick them.
--yesstarts none. Check a dump you didn't make yourself before ticking anything. - Dumps belong to the machine that made them. Agent sessions live on that machine, and an agent whose directory is gone isn't restored.
- Each restore builds a new copy. Restoring twice gives you the layout twice.
Related
- Multiplexers compares tmux, Herdr and Rex.
- Moshi CLI covers the shorter
moshicommand, which runs all of these too.