CLI Reference

Complete reference for O3 Code command-line interface, including commands and flags.

The CLI is currently in Beta — commands and flags are still evolving. Make sure you're on the latest version of the CLI if you run into issues.

Synopsis

o3-code <command> [subcommand] [options]

Run o3-code --help for the top-level command list, or o3-code <command> --help for any group.

Global options

These flags are accepted by every command:

FlagEnvDescription
--jsonPrint the data payload as formatted JSON.
--quietOne ID per line for arrays; the ID for single objects; JSON fallback otherwise.
--api-key <key>O3_CODE_API_KEYUse an API key instead of stored OAuth login.
--help, -hShow help for the current command.
--version, -vPrint o3-code v<version> and exit.

Commands

auth

Authentication and session inspection.

o3-code auth login

Authenticate via browser OAuth and store a session token at ~/.o3/code/config.json.

Single-org accounts are selected automatically. With multiple orgs and a TTY, the CLI prompts; with multiple orgs and no TTY, you must pass --organization or the command exits 1 listing the available slugs.

o3-code auth login
o3-code auth login --organization acme

To sign in with an API key — useful for CI or any environment where the OAuth browser flow isn't an option — pass --api-key. The CLI validates the key, stores it at ~/.o3/code/config.json, and clears any prior OAuth session.

o3-code auth login --api-key sk_live_…
o3-code auth login --api-key sk_live_… --organization acme

Returns

The newly authenticated user and active organization.

◇  Authorized!
│  Satya Patel (you@example.com)
│  Organization: Acme
└  Logged in successfully.

--json

{
  userId: string;
  organizationId: string;
  organizationName: string;
}

Options

FlagDescription
--organization <idOrSlug>Selects the active organization without prompting. Required for non-TTY logins when you belong to multiple orgs.
--api-key <key>Store a O3 Code API key (`sk_live_…`) at `~/.o3/code/config.json` instead of running the OAuth flow.

o3-code auth logout

Clear stored credentials — both an OAuth session and a stored API key. Does not call the API and does not clear the active organization (your preferred org persists across re-logins).

o3-code auth logout

Returns

A confirmation message.

Logged out.

--json

{ message: "Logged out." }

o3-code auth whoami

Show the current user, active organization, and auth source.

o3-code auth whoami

Returns

The current user and organization context.

Signed in as Satya Patel (you@example.com)
Organization: Acme
Auth: Session (expires in 32 min)

--json

{
  userId: string;
  email: string;
  name: string;
  organizationId: string;
  organizationName: string;
  authSource: "override" | "config" | "oauth";
}

start

Start the local host server — the daemon the CLI and desktop app both talk to when targeting this machine.

o3-code start

If a manifest exists and the PID is alive, returns the existing instance's details. Otherwise spawns the host server binary, polls /trpc/health.check for up to 10 seconds, and writes the manifest. Binds to 127.0.0.1 only.

o3-code start --daemon

Returns

The running host server.

--json

{
  pid: number;
  port: number;
  organizationId: string;
}

Options

FlagDescription
--daemonRun detached.
--port <n>Specific port. Default: a free loopback port.

stop

Stop the local host server.

o3-code stop

Sends SIGTERM, waits up to 10 seconds, sends SIGKILL if still alive. The manifest is removed in all cases — including when SIGTERM itself throws.

o3-code stop

Returns

The stopped host server, if one was running.

--json

// No manifest
{ running: false }

// Manifest existed
{ pid: number; organizationId: string }

status

Inspect the local host server.

o3-code status

healthy reflects a live health.check request (2-second timeout).

o3-code status

Returns

The host server state. Three shapes depending on what's running.

--json

// No manifest
{ running: false; organizationId: string }

// Manifest exists but PID is dead
{
  running: false;
  stale: true;
  pid: number;
  organizationId: string;
}

// Running
{
  running: true;
  healthy: boolean;
  pid: number;
  port: number;
  endpoint: string;
  organizationId: string;
  uptimeSec: number;
}

update

Update the O3 Code CLI and host server binary.

o3-code update

Downloads the matching o3-code-<platform>.tar.gz from GitHub Releases and atomically replaces the install root. Only available in built binaries; running from bun run dev errors out.

o3-code update                     # upgrade to the latest release
o3-code update --check             # show current → target without installing
o3-code update --version 0.1.2     # install a specific version (up or down)

Returns

The current and target version, plus whether anything changed.

Updated 0.1.4 → 0.1.5 (/Users/you/.local/share/o3-code)

--json

// --check
{
  current: string;
  target: string;
  upToDate: boolean;
  pinned: boolean;
}

// install
{
  current: string;
  target: string;
  updated: boolean;
  installRoot?: string;
}

Options

FlagDescription
--checkOnly check for updates; don't install.
--forceRe-install even if already on that version.
--version <version>Install a specific version (e.g. `0.1.2`) instead of the rolling latest. Accepts upgrade or downgrade.

organization (alias: org)

Manage which organization the CLI targets.

o3-code organization list

List organizations available to the current auth context. Marks the active one.

Human mode: table with NAME, SLUG, ACTIVE.

--quiet: organization IDs.

o3-code organization switch <idOrSlug>

Set the active organization in ~/.o3/code/config.json.

o3-code organization switch acme
o3-code org switch org_…

Arguments

NameDescription
<idOrSlug>requiredOrganization ID or slug.

o3-code organization members list

List members in the active organization.

o3-code organization members list
o3-code org members list -s satya

Options

FlagDescription
--search <query>, -sSearch by name or email.
--limit <n>Default 50.

Human mode: table with NAME, EMAIL, ROLE, ID.

--quiet: member IDs.


projects

A project is a repository registered with your organization. It carries a cloud record (one per repo, shared across the org) and one or more host-side checkouts. Workspaces branch off a host's checkout.

o3-code projects list

List projects in the active organization. Org-wide; not host-scoped.

Human mode: table with NAME, SLUG, REPO, ID.

--quiet: project IDs.

o3-code projects create

Create a fresh project on a host. Two modes:

  • Clone — pass --clone <url> and --parent-dir. The host clones the repo into <parent-dir>/<derived-name>/.
  • Import — pass --import <path> to register a repo that already exists on disk.

Either way, a new cloud project record is created and the host's main workspace is ensured.

create always creates a new cloud project, even if your org already has one for the same Git URL. Use projects setup when adopting an existing project on a fresh machine.

o3-code projects create --name "my-app" --local --clone https://github.com/org/my-app.git --parent-dir ~/code
o3-code projects create --name "my-app" --local --import ~/code/my-app

Options

FlagDescription
--name <name>requiredDisplay name for the project.
--host <id>Target host machineId. Mutually exclusive with `--local`; one is required.
--localTarget this machine. Mutually exclusive with `--host`; one is required.
--clone <url>Clone from a Git URL. Mutually exclusive with `--import`.
--parent-dir <path>Parent directory the cloned repo lands in. Required with `--clone`.
--import <path>Existing repo path on the target host. Mutually exclusive with `--clone`.

o3-code projects setup <id>

Adopt an existing project onto a host without creating a duplicate cloud record. Counterpart to create for the "new machine, repo already in the org" case.

Find the project ID via projects list.

Idempotent: re-running against a project that's already set up at the same path is a no-op that returns the existing mainWorkspaceId.

# Pick an ID from `o3-code projects list`, then clone it onto this machine
o3-code projects setup 47c31b04-… --local --parent-dir ~/code

# Or register an existing local checkout
o3-code projects setup 47c31b04-… --local --import ~/code/my-app

Arguments

NameDescription
<id>requiredProject UUID to adopt.

Options

FlagDescription
--host <id>Target host machineId. Mutually exclusive with `--local`; one is required.
--localTarget this machine. Mutually exclusive with `--host`; one is required.
--parent-dir <path>Parent directory to clone the project's repo into (clone mode). The URL comes from the cloud project, so no `--clone <url>` is needed.
--import <path>Existing repo path on the target host (import mode).
--allow-relocatePermit re-importing at a different path if the project is already set up here. `--import` only.

hosts

Discover hosts registered to the active organization. To control the host server running on this machine, use start, stop, and status.

o3-code hosts list

List hosts registered to the active organization. Host registration happens via o3-code start on each machine — there is no separate registration command.

o3-code hosts list

Human mode: table with ID, NAME, ONLINE.

--quiet: host IDs.


workspaces (alias: ws)

Workspaces are branch-scoped working copies on a host.

Routing: when --host resolves to the local machine, the CLI calls the host server directly over loopback HTTP — no cloud roundtrip, works offline. Otherwise it routes through the cloud API and the relay.

If the resolved host is the local machine but the host server isn't responding, the CLI errors out and points you at o3-code start rather than silently falling through to the cloud.

o3-code workspaces list

List workspaces accessible to the active organization. With neither --host nor --local, the list is organization-wide.

Options

FlagDescription
--host <id>Filter to a specific host machineId.
--localFilter to this machine.

Human mode: table with NAME, BRANCH, PROJECT, HOST.

--quiet: workspace IDs.

o3-code workspaces create

Create a workspace on the target host. Specify exactly one of --branch or --pr. If you pass --agent, you must also pass --prompt.

o3-code workspaces create \
  --project prj_… \
  --name "fix-login-bug" \
  --branch fix/login-bug \
  --local

o3-code workspaces create \
  --project prj_… \
  --name "review-pr-123" \
  --pr 123 \
  --local

Options

FlagDescription
--project <projectId>requiredProject ID.
--name <name>requiredWorkspace name.
--branch <branch>Workspace branch. Required unless `--pr` is set.
--pr <number>Pull request number. Checks out the verified PR head.
--base-branch <branch>Branch to fork from when `--branch` does not exist. Defaults to the project default branch.
--host <id>Target host machineId. Mutually exclusive with `--local`; one is required.
--localTarget this machine. Mutually exclusive with `--host`; one is required.
--agent <preset|uuid|o3-code>Agent to spawn after creation.
--prompt <text>Initial prompt. Required when `--agent` is set.
--attachment <path>Local file to upload for the spawned agent. Repeatable.

o3-code workspaces delete <id...>

Delete one or more workspaces on the target host.

o3-code workspaces delete ws_a ws_b ws_c

Arguments

NameDescription
<id...>requiredWorkspace IDs to delete.

Options

FlagDescription
--host <id>Skip cloud lookup and target this host directly.
--localSkip cloud lookup and target this machine.

o3-code workspaces update <id>

Update a workspace.

o3-code workspaces update ws_… --name "better-name"
o3-code workspaces update ws_… --task-id tsk_…
o3-code workspaces update ws_… --clear-task

Arguments

NameDescription
<id>requiredWorkspace UUID.

Options

FlagDescription
--name <name>New workspace name.
--task-id <id>Link the workspace to a task by id.
--clear-taskUnlink the workspace from its current task. Mutually exclusive with --task-id.

o3-code workspaces open <id>

Open a workspace in the O3 Code desktop app.

o3-code workspaces open ws_…
o3-code workspaces open ws_… --print

Arguments

NameDescription
<id>requiredWorkspace ID.

Options

FlagDescription
--printPrint the deep link instead of opening the desktop app.

agents

Agents are terminal-agent rows configured on a host (the same rows shown in Settings → Agents on that machine). Each row stores a command, args, prompt-transport mode, and environment used to launch the agent in a fresh terminal session inside a workspace.

o3-code agents list

List agents configured on a host. First call on a fresh host seeds the bundled defaults.

o3-code agents list --local
o3-code agents list --host host_…

Options

FlagDescription
--host <id>Target host machineId.
--localTarget this machine. Mutually exclusive with --host; exactly one is required.

Human mode: table with LABEL, PRESET, COMMAND, ID.

--quiet: agent instance IDs.

o3-code agents run

Launch an agent inside an existing workspace. Resolves the host that owns the workspace and starts the named preset (or HostAgentConfig instance) in a fresh terminal session on that host.

o3-code agents run --workspace ws_… --agent claude --prompt "Audit the login flow"
o3-code agents run --workspace ws_… --agent codex --prompt "Review this diff" --attachment ./trace.log

Options

FlagDescription
--workspace <id>requiredWorkspace UUID to run the agent in.
--agent <preset|uuid|o3-code>requiredAgent preset id (e.g. `claude`, `codex`), HostAgentConfig instance UUID, or `o3-code`.
--prompt <text>requiredPrompt sent to the agent.
--attachment-id <uuid>Pre-uploaded attachment UUID; pass repeatedly for multiple attachments.
--attachment <path>Local file path to upload as an attachment. Repeatable.

tasks (alias: t)

Tasks are units of work in your organization's task tracker.

o3-code tasks list

List tasks in the active organization.

o3-code tasks list --assignee-me
o3-code t list -s "auth" --json

Options

FlagDescription
--status <id>Filter by status ID.
--priority <urgent|high|medium|low|none>Filter by priority.
--assignee <userId>Filter by assignee user ID.
--assignee-me, -mTasks assigned to the current user.
--creator-meTasks created by the current user.
--search <query>, -sSubstring search on title.
--limit <n>Default 50.
--offset <n>Default 0.

Human mode: table with SLUG, TITLE, PRIORITY, ASSIGNEE.

--quiet: task IDs.

o3-code tasks get <idOrSlug>

Get a task by ID or slug.

o3-code tasks get tsk_…
o3-code tasks get fix-login-bug

Arguments

NameDescription
<idOrSlug>requiredTask ID or slug.

o3-code tasks create

Create a task.

o3-code tasks create --title "Audit auth flow" --priority high

Options

FlagDescription
--title <title>requiredTask title.
--description <text>Task description.
--priority <urgent|high|medium|low|none>Priority.
--assignee <userId>Assignee user ID.
--status-id <id>Initial status ID.
--estimate <n>Story-point estimate.
--due-date <iso8601>Due date.
--labels <a,b,c>Comma-separated labels.

o3-code tasks update <idOrSlug>

Update a task. Same fields as create, all optional.

o3-code tasks update fix-login-bug --priority urgent

Arguments

NameDescription
<idOrSlug>requiredTask ID or slug.

Options

FlagDescription
--title <title>New title.
--description <text>New description.
--priority <urgent|high|medium|low|none>New priority.
--assignee <userId>New assignee.
--status-id <id>New status ID.
--pr-url <url>Linked pull request URL.
--estimate <n>Story-point estimate.
--due-date <iso8601>Due date.
--labels <a,b,c>Replace labels with a comma-separated list.

o3-code tasks delete <idOrSlug...>

Delete one or more tasks.

o3-code tasks delete tsk_a tsk_b

Arguments

NameDescription
<idOrSlug...>requiredTask IDs or slugs to delete.

o3-code tasks statuses list

List task statuses in the active organization. Use the returned IDs with tasks list --status, tasks create --status-id, or tasks update --status-id.

o3-code tasks statuses list

Human mode: table with NAME, TYPE, POS, ID.

--quiet: status IDs.


automations (alias: auto)

Scheduled agent runs. Schedules use RFC 5545 RRULE bodies, e.g. FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9;BYMINUTE=0.

o3-code automations list

List automations in the active organization.

Human mode: table with ID, NAME, AGENT, SCHEDULE, ENABLED, NEXT RUN.

--quiet: automation IDs.

o3-code automations get <id>

Get an automation's metadata. The prompt body is omitted — use automations prompt get to read it. Use automations logs for run history.

Arguments

NameDescription
<id>requiredAutomation ID.

o3-code automations create

Create an automation. Provide --prompt or --prompt-file; if both are present, the inline --prompt value is used. At least one of --project or --workspace must be provided.

o3-code automations create \
  --name "Weekday triage" \
  --project prj_… \
  --workspace ws_… \
  --rrule "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9;BYMINUTE=0" \
  --prompt-file ./prompts/triage.md

Options

FlagDescription
--name <name>requiredAutomation name.
--prompt <text>Inline prompt.
--prompt-file <path>Read prompt from file, verbatim.
--rrule <rrule>requiredRFC 5545 RRULE schedule.
--timezone <iana>Default: host TZ, then UTC.
--dtstart <iso8601>Default: now.
--workspace <workspaceId>Reuse an existing workspace.
--project <projectId>Project ID for new-workspace-per-run mode.
--host <hostId>Default: owner's online host.
--agent <agent>Host agent presetId, instance UUID, or 'o3-code' for built-in chat. Default: claude.

o3-code automations update <id>

Update an automation's metadata (name, schedule, agent, host). All flags optional. Omitting a flag preserves the existing value — undefined means "no change", not "clear". Use automations prompt get or automations prompt set to read or replace the prompt body.

Arguments

NameDescription
<id>requiredAutomation ID.

Options

FlagDescription
--name <name>New name.
--rrule <rrule>New schedule.
--timezone <iana>New timezone.
--dtstart <iso8601>New start time.
--host <hostId>New target host.
--project <projectId>New v2 project ID.
--workspace <workspaceId>New v2 workspace ID.
--agent <agent>New host agent presetId, instance UUID, or 'o3-code'.
--mcp-scope <a,b,c>Comma-separated MCP scope strings.
--enabled / --no-enabledCalls automation.setEnabled first.

o3-code automations prompt get <id>

Print an automation's prompt body to stdout. The output is the raw prompt with no trailing newline added, so prompt get and prompt set round-trip byte-exactly.

# Read to a file
o3-code automations prompt get aut_… > prompt.md

# Verify a push landed
o3-code automations prompt get aut_… | diff - ./prompt.md

Arguments

NameDescription
<id>requiredAutomation ID.

o3-code automations prompt set <id>

Replace an automation's prompt body. The new prompt fully overwrites the old one.

# Write from file
o3-code automations prompt set aut_… --from-file ./prompt.md

# Write from stdin
cat ./prompt.md | o3-code automations prompt set aut_… --from-file -

Arguments

NameDescription
<id>requiredAutomation ID.

Options

FlagDescription
--from-file <path>requiredRead the new prompt from a file. Use `-` for stdin.

o3-code automations delete <id>

Delete an automation.

o3-code automations delete aut_…

Arguments

NameDescription
<id>requiredAutomation ID.

o3-code automations pause <id>

Pause an automation (sets enabled: false).

o3-code automations pause aut_…

Arguments

NameDescription
<id>requiredAutomation ID.

o3-code automations resume <id>

Resume an automation (sets enabled: true). The API recomputes nextRunAt on resume.

o3-code automations resume aut_…

Arguments

NameDescription
<id>requiredAutomation ID.

o3-code automations run <id>

Dispatch an automation immediately. Does not wait for completion.

o3-code automations run aut_…

Arguments

NameDescription
<id>requiredAutomation ID.

o3-code automations logs <id>

List recent runs for an automation.

o3-code automations logs aut_…

Arguments

NameDescription
<id>requiredAutomation ID.

Options

FlagDescription
--limit <n>Default 20, max 100.

Human mode: table with RUN ID, STATUS, SCHEDULED, DISPATCHED, HOST.

--quiet: run IDs.


Output modes

JSON mode (--json): raw payloads. Lists print arrays, get/create/update print objects, delete prints summary objects. No { "data": ... } wrapper. Empty results print null.

Quiet mode (--quiet): IDs only. Arrays of objects with an id field print one ID per line; single objects print their id; everything else falls back to JSON.

When CLAUDE_CODE, CLAUDECODE, CLAUDE_CODE_ENTRYPOINT, CODEX_CLI, GEMINI_CLI, O3_CODE_AGENT, or CI is set to a non-empty value, output defaults to JSON unless --quiet is provided.

On this page