---
title: "YOLO Mode"
source: https://docs.autohand.ai/working-with-autohand-code/yolo-mode
---

# YOLO Mode

YOLO Mode auto-approves tool calls based on configurable patterns, letting you skip repetitive confirmation prompts for trusted operations while keeping guardrails for dangerous ones.

## Overview

By default, Autohand asks for confirmation before running shell commands, deleting files, and other potentially destructive operations. YOLO Mode lets you selectively bypass these prompts using pattern matching.

``` bash
# Auto-approve everything (use with caution)
autohand --yolo

# Auto-approve with specific patterns
autohand --yolo "allow:npm *,allow:git status,deny:rm *"
```

## Pattern syntax

Patterns control which tool calls are auto-approved. Use comma-separated rules with `allow:` and `deny:` prefixes:

| Pattern | Effect |
|---|---|
| allow:* | Auto-approve all operations |
| allow:npm * | Auto-approve any npm command |
| allow:git status | Auto-approve exact command |
| deny:rm * | Always prompt for rm commands |
| deny:sudo * | Always prompt for sudo commands |

### Rule precedence

Deny rules always take precedence over allow rules. If a command matches both an allow and deny pattern, it will require confirmation.

``` bash
# Allow all npm commands except npm publish
autohand --yolo "allow:npm *,deny:npm publish"

# Allow git operations except force push
autohand --yolo "allow:git *,deny:git push --force*"
```

## Timeout support

Combine YOLO mode with `--timeout` to automatically kill long-running auto-approved commands:

``` bash
# Auto-approve with 30-second timeout
autohand --yolo --timeout 30

# Kill any auto-approved command that runs longer than 60 seconds
autohand --yolo "allow:npm test*" --timeout 60
```

If a command exceeds the timeout, it is killed and the agent is notified so it can adjust its approach.

## Integration with permissions

YOLO mode works alongside the existing permission system. The permission hierarchy is:

1.  **Deny patterns** (highest priority) — Always block
2.  **Config-level deny rules** — From settings.json
3.  **YOLO allow patterns** — Auto-approve matching commands
4.  **Default behavior** — Prompt for confirmation

``` json
// settings.json — deny rules always win over YOLO
{
  "permissions": {
    "deny": ["run_command:rm -rf *", "run_command:sudo *"]
  }
}
```

## Security considerations

-   **Use specific patterns** — Prefer `allow:npm test*` over `allow:*`
-   **Always deny dangerous commands** — Add explicit deny rules for `rm -rf`, `sudo`, `curl | sh`
-   **Set timeouts** — Prevent runaway commands with `--timeout`
-   **Combine with restricted mode** — Use config-level deny patterns as a safety net
-   **CI/CD caution** — In automated pipelines, prefer `--restricted` over `--yolo`

**Tip:** Start with narrow allow patterns and broaden them as you build trust. It is easier to add permissions than to recover from an unintended deletion.

## Examples

### Development workflow

``` bash
# Auto-approve common dev commands
autohand --yolo "allow:npm *,allow:git add*,allow:git commit*,deny:git push --force*"
```

### Test-driven development

``` bash
# Auto-approve test runs with a timeout
autohand --yolo "allow:npm test*,allow:npx vitest*" --timeout 120
```

### Read-only analysis

``` bash
# Auto-approve only read operations
autohand --yolo "allow:git status,allow:git diff,allow:git log,deny:*"
```