Headless mode runs Cline without an interactive interface — perfect for automation, scripting, and CI/CD pipelines where human interaction isn’t possible or desired. Cline executes tasks, produces clean text or JSON output, and exits when complete. For collaborative, conversational development, see Interactive Mode instead.Documentation Index
Fetch the complete documentation index at: https://docs.cline.bot/llms.txt
Use this file to discover all available pages before exploring further.
Migrating from an older CLI version? Instance commands (
cline instance new/list/kill) have been removed in Cline CLI 2.0. The new architecture is simpler — just use cline -y "task" for headless execution.When Headless Mode Activates
Cline automatically enters headless mode when any of these conditions are met:| Invocation | Reason |
|---|---|
cline -y "task" | -y/--yolo flag forces headless |
cline --json "task" | --json flag forces headless |
cat file | cline "task" | stdin is piped |
cline "task" > output.txt | stdout is redirected |
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 approves all actions and runs without prompts:
- All actions are auto-approved
- Output is plain text (non-interactive)
- Process exits automatically when complete
- Perfect for CI/CD and scripts
Mode Selection
Control whether Cline plans first or acts immediately:Piping Context
Pipe file contents or command output into Cline to provide context:Chaining Commands
Pipe Cline’s output into another Cline instance for multi-step workflows:JSON Output
Use--json for machine-readable output that’s easy to parse in scripts:
~/.cline/data/tasks/<id>/ui_messages.json.
JSON Message Schema:
| Field | Type | Description |
|---|---|---|
type | "ask" or "say" | Message category |
text | string | Message content |
ts | number | Unix timestamp (ms) |
reasoning | string | (Optional) Model reasoning |
partial | boolean | (Optional) Streaming flag |
Including Images
Attach images to your headless task:Timeout Control
Set a maximum execution time to prevent runaway tasks:Environment Variables
Control Cline behavior via environment variables — useful for CI/CD where you can’t use interactive configuration. CLINE_DIR — Custom configuration directory:CI/CD Integration
GitHub Actions Example
Automate PR reviews with Cline:Shell Script Example
Create a reusable code review script:Common Use Cases
| Use Case | Example |
|---|---|
| Code review | git diff | cline -y "Review these changes" |
| Fix test failures | cline -y "Run tests and fix any failures" |
| Generate release notes | git log --oneline v1.0..v1.1 | cline -y "Write release notes" |
| Fix lint errors | cline -y "Fix all ESLint errors in src/" |
| Update dependencies | cline -y "Update dependencies with known vulnerabilities" |
| Migrate code patterns | cline -y "Update all deprecated React lifecycle methods" |
| PR automation | gh pr diff 123 | cline -y "Review this PR" |
| Batch processing | cline -y --json "List all TODO comments" | jq '.text' |
Next Steps
Interactive Mode
For hands-on development with keyboard shortcuts, slash commands, and file mentions.
CLI Reference
Complete command documentation with all flags and options.
Configuration
Environment variables, rules, and advanced settings.
CLI Samples
Real-world examples of headless workflows and automation patterns.

