Skip to main content

Module external

Module external 

Source
Expand description

External process-based hooks.

External hooks are executable scripts/programs placed in hook directories (~/.recursive/hooks/ or <workspace>/.recursive/hooks/). They receive a JSON event on stdin and must reply with a JSON decision on stdout within 5 seconds. Timeout or non-parseable output is treated as “continue”.

§Protocol

Input (stdin, single line JSON):

{
  "event": "preToolCall",
  "toolName": "run_shell",
  "args": {"command": "rm -rf /"},
  "mode": "ask"
}

Output (stdout, single line JSON):

{"action": "continue"}
{"action": "skip", "message": "dangerous command"}
{"action": "error", "message": "not allowed"}

Re-exports§

pub use crate::hooks::HookAction;

Structs§

ExternalHookRunner
Discovers and runs external hook executables.
HookInput
Input payload sent to the external hook on stdin.
HookResult
Rich result returned by a hook dispatch, containing the primary action as well as optional structured metadata for the caller to consume.

Enums§

HookEvent
The kind of lifecycle event sent to the external hook.
PermissionDecision
Permission decision returned by a hook.