sdk/examples/README.md
Learn how to build with the Cline SDK through practical, runnable examples.
Plugins extend the CLI and SDK with custom capabilities. Install them in ~/.cline/plugins/:
./plugins/Plugin module examples showing how to extend the CLI and SDK with custom capabilities:
.cline/pluginsExamples include:
weather-metrics.ts - Weather query toolmac-notify.ts - macOS Notification Center alertscustom-compaction.ts - Custom context compactionautomation-events.ts - Plugin event emissionbackground-terminal.ts - Background shell jobs with loggingmkdir -p ~/.cline/plugins
cp examples/plugins/weather-metrics.ts ~/.cline/plugins/weather-metrics.ts
cline -i "What's the weather like in Tokyo and Paris?"
./plugins/typescript-lsp/TypeScript LSP plugin that gives the agent a goto_definition tool powered by the TypeScript Language Service API. Resolves through imports, re-exports, and type aliases -- much more precise than text search.
createTool() and AgentExtensiontypescript from the target projectcp examples/plugins/typescript-lsp/index.ts ~/.cline/plugins/typescript-lsp.ts
cline -i "Find where createTool is defined"
./plugins/agents-squad/Portable subagent plugin that adds background agent orchestration tools to the CLI and SDK:
.cline/pluginsIncludes pre-configured agents:
Skills available:
mkdir -p ~/.cline/plugins
cp examples/plugins/agents-squad/index.ts ~/.cline/plugins/portable-subagents.ts
cline -i "Use subagents to inspect this repository and report back."
Once loaded, the agent can call tools like start_subagent, message_subagent, get_subagent, list_agent_presets, list_skills, and the handoff tools.
./cron/Example file-based and event-driven automation specs for global ~/.cline/cron/:
Recurring jobs for continuous quality:
Event-driven jobs for PR workflows:
mkdir -p ~/.cline/cron
cp examples/cron/changelog-generator.cron.md ~/.cline/cron/
mkdir -p ~/.cline/cron/events
cp examples/cron/events/pr-changelog-check.event.md ~/.cline/cron/events/
See cron/README.md for full descriptions and usage patterns.
./hooks/Lifecycle hooks written in bash, Python, or TypeScript that intercept agent actions at key points:
Hooks live in .cline/hooks/ and are named after the event they handle (PreToolUse, PostToolUse, TaskStart, etc.):
mkdir -p ~/.cline/hooks
# Bash hook
cp examples/hooks/PreToolUse.sh ~/.cline/hooks/
chmod +x ~/.cline/hooks/PreToolUse.sh
# Or Python
cp examples/hooks/PreToolUse.py ~/.cline/hooks/PreToolUse.py
chmod +x ~/.cline/hooks/PreToolUse.py
# Or TypeScript (runs via bun)
cp examples/hooks/PreToolUse.ts ~/.cline/hooks/PreToolUse.ts
chmod +x ~/.cline/hooks/PreToolUse.ts
cline -i "do something" # Hooks will execute automatically
To use the SDK in your own Node app (outside this monorepo), start with:
npm add @cline/core
Add @cline/agents or @cline/llms only if you intentionally want lower-level control. For RPC client helpers, prefer importing from @cline/core when you want the app-facing SDK surface.
Current SDK layering:
@cline/core owns config discovery/watchers, runtime plugin loading, and the context pipeline@cline/core surface unless they intentionally need lower-level agent or model controlBuilding plugins?
./plugins/ for basic tool and event patterns./plugins/typescript-lsp/ for integration with language services./plugins/agents-squad/ for advanced agent orchestrationBuilding integrations?
./cron/ for automation and event-driven workflowsdesktop-app/, vscode/, and menubar/ for app integration patternsControlling agent behavior?
./hooks/ to intercept and modify tool execution, log actions, or enforce policiesANTHROPIC_API_KEY, OPENAI_API_KEY, or provider-specific key (for SDK examples)