Skip to main content

Hooks

Hooks are daemon-configured lifecycle interceptors that can observe and influence runtime behavior.

What hooks can do

Depending on the event and executor, hooks can:
  • block or approve execution
  • update permission rules
  • modify tool input or output
  • inject additional context into the agent transcript
  • suggest an initial session message
  • register watch paths
  • emit retry instructions after failures

Where hooks apply

Hooks cover a broad set of runtime events, including:
  • tool execution
  • permission requests and denials
  • session start and end
  • compaction
  • task lifecycle
  • subagent lifecycle
  • file and working-directory changes
  • notification and configuration events

Executor model

Kheish supports several hook executors:
  • shell command executors
  • HTTP executors
  • lightweight model prompt executors
  • isolated ephemeral agent executors
  • in-process callback executors
Use prompt or agent executors when hook logic is model-driven. Use command or HTTP executors when the logic must integrate with external systems or local scripts.

Operational guidance

Treat hooks as production runtime policy. Validate them on a real daemon, because they can alter permissions, mutate execution flow, and interact with stateful components like tasks and outputs.

Playbooks and flows

A Flow starts a normal session run, so hook behavior remains run and tool scoped. The Flow projection can help correlate evidence, but hooks still observe the underlying daemon events and runtime actions rather than a separate Flow executor.