Start a campaign
Run/campaign with the objective:
- Asks the current model to split the objective into up to three subtasks, each with a role and a task.
- Starts one worker agent for each subtask. The workers run at the same time, each in its own context.
- When all workers finish, asks the model to combine their results into one response in the chat.
Campaign starting: and the objective while o4 plans the
subtasks. Only one /campaign runs at a time. A /campaign you type while
one starts or runs, or while the model is working, waits:
Queued '/campaign' until the active task finishes.
/campaign works only in a session that runs in this window. In a session
that runs in the o4 daemon it
shows Campaign UI is only available for local sessions. The model’s
campaign tool, described below, still works there, with these differences:
a worker’s tool call that would ask in the session asks you too, the
campaign runs no harness sensors, and it keeps its campaign files in your
system’s temporary folder instead of .o4/campaign/.
Watch a campaign
A running campaign and its workers appear in Ringside (/agents).
Run /agents to open it, select a worker, and press Enter twice — once
for its details, once to open its output. See
todos and background tasks
for the dashboard keys.
Cancel a campaign
PressCtrl+C with an empty prompt to cancel a campaign that is starting or
running. The chat shows Interrupted, and the campaign’s row on the Task
Board reads cancelled. If the main agent is also running a turn, the first
Ctrl+C stops that turn and the campaign keeps going; press it again to
cancel the campaign.
An open approval prompt or panel also takes Ctrl+C first. To stop a single
worker instead, select it in /agents and press x.
Results and campaign files
When the workers finish, the combined result appears in the chat. If every worker failed, o4 says so instead of combining results. o4 keeps each campaign’s state in.o4/campaign/<id>/ in your project:
A
/campaign that fails before its workers start writes failure.json to
.o4/campaign/startup-<id>/ instead.
/campaign also runs as a background task named Campaign: <objective>.
Press Alt+B to open the Task Board, select that row, and press Enter:
its output opens in the chat area, a short summary and the path to the full
result or failure file.
Validation with harness sensors
o4 validates each worker’s result after the workers finish. If your project has a.o4/harness.toml file that defines sensors (commands that check the
work, such as a test or lint command), o4 also runs the sensors that apply to
the campaign’s objective, without asking, and records their results in
result.json. With the sequential strategy, it also runs them after each
worker. A campaign counts as failed if a worker fails or a blocking sensor
fails. o4 reads .o4/harness.toml only in trusted workspaces. See
workspace trust, and
Harness guides and sensors for the file format.
The campaign tool
The model can start a campaign itself with thecampaign tool. It asks for
approval every time. With the tool, the model chooses the workers and their
roles directly, and it can pick a strategy:
Each worker takes a
role, a task, and an optional model. Without a
model, a worker uses its agent definition’s model, then the session’s
current model. A model you chose for an agent in /sub-agents doesn’t apply
to campaign workers. The tool also takes
timeout_secs, a time limit for each worker in seconds. Without it, workers
have no time limit. In o4 0.4.23 the tool’s auto_approve option has no
effect: whatever it says, workers in a window session never ask for
approval.
A worker’s role can name an agent definition, such as a custom agent from
.o4/agents/. If no definition matches, the worker uses the built-in
General agent. See subagents.
Campaigns and worktrees
Campaign workers don’t get their own worktrees. When you want parallel changes kept apart, ask the model to use subagents with worktree isolation instead. Each one then works in its own git worktree on its own branch, and o4 keeps any worktree with changes so you can review and merge it. See run a subagent in its own worktree. The main session can make worktrees too, with theenter_worktree tool. It
creates a worktree under .o4/worktrees/ on a new branch that starts from
the remote’s default branch (origin/HEAD, else origin/main or
origin/master, as of your last git fetch), or from the current commit
when there’s no remote. The model can name the branch, for example
fix/tab-guards. The session stays in your project folder and works in the
worktree by its path, so other tabs aren’t affected, and it can have several
worktrees at once. exit_worktree removes one. With merge, it merges the
worktree’s branch into your current branch first. It won’t discard a
worktree with uncommitted changes unless the model passes force. When you
close the tab or quit o4, o4 removes the session’s worktrees that have no
uncommitted or unpushed work. Both tools ask for approval once per session.
See Tools.
Related pages
- Subagents: hand one task to an agent with its own context.
- Todos and background tasks: watch and stop running work.
- Git and code review: review and commit changes.