buildwithnexusv0.15.1
Menu

Quickstart

Launch bwn in a repo and describe a task. The agent reads files, edits them, and runs commands. The permission gate checks every edit and command first. If the agent changed files and tries to finish without running check_work, bwn runs it once. check_work runs your project's build, tests and linter, and a failure goes back to the model for one more round.

The first run sets up a provider and model. If you have not done that yet, see First run on the Install page, or Models & providers for keys and local models. Data & privacy lists what bwn sends to the provider and what stays on your machine.

Interactive session

bwn                         # full-screen TUI
> fix the failing pagination test

Headless

bwn run "fix the failing test"       # agentic BUILD loop, no TUI
bwn plan "migrate the config loader" # decompose, approve, then execute
bwn plan -y "…"                      # auto-approve (required without a TTY)
bwn --json --yes plan "…"            # emits a {"type":"plan"} event, then executes
bwn brainstorm "how should auth work?"
bwn --json run "…"                   # machine-readable event stream

A headless run asks you to approve a change only when stdin is a terminal and you did not pass --json. Otherwise nobody can answer. In the default ask permission mode, bwn then blocks edits, commands and network access. In accept-edits, it makes file edits inside the project and blocks the rest, such as commands, deletions and network access. The run says so before it starts, and it exits with code 3 if it blocked anything. Pass --permission-mode auto to let it make changes, or --permission-mode readonly to only read. Even under auto, some calls need a person, such as a call that reads or changes a sensitive path, a dangerous command, or a call an ask rule covers. A run with no terminal blocks them unless one of your own hooks allows the call. In CI, an API key in the environment is enough, and there is no setup step. On an npm install with no terminal, the first run also needs --bootstrap or BWN_ALLOW_BOOTSTRAP=1 so the npm launcher downloads the binary. Output that is piped or redirected is plain text; set FORCE_COLOR=1 to keep colour. Headless runs never show the trust prompt. They ignore project settings you have not trusted, such as a repo's base_url or hooks, and print a warning that names them. Pass --trust-project <digest> to trust them for one run. When they set base_url, or a permission looser than readonly, also name those keys with --trust-project-allow.

Exit codeMeaning
0Finished
1Failed, or the turn ended right after a call that could not run
2Usage error, including an unknown option, no task, a spend cap on a remote model with no price, or a repository command that is not trusted
3bwn blocked changes for lack of approval, or a hook, a deny rule or read-only mode refused them. A check_work round that nobody could approve does not count.
4A UserPromptSubmit hook blocked the task
5--max-budget-usd stopped the run
6The turn ran out of steps
7The project's checks, run by check_work, still fail
8The verifier still blocks after its fix rounds
9buildwithnexus review found a blocking issue
130, 143SIGINT or SIGTERM interrupted the run, and bwn saved the session

With --json, the last event names the outcome. --legacy-exit-codes turns codes 4 to 8 back into 0, as in 0.14. It does the same for a 3 from a hook, a deny rule or read-only mode, and for a 1 from a call that could not run or from a model that returned no output. A run that ends in an error, a usage error, a blocking review and changes blocked for lack of approval keep their codes.

Options

Options can go before or after the command. In mcp add, every word after the server name belongs to the server's command line, so bwn reads no options there. Every option that takes a value rejects a missing or empty value with exit code 2. -- ends option parsing, so a task can contain literal option names.

OptionEffect
--provider <name>Override the configured provider for this run
--model <name>Override the configured model
--base-url <url>Send model requests to this endpoint, such as a gateway. With --provider custom, bwn reads the key from CUSTOM_API_KEY.
--permission-mode <mode>ask, accept-edits, auto, or readonly
--prompt <text>Initial prompt for the interactive session
--jsonHeadless output as one JSON object per line
--yes, -yAuto-approve a plan and execute it (required for plan without a TTY)
--effort <level>Reasoning depth: off, low, medium, high
--max-budget-usd <n>Stop before the next model request once the session's estimated spend exceeds n
--sandbox <mode>OS-level confinement for shell commands: off, auto, or require
--worktree <name>Work in .bwn/worktrees/<name> on branch bwn/<name>
--add-dir <path>Also read and change files in <path>. Repeat it for more folders.
--plainLine mode, with no alternate screen or cursor control. TERM=dumb does the same.
--legacy-exit-codesExit 0 when a run stops short without failing, as before 0.15
--trust-project <digest>Trust exactly this project settings content for this run. buildwithnexus trust --print prints the digest.
--trust-project-allow <keys>Let that digest also trust base_url, permission or both, for example base_url,permission
--Stop parsing options: bwn run -- explain --model --json sends the whole task text

Values that start with a dash use the inline form, for example --prompt=--help. bwn --help prints the same list.

Modes

ModeWhat it does
PLANDecomposes the task into steps, then executes them once you approve. Before that you can edit a step, or say what to change and get a revised plan.
BUILDRuns the agentic ReAct loop, which reads and edits files, runs commands, and iterates.
BRAINSTORMChats with you and uses only read-only tools. A task typed here gets a tip to switch modes. The mode changes only when you change it, or when you answer y to the model's offer to switch.

Shift+Tab cycles modes without losing what you have typed. The active mode shows as a colored badge in the banner.

Project instructions

bwn reads the same instruction files other agents use. From the git root down to your current directory, it loads AGENTS.md, or CLAUDE.md where no AGENTS.md exists. It also loads ~/.buildwithnexus/AGENTS.md for global rules. It adds these files to the system prompt in every mode, helper agent, and headless run. In the TUI, the repository's own files need a yes first. The TUI names them, for example instructions from this repo: AGENTS.md, src/AGENTS.md, and asks use them? y yes · n no · r review [N]. Only y adds them, and bwn asks again when one of them changes. Enter, n or Esc leaves them out for that session, and bwn asks again at the next launch. When the folder also has project settings, commands, skills or agents to trust, the trust prompt lists these files too, and its answer covers them, so the use them? question does not appear. A headless run adds them and prints a not reviewed line on stderr until someone accepts them in the TUI. bwn caps each file at 32 KiB and all files together at 96 KiB, and leaves a visible marker wherever it cuts one.

{ "instruction_files": ["AGENTS.md", "CLAUDE.md", "GEMINI.md"] }   // in settings.json; set it to [] to load no instruction files

/init runs setup again, then offers to write an AGENTS.md from the repository's build and test files, or to improve the one already there. It shows the change as a diff you approve. It offers nothing when the folder has a CLAUDE.md and no AGENTS.md. bwn init --agents-md runs the same task as a headless run, under that run's permission mode. With no terminal, the default ask permission mode blocks the write, so pass --permission-mode accept-edits.

Skills

Skills follow the open Agent Skills format: a folder with a SKILL.md whose frontmatter has name and description. bwn finds them in .buildwithnexus/skills/, .claude/skills/, and .agents/skills/, in both the project and your home directory, so skills written for other agents work unchanged. The project's skills load only after you trust the folder. A project skill with the same name as a bundled skill or one of yours loads as /project:<name>. When your own settings set "project_skills_override": true, the project's skill takes the plain name instead. Flat name.md files still work. Only the name and description go into context. The body loads when you run /name or the model calls load_skill. Add more skill directories with "skill_dirs": ["~/my-skills"].

While the agent works

Next: The TUI →