Skip to main content
Plugins are packages of reusable agent capabilities. They let you bundle tools, lifecycle hooks, commands, and configuration into a single module that can be shared across projects or published for others to use.

Benefits of Plugins

Extension Glossary

What is a Plugin?

A plugin is an AgentPlugin — an object that implements the SDK’s extension interface. It can register tools, hook into agent lifecycle events, and provide configuration defaults.
Hooks are defined inside the hooks object, not directly on the extension. The available lifecycle hooks are beforeRun, afterRun, beforeModel, afterModel, beforeTool, afterTool, and onEvent.

Next Steps

Register with ClineCore:

File-Based Plugins

ClineCore supports plugin module paths via pluginPaths in session config:
Plugin files export an AgentPlugin.

Installing Plugins via CLI

Plugins can also be installed from file URLs, npm, git, or local paths using cline plugin install. See Plugins for install commands, the manifest format, and directory layout.

Hook Stages

Hook stages include:
Common stages:

Hook Policies

Hook policies control execution behavior: Use fail_closed for policy-enforcement hooks where bypassing the hook is unsafe.

Build a Plugin

For a step-by-step plugin tutorial, see Writing Plugins.

SDK Examples

The SDK repository includes ready-to-run plugin examples under examples/plugins/, including tool registration, lifecycle metrics, notifications, custom compaction, policy guards, web search, background jobs, TypeScript LSP tools, and multi-agent teams. See Plugin Examples for the full list and usage commands.