Get Moshi
cli

Moshi CLI

The short moshi command — a project tmux launcher and one-shot diff viewer that ships with moshi-hook.

updated 1 week ago23 min readpage 22 / 32

When you install moshi-hook, the package also exposes a shorter moshi alias. It points at the same binary, so every moshi-hook subcommand works under either name — moshi pair, moshi install, moshi serve, moshi status, and so on.

The alias adds one extra behavior: if you pass a single directory as the only argument, moshi treats it as "open a tmux session for this project" instead of looking for a subcommand. That makes the two things you reach for most from a shell — project tmux sessions and the git diff viewer — fit in a single short word.

Project tmux sessions

Pass a single directory argument and moshi resolves it, names the tmux session after the directory basename, and replaces itself with the equivalent tmux new-session -A command:

anywhere on the host
$moshi .
$moshi ~/projects/app-ios
$moshi ~/a/b/name

For example, moshi ~/a/b/name becomes:

effective command
$tmux new-session -A -s name -c /Users/you/a/b/name

A few things to note:

  • The session name is the directory basename. Running moshi again on the same path attaches; running it on a sibling path with the same basename collides — pass a fuller path or rename one of them.
  • Because moshi uses exec, no wrapper process stays around. From the shell's point of view, you started tmux normally.
  • The working directory is set with -c so new windows inside the session default to that path.

See tmux for windows, panes, and reattach patterns.

Git diff viewer

moshi diff starts the embedded git diff viewer for a local repository and opens it in your default browser:

anywhere on the host
$moshi diff .
$moshi diff ~/projects/some-repo
$moshi diff ~/projects/some-repo --no-open

The viewer is served by moshi-hook, binds to 127.0.0.1 only, and uses a stable port (24543 by default). Running moshi diff again for a different workspace re-points the same server at the new repo and reopens the existing local URL — you don't accumulate browser tabs.

Useful flags:

--no-open
Don't launch the browser, just print the URL.
--port N
Bind a specific port. --port 0 picks any free port.

If the daemon gateway already owns port 24543, the CLI falls back to a free ephemeral port and prints the URL it chose.

For everything else the viewer can do — staged/unstaged/untracked sections, side-by-side rendering, in-app integration — see Diff viewer.

Every other subcommand

Because moshi is the same binary, you can drop the -hook suffix anywhere:

moshi pair
Pair this host with your Moshi account.
moshi install
Wire up Claude Code, Codex, OpenCode, and friends.
moshi serve
Run the daemon foreground (otherwise use brew services).
moshi status
Pairing state, socket path, WebSocket health.
moshi logs -f
Tail the daemon log.

The one disambiguation rule: a single directory argument routes to the tmux launcher, not a subcommand. Subcommands like pair, install, diff, status are still dispatched normally because they aren't paths. If you ever need to be explicit, moshi-hook always means the underlying binary with no alias behavior.

If moshi is not on your PATH after brew install moshi-hook, make sure your shell has Homebrew's bin directory loaded, or call the absolute path printed by which moshi-hook.