Hooks
Hooks are local event handlers that run inside the gateway when matching Fased events occur. They are useful for small runtime extensions such as session memory, startup files, command logging, and plugin-side tool-result transforms. Hooks are not webhooks. For inbound HTTP automation, read Webhooks.Normal path
Most users only need the bundledsession-memory hook.
- Enable
session-memoryduring onboarding or from Agent > Memory. - Use Extensions > Hooks to inspect enabled hook packs.
- Use Advanced > Config only when a hook has no UI yet.
- Restart the gateway if the UI says runtime hook state has not caught up.
Bundled hooks
| Hook | Event | Purpose | Normal user path |
|---|---|---|---|
session-memory | /new, /reset | Archives recent session context into the Agent workspace memory area. | Onboarding or Agent > Memory. |
boot-md | gateway startup | Runs BOOT.md from each Agent workspace on gateway start. | Operator startup automation. |
bootstrap-extra-files | agent bootstrap | Adds extra workspace files into Agent bootstrap context. | Advanced workspace setup. |
command-logger | commands | Appends command events to ~/.fased/logs/commands.log. | Debug command usage. |
Discovery
Hooks are loaded from these sources, later sources winning name conflicts:- extra hook directories from
hooks.internal.load.extraDirs - bundled hooks:
<fased>/dist/hooks/bundled/ - managed hooks:
~/.fased/hooks/ - workspace hooks:
<workspace>/hooks/
Hook packs
Hook packs are npm packages that expose one or more hooks throughpackage.json -> fased.hooks.
Install with:
- npm specs are registry-only
- local directories and local archives are supported for operator-controlled installs
- Git, URL, and arbitrary remote specs are rejected
- hook entries must resolve inside the package directory
- dependencies install with
npm install --ignore-scripts
Hook metadata
HOOK.md combines metadata and human docs.
metadata.fased fields:
emojieventsexporthomepagerequiresalwaysinstall
requires can check binaries, environment variables, config keys, and OS
constraints before a hook is considered eligible.
Handler shape
Handlers are async functions that inspect an event, optionally append messages to the event, and may perform a small side effect.typeactionsessionKeyagentIdconfig- event-specific payload
Event families
| Family | Examples |
|---|---|
| Command | command:new, command:reset, command:custom |
| Agent | agent:bootstrap |
| Gateway | gateway:startup, gateway:shutdown |
| Message | message:received, message:sent |
| Tool result | plugin-side tool-result transforms |
Configuration
Current config shape:hooks.internal.enabled and
hooks.internal.entries. Top-level hooks.enabled belongs to HTTP webhook
ingress, not local runtime hooks.
Debugging
Start with:| Symptom | Check |
|---|---|
| Hook not discovered | Directory name, HOOK.md, load source, and name collisions. |
| Hook not eligible | Missing binary, env var, config key, or OS requirement. |
| Hook not executing | Event name, enabled state, gateway restart, and logs. |
| Handler errors | Catch expected failures and write concise diagnostics. |