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

# Autopilot Mode

> AI-generated execution plans with multi-agent orchestration

Autopilot mode uses an AI planner to analyze complex tasks and generate execution plans that leverage multiple agents' strengths. Each step in the plan is assigned to the most suitable agent (claude, gemini, codex, ollama) based on what it does best.

## Usage

### TUI (Interactive)

```bash theme={null}
/autopilot "<task>"
/planner <agent>     # set planner agent
/execute             # toggle auto-execution
/interactive         # toggle pause between steps
```

### CLI

```bash theme={null}
puzldai autopilot "<task>" [-p planner] [-x] [-i]
```

| Flag | Description |
| - | - |
| `-p` | Agent to use for planning (default: ollama) |
| `-x` | Execute the plan after generating |
| `-i` | Interactive mode - prompt before each step |

### Examples

```bash theme={null}
# TUI: Generate and review a plan
/autopilot "Build user authentication with JWT"

# CLI: Full autonomous execution with claude as planner
puzldai autopilot "Refactor the API layer" -p claude -x

# CLI: Interactive execution (approve each step)
puzldai autopilot "Add unit tests for utils" -p claude -x -i
```

## How It Works

**1. Analyze Task**

The planner agent analyzes the task and determines what steps are needed.

**2. Assign Agents**

For each step, the planner selects the best agent based on their strengths:

* **claude**: Code writing, architecture, creative tasks
* **gemini**: Analysis, research, planning
* **codex**: Debugging, security, code review
* **ollama**: Simple queries, fast local responses

**3. Generate Plan**

A 1-5 step execution plan is created, with each step showing the assigned agent and action.

**4. Execute (optional)**

If `/execute` is enabled, steps run in sequence. Each step receives the output from previous steps.

## Agent Assignment

The planner automatically matches agents to tasks:

| Task Type | Recommended Agent |
| - | - |
| Write code, generate files | claude |
| Analyze requirements, plan architecture | gemini |
| Review code, find bugs, security check | codex |
| Quick lookups, simple transformations | ollama |

## Configuration

### Planner Agent

Set which agent creates the execution plan:

```bash theme={null}
# TUI
/planner claude

# CLI
puzldai autopilot "task" -p claude
```

### Execution Mode

Control how the plan is executed:

| Mode | Description |
| - | - |
| Plan only | Generate plan without executing (default) |
| Auto-execute (`/execute`) | Execute all steps automatically |
| Interactive (`/interactive`) | Pause and confirm before each step |

To enable execution in TUI:

```bash theme={null}
/execute           # toggle auto-execution on
/autopilot "task"  # now runs the plan automatically
```

## Keyboard Shortcuts

| Key | Action |
| - | - |
| `Escape` | Hide view (keeps running) |
| `Ctrl+E` | Return to autopilot view |
| `Ctrl+C` | Cancel operation |

## Example Output

```
─── Autopilot [Autopilot Mode] ───

Generated Plan:
━━━━━━━━━━━━━━━━

1. [gemini] analyze
   Break down the authentication requirements and identify components

2. [claude] code
   Implement JWT token generation and validation utilities

3. [claude] code
   Create login and register API endpoints

4. [codex] review
   Review implementation for security vulnerabilities

Use /execute to enable auto-execution
```

## Tips

> [!TIP]
>
> **Claude makes a great planner** - For complex tasks, use `/planner claude` to get more detailed, well-structured plans.

> [!TIP]
>
> **Start with plan-only mode** - Review the generated plan before enabling `/execute` to ensure the agent assignments make sense.

> [!TIP]
>
> **Use interactive for learning** - Enable `/interactive` to see how each agent handles its assigned step.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.