pub trait HookFormat: Send + Sync {
// Required methods
fn parse_input(&self, stdin: &str) -> Result<HookInput, ParseError>;
fn render_response(&self, verdict: Verdict) -> HookResponse;
// Provided methods
fn render_context(&self, _context: &str) -> HookResponse { ... }
fn gated_policy(&self) -> GatedPolicy { ... }
fn render_deny(&self, _reason: &str) -> HookResponse { ... }
fn render_ask(&self, _reason: &str) -> HookResponse { ... }
}Required Methods§
fn parse_input(&self, stdin: &str) -> Result<HookInput, ParseError>
fn render_response(&self, verdict: Verdict) -> HookResponse
Provided Methods§
Sourcefn render_context(&self, _context: &str) -> HookResponse
fn render_context(&self, _context: &str) -> HookResponse
Surface explanatory context to the model on a non-approval without changing the permission decision (the command still flows through the tool’s normal approval path, and the user’s own allowlist still applies).
The default abstains silently — same as today’s empty deny body. A target overrides this only when its hook schema has a verified field for injecting model-visible context without a permission decision.
Sourcefn gated_policy(&self) -> GatedPolicy
fn gated_policy(&self) -> GatedPolicy
How this harness’s hook must handle a GATED command (one safe-chains does not auto-approve),
derived from its capabilities (docs/design/harness-capability-model.md):
Defer— stay silent; the harness’s own per-command human review is the check (Claude).Deny— veto it; the harness has no human review and no escalate (Codex).Ask— escalate to an in-the-moment human prompt (Antigravity’sask).
Sourcefn render_deny(&self, _reason: &str) -> HookResponse
fn render_deny(&self, _reason: &str) -> HookResponse
The hook output that VETOES a gated command, for a Deny harness. Default abstains (so a
stray call can’t fail open). The shape must be exactly what the harness supports, or a
harness that “continues on malformed output” (e.g. Codex) fails open.
Sourcefn render_ask(&self, _reason: &str) -> HookResponse
fn render_ask(&self, _reason: &str) -> HookResponse
The hook output that ESCALATES a gated command to a human prompt, for an Ask harness.
Default abstains. (Antigravity fails CLOSED on a malformed/absent decision, so an Ask target
must always emit a valid decision.)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".