Skip to content

Manage agent lifecycle hooks: list, upsert, delete, toggle, test-fire, reload from disk, disable all, and acknowledge the hook-trust prompt. Hooks are session-scoped — every operation on this page requires a live session_id. Guarded writes (upsert, delete, toggle, disable-all) additionally require a single-use write nonce minted by beginHookWrite.

GET /api/v1/agent/hooks

Lists the lifecycle hooks for a live session. Returns the live + on-disk hook summaries, drift status, per-scope settings files, and the execution-trust probe. session_id may be supplied in the body or as the ?session_id query alias; the body value wins.

NameInTypeRequiredDescription
session_idquerystringNoLive session id (hooks are session-scoped; required by the daemon RPC). Query alias of the body session_id (the body value wins).
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1): the .hoody project layer / record cwd / tool+workflow cwd.
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1) selecting which on-disk .hoody install a stateless read/write resolves.
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local). Rejected (400) on routes with no container dimension.
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1): “global” or a 24-hex id. Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header (read only when the header is absent).
FieldTypeRequiredDescription
session_idstringNoLive session id (hooks are session-scoped; required by the daemon RPC). May be supplied here OR as the ?session_id query alias; the body value wins.
Terminal window
curl -X GET "https://api.hoody.com/api/v1/agent/hooks?session_id=sess_8f3a2b1c4d5e6f70" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{"session_id": "sess_8f3a2b1c4d5e6f70"}'

POST /api/v1/agent/hooks/begin-write

Issues the two-step write nonce required before every guarded hook mutation: not just upsert/delete, but also toggle and disable-all. The returned nonce binds to a (session, op, scope) tuple and is single-use. A nonce minted for op:toggle is NOT accepted by upsert, etc.

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1): “global” or a 24-hex id. Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.
FieldTypeRequiredDescription
session_idstringYesLive session id (hooks are session-scoped).
opstringYesThe write the nonce authorizes; one of: upsert, delete, toggle, set_disabled. The nonce is rejected by any other op.
scopestringYesScope of the settings file the write targets (e.g. project/user); the nonce binds to its resolved path.
Terminal window
curl -X POST "https://api.hoody.com/api/v1/agent/hooks/begin-write" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{
"session_id": "sess_8f3a2b1c4d5e6f70",
"op": "upsert",
"scope": "project"
}'

PUT /api/v1/agent/hooks

Creates or updates a hook. Requires a nonce minted by beginHookWrite for op:upsert and a live session_id. Defining a hook persists an arbitrary command that fires on lifecycle events.

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.
FieldTypeRequiredDescription
session_idstringYesLive session id (hooks are session-scoped).
noncestringYesThe single-use write nonce from beginHookWrite minted for op:upsert + this scope; the RPC fails closed without it.
scopestringNoScope of the settings file to write (must match the nonce’s scope).
eventstringNoLifecycle event the hook fires on.
matcherstringNoMatcher selecting when the hook fires.
commandstringNoCommand to run when the hook fires.
timeoutintegerNoPer-fire timeout.
Terminal window
curl -X PUT "https://api.hoody.com/api/v1/agent/hooks" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{
"session_id": "sess_8f3a2b1c4d5e6f70",
"nonce": "nonce_4d2c1e8f9a0b6c5d7e3f1a2b8c9d0e1f",
"scope": "project",
"event": "PreToolUse",
"matcher": "Bash",
"command": "echo running pre-tool hook",
"timeout": 5000
}'

DELETE /api/v1/agent/hooks

Deletes a hook. Requires the begin-write nonce minted by beginHookWrite for op:delete and a live session_id.

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.
FieldTypeRequiredDescription
session_idstringYesLive session id (hooks are session-scoped).
noncestringYesThe single-use write nonce from beginHookWrite minted for op:delete + this scope; the RPC fails closed without it.
scopestringNoScope of the settings file to write (must match the nonce’s scope).
Terminal window
curl -X DELETE "https://api.hoody.com/api/v1/agent/hooks" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{
"session_id": "sess_8f3a2b1c4d5e6f70",
"nonce": "nonce_4d2c1e8f9a0b6c5d7e3f1a2b8c9d0e1f",
"scope": "project"
}'

POST /api/v1/agent/hooks/toggle

Toggles a single hook’s enabled state. Requires the begin-write nonce minted by beginHookWrite for op:toggle and a live session_id.

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.
FieldTypeRequiredDescription
session_idstringYesLive session id (hooks are session-scoped).
noncestringYesThe single-use write nonce from beginHookWrite minted for op:toggle + this scope; the RPC fails closed without it.
scopestringNoScope of the settings file to write (must match the nonce’s scope).
Terminal window
curl -X POST "https://api.hoody.com/api/v1/agent/hooks/toggle" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{
"session_id": "sess_8f3a2b1c4d5e6f70",
"nonce": "nonce_4d2c1e8f9a0b6c5d7e3f1a2b8c9d0e1f",
"scope": "project"
}'

POST /api/v1/agent/hooks/disable-all

Disables (or re-enables) all hooks at once. Requires the begin-write nonce minted by beginHookWrite for op:set_disabled and a live session_id. The daemon RPC fails closed without the nonce.

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.
FieldTypeRequiredDescription
session_idstringYesLive session id (hooks are session-scoped).
noncestringYesThe single-use write nonce from beginHookWrite minted for op:set_disabled + this scope; the RPC fails closed without it.
scopestringNoScope of the settings file to write (must match the nonce’s scope).
Terminal window
curl -X POST "https://api.hoody.com/api/v1/agent/hooks/disable-all" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{
"session_id": "sess_8f3a2b1c4d5e6f70",
"nonce": "nonce_4d2c1e8f9a0b6c5d7e3f1a2b8c9d0e1f",
"scope": "project"
}'

POST /api/v1/agent/hooks/reload

Reloads the hook configuration from disk. Pass a live session_id to also receive the reloaded summary.

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.

This endpoint takes no body fields.

Terminal window
curl -X POST "https://api.hoody.com/api/v1/agent/hooks/reload" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{}'

POST /api/v1/agent/hooks/test

Test-fires a hook command — this executes an arbitrary command now. The daemon’s human-only _machine_confirmed denial lives only on the model-facing tool path, NOT on the hooks.test RPC this route dispatches. The HTTP edge has no service-level auth; securing the public surface is hoody-proxy’s responsibility. Requires a live session_id (hooks are session-scoped).

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.

This endpoint takes no body fields.

Terminal window
curl -X POST "https://api.hoody.com/api/v1/agent/hooks/test" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{}'

POST /api/v1/agent/hooks/trust/ack

Acknowledges the hook-trust prompt. Requires a live session_id (hooks are session-scoped).

NameInTypeRequiredDescription
X-Hoody-CwdheaderstringNoPer-request working-directory scope (§6.1).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override (§6.1).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (§6.1; omitted = local).
X-Hoody-RealmheaderstringNoPer-request realm selector (§6.1). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector (§6.1) — the in:query alias of the X-Hoody-Realm header.

This endpoint takes no body fields.

Terminal window
curl -X POST "https://api.hoody.com/api/v1/agent/hooks/trust/ack" \
-H "X-Hoody-Cwd: /home/user/projects/myapp" \
-H "X-Hoody-Config-Dir: /home/user/.hoody" \
-H "X-Hoody-Container: local" \
-H "Content-Type: application/json" \
-d '{}'