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

# Execution Modes

> Control how much autonomy the agent has

Fliiq has three execution modes that control agent autonomy. Choose the right mode based on how much oversight you want.

## Plan Mode

The agent creates a structured plan but does not execute anything. You review the plan and decide whether to approve, revise, or reject it.

```bash theme={null}
fliiq run "refactor the auth module" --mode plan
fliiq plan "refactor the auth module"  # shortcut
```

**What happens:**

1. Agent analyzes the task and creates a TODO list
2. Agent calls the `plan_complete` tool when the plan is ready
3. You see the plan and choose: **approve** (transitions to supervised mode), **revise** (agent adjusts), or **reject** (agent stops)

**Available tools:** Only `todo`, `ask_user`, `ask_user_choice`, and `plan_complete`. Execution tools (shell, write\_file, etc.) are blocked.

**Use when:** You want to understand the approach before any changes are made. Complex refactors, unfamiliar codebases, or tasks where you want to shape the strategy.

## Supervised Mode

The agent executes step-by-step, pausing before each tool call for your approval.

```bash theme={null}
fliiq run "add user authentication" --mode supervised
fliiq --mode supervised
```

**What happens:**

1. Agent decides to call a tool (e.g., `write_file`)
2. You see the tool name and parameters
3. You choose: **y** (approve this call), **n** (skip it), or **a** (approve all remaining)

**Use when:** You trust the agent's judgment but want visibility and veto power. New integrations, production code changes, or when learning what the agent does.

## Autonomous Mode

The agent executes fully without interruption. It picks tools, runs them, evaluates results, and continues until the task is done.

```bash theme={null}
fliiq run "what time is it" --mode autonomous
```

**What happens:**

1. Agent runs the full loop: plan → execute → evaluate → repeat
2. Results are displayed when complete
3. Full [audit trail](/guides/audit) saved to `.fliiq/audit/`

**When the agent encounters ambiguity** (e.g., multiple valid approaches), it auto-selects the recommended option from `ask_user_choice` instead of pausing to ask.

**Use when:** Routine tasks, exploration, or when you've built trust with the agent's behavior. Quick questions, file operations, web searches.

## Switching Modes

### At startup

```bash theme={null}
fliiq --mode plan              # Start in plan mode
fliiq run "task" --mode supervised
```

### Mid-conversation

In the REPL or TUI, use the `/mode` command to cycle through modes:

```
/mode
```

Cycles: plan → supervised → autonomous → plan

The mode indicator in the TUI updates to show the current mode. The agent's system prompt is rebuilt with new mode instructions.

## Mode Comparison

|                                  | Plan             | Supervised           | Autonomous           |
| -------------------------------- | ---------------- | -------------------- | -------------------- |
| **Agent executes tools**         | No               | Yes, with approval   | Yes, freely          |
| **User approves each step**      | Plan only        | Each tool call       | No                   |
| **Ambiguous choices**            | Agent asks       | Agent asks           | Agent auto-selects   |
| **[Audit trail](/guides/audit)** | Plan only        | Full                 | Full                 |
| **Best for**                     | Strategy, review | Learning, production | Routine, exploration |

## Cancellation

In any mode, you can cancel the agent mid-execution:

* **TUI (`fliiq tui`):** Press `Esc`
* **REPL (`fliiq`):** Press `Ctrl+C`
* **Single-shot (`fliiq run`):** Press `Ctrl+C`

The agent stops cooperatively between tool calls and returns any partial results.
