# Config

> Understand where Cline stores configuration and how global and project config work together.

- 网址：https://funcoding.ai/agents/cline/getting-started/config/
- 来源：Cline 官方文档原文（英文），Apache-2.0 许可，同步于 2026-10-11
- 官方原文：https://docs.cline.bot/getting-started/config

---
Cline configuration lives in two scopes:

- **Global configuration** in `~/.cline/` (applies globally across all Cline applications, including IDE, CLI, and SDK)
- **Project configuration** in `.cline/` (applies only to the current workspace)

## Configuration Directory Layout

Cline stores shared configuration across a few well-known locations. The primary root is `~/.cline/`, with structured app state under `~/.cline/data/`:

```text
~/.cline/
  data/
    settings/
      providers.json           # API keys and provider configuration
      global-settings.json     # Global settings
      cline_mcp_settings.json  # MCP settings
    teams/                     # Team state
    sessions/                  # One folder of messages per session
    db/                        # SQLite databases (sessions.db, cron.db, ...)
    logs/                      # CLI and hub logs
  rules/                       # Global rules
  workflows/                   # Global workflows
  hooks/                       # Global hooks
  skills/                      # Global skills
  agents/                      # Global agent definitions
  plugins/                     # Global plugins (.js, .ts)
  cron/                        # Global cron specs
```

Additional global search paths supported by the code:

```text
~/Documents/Cline/
  Rules/                       # Additional global rules
  Hooks/                       # Additional global hooks
  Plugins/                     # Additional global plugins
  Workflows/                   # Additional global workflows
```

Project-level configuration lives in `.cline/` at your repository root:

```text
.cline/
  rules/                       # Project rules
  workflows/                   # Project workflows
  skills/                      # Project skills
  hooks/                       # Lifecycle hooks
  agents/                      # Project agent definitions
  plugins/                     # Project plugins
```

Notes:

- Global provider settings, global settings, and MCP settings are stored under `~/.cline/data/settings/`.
- Global rules, workflows, hooks, skills, agents, plugins, and cron specs resolve directly under `~/.cline/`.
- Rules, hooks, plugins, and workflows may also be discovered from `~/Documents/Cline/` for compatibility.
- In a project, Cline also reads the older `.clinerules/` layout (rules, plus its `workflows/`, `skills/` and `hooks/` folders), `AGENTS.md` at the project root, and skills in `.agents/skills/`. Globally, it also reads `~/.agents/AGENTS.md` and skills in `~/.agents/skills/`.

## What Goes Where?

- Use **global (`~/.cline/`)** for defaults shared across all Cline applications (IDE, CLI, SDK) on your machine.
- Use **project (`.cline/`)** for team-shared behavior that should travel with the repo.

Commit `.cline/` files you want to share with your team. Keep secrets out of the repo.

## Configure Through the CLI

Use the interactive config UI:

```bash
cline config
```

From there, you can view/edit:

- Settings (global + workspace)
- Rules
- Skills
- Hooks

## Useful Configuration Commands

Use a custom configuration directory:

```bash
cline --config /path/to/custom/config "your task"
```

Or via environment variable:

```bash
export CLINE_DIR=/path/to/custom/config
cline "your task"
```

Open the CLI log file (`~/.cline/data/logs/cline.log`, or the file `CLINE_LOG_PATH` names) when troubleshooting:

```bash
cline doctor log
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `CLINE_DIR` | Custom configuration directory (replaces `~/.cline/`), like `--config` |
| `CLINE_DATA_DIR` | Custom data directory (replaces `~/.cline/data/`) |
| `CLINE_HUB_PORT` | Port of the local hub (default: `25463`) |
| `CLINE_HUB_ADDRESS` | Hub address for `cline schedule` commands, like their `--address` option |
| `CLINE_SESSION_BACKEND_MODE` | Force backend mode (`local`, `hub`, `remote`, `auto`) |
| `CLINE_SANDBOX` | Enable sandbox mode |
| `CLINE_SANDBOX_DATA_DIR` | Sandbox session storage directory |
| `CLINE_HOOKS_DIR` | Additional hooks directory |
| `CLINE_LOG_PATH` | CLI log file (default: `~/.cline/data/logs/cline.log`). `cline doctor log` opens it |

### CLINE_DATA_DIR

```bash
export CLINE_DATA_DIR=/custom/path/to/cline
cline "your task"
```

## Related Docs

- [Rules](https://funcoding.ai/agents/cline/customization/cline-rules/)
- [Skills](https://funcoding.ai/agents/cline/customization/skills/)
- [Hooks](https://funcoding.ai/agents/cline/customization/hooks/)
- [Plugins](https://funcoding.ai/agents/cline/customization/plugins/)
- [.clineignore](https://funcoding.ai/agents/cline/customization/clineignore/) (deprecated)

## Security Notes

<div class="callout callout-warning">

Only use rules, hooks, skills, and plugins from sources you trust.

</div>

Hooks and plugins can execute code. Review them like any other executable artifact before adding them globally or to a project.
