Skip to main content
Headless mode runs Cline without an interactive UI. It’s designed for automation, scripting, and CI/CD pipelines where no human is present. Cline executes the task, writes output to stdout, and exits when complete. For hands-on development with a terminal UI, see interactive mode instead.
Migrating from Cline CLI 1.x? Instance commands (cline instance new/list/kill) were removed in CLI 2.0. Use cline -y "task" for headless execution instead.

When headless mode activates

Cline enters headless mode automatically when any of the following conditions are met: If none of these apply — for example, running cline or cline "task" in a terminal — Cline launches in interactive mode.

YOLO mode (fully autonomous)

The -y or --yolo flag enables fully autonomous operation. Cline auto-approves all actions and runs without any prompts:
In YOLO mode:
  • All file writes, shell commands, browser actions, and MCP tool calls are approved automatically
  • Output is plain text — no UI rendering
  • The process exits automatically when the task completes
  • Suitable for CI/CD and unattended scripts
YOLO mode gives Cline full autonomy over your working directory. Always run on a clean git branch so you can revert changes if needed.

Controlling the mode before execution

Use -p (Plan) or -a (Act) to control how Cline approaches the task:

Piping context into Cline

Pipe file contents or command output to provide context:
When stdin is piped, Cline automatically enters headless mode — the piped content is prepended to the task prompt as context.

Chaining commands

Pipe Cline’s output into another Cline invocation to build multi-step workflows:

JSON output

Use --json to get machine-readable output, one JSON object per line:
The --json flag forces headless mode automatically. JSON message schema: Example output:
JSON output follows the same schema as task files stored in ~/.cline/data/tasks/<id>/ui_messages.json.

Including images

Attach one or more images to a headless task with -i:
You can also reference images inline using @:

Setting a timeout

Prevent runaway tasks with --timeout:
The value is in seconds. If the task doesn’t complete within the timeout, Cline stops and exits with a non-zero code.

Three core headless workflows

Batch processing

Process multiple files or apply changes across a repository in one pass:

CI/CD integration

Integrate Cline into automated pipelines for code review, testing, and documentation:

Scripting

Build reusable shell scripts that incorporate AI analysis:

Environment variables

Control Cline’s behavior without interactive configuration — useful for CI/CD environments.

CLINE_DIR

Override the configuration directory:
All settings, secrets, and task history are stored in this directory instead of ~/.cline/data/. Use this to:
  • Run isolated Cline instances in parallel (e.g., parallel CI jobs)
  • Separate configurations for different projects or teams
  • Test configuration changes without affecting your main setup

CLINE_COMMAND_PERMISSIONS

Restrict which shell commands Cline can execute:
Examples:
When allow is set, all commands that don’t match the allow patterns are denied. Use this in security-sensitive environments like shared CI runners.

Common use cases

Next steps

Interactive mode

For hands-on development with keyboard shortcuts and slash commands.

CLI reference

Complete documentation for all flags and commands.