> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/cline/cline/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI reference

> Complete reference for all Cline CLI commands, flags, environment variables, and output formats.

For quick help in your terminal:

```bash theme={null}
cline --help          # Show all commands and global options
cline task --help     # Show options for the task command
cline auth --help     # Show options for the auth command
```

## Synopsis

```bash theme={null}
cline [prompt] [options]
cline <command> [options] [arguments]
```

## Global options

These options are accepted by any command:

| Option             | Description                                                      |
| ------------------ | ---------------------------------------------------------------- |
| `--config <path>`  | Use a custom configuration directory instead of `~/.cline/data/` |
| `-c, --cwd <path>` | Set the working directory for the task or command                |
| `-v, --verbose`    | Show detailed output including model reasoning                   |
| `--help`           | Show help for the command                                        |

## Default command

Running `cline` without a subcommand starts a task or opens interactive mode.

```bash theme={null}
# Open interactive mode (no prompt)
cline

# Start a task with a prompt
cline "your prompt here"

# Resume the most recent task for the current directory
cline --continue
```

**Options:**

| Option                           | Description                                                                        |
| -------------------------------- | ---------------------------------------------------------------------------------- |
| `-a, --act`                      | Start in Act mode. Cline executes actions immediately. (default)                   |
| `-p, --plan`                     | Start in Plan mode. Cline analyzes and plans before acting.                        |
| `-y, --yolo`                     | YOLO mode: auto-approve all actions, plain text output, exit on completion.        |
| `--auto-approve-all`             | Auto-approve all actions while keeping the interactive TUI.                        |
| `-m, --model <id>`               | Override the model for this task (e.g., `claude-sonnet-4-5-20250929`, `gpt-4o`).   |
| `-i, --images <paths...>`        | Attach image files to the prompt.                                                  |
| `--thinking [tokens]`            | Enable extended thinking. Default budget: 1024 tokens. Pass a number to customize. |
| `--reasoning-effort <level>`     | Set reasoning effort: `none`, `low`, `medium`, `high`, or `xhigh`.                 |
| `--max-consecutive-mistakes <n>` | Maximum consecutive mistakes before halting (YOLO mode).                           |
| `--json`                         | Output messages as JSON (one object per line). Forces headless mode.               |
| `--timeout <seconds>`            | Maximum execution time before the task is stopped.                                 |
| `--continue`                     | Resume the most recent task from the current working directory.                    |
| `--double-check-completion`      | Reject the first completion attempt to force re-verification.                      |
| `--auto-condense`                | Use AI-powered context compaction instead of mechanical truncation.                |
| `--hooks-dir <path>`             | Path to an additional hooks directory injected at runtime.                         |
| `--acp`                          | Run in ACP (Agent Client Protocol) mode for editor integration.                    |
| `-T, --taskId <id>`              | Resume an existing task by ID.                                                     |

**Mode selection behavior:**

| Invocation                   | Output mode     | Reason                      |
| ---------------------------- | --------------- | --------------------------- |
| `cline`                      | Interactive TUI | No arguments, TTY connected |
| `cline "prompt"`             | Interactive TUI | TTY connected               |
| `cline -y "prompt"`          | Plain text      | `--yolo` flag               |
| `cline --json "prompt"`      | JSON            | `--json` flag               |
| `cat file \| cline "prompt"` | Plain text      | stdin piped                 |
| `cline "prompt" > out.txt`   | Plain text      | stdout redirected           |

***

## `cline task` (alias: `t`)

Run a new task with a prompt. Equivalent to `cline "prompt"`.

```bash theme={null}
cline task "Create a REST API endpoint"
cline t "Fix the bug in utils.js"
```

Accepts the same options as the default command above, plus:

| Option              | Description                                                             |
| ------------------- | ----------------------------------------------------------------------- |
| `-T, --taskId <id>` | Resume an existing task by ID, optionally sending an additional prompt. |

***

## `cline auth`

Configure authentication with an AI provider.

```bash theme={null}
# Interactive wizard
cline auth

# Non-interactive: Anthropic
cline auth -p anthropic -k sk-ant-api-xxxxx -m claude-sonnet-4-5-20250929

# Non-interactive: OpenAI
cline auth -p openai-native -k sk-xxxxx -m gpt-4o

# Non-interactive: OpenRouter
cline auth -p openrouter -k sk-or-xxxxx -m anthropic/claude-sonnet-4-5-20250929

# Non-interactive: OpenAI-compatible with custom base URL
cline auth -p openai -k your-key -b https://api.example.com/v1
```

**Options:**

| Option                | Description                                                     |
| --------------------- | --------------------------------------------------------------- |
| `-p, --provider <id>` | Provider ID. See supported providers below.                     |
| `-k, --apikey <key>`  | API key for the provider.                                       |
| `-m, --modelid <id>`  | Model ID to use (e.g., `claude-sonnet-4-5-20250929`, `gpt-4o`). |
| `-b, --baseurl <url>` | Base URL for OpenAI-compatible providers.                       |

**Supported providers:**

| Provider ID     | Description                                 |
| --------------- | ------------------------------------------- |
| `anthropic`     | Anthropic Claude (direct API)               |
| `openai-native` | OpenAI GPT models                           |
| `openai-codex`  | ChatGPT subscription via OAuth              |
| `openrouter`    | OpenRouter (multiple providers via one key) |
| `bedrock`       | AWS Bedrock                                 |
| `gemini`        | Google Gemini                               |
| `xai`           | X AI (Grok)                                 |
| `cerebras`      | Cerebras (fast inference)                   |
| `deepseek`      | DeepSeek                                    |
| `moonshot`      | Moonshot AI (Kimi models)                   |
| `ollama`        | Ollama (local models)                       |
| `lmstudio`      | LM Studio (local models)                    |
| `openai`        | Any OpenAI-compatible API                   |

***

## `cline history` (alias: `h`)

Browse task history with pagination.

```bash theme={null}
# Show 10 most recent tasks (default)
cline history

# Show 20 tasks
cline history -n 20

# Show page 2
cline history -n 10 -p 2
```

**Options:**

| Option                 | Description                             |
| ---------------------- | --------------------------------------- |
| `-n, --limit <number>` | Number of tasks to show. Default: `10`. |
| `-p, --page <number>`  | Page number (1-based). Default: `1`.    |

***

## `cline config`

Open the interactive configuration view.

```bash theme={null}
cline config
```

Navigate tabs with arrow keys:

| Tab           | Contents                                                          |
| ------------- | ----------------------------------------------------------------- |
| **Settings**  | Global and workspace-specific settings                            |
| **Rules**     | `.clinerules` files and imported rules (Cursor, Windsurf format)  |
| **Workflows** | Available workflows (shown as slash commands in interactive mode) |
| **Hooks**     | Configured hook scripts                                           |
| **Skills**    | Enabled skills                                                    |

***

## `cline mcp add`

Add an MCP server to `~/.cline/data/settings/cline_mcp_settings.json`.

```bash theme={null}
# STDIO server
cline mcp add my-server -- node /path/to/server.js

# Remote HTTP server
cline mcp add linear https://mcp.linear.app/mcp --type http

# SSE server
cline mcp add my-sse-server https://example.com/sse --type sse
```

**Arguments:**

| Argument               | Description                                                          |
| ---------------------- | -------------------------------------------------------------------- |
| `<name>`               | Name for the MCP server entry                                        |
| `[targetOrCommand...]` | For stdio: use `-- <command> [args]`. For http/sse: provide the URL. |

**Options:**

| Option          | Description                                          |
| --------------- | ---------------------------------------------------- |
| `--type <type>` | Transport type: `stdio` (default), `http`, or `sse`. |

***

## `cline update`

Check for updates and install the latest version.

```bash theme={null}
cline update
```

***

## `cline version`

Print the installed CLI version.

```bash theme={null}
cline version
# Cline CLI version: 2.11.0
```

***

## `cline dev log`

Open the debug log file in your default editor.

```bash theme={null}
cline dev log
```

Useful for diagnosing unexpected behavior or reporting bugs.

***

## Environment variables

### `CLINE_DIR`

Override the default configuration directory:

```bash theme={null}
export CLINE_DIR=/path/to/custom/config
cline "your task"
```

When set, all Cline data — settings, secrets, and task history — is stored in this directory instead of `~/.cline/data/`.

**Use cases:**

* Running isolated Cline instances (e.g., parallel CI jobs)
* Keeping separate configurations for different projects
* Testing configuration changes without touching your main setup

### `CLINE_COMMAND_PERMISSIONS`

Restrict which shell commands Cline is allowed to execute:

```bash theme={null}
export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"], "deny": ["rm -rf *"]}'
```

**Format:**

```json theme={null}
{
  "allow": ["pattern1", "pattern2"],
  "deny": ["pattern3"],
  "allowRedirects": false
}
```

| Field            | Type       | Description                                                                            |
| ---------------- | ---------- | -------------------------------------------------------------------------------------- |
| `allow`          | `string[]` | Glob patterns for permitted commands. If set, only matching commands are allowed.      |
| `deny`           | `string[]` | Glob patterns for denied commands. Deny rules always take precedence over allow rules. |
| `allowRedirects` | `boolean`  | Whether shell redirects (`>`, `>>`, `<`) are permitted. Default: `false`.              |

**Command evaluation order:**

1. Check for dangerous characters (backticks outside single quotes, unquoted newlines)
2. Parse command segments split by operators (`&&`, `||`, `|`, `;`)
3. If redirects are detected and `allowRedirects` is not `true`, deny the command
4. Validate each segment: deny rules are checked first, then allow rules
5. Recursively validate subshell contents (`$(...)` and `(...)`)
6. All segments must pass for the command to be allowed

<Warning>
  When `allow` is set, any command not matching the allow patterns is denied. Use this in security-sensitive environments like shared CI runners.
</Warning>

***

## JSON output format

When using `--json`, each message is written as a JSON object on its own line:

```json theme={null}
{"type":"say","text":"I'll create the file now.","ts":1760501486669,"say":"text"}
```

**Required fields:**

| Field  | Type               | Description                    |
| ------ | ------------------ | ------------------------------ |
| `type` | `"ask"` or `"say"` | Message category               |
| `text` | `string`           | Human-readable message content |
| `ts`   | `number`           | Unix timestamp in milliseconds |

**Optional fields:**

| Field       | Type       | Description                                                        |
| ----------- | ---------- | ------------------------------------------------------------------ |
| `say`       | `string`   | Subtype when `type` is `"say"` (e.g., `"text"`, `"tool"`)          |
| `ask`       | `string`   | Subtype when `type` is `"ask"` (e.g., `"tool"`, `"followup"`)      |
| `reasoning` | `string`   | Model reasoning output (omitted when empty)                        |
| `partial`   | `boolean`  | `true` while the message is still streaming; omitted when complete |
| `images`    | `string[]` | Image data URIs (omitted when empty)                               |
| `files`     | `string[]` | File paths referenced (omitted when empty)                         |

***

## Configuration files

Cline stores all data under `~/.cline/` by default:

```text theme={null}
~/.cline/
├── data/
│   ├── globalState.json          # Global settings
│   ├── secrets.json              # API keys (encrypted at rest)
│   ├── settings/
│   │   └── cline_mcp_settings.json  # MCP server configuration
│   ├── workspace/                # Per-workspace state
│   └── tasks/                    # Task history and conversation logs
└── log/                          # Debug logs (open with cline dev log)
```

The `CLINE_DIR` environment variable or `--config` flag changes the root from `~/.cline/data/` to your specified path.

***

## Examples

### Interactive development

```bash theme={null}
# Open interactive mode
cline

# Start with an initial task
cline "Help me refactor this module to use async/await"

# Start in Plan mode to review strategy first
cline -p "Design a caching layer for the API"
```

### Headless and automation

```bash theme={null}
# Auto-approve everything (YOLO)
cline -y "Run the test suite and fix any failures"

# JSON output piped to jq
cline --json "List all TODO comments" | jq -r 'select(.type == "say") | .text'

# Task with a timeout
cline -y --timeout 600 "Run the full test suite"

# Chain commands
git diff | cline -y "explain" | cline -y "write a commit message"
```

### Piped input

```bash theme={null}
# Summarize a file
cat README.md | cline "Summarize this document"

# Review git changes
git diff | cline "Review these changes for potential issues"

# Analyze test output
npm test 2>&1 | cline -y "Fix any failing tests"

# Review a GitHub PR
gh pr diff 123 | cline -y "Review this PR"
```

### Authentication

```bash theme={null}
# Interactive wizard
cline auth

# Anthropic
cline auth -p anthropic -k sk-ant-api-xxxxx -m claude-sonnet-4-5-20250929

# OpenAI
cline auth -p openai-native -k sk-xxxxx -m gpt-4o

# OpenRouter
cline auth -p openrouter -k sk-or-xxxxx

# OpenAI-compatible with custom base URL
cline auth -p openai -k your-key -b https://api.example.com/v1
```

### Isolated configurations

```bash theme={null}
# Work configuration
cline --config ~/.cline-work "Review this PR"

# Personal configuration with a different model
cline --config ~/.cline-personal -m gpt-4o "Help with this side project"
```

***

## See also

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/cline-cli/installation">
    Install Cline CLI and configure authentication.
  </Card>

  <Card title="Interactive mode" icon="terminal" href="/cline-cli/interactive-mode">
    Keyboard shortcuts, slash commands, and file mentions.
  </Card>

  <Card title="Headless mode" icon="robot" href="/cline-cli/headless-mode">
    Run Cline autonomously in scripts and CI/CD pipelines.
  </Card>
</CardGroup>
