Skip to content

CLI Overview

The nb command is your primary interface to the NimbleBrain runtime. It starts interactive sessions, launches servers, manages bundles, and configures your workspace.

nb [command] [flags]

When you run nb without a command, it enters interactive mode (TUI or headless, depending on your terminal).

CommandDescription
(default)Interactive TUI or headless pipe mode
serveStart the HTTP API server
devStart development mode (API with watch + web HMR)
bundleManage installed bundles
skillInspect loaded skills
configConfigure bundle settings
statusShow workspace status
reloadHot-reload bundles and config
telemetryManage anonymous usage telemetry

These flags work with any command:

FlagDescription
--config <path>Path to a nimblebrain.json config file
--workdir <dir>Working directory for data, logs, and conversations
--model <name>Override the default model (e.g., claude-sonnet-4-5-20250929)
--debugEnable verbose logging to stderr
--helpPrint help text and exit

Pass --help to any command to see its usage and flags:

Terminal window
nb --help
NimbleBrain Platform CLI
Usage: nb [command] [flags]
Commands:
(default) Interactive TUI / headless mode
serve Start HTTP API server
dev Start dev mode (API with watch + web HMR)
bundle Manage installed bundles
skill Inspect loaded skills
config Configure bundle settings
status Show workspace status
reload Hot-reload bundles and config
telemetry Manage anonymous usage telemetry
Global flags:
--config <path> Config file path
--workdir <dir> Working directory
--model <name> Override default model
--debug Verbose logging
Run 'nb <command> --help' for command-specific flags.
Terminal window
nb serve --help
Start HTTP API server
Launches the NimbleBrain runtime and listens for HTTP requests.
Usage: nb serve [flags]
Flags:
--port <number> Server port (default: 3000)
--config <path> Config file path
--workdir <dir> Working directory
--model <name> Override default model
--debug Verbose logging

The CLI operates in one of three modes, determined automatically:

When you run nb in a terminal with no piped input, it launches an Ink-based terminal UI with streaming output, inline tool call display, and a line editor.

Terminal window
nb

When stdin is piped (not a TTY), nb reads one message per line from stdin and writes responses to stdout. The session stays alive across all lines until EOF.

Terminal window
echo "What bundles are installed?" | nb

When you pass a command name (serve, dev, bundle, etc.), that command runs and exits.

Terminal window
nb bundle list

The CLI detects which mode to use in this order:

  1. If the first positional argument matches a known command name, run that subcommand.
  2. If stdin is not a TTY (i.e., input is piped), run in headless mode.
  3. Otherwise, run in TUI mode.

NimbleBrain loads its configuration from a nimblebrain.json file. The CLI resolves the config path using this priority:

PrioritySourcePath
1--config flagExactly the path you specify
2--workdir flag<workdir>/nimblebrain.json
3NB_WORK_DIR env var<NB_WORK_DIR>/nimblebrain.json
4Default work directory~/.nimblebrain/nimblebrain.json

If no config file exists at the resolved path, NimbleBrain auto-creates one with defaults:

nimblebrain.json
{
"$schema": "https://schemas.nimblebrain.ai/nimblebrain.json",
"version": "1",
"bundles": [],
"skills": []
}

CLI flags override values from the config file. For example, --model claude-sonnet-4-5-20250929 overrides whatever defaultModel is set in your config.

CodeMeaning
0Success
1Runtime error
2Usage error (bad flags, missing arguments)