Skip to main content

crewship hooks

Manage the lifecycle-hook registry — shell commands, HTTP webhooks, or subagents that fire on platform events (pre_tool_call, post_agent_stop, on_approval_requested, …). See the Hooks guide for the full 15-event catalog and the three handler kinds.
Every write requires OWNER or ADMIN. Creating or editing a shell hook requires OWNER — 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, so changing the event does not quietly clear your matcher or 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 OWNER.

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

Dispatched:
  • pre_agent_start, post_agent_stop
  • on_approval_requested
The other 12 events are defined but not yet dispatched at their call sites — see the Hooks guide coverage table. Registering a hook on an undispatched event is legal but nothing will fire it.