Saphan StudioDocs
Reference/Commands

saphan session-hook

Runs Saphan Studio's built-in hook for one event of an agent session: sessionstart, pretooluse, posttooluse, precompact or stop.

Runs Saphan Studio's built-in hook for one event of an agent session: sessionstart, pretooluse, posttooluse, precompact or stop. A session's hook configuration calls this command instead of a script, and saphan init can write that configuration into the workspace's .claude/settings.json with your consent. The hook only reads, returns within about two seconds, and never breaks the session: if it cannot reach the record it still exits successfully. Under contract 2 it also prints, at session start only and within a fixed size, the seat's unread messages as this machine last fetched them and the remembered context for its role, which the agent vendor then injects into the session; a part it cannot read is printed as missing, with the reason.

saphan session-hook sessionstart --contract 2
saphan session-hook <event>
flagtypedefaultwhat it does
--contractint0Required: the hook behaviour the configuration was written for — 1 injects nothing into the session, 2 adds unread messages and role memory at session start; an unsupported number is refused by name.
--explainboolfalsePrint one line on standard error saying what the hook read, or why it read nothing.

Global options apply to every command — see Every command.