o4 command. Run o4 with no command to start an interactive session in the current directory. The subcommands manage sessions, MCP servers, plugins, workspace trust, the daemon, watch mode and evaluations without starting a session.
Every command also accepts -h or --help. o4 help <command> prints the same help as o4 <command> --help.
Global options
These options go before the command, for exampleo4 -m anthropic:claude-sonnet-4-6 or o4 -C ~/code/api watch. Most of them affect how a session starts, so they matter for plain o4, for o4 resume, and for print mode.
Model and prompt
The model to start with. Accepts
provider:model (anthropic:claude-sonnet-4-6), provider/model (anthropic/claude-sonnet-4-6), or a bare model ID or name (claude-sonnet-4-6). A model given here must exist: if o4 can’t find it, it exits with a not found error that suggests o4 --list-models. Without -m, o4 uses your saved model. See Choosing a model.Runs the prompt once without the interface, prints the reply, and exits. See Print mode and scripting for permissions, exit codes and output.Two prompts print a JSON report instead of calling the model:
o4 -p "/context --json" and o4 -p "/stats --json". See Context and cost.o4 picks a prompt profile for each model automatically. This option forces one for the session:
modern-minimal, modern-guided, legacy-guided or local-defensive. See Reasoning and prompt profiles.The reasoning effort to start with. The help lists
default, low, medium, high and max. o4 also accepts minimal, extra-high (or xhigh) and ultra where the model supports them. default leaves the choice to the provider. Without this option, o4 uses the reasoning value from your settings. An unknown value stops o4 with Unknown reasoning level. See Reasoning and prompt profiles.Kept for compatibility. A prompt given with
-p is what starts print mode, so o4 --print -p "..." behaves like o4 -p "...", and o4 --print alone starts the normal interface.Prints the full system prompt o4 would send, followed by a
--- Prompt diagnostics --- block with the prompt profile, how it was selected, a hash, and the size in bytes and estimated tokens. Then it exits. It doesn’t call the model. Combine it with -m, --prompt-profile or -s to see their effect.Streams the model’s reasoning output as it arrives. It works in print mode, where the reasoning goes to stderr so stdout keeps only the reply. The full-screen interface ignores it.
Lists every registered model, grouped by provider, with its context window, maximum output tokens, input types and whether it supports reasoning. Then it exits. It doesn’t need an API key.
Interface and setup
Turns on screen reader output for this session, the same as the screen reader setting. See Themes and display.
Skips the first-run setup wizard. If no model is configured and you don’t pass
-m, o4 exits with No default model configured and tells you to run without --no-onboarding or to pass -m.Permissions and sandbox
Sets how tool calls are approved for this run:
ask, accept-edits, plan, review, auto or bypass. See Permissions. Print mode starts in auto when you don’t set this.Fixes the sandbox for shell commands from the model for this run:
With
read-only or workspace-write, o4’s file tools also refuse paths outside those directories. See Sandbox.Runs enabled hooks even if you haven’t trusted them, for this run only. Use it only in automation that already checks where its hooks come from. See Hooks.
Directories
When you pass-C or --add-dir, o4’s file tools only read and write inside the working root and the added directories. Shell commands are limited to those directories only with --sandbox workspace-write. See Sandbox.
Runs o4 as if you started it in this directory. It applies to sessions and to commands such as
o4 -C ~/code/api watch. The directory must exist. o4 refuses directories that overlap protected credential locations such as ~/.ssh. --cwd is a hidden spelling of the same option. When o4 restarts itself to resume a session, it passes the directory you chose with --cwd, so it doesn’t ask again.Adds a directory the agent may write to, next to the working root. Repeat it for several directories. A relative path is resolved against the working root. Directories that overlap protected credential locations are refused with
overlaps a protected credential location.Teams
Runs the session as a member of a team the model created with
team_create. Give it as <name>@<team>; anything else stops o4 with --as expects <name>@<team>. Between turns the session reads the messages sent to that member, and o4 tells the model to reply to the team’s lead with send_message. Print mode doesn’t read the mailbox. o4 reads team mail only in a trusted workspace; in an untrusted one the session starts anyway and o4 prints a warning. See Teams.Removed flags
Older approval flags now stop o4 with a message that names the replacement:o4 resume
Resume a saved session.
Without an ID,
o4 resume opens the session picker. When no terminal is attached, it prints the list of sessions from every directory instead. With an ID, it resumes that session directly. If the session started in a different directory, o4 asks which directory to use, unless you chose an “always” answer before or pass -C. See Resuming in a different directory. Global options such as -m still apply. The resumed session comes back on the model and reasoning level it was left on, unless you pass -m or --reasoning; if its model is no longer available, o4 uses your default model. See Sessions.
o4 sessions
Manage sessions. A subcommand is required.o4 sessions list
List recent sessions from the current checkout, with ID, model, title, directory and last update.o4 sessions list --all.
o4 sessions live
Print the sessions open in o4 windows on this machine, and the ones the daemon runs, as one line of JSON. It changes nothing. Ringside on another machine runs it over SSH to list this machine’s sessions.sessions has the session’s session_id, cwd, title, model and status (idle, working or needs_input), a short detail such as the question it asks, and the subagents and background tasks it runs in work. A session the daemon runs also has attached, the number of windows on it.
o4 sessions delete
Delete a session.Deleted session <id> even when no session has that ID. See Sessions for what deleting removes.
o4 mcp
Manage MCP servers. With no subcommand,o4 mcp runs o4 mcp list. See MCP servers.
o4 mcp add
Add an MCP server: a command to run, a remote server’s address, or a server from the MCP registry.
Without
--global, o4 adds the server to the project’s .o4/.mcp.json, which needs a trusted workspace. In an untrusted workspace the command stops and asks you to run o4 trust or pass --global. With --global, the server goes into ~/.o4/.mcp.json.
o4 checks the server before it saves it. It refuses a name that is already used in the destination file, and options that don’t fit the kind of server, such as --env without a command or --header on a local command. Values can use ${NAME} variables, which o4 fills in when it starts the server; quote them so your shell leaves them alone. See Variables in settings.
Without a command or --url, o4 looks up the full registry ID. If several installations are available, it lists their IDs and saves nothing until you repeat the command with --installation. Unsupported choices explain why they cannot be used. Required environment variables without a catalog-provided fixed value or default must be set and non-empty before the add; o4 saves references to them, not their resolved values. Catalog-provided fixed values and defaults are saved as given. A project catalog add also refuses a name already defined in the repository’s .mcp.json. The command validates and saves the selected installation without starting it. Use o4 mcp list --check to test it.
--installation and --as are only for registry adds. Custom server options (--env, --pass-env, --header and --bearer-token-env-var) cannot be combined with a registry add. See Add a server from the catalog.
o4 mcp add counts as approved. See o4 mcp approve.
o4 mcp approve
Show what the project’s MCP servers that wait for your OK would run, or approve them so they can start. A project server, from.o4/.mcp.json, the repository’s .mcp.json, or a plugin in .o4/plugins, waits for your OK until you approve it, and again whenever what it runs changes.
o4 trust. A name that doesn’t wait is an error that lists the ones that do. Approvals are kept in ~/.o4/mcp_server_approvals.json. See Project servers need trust and your OK.
o4 mcp remove
Remove an MCP server.
o4 removes the server from the project config if it’s there, otherwise from the global config.
o4 mcp list
List every MCP server o4 found in the config files and installed plugins, where each comes from, and whether it will start or waits for your OK, followed by anything that keeps a server from loading, each with what to do about it. Without--check it doesn’t start any server.
o4 mcp search
Search the MCP registry atregistry.modelcontextprotocol.io. Shows up to 20 results, each with its name, a short description and its transport.
o4 mcp restart
Restart MCP servers.
Servers only run inside a session, so this command fails from the shell with
Server restart is only available within an interactive session. Use /mcp restart [name] in a session instead.
o4 plugin
Manage plugins and marketplaces.o4 plugins works too. With no subcommand, o4 plugin runs o4 plugin list. See Plugins and marketplaces.
o4 plugin install
Install a plugin.
Global plugins go into
~/.o4/plugins, and project plugins into the project’s .o4/plugins. Installing a project plugin needs a trusted workspace.
o4 plugin remove
Remove an installed plugin.o4 plugin list
List installed plugins with their version, scope (global or project) and description. It warns about project plugins it ignored because the workspace isn’t trusted.
o4 plugin marketplace
Manage plugin marketplaces. With no subcommand, it runso4 plugin marketplace list. Marketplaces are stored under ~/.o4/marketplaces.
o4 watch
Watch the workspace and run its configured check after each change. When the check fails, o4 offers to fix it. See Watch mode.
Without
-c, o4 uses command from the [watch] section of the project’s .o4/config.toml (only in a trusted workspace). If that isn’t set, it picks a command from the project files:
o4 trust
Trust the current workspace. This enables its project hooks and MCP servers, and the rest of the project configuration covered in Workspace trust. Trust also covers the directories inside it. Choosing Yes, trust this folder when o4 asks “Trust this folder?” at startup does the same.o4 untrust
Revoke trust for the current workspace.o4 update
Update o4 to the latest release. o4 downloads the release archive for your platform, checks it against the published checksum, and replaces the binary you ran. See Update o4.
Without
--version, o4 never replaces a build that is newer than the latest release. If the binary is in a Homebrew Cellar, o4 doesn’t replace it and tells you to run brew upgrade open4rena/tap/o4. Open sessions keep using the old binary until you restart them.
o4 daemon
Manage the o4 daemon, a long-running background process that hosts sessions for clients connecting over a Unix socket. Withinteractive_sessions = true in the [daemon] section of ~/.o4/config.toml, your o4 windows run their sessions in it, so a response keeps going after you close the window. A subcommand is required. The daemon is available on macOS and Linux. See The o4 daemon.
status exits with 0 when the daemon is running and 3 when it isn’t, so scripts can check it without parsing the output. stop also exits with 3 if the daemon wasn’t running. start waits up to 5 seconds for the daemon to answer; if it doesn’t, the error points to the daemon log at ~/.o4/daemon/daemon.log. A hidden serve subcommand runs the daemon in the foreground; see Run in the foreground.
If a session in the daemon is answering or waiting on you, stop and restart list those sessions and ask [y/N] before they end them. Any answer but y or yes prints Nothing was stopped. and exits with 4. Without a terminal to ask in, they stop nothing and also exit with 4. Pass --yes to skip the question. See Stop and restart.
binary is the o4 file the daemon runs from.
o4 eval
Run and report coding-agent evaluations. A subcommand is required. o4 reads the task corpus from theevals directory in the current directory and records runs in .o4/evals.db, so run these commands from the repository that holds the corpus. See Evaluations.
o4 eval run
Run selected corpus tasks against one or more models.
o4 skips a model reference it can’t resolve, with a warning, and runs the rest. If nothing matches your selection, it stops with
no tasks matched the requested eval selection.
o4 eval paired
Run an automatic control arm and amodern-minimal candidate arm, to compare the automatic prompt profile with modern-minimal.
o4 eval report
Render a recorded eval run.o4 eval summary
Summarize autonomy results by o4 version: tasks attempted and completed, how many finished without intervention, and the rates.o4 eval list
List eval corpus tasks.Exit codes
Commands exit with0 on success and 1 on an error, printing Error: ... to standard error. An unknown flag, an invalid value or a missing subcommand exits with 2. o4 daemon status and o4 daemon stop use 3 for “not running”. o4 daemon stop and o4 daemon restart use 4 when they stopped nothing because nobody confirmed. See Print mode and scripting for print mode.