# Interactive REPL

> How the raptor REPL starts, asks for consent, routes each request to the swarm or a single agent, and what you can control with slash commands.

Running `raptor` with no arguments in an interactive terminal opens the REPL. It is the main way to work with RaptorCode: you type what you want, and agents do the work under your supervision.

```bash
cd your-project
raptor
```

## What happens at startup

#### 1. Startup screen and key check

RaptorCode shows its startup screen and finds your DeepSeek key (`DEEPSEEK_API_KEY`, else `~/.raptor/.credentials`). A found key is checked with a free model listing; a rejected one can be replaced on the spot. Without a key, it asks for one and saves it. See [DeepSeek setup](https://raptorcode.dev/docs/deepseek).

#### 2. Consent, once per session

```text
  Allow RaptorCode to execute shell commands and modify files?
  Grants access to the full file system as your user.

  Grant permission? [y/N]:
```

Answer `y` to let agents use tools. Any other answer gives a **chat-only** session: plain answers, no tools and no swarm.

#### 3. Your requests

Type a request and press `Enter`. Where it goes depends on where you are, as described below.

## How requests are routed

| Where you run `raptor` | What a request does |
|---|---|
| Inside a git repository, after consent | Launches the [live swarm](https://raptorcode.dev/docs/swarm) with your request as the mission. Each request is a new run. |
| Outside a git repository, after consent | One agent works directly in the current directory and keeps its conversation across requests. |
| When the swarm cannot start | One agent answers instead, for example when a run for the same mission text already exists. |
| Without consent | Chat only. Nothing is executed. |

> **Note:** A swarm runs four agents in parallel, so expect roughly four times the tokens of a single agent. To keep a single agent in a repository, start [`raptor run`](https://raptorcode.dev/docs/headless) there instead, or run the REPL from a folder that is not a git repository.

## Working with a single agent

A single agent edits your files directly; there is no worktree in between. In a git repository, check its changes with `git status` and `git diff` as usual.

- The agent keeps its conversation across requests, so you can refine the result step by step.
- It stops after 100 steps. Type `continue` to resume where it stopped.
- `/clear` starts a fresh conversation.

## Confirmations

Some actions need your approval even after consent: privileged commands, every `git push`, network tools such as `curl` or `ssh`, power commands and the first write outside the workspace. The REPL shows:

```text
  ⚠  Policy check
  <what the agent wants to do>
  Allow? [y/N]:
```

Refusing tells the agent, which then has to find another way. Catastrophic commands, such as deleting the filesystem root, are refused without asking. The full rules are in the [safety model](https://raptorcode.dev/docs/security#tool-policy).

## Project instructions

The agent reads the first of `RAPTOR.md`, `AGENTS.md` or `CLAUDE.md` it finds in its working directory, or else in the nearest parent directory that contains `.git`, and adds it to its system prompt as guidance from the repository's maintainers (up to 24,000 bytes). Use it for build commands, conventions and things the agent should never do.

> **Warning:** Instruction files are repository content. They cannot change the tool policy, but they can steer what the model asks for. In a repository you don't trust, read them before granting consent.

## Slash commands

| Command | What it does |
|---|---|
| `/help`, `?` | Show the commands |
| `/swarm <mission>` | Launch the live four-specialist swarm |
| `/model` | Pick `deepseek-v4-pro` or `deepseek-flash` (saved as your default) |
| `/effort` | Cycle the thinking effort: low → high → max |
| `/thinking` | Turn thinking mode off or on |
| `/stream` | Turn streamed output off or on |
| `/json` | Ask for JSON-only answers |
| `/balance` | Show your DeepSeek account balance |
| `/api` | Replace the saved API key (never displayed) |
| `/clear` | Start a fresh conversation |
| `/exit`, `/quit` | Leave |

Details for each are in the [REPL commands reference](https://raptorcode.dev/docs/reference/repl-commands).

## Writing good requests

- Describe the outcome, not the steps: *"Add Stripe checkout to the pricing page"* works better than a list of edits.
- Commit first if the work depends on uncommitted changes. Swarm worktrees start from your last commit.
- Keep the agent honest: ask it to run the tests. Agents are prompted to build, test, read exit codes and fix before they finish.
