Skip to main content
The SDK repository includes installable plugin examples under examples/plugins/. Use them as starting points for tools, lifecycle hooks, message rewriting, policy enforcement, background jobs, and multi-agent workflows.

Examples

Try a File Plugin with the CLI

The CLI auto-discovers plugins from .cline/plugins in the workspace, ~/.cline/plugins, and the system plugins folder.
Swap weather-metrics.ts for any other single-file plugin example.

Block Ignored File Access

Use gitignore-read-files-guard.ts to block tools from reading or editing files ignored by workspace .gitignore files:
The guard uses the beforeTool runtime hook. When a read_files, editor, or apply_patch call targets an ignored workspace file, the hook returns { skip: true }, so the tool records a policy error and does not access the file.

Install a Directory Plugin

For a plugin that lives in a directory with its own package.json, use cline plugin install:
See Installing Plugins for more install options. The web-search.ts plugin registers a web_search tool backed by Exa. Use web_search to discover relevant URLs, then use fetch_web_content when the agent needs to inspect a specific page.
EXA_API_KEY authenticates the search backend. The CLI still needs a normal model provider key or saved provider auth for inference.

Custom Message Compaction

Use registerMessageBuilder when a plugin needs to rewrite the provider-bound message list before the model call. Prefer the message-builder version for normal compaction. It runs in the core message pipeline before the built-in safety builder, multiple builders run in registration order, and the final pass enforces provider-safe truncation.

Background Terminal Plugin

background-terminal.ts registers three tools for long-running shell jobs: When notifyParent is true, the plugin emits a steer_message after the command exits, pushing a completion summary back into the active session so the agent can react to long-running commands without blocking the original tool call.