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

Command line

nav is one binary with several subcommands. nav --help lists them, and nav <command> --help shows the flags of one.

CommandWhat it does
nav tuiTerminal chat client.
nav webBrowser chat client.
nav runRun one task and exit.
nav serveThe session server alone (HTTP and SSE).
nav authStore API keys.
nav doctorRead-only diagnostics.
nav lspThe language server the editor extension launches.
nav flows cataloguePrint the flow schema of this build as JSON.

Add --version to any of them to print the version.

nav tui [--workspace <dir>] [--model <gateway/id> | --session <id>] [--models <file> | --url <server>]
FlagMeaning
--workspace <dir>Folder the conversation works in. Default: the current directory.
--model <gateway/id>Model for a new conversation. Cannot be combined with --session.
--session <id>Resume a past conversation. Cannot be combined with --model.
--models <file>Use this models.json for the embedded server. Cannot be combined with --url.
--url <server>Connect to a running server instead of starting one. If it needs a bearer token, set WITHNAV_SERVER_TOKEN. Cannot be combined with --models.

The terminal client writes its log to ~/.local/share/withnav/tui.log, never to the screen.

nav web [--workspace <path>]... [--models <file>] [--port <n>] [--no-open]
FlagMeaning
--workspace <path>A workspace to offer in the browser. Repeat for several. Default: the current directory.
--models <file>Use this models.json for the embedded server.
--port <n>Loopback port to listen on. Default 0, which picks a free one.
--no-openPrint the address without opening the browser.
nav run -p "<task>" [flags]

Runs one task in the terminal and exits. If you pass no -p, or -p -, the prompt is read from standard input. nav run never approves a tool call by itself, unless you pass --yes.

FlagMeaning
-m, --model <gateway/id>Model to use.
-p, --prompt <text>The task. A prompt that is a /command runs that command.
--workspace <dir>Folder to work in. Default: the current directory.
--models <file>Use this models.json.
--agent <agent>Primary agent: build (default) or plan.
--variant <name|off>A variant the model offers, or off for none. Default: the model’s default variant.
--show-thinkingShow the model’s reasoning.
--yesUnsafe. Turn on bypass for the run: ordinary permission prompts run once. Protected ones still stop the run with exit code 3.

Exit codes:

CodeMeaning
0Done.
1Error.
2The agent asked a question.
3A tool call needs approval (permission_required).
130Interrupted.
nav serve [--bind <addr>] [--allow-non-loopback] [--models <file>]

Runs the session server alone, with no client: an HTTP API with Server-Sent Events.

FlagMeaning
--bind <addr>Address to listen on. Default 127.0.0.1:7310.
--allow-non-loopbackAllow an address that is not loopback.
--models <file>Use this models.json.

The server has no authentication and no TLS. Keep it on loopback. If you open it to a network with --allow-non-loopback, protecting it is your job: use a private network or a reverse proxy.

nav auth set <provider>
nav auth list
nav auth remove <provider>

Keys are stored in ~/.config/withnav/auth.json with mode 0600. set reads one line from standard input and does not hide it as you type, so pipe the key in if anyone can see your screen. list prints the providers that have a key. A stored key wins over the environment variable named by api_key_env.

nav doctor [--offline] [--json] [--workspace <dir>] [--layer <reflex|instinct|metacognition>]

Checks your configuration. It is covered in Troubleshooting.

nav lsp [--models <file>]
nav lsp replay [--log <file>] [--json]

The language server for editors. The VS Code extension launches it for you over stdio, so you rarely run it yourself. nav lsp replay replays the built-in editor flows offline against a decision log (default ~/.local/share/withnav/withnav.jsonl) and prints a summary, or a JSON report with --json.

Environment variables

VariableMeaning
WITHNAV_SERVER_TOKENBearer token for nav tui --url.
WITHNAV_MAX_STEPSCap on the steps of one turn. Unset: no cap for the main agent (a watchdog supervises it) and 50 for subagents. A value that is not a non-negative integer logs a warning and caps the turn at 500 steps (50 for subagents).
API key variablesThe names you give in api_key_env in models.json, for example OPENAI_API_KEY.

The old NAVAI_* names still work as fallbacks, with a warning. See Older installs.