Overview
Plugin hooks provide a system for intercepting and modifying plugin registration during agent initialization. This allows external systems to participate in plugin loading, filtering, and post-registration processing.Hook Types
Pre-Register Hooks
Run before plugins are registered with the runtime. Can filter, add, or modify the plugin list.Post-Register Hooks
Run after plugins are registered. Used for cleanup, logging, or additional setup.Hook Context
Pre-Register Hooks
registerPreRegisterHook
Register a hook that runs before plugins are registered. Signature:hook: Function that receives context and returns filtered plugins
runPreRegisterHooks
Executes all registered pre-register hooks in order. Signature:Post-Register Hooks
registerPostRegisterHook
Register a hook that runs after plugins are registered. Signature:hook: Function that receives context after registration
runPostRegisterHooks
Executes all registered post-register hooks in order. Signature:Plugin Filtering
applyPluginFilter
Filters plugins based on allow/deny lists. Signature:- If
allowis specified, only plugins in the allow list are kept - If
denyis specified, plugins in the deny list are removed - Both can be used together: allow is applied first, then deny
- Full plugin name:
"@elizaos/plugin-discord" - Short name:
"discord"(matches"@elizaos/plugin-discord") - Case-insensitive matching