> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentopfor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI commands

> Every opfor command and flag.

Three commands: `setup` writes a config, `run` fires a scan from one, and `hunt` runs an autonomous campaign. Run `opfor <command> --help` for the live version any time.

## `opfor setup`

Interactive wizard that writes a timestamped config to `.opfor/configs/`.

| Flag              | Description                                  |
| ----------------- | -------------------------------------------- |
| `--agent`         | Skip the mode prompt, go to the agent wizard |
| `--mcp`           | Skip the mode prompt, go to the MCP wizard   |
| `--empty`         | Write a minimal config without prompts       |
| `--config <path>` | Override the output config path              |
| `--env <path>`    | Load env vars from a non-default `.env` path |

## `opfor run`

Reads a config, fires attacks, judges, and writes the report. With no `--config`, it runs the setup wizard inline first.

| Flag                                                             | Description                                                         |
| ---------------------------------------------------------------- | ------------------------------------------------------------------- |
| `--config <file>`                                                | Config to run. Omit to run the wizard inline                        |
| `--effort <e>`                                                   | Override effort (`adaptive` or `comprehensive`)                     |
| `--turns <n>`                                                    | Override turn count (`1` forces single-turn)                        |
| `--output <dir>`                                                 | Override report parent directory (default `.opfor/reports/`)        |
| `--env <path>`                                                   | Load env vars from a non-default `.env` path                        |
| `--events <path>`                                                | Stream NDJSON run lifecycle events to `<path>` (for CI/automation)  |
| `--objective <text>` / `--objective-file <path>`                 | Steer every evaluator's attacks toward a specific free-text mission |
| `--judge-hint <text>` / `--judge-hint-file <path>`               | Free-text steering for the judge's verdict                          |
| `--business-use-case <text>` / `--business-use-case-file <path>` | Free-text domain/business context for the target agent              |

## `opfor hunt`

Autonomous red-team campaign driven by an AI agent. See the [autonomous mode guide](/cli/autonomous) for details.

<AccordionGroup>
  <Accordion title="Target">
    | Flag                         | Description                                                                                                                                                                                       |
    | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `--endpoint <url>`           | Target HTTP endpoint (required unless a [local-script target](/cli/autonomous#local-script-targets) is given via `--target-config`)                                                               |
    | `--objective <text>`         | Attack objective                                                                                                                                                                                  |
    | `--objective-file <path>`    | Read objective from a file                                                                                                                                                                        |
    | `--target-key-env <var>`     | Env var holding the target API key                                                                                                                                                                |
    | `--target-key <key>`         | Target API key directly                                                                                                                                                                           |
    | `--name <name>`              | Display name for the target                                                                                                                                                                       |
    | `--target-model <id>`        | Model value sent in requests                                                                                                                                                                      |
    | `--stateless` / `--stateful` | Conversation history handling                                                                                                                                                                     |
    | `--session-field <name>`     | Body field for a client-owned session id                                                                                                                                                          |
    | `--target-config <path>`     | JSON file with a run-style `target` block — enables server-owned & header sessions, and [local-script targets](/cli/autonomous#local-script-targets); see [session handling](/reference/sessions) |
  </Accordion>

  <Accordion title="Models">
    | Flag                    | Default  |
    | ----------------------- | -------- |
    | `--model <id>`          | `sonnet` |
    | `--operator-model <id>` | `sonnet` |
    | `--scout-model <id>`    | `haiku`  |
  </Accordion>

  <Accordion title="Limits">
    | Flag                      | Default | Purpose                           |
    | ------------------------- | ------- | --------------------------------- |
    | `--budget-usd <n>`        | `10`    | Hard USD budget (`0` = unlimited) |
    | `--max-operators <n>`     | `6`     | Parallel operators                |
    | `--max-turns <n>`         | `120`   | Total agentic turns               |
    | `--max-thread-turns <n>`  | `25`    | Per-thread depth ceiling          |
    | `--max-total-threads <n>` | `40`    | Total attack threads              |
    | `--max-depth <n>`         | `3`     | Exploration generations           |
    | `--max-recon-probes <n>`  | `8`     | Benign recon probes               |
  </Accordion>

  <Accordion title="Output">
    | Flag               | Default          | Purpose               |
    | ------------------ | ---------------- | --------------------- |
    | `--output <dir>`   | `.opfor/reports` | Report directory      |
    | `--ui`             | off              | Launch live dashboard |
    | `--ui-port <port>` | `3847`           | Dashboard port        |
    | `--env <path>`     | —                | Load a `.env` file    |
  </Accordion>
</AccordionGroup>
