Skip to main content

crewship hooks

Paused — work in progress. Lifecycle hooks are switched off: hooks do not fire, every /api/v1/hooks endpoint answers 503 with the reason, crewship hooks is hidden, and Settings no longer links to the page. Hooks registered earlier are kept in hooks_config and do not run. The feature returns once hooks can reach tools like Slack or Teams directly. For development, CREWSHIP_HOOKS_ENABLED=1 on the server process turns them back on. The rest of this page describes the feature as built.
Manage the lifecycle-hook registry — shell commands, HTTP webhooks, or subagents that fire on platform events (pre_agent_start, post_agent_stop, on_approval_requested, …). See the Hooks guide for the full 14-event catalog and the three handler kinds. There is no pre_tool_call — the platform has no interception point before a tool runs. Every one of the 14 catalog events, including post_tool_call, now dispatches from a real call site — see Currently-dispatched events below.
Non-host writes require workspace OWNER or ADMIN. Creating, editing or enabling a shell hook requires an instance administrator — a shell handler runs its command on the crewshipd host, outside container isolation.

Subcommands

hooks list, create, and update honour the global --format flag (json/yaml/ndjson) — see Output Formats.

crewship hooks list

Sample output:
TARGET is derived from handler_config: the URL for http, the command for shell, the agent for subagent, truncated to 40 characters.

crewship hooks create

Requires --event and --handler, plus a target for that handler kind. New hooks are enabled unless you pass --disabled.
Sample output:

crewship hooks update <id>

Takes the same flags as create, all optional. Only the flags you pass are sent — an omitted flag keeps its current server-side value. If a blocking pre_* hook is changed to a post_* or on_* event, explicitly pass --blocking=false; the server refuses an observation event that retains the old blocking flag. Passing no flags at all is an error rather than an empty patch. Converting a hook to --handler shell, or editing one that is already shell, requires an instance administrator.

crewship hooks delete <id>

Without --yes the command refuses and points at crewship hooks disable, which stops the hook firing while keeping its definition.

crewship hooks enable <id>

Sample output:
Requires OWNER or ADMIN (403 otherwise). Emits system.hook_toggled into the Crew Journal with the actor’s user ID.

crewship hooks disable <id>

Same auth and audit semantics as enable.

Errors

Currently-dispatched events

All 14 events in the --event catalog now dispatch from a real call site — see the Hooks guide coverage table for the call site behind each one. internal/hooks/dispatch_site_test.go enforces this as an invariant: a source-scan test fails CI if an event is ever added to AllEvents without a matching hooks.Dispatch call reachable from outside the hooks package.pre_tool_call used to be exactly the opposite trap — an event that registered cleanly and never fired, with no “wire it up” path on the roadmap — and was removed from the valid event list rather than left there: it is the one event name that is now a 400, not a silently-dead 201.

Host hook review after upgrade or restore

Host shell hooks require instance administrator authority, not workspace ownership. Existing host hook definitions are preserved but disabled on upgrade because prior versions did not record historical instance authority. The audit log records hook.host_review_required without recording command contents. A restored host hook also loses imported approval and stays disabled until local review. An instance administrator must inspect the current command and configuration, then use Enable in Lifecycle hooks or crewship hooks enable ID with the appropriate workspace and an instance-admin session/token (instance:admin). host_review_required in list/detail responses identifies pending review. Creating or editing a host hook requires the same authority. The default global lifecycle pause still prevents execution; it is not an authorization bypass. Container startup hooks are a separate feature and are unchanged.