| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- ---
- title: "CLI Reference"
- description: "Complete command reference for Cline CLI including configuration, instance management, and task commands"
- ---
- Complete command reference for Cline CLI. Use this for detailed documentation on all commands, options, and configuration.
- For quick help in your terminal:
- ```bash
- cline --help # Show all commands
- cline task --help # Show task-specific commands
- man cline # View the full manual page
- ```
- ## Manual Page
- The complete manual page for the Cline CLI:
- ```
- CLINE(1) User Commands CLINE(1)
- NAME
- cline - orchestrate and interact with Cline AI coding agents
- SYNOPSIS
- cline [prompt] [options]
- cline command [subcommand] [options] [arguments]
- DESCRIPTION
- Try: cat README.md | cline "Summarize this for me:"
- cline is a command-line interface for orchestrating multiple Cline AI
- coding agents. Cline is an autonomous AI agent who can read, write,
- and execute code across your projects. He operates through a
- client-server architecture where Cline Core runs as a standalone
- service, and the CLI acts as a scriptable interface for managing tasks,
- instances, and agent interactions.
- The CLI is designed for both interactive use and automation, making it
- ideal for CI/CD pipelines, parallel task execution, and terminal-based
- workflows. Multiple frontends (CLI, VSCode, JetBrains) can attach to
- the same Cline Core instance, enabling seamless task handoff between
- environments.
- MODES OF OPERATION
- Instant Task Mode
- The simplest invocation: cline "prompt here" immediately spawns
- an instance, creates a task, and enters chat mode. This is
- equivalent to running cline instance new && cline task new &&
- cline task chat in sequence.
- Subcommand Mode
- Advanced usage with explicit control: cline <command>
- [subcommand] [options] provides fine-grained control over
- instances, tasks, authentication, and configuration.
- AGENT BEHAVIOR
- Cline operates in two primary modes:
- ACT MODE
- Cline actively uses tools to accomplish tasks. He can read
- files, write code, execute commands, use a headless browser, and
- more. This is the default mode for task execution.
- PLAN MODE
- Cline gathers information and creates a detailed plan before
- implementation. He explores the codebase, asks clarifying
- questions, and presents a strategy for user approval before
- switching to ACT MODE.
- INSTANT TASK OPTIONS
- When using the instant task syntax cline "prompt" the following options
- are available:
- -o, --oneshot
- Full autonomous mode. Cline completes the task and stops
- following after completion. Example: cline -o "what's 6 + 8?"
- -s, --setting setting value
- Override a setting for this task
- -y, --no-interactive, --yolo
- Enable fully autonomous mode. Disables all interactivity:
- • ask_followup_question tool is disabled
- • attempt_completion happens automatically
- • execute_command runs in non-blocking mode with timeout
- • PLAN MODE automatically switches to ACT MODE
- -m, --mode mode
- Starting mode. Options: act (default), plan
- -w, --workspace path
- Additional workspace paths. Can be specified multiple times to
- include multiple directories. The current working directory is
- always included as the first workspace. Example: cline -w
- /path/to/other/project "refactor shared code"
- GLOBAL OPTIONS
- These options apply to all subcommands:
- -F, --output-format format
- Output format. Options: rich (default), json, plain
- -h, --help
- Display help information for the command.
- -v, --verbose
- Enable verbose output for debugging.
- COMMANDS
- Authentication
- cline auth [provider] [key]
- cline a [provider] [key]
- Configure authentication for AI model providers. Launches an
- interactive wizard if no arguments provided. If provider is
- specified without a key, prompts for the key or launches the
- appropriate OAuth flow.
- Instance Management
- Cline Core instances are independent agent processes that can run in
- the background. Multiple instances can run simultaneously, enabling
- parallel task execution.
- cline instance
- cline i
- Display instance management help.
- cline instance new [-d|--default]
- cline i n [-d|--default]
- Spawn a new Cline Core instance. Use --default to set it as
- the default instance for subsequent commands.
- cline instance list
- cline i l
- List all running Cline Core instances with their addresses and
- status.
- cline instance default address
- cline i d address
- Set the default instance to avoid specifying --address in task
- commands.
- cline instance kill address [-a|--all]
- cline i k address [-a|--all]
- Terminate a Cline Core instance. Use --all to kill all running
- instances.
- Task Management
- Tasks represent individual work items that Cline executes. Tasks
- maintain conversation history, checkpoints, and settings.
- cline task [-a|--address ADDR]
- cline t [-a|--address ADDR]
- Display task management help. The --address flag specifies
- which Cline Core instance to use (e.g., localhost:50052).
- cline task new prompt [options]
- cline t n prompt [options]
- Create a new task in the default or specified instance.
- Options:
- -s, --setting setting value
- Set task-specific settings
- -y, --no-interactive, --yolo
- Enable autonomous mode
- -m, --mode mode
- Starting mode (act or plan)
- cline task open task-id [options]
- cline t o task-id [options]
- Resume a previous task from history. Accepts the same options
- as task new.
- cline task list
- cline t l
- List all tasks in history with their id and snippet
- cline task chat
- cline t c
- Enter interactive chat mode for the current task. Allows
- back-and-forth conversation with Cline.
- cline task send [message] [options]
- cline t s [message] [options]
- Send a message to Cline. If no message is provided, reads from
- stdin. Options:
- -a, --approve
- Approve Cline's proposed action
- -d, --deny
- Deny Cline's proposed action
- -f, --file FILE
- Attach a file to the message
- -y, --no-interactive, --yolo
- Enable autonomous mode
- -m, --mode mode
- Switch mode (act or plan)
- cline task view [-f|--follow] [-c|--follow-complete]
- cline t v [-f|--follow] [-c|--follow-complete]
- Display the current conversation. Use --follow to stream
- updates in real-time, or --follow-complete to follow until task
- completion.
- cline task restore checkpoint
- cline t r checkpoint
- Restore the task to a previous checkpoint state.
- cline task pause
- cline t p
- Pause task execution.
- Configuration
- Configuration can be set globally. Override these global settings for
- a task using the --setting flag
- cline config
- cline c
- cline config set key value
- cline c s key value
- Set a configuration variable.
- cline config get key
- cline c g key
- Read a configuration variable.
- cline config list
- cline c l
- List all configuration variables and their values.
- Context Window Configuration
- For local model providers, you can configure the context window size:
- Ollama
- cline config s ollama-api-options-ctx-num=32768
- LM Studio
- cline config s lm-studio-max-tokens=32768
- For other providers (Anthropic, OpenRouter, etc.), the context window
- is defined per model in the model metadata and is not user-settable.
- Cline uses each model's built-in context limits automatically.
- TASK SETTINGS
- Task settings are persisted in the ~/.cline/x/tasks directory. When
- resuming a task with cline task open, task settings are automatically
- restored.
- Common settings include:
- yolo Enable autonomous mode (true/false)
- mode Starting mode (act/plan)
- hooks_enabled
- Enable or disable hooks for the task (true/false)
- HOOKS INTEGRATION
- Hooks let you inject custom logic into Cline's workflow at key moments.
- They can validate operations before they execute, monitor tool usage,
- and shape AI decisions. This allows you to integrate hooks into
- automated workflows, CI/CD pipelines, and headless task execution.
- Enable hooks for a task:
- cline "prompt" -s hooks_enabled=true
- Configure hooks globally:
- cline config set hooks-enabled=true
- cline config get hooks-enabled
- Note: Hooks in the CLI are only supported on macOS and Linux.
- For complete hooks documentation, see:
- <https://docs.cline.bot/features/hooks/index>
- NOTES & EXAMPLES
- The cline task send and cline task new commands support reading from
- stdin, enabling powerful pipeline compositions:
- cat requirements.txt | cline task send
- echo "Refactor this code" | cline -y
- Instance Management
- Manage multiple Cline instances:
- # Start a new instance and make it default
- cline instance new --default
- # List all running instances
- cline instance list
- # Kill a specific instance
- cline instance kill localhost:50052
- # Kill all CLI instances
- cline instance kill --all-cli
- Task History
- Work with task history:
- # List previous tasks
- cline task list
- # Resume a previous task
- cline task open 1760501486669
- # View conversation history
- cline task view
- # Start interactive chat with this task
- cline task chat
- ARCHITECTURE
- Cline operates on a three-layer architecture:
- Presentation Layer
- User interfaces (CLI, VSCode, JetBrains) that connect to Cline
- Core via gRPC
- Cline Core
- The autonomous agent service handling task management, AI model
- integration, state management, tool orchestration, and real-time
- streaming updates
- Host Provider Layer
- Environment-specific integrations (VSCode APIs, JetBrains APIs,
- shell APIs) that Cline Core uses to interact with the host
- system
- BUGS
- Report bugs at: <https://github.com/cline/cline/issues>
- For real-time help, join the Discord community at:
- <https://discord.gg/cline>
- SEE ALSO
- Full documentation: <https://docs.cline.bot>
- AUTHORS
- Cline is developed by the Cline Bot Inc. and the open source community.
- COPYRIGHT
- Copyright © 2025 Cline Bot Inc. Licensed under the Apache License 2.0.
- ```
- ## JSON output (-F json)
- When you run a command with `-F json` (or `--output-format json`), Cline prints each client message as JSON.
- ### ClineMessage schema
- | Field | Type | Required | Notes |
- |-------|------|----------|-------|
- | `type` | `"ask" or "say"` | Yes | Top-level message category. |
- | `text` | `string` | Yes | Human-readable message content. |
- | `ts` | `number` | Yes | Unix epoch timestamp in milliseconds. |
- | `reasoning` | `string` | No | Omitted when empty. |
- | `say` | `string` | No | Omitted when empty. Present when `type` is `"say"`. |
- | `ask` | `string` | No | Omitted when empty. Present when `type` is `"ask"`. |
- | `partial` | `boolean` | No | Omitted when false. `true` for streaming updates. |
- | `images` | `string[]` | No | Omitted when empty. Image URIs when included with a message. |
- | `files` | `string[]` | No | Omitted when empty. File paths when attached to a message. |
- | `lastCheckpointHash` | `string` | No | Omitted when empty. Git checkpoint hash when available. |
- | `isCheckpointCheckedOut` | `boolean` | No | Omitted when false. `true` if Cline checked out a checkpoint. |
- | `isOperationOutsideWorkspace` | `boolean` | No | Omitted when false. `true` if an operation happened outside the workspace. |
- <Note>
- Most fields are optional and omitted when empty. If you parse this output, treat missing fields as “not present”, not as empty strings.
- </Note>
- ### Example
- ```json
- {
- "type": "say",
- "text": "Cline is about to run a command.",
- "ts": 1760501486669,
- "say": "command",
- "partial": false
- }
- ```
- ### Shell Completion
- Generate autocompletion scripts for various shells:
- #### Bash
- ```bash
- # Generate bash completion
- cline completion bash > /etc/bash_completion.d/cline
- # Or for user-level installation
- cline completion bash > ~/.local/share/bash-completion/completions/cline
- ```
- #### Zsh
- ```bash
- # Generate zsh completion
- cline completion zsh > "${fpath[1]}/_cline"
- # Or add to your .zshrc
- echo 'source <(cline completion zsh)' >> ~/.zshrc
- ```
- #### Fish
- ```bash
- # Generate fish completion
- cline completion fish > ~/.config/fish/completions/cline.fish
- ```
- #### PowerShell
- ```powershell
- # Generate PowerShell completion
- cline completion powershell > cline.ps1
- # Add to your PowerShell profile
- Add-Content $PROFILE "cline completion powershell | Out-String | Invoke-Expression"
- ```
- ### Version Command
- ```bash
- # Show version information
- cline version
- ```
- ### Environment Variables
- #### CLINE_DIR
- Override the default Cline directory location:
- ```bash
- # Override default Cline directory
- export CLINE_DIR=/custom/path
- # Default: ~/.cline
- ```
- This directory is used for:
- - Instance registry database
- - Configuration files
- - Task history
- - Checkpoints
|