# Cline SDK

Guides building AI agents with the Cline SDK, covering runtime, tools, plugins, and teams.

- Repository: https://github.com/cline/cline (71178 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add cline/cline --skill cline-sdk -g -a claude-code -y`
Codex: `npx skills add cline/cline --skill cline-sdk -g -a codex -y`
Cursor: `npx skills add cline/cline --skill cline-sdk -g -a cursor -y`
Gemini CLI: `npx skills add cline/cline --skill cline-sdk -g -a gemini-cli -y`

## Description

Comprehensive Cline SDK skill for building AI agents. Covers the Agent runtime, ClineCore sessions, custom tools, plugins, events, LLM providers, scheduling, multi-agent teams, and production deployment. Use for any task involving @cline/sdk or its sub-packages.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Cline SDK Skill

Consolidated skill for building AI agents with the Cline SDK. Use the decision trees below to find the right entry point and API surface, then load detailed references.

## Critical Rules

Follow these rules in all Cline SDK code:

1. Install with `npm install @cline/sdk`. The `@cline/sdk` package re-exports everything from `@cline/core`, `@cline/agents`, `@cline/llms`, and `@cline/shared`.
2. Requires Node.js 22 or later.
3. Use `createTool()` from `@cline/sdk` (or `@cline/shared`) to define tools. Tool names must be `snake_case`.
4. Return errors as structured data from tool `execute` functions. Throwing counts as a "mistake" against the agent's mistake limit.
5. Use `lifecycle: { completesRun: true }` on tools that should end the agent loop (e.g. a "submit answer" tool).
6. When using `ClineCore`, always call `dispose()` when done to clean up resources.
7. The standalone `Agent` and `ClineCore` have different event systems. For `Agent`: use `agent.subscribe()` to get `AgentRuntimeEvent` types (text streaming is `"assistant-text-delta"`, result text is `result.outputText`). For `ClineCore`: use `cline.subscribe()` to get `CoreSessionEvent` types (text streaming is `"chunk"` with `payload.type === "text"`, result text is `result.text`). There is no top-level `onEvent` field on `AgentRuntimeConfig` -- use `agent.subscribe()` or `hooks.onEvent` instead. Do not use event types like `"content_update"` or `"content_start"` with `agent.subscribe()` -- those are internal legacy types from the ClineCore adapter layer.

## How to Use This Skill

### Reference File Structure

The two main API surfaces (`Agent` and `ClineCore`) follow a 4-file pattern. Cross-cutting concepts are single-file guides.

Each main API surface in `./references/<api>/` contains:

The rest: https://github.com/cline/cline/blob/HEAD/.agents/skills/cline-sdk/SKILL.md
