Plugin System

Description

The Plugin System provides a marketplace runtime for extending Claude Code with third-party capabilities. Plugins can add new tools, register hooks-system callbacks, provide custom agent types, and bundle skill-system workflows. The system includes dependency resolution with cycle detection, versioning, and support for three distinct agent type categories: BuiltIn, Custom, and Plugin.

Agent Types

Type Source Characteristics
BuiltIn Shipped with Claude Code Core tools like Bash, Read, Write, Edit, Grep, Glob; always available
Custom User-defined in settings Added via settings.json or .claude/ configuration; scoped to a project or user
Plugin Marketplace Installed from the plugin marketplace; can declare dependencies on other plugins

Dependency Resolution

When plugins declare dependencies on other plugins, the system performs a topological sort to determine load order. A cycle detection algorithm (Kahn's algorithm variant) runs during resolution and raises an error if any circular dependency is found. This prevents infinite loops during plugin initialization and ensures deterministic load ordering.

Plugin Lifecycle

  1. Discovery -- The runtime scans configured plugin directories and the marketplace cache.
  2. Resolution -- Dependencies are resolved and a load order is computed.
  3. Initialization -- Each plugin's init() is called in dependency order, receiving a context object with access to the hook registry, tool registry, and configuration store.
  4. Runtime -- The plugin's tools and hooks are active for the duration of the session.
  5. Teardown -- On SessionEnd, plugins are torn down in reverse dependency order.

Marketplace Distribution

Plugins distributed through the marketplace are packaged as versioned bundles with a manifest declaring their tools, hooks, required permissions, and dependencies. The marketplace enforces code signing and review before listing. Users install plugins via claude plugin install <name>, and the CLI handles downloading, signature verification, and registration.

Security Considerations

Plugins run within the same process as Claude Code and have access to the same permission-pipeline as built-in tools. However, plugin-provided tools are tagged with their source, so the permission system can apply stricter policies to plugin tools (e.g., always requiring user approval). The three-layer-verification system treats plugin tools with the same scrutiny as any other tool invocation.

Integration

The bridge-system uses the Plugin System to load IDE-specific extensions. The skill-system can be extended by plugins that provide reusable skill definitions. Plugin tools are indexed by the toolsearch-system and appear in lazy-loaded tool discovery.

Key claims

Relations

Sources

src-20260409-e7da1a492842