Skip to main content

run_with_hook_input

Function run_with_hook_input 

Source
pub fn run_with_hook_input(hook_input: &HookInput) -> Result<(), RecallError>
Expand description

Archive the session named by a hook input.

§Why nothing here returns an error

A hook that exits nonzero fails the invocation that ran it, every time. So the three ways this can have nothing to do all report themselves and exit zero:

  • No transcript path. Some other harness’s payload, spelled some other way. Named, with what to do about it.
  • No file at the path. Sessions run with --no-session-persistence never write one. Normal, and silent about anything but the fact.
  • A transcript we cannot read. Gemini’s hooks migrate --from-claude copies this command into Gemini’s own settings, where it is handed a JSON session document rather than Claude Code’s JSON Lines. That shape is read when it is recognisable; when it is not, the message says which file and which format, because a user who ran a migration command deserves to know it half-worked.

Everything written here goes to stderr: Gemini requires a hook’s stdout to be JSON and nothing else, and stray prose there is swallowed at best.