CLI

Using modu_code in the terminal

modu_code is Modu’s terminal coding agent. This page covers installation, the four run modes, resuming sessions, and what the keys do while the agent works.

Install

Requires Go (see go.mod in the repository for the exact version). Run straight from source:

terminal
$ go run ./cmd/modu_code

Or build a single binary and put it on your PATH:

terminal
$ go build -o modu_code ./cmd/modu_code
$ ./modu_code

Below, go run ./cmd/modu_code and modu_code are interchangeable.

Zero-config start

The fastest path is one environment variable and no config file. modu_code picks the first provider that matches, in this order:

  • ANTHROPIC_API_KEY — Anthropic (over the OpenAI-compatible endpoint)
  • OPENAI_API_KEY — OpenAI Responses; model from $OPENAI_MODEL, default gpt-4o
  • DEEPSEEK_API_KEY — DeepSeek; model from $DEEPSEEK_MODEL, default deepseek-chat
  • OLLAMA_HOST — Ollama; model from $OLLAMA_MODEL (required)
terminal
$ export DEEPSEEK_API_KEY=sk-xxx
$ go run ./cmd/modu_code

You can enter the TUI with no provider at all: it offers /config to set up a provider, API key, and model on the spot. For multiple models, roles, and reasoning levels see Models & providers.

Run modes and flags

Without -p/--rpc/--acp you get the interactive TUI. The other three are non-interactive modes for scripts and editor integrations.

  • (none) — interactive TUI (default)
  • -p "<prompt>" — print mode: send one prompt, write the result to stdout, exit
  • --json — with -p: emit an NDJSON event stream instead of plain text
  • --rpc — RPC mode: JSON-line protocol over stdin/stdout
  • --acp — ACP stdio server: JSON-RPC 2.0 LDJSON, for ACP clients such as Zed
  • --no-approve — skip tool-execution approval and auto-allow every tool
  • --resume <id> — resume a saved session (full id or a unique prefix)
  • --worktree — start inside an isolated git worktree
terminal
$ go run ./cmd/modu_code -p "Summarize what cmd/modu_code does" --no-approve

The non-interactive modes exit with an error when no provider is configured rather than opening the setup flow — scripted runs need the model configured up front.

Sessions and resuming

Every start creates a new session id; the previous conversation in the same directory is not picked up automatically. On exit the terminal prints the session id and the command to resume it:

terminal
$ go run ./cmd/modu_code --resume <session-id>

A unique prefix works, so you do not have to paste the whole UUID.

Keys while it runs

While the agent is working, what you type can be delivered two ways. The status line shows which is which:

  • Enter — interject: the message joins the current turn at its next tool boundary, and work in flight is not thrown away
  • ⇧Enter — queue: the message waits until the turn finishes
  • Esc — interrupt the running task
  • Ctrl+V — paste an image from the clipboard (dragging an image file into the terminal also works)

On macOS use Ctrl+V rather than Cmd+V to paste an image: the terminal intercepts Cmd+V itself, so the program never sees the keypress.

Copied to clipboard