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:
- 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
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: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:
--json flag forces headless mode automatically.
JSON message schema:
Example output:
~/.cline/data/tasks/<id>/ui_messages.json.
Including images
Attach one or more images to a headless task with-i:
@:
Setting a timeout
Prevent runaway tasks with--timeout:
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:
~/.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:
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.