Plugin function
A plugin is a function that receives context and returns a hooks object:Where plugins are loaded from
Plugins are loaded from multiple sources (low to high priority):- Internal plugins — always loaded (Codex auth, Copilot auth, GitLab auth, Antigravity OAuth)
- Built-in npm plugins — installed automatically (e.g.,
zeroxzero-anthropic-auth) - Config
pluginarray — npm packages or file URLs specified in config - Local files —
.zeroxzero/plugin/*.{ts,js}or.zeroxzero/plugins/*.{ts,js}
Config example
Disabling defaults
Setdisable_default_plugins: true in config to skip built-in npm plugins.
Hooks reference
Core hooks
| Hook | Description |
|---|---|
event | Called for every internal bus event |
config | Called with the resolved config at startup |
tool | Register custom tools (return a { [id]: ToolDefinition } map) |
auth | Register auth methods for a provider |
Chat hooks
| Hook | Description |
|---|---|
chat.message | Modify user messages and parts before processing |
chat.params | Modify LLM parameters (temperature, topP, topK, options) |
chat.headers | Add or modify HTTP headers for LLM requests |
Execution hooks
| Hook | Description |
|---|---|
permission.ask | Intercept permission requests; can auto-allow or auto-deny |
command.execute.before | Modify slash command execution before it runs |
tool.execute.before | Modify tool arguments before execution |
tool.execute.after | Modify tool results (title, output, metadata) after execution |
shell.env | Inject environment variables into shell commands |
Experimental hooks
| Hook | Description |
|---|---|
experimental.chat.messages.transform | Transform the full message history before sending to LLM |
experimental.chat.system.transform | Transform the system prompt array |
experimental.session.compacting | Customize compaction prompt and context |
experimental.text.complete | Modify completed text output |
Custom tools
Register tools via thetool hook using Zod schemas for argument validation:
Local file plugins
Place.ts or .js files in your project or global plugin directory:
- Project:
.zeroxzero/plugin/my-plugin.tsor.zeroxzero/plugins/my-plugin.ts - Global:
~/.zeroxzero/plugin/my-plugin.tsor~/.zeroxzero/plugins/my-plugin.ts
Plugin lifecycle
- Plugins are initialized at startup after config is resolved.
- Failed plugin npm installations are retried after a 15-minute backoff.
- Plugin hooks are called in registration order; results from multiple plugins providing the same hook are merged.