Overview
The Creor engine has a plugin system that lets you extend its capabilities without modifying the core codebase. Plugins can:
- Add custom tools that the agent can use
- Register authentication providers for custom LLM endpoints
- Hook into lifecycle events (tool execution, chat messages, system prompt generation)
- Transform system prompts before they're sent to the model
- React to internal bus events
Plugins are loaded during engine initialization. Each plugin exports a function that receives a context object and returns a hooks object.
Plugin Sources
Plugins can come from three sources:
| Source | Format | Example |
|---|---|---|
| npm package | package-name@version | "devflow-rag@latest" |
| Scoped npm package | @scope/package@version | "@myorg/creor-plugin@1.0.0" |
| Local file | file:// URL (auto-detected from .creor/plugins/) | "file:///path/to/plugin.ts" |
Creor automatically installs npm packages using Bun. Local plugins are loaded directly from the filesystem.
Configuration
Add plugins to the plugin array in your creor.json:
Plugins can also be auto-discovered from the .creor/plugins/ directory. Any .ts or .js file in this directory is automatically loaded as a plugin.
Note
plugin array from all config levels is concatenated, not replaced. Plugins defined globally in ~/.creor/creor.json are always included alongside project-level plugins.Plugin API
A plugin is a function that receives an input context and returns a hooks object. The input provides access to the engine's SDK client and project information.
Plugin Input
Hooks Object
The returned hooks object can implement any combination of lifecycle hooks:
| Hook | Description |
|---|---|
| tool.execute.before | Called before any tool executes. Can modify args or block execution. |
| tool.execute.after | Called after a tool completes. Can add context to the response. |
| tool.execute.failure | Called when a tool fails. |
| shell.env | Set environment variables for shell commands. |
| command.execute.before | Called before a slash command executes. |
| chat.message | Called when a new chat message is sent. |
| session.start | Called when a new session begins. |
| session.end | Called when a session ends. |
| notification | Called when the agent sends a notification. |
| pre.compact | Called before context compaction. |
| experimental.chat.system.transform | Transform the system prompt before it's sent to the model. |
| auth | Provide custom authentication for LLM providers. |
| tool | Register custom tools for the agent. |
| event | React to internal bus events. |
| config | Called with the resolved config after initialization. |
Creating a Plugin
Here is a complete plugin that adds a custom tool and hooks into tool execution:
Installing the Plugin SDK
If you're developing a plugin as an npm package, install the plugin SDK:
bun add @creor-ai/plugin
For local plugins in .creor/plugins/, Creor automatically installs @creor-ai/plugin as a dependency in the .creor/ directory. A package.json, .gitignore, and node_modules/ are created automatically.
Local Plugins
The simplest way to extend Creor is with local plugins in your project's .creor/plugins/ directory:
Local plugins are loaded as file:// URLs internally. They have full access to the Node.js runtime and can import any packages installed in the .creor/node_modules/ directory.
Tip
.creor/package.json with a dependencies field. Creor runs bun install automatically when it detects a package.json in the .creor/ directory.Built-in Plugins
Creor ships with several built-in plugins that are loaded automatically:
| Plugin | Description |
|---|---|
| opencode-anthropic-auth | Handles Anthropic OAuth authentication flows |
| Codex Auth (internal) | OpenAI Codex / Responses API authentication |
| Copilot Auth (internal) | GitHub Copilot authentication integration |
To disable built-in plugins, set the CREOR_DISABLE_DEFAULT_PLUGINS environment variable to true.
Plugin Deduplication
When the same plugin is referenced at multiple config levels (e.g., global and project), Creor deduplicates by canonical name. The higher-priority source wins.
Priority order (highest to lowest):
- Project .creor/plugins/ directory
- Project creor.json plugin array
- Global .creor/plugins/ directory
- Global creor.json plugin array
For example, if ~/.creor/creor.json lists my-plugin@1.0.0 and .creor/creor.json lists my-plugin@2.0.0, only version 2.0.0 is loaded.