# Tasks and planning

> Single-task worktrees with a supervised merge, and the planning and proposal commands that ask DeepSeek for plans without executing anything.

Besides the live swarm, RaptorCode has a slower, fully supervised path: a single task in its own worktree, and planning commands that write Markdown instead of running tools.

## Which path to use

| Command | What runs | Where changes land | How they reach your branch |
|---|---|---|---|
| `raptor` or `raptor swarm run` | The live four-agent swarm | Role worktrees | You commit and `git merge` |
| `raptor run "task"` | One agent, headless | The current directory | Directly |
| `raptor task "description"` | Nothing; it prepares a worktree | `.raptor/worktrees/<task-id>` | `raptor merge <task-id> --execute` |
| `raptor swarm "description"` | Planning only | `RAPTOR_PLAN.md` in each role worktree | Nothing to merge |
| `raptor swarm implement <task-id> <role>` | A proposal only | `RAPTOR_IMPLEMENTATION_PROPOSAL.md` | You apply it by hand |

The planning and proposal paths never execute model output: they only write Markdown files.

## Single-task worktrees

```bash
raptor task "Add router tests"
```

Inside a git repository, `raptor task`:

- derives a task id from the description;
- creates the branch `raptor-task-<task-id>` and the worktree `.raptor/worktrees/<task-id>`;
- records the task in `.raptor/tasks/<task-id>.toml` with the status `planned`;
- refuses if the metadata, the branch or the worktree path already exists.

Nothing runs in the worktree until you do. Work there by hand, or start `raptor run` from inside it, and commit on the task branch. Then, from your main checkout, [review, test and merge](https://raptorcode.dev/docs/review-and-merge#merge-a-single-task) it:

```bash
raptor review <task-id>
raptor test <task-id>
raptor merge <task-id>             # dry run
raptor merge <task-id> --execute   # asks you to type MERGE <task-id>
```

### Manage tasks

```bash
raptor task list               # id, status, created, worktree, description
raptor task show <task-id>
raptor task abandon <task-id>  # mark a task you won't merge
raptor task cleanup <task-id>  # delete the worktree of a merged or abandoned task
```

| Status | Meaning |
|---|---|
| `planned` | Created by `raptor task`; not merged or abandoned. |
| `merged` | `raptor merge --execute` succeeded. |
| `merge_conflict` | `raptor merge --execute` stopped on a conflict. |
| `abandoned` | Marked by `raptor task abandon`. |

`raptor task abandon` keeps the metadata, worktree and branch. `raptor task cleanup` works only on `merged` or `abandoned` tasks: it prints what it will delete, asks you to type `CLEANUP <task-id>`, deletes only the worktree directory and runs `git worktree prune`. The metadata, as the local record of the task, and the branch are kept.

## Plan a swarm without running it

```bash
raptor swarm "Add SSO login"
```

This creates the four role branches and worktrees and `.raptor/swarms/<task-id>.toml`, then asks DeepSeek once per role for a plan, sending only the task id and description and that role's template. Each plan is written to `RAPTOR_PLAN.md` in the role worktree; an existing plan is never overwritten.

Without a DeepSeek key, the worktrees and metadata are kept, the run is recorded as `blocked_missing_deepseek_api_key`, and the command tells you where to get a key.

## Turn a plan into a proposal

```bash
raptor swarm implement <task-id> backend-agent
```

This reads that role's `RAPTOR_PLAN.md`, sends DeepSeek the task description, the role and the plan, and writes the answer to `RAPTOR_IMPLEMENTATION_PROPOSAL.md` in the role worktree. Patch-like content in the proposal stays text; applying it is up to you.

> **Info:** Planning and proposals send DeepSeek only the description, the role, its template and the plan, never your repository contents, `.env` files, metadata or secrets.
