RAPTORCODE Docs

Using RaptorCode

Review and merge

Inspect, test and keep agent work. Review and diff every worktree, run the tests, then merge what you accept with git or with a supervised merge.

Agents never merge their own work. After a swarm run or a single task, the changes wait in worktrees until you review them, test them and decide what to keep.

#Inspect the changes

raptor review and raptor diff take a task id and, for swarm runs, an optional role:

raptor review <task-id>                  # every role: status and changed files
raptor review <task-id> security-agent   # one role
raptor diff <task-id>                    # every role: unstaged and staged diffs
raptor diff <task-id> backend-agent      # one role
  • An id is looked up as a single task first, then as a swarm run.
  • The roles are frontend-agent, backend-agent, test-agent and security-agent. Naming a role for a single task is an error.
  • Untracked files are listed by name, without their contents.
  • Both show uncommitted changes only. After you commit in a worktree, compare branches with git instead, for example git diff HEAD...raptor/<task-id>/<role> from your checkout.
  • Neither command writes files or metadata, stages, commits or merges.

#Run the tests

raptor test runs a test command in the task worktree, or in every role worktree of a swarm run:

raptor test <task-id>                              # detect the test command
raptor test <task-id> -- cargo test -p my-crate    # or pass one after --

Without a command it detects one:

Found in the worktreeCommand
Cargo.tomlcargo test
package.json with scripts.testnpm test
Makefile with a test targetmake test

An explicit command must be a test command: the test subcommands of cargo, npm, pnpm, yarn, bun, make and go, or pytest, python -m pytest and uv run pytest. Commands run with structured arguments, without a shell, and the output, exit code and pass or fail are shown per worktree. raptor test fails if any run fails.

Tests execute the code under test, including code an agent wrote, with your permissions and outside the tool policy. Read the diff first when that matters.

#Keep swarm work

Swarm output is merged with plain git. For each role you want to keep, commit inside its worktree, then merge its branch from your main checkout:

git -C .raptor/worktrees/<task-id>/backend-agent add -A
git -C .raptor/worktrees/<task-id>/backend-agent commit -m "Backend for <mission>"
git merge raptor/<task-id>/backend-agent

You can keep some roles and drop others, or cherry-pick single files from a worktree.

All four roles start from the same commit, so their branches can conflict where they touched the same files. Resolve those conflicts as you would for any merge. raptor merge does not handle swarm runs; it reads single-task metadata only.

#Merge a single task

A task created with raptor task has a supervised merge:

Commit on the task branch

Work inside .raptor/worktrees/<task-id> (by hand, or with raptor run started there) and commit. Only committed work is merged.

Dry run

raptor merge <task-id>

It validates the task and its worktree, requires a clean main checkout (RaptorCode’s own .raptor/ state aside), no unresolved conflicts and some changes in the task, then prints the task, the target and task branches, the worktree and the changed files. Nothing is merged.

Execute

raptor merge <task-id> --execute

It repeats the checks, also requires distinct, detectable branches and no uncommitted changes in the task worktree, then asks you to type the confirmation phrase exactly:

MERGE <task-id>

Empty or mismatched input, or no interactive terminal, aborts.

raptor merge --execute runs git merge --no-edit from your checkout and records the task as merged, or as merge_conflict when git stops on a conflict, which it leaves for you to resolve. It never pushes, never resolves conflicts, and never deletes the worktree or the branch.

Because the phrase is read from an interactive terminal only, an agent cannot merge on your behalf: a command started by an agent has no terminal on its input, so it aborts.

#Clean up

  • A finished single task: raptor task cleanup <task-id> (after merged or abandoned) asks for the phrase CLEANUP <task-id>, deletes the worktree directory and runs git worktree prune. The metadata and the branch are kept.
  • A swarm run: remove its worktrees and branches with git, as shown in The live swarm.