Coding Assistant Hooks
Supported modes: Hosted Hybrid Local Available in: Free Solo Teams (org-wide enrollment: Teams)
Coding assistant hooks provide deterministic enforcement on Claude Code and Kiro CLI, and partial, event-scoped coverage on Gemini CLI and Cursor IDE. For every tool call covered by the host's pre-execution hook, a deny stops the call before it executes. No code changes, proxy, or signup is required for local mode.
Coverage is declared per event, not per host: each audit row identifies the
surface and the enforcement coverage for that specific event. The
capability matrix is derived from the adapters' own
capability declarations. This page is written by hand; controlzero coverage --json
exports those declarations for your installation and is the authority if the two
ever disagree. A bare controlzero coverage prints only a short per-host
summary.
Policy resolution fails closed by default: a missing policy bundle is denied
rather than guessed at. (Age is not itself a deny trigger in the SDK -- a
cached bundle with real rules keeps enforcing while a refresh is retried, which
is the intended last-known-good behaviour.) A bundle that fails signature
verification is never loaded: during a background refresh the agent keeps
enforcing the last known good policy, and at startup there is nothing to fall
back to, so calls are denied.
Coverage is narrower on
several surfaces, each for a different reason: Cursor IDE wires only shell, MCP,
file-read and prompt events (native writes and sub-agent starts are not
received); Gemini CLI is partial (untrusted folders skip settings hooks, a hook
can time out or be disabled); Codex CLI and Cursor CLI (cursor-agent) cover
the execute family only, and never receive the other eight; on Antigravity the
CLI's host may treat a deny as advisory in its headless modes, so a denied call
can still run there, and the IDE is NOT_SCANNED; Kiro IDE routes no tool call
to a deciding event, so it does not enforce. See
Enforcement Coverage for the per-tool detail.
What Hooks Do
When a coding assistant invokes a tool (run a shell command, write a file, call an API), the hook intercepts the call and:
- Evaluates the tool name against your policy rules (first-match-wins, fail-closed default).
- Scans tool arguments for DLP violations (PII, secrets, proprietary patterns).
- Blocks denied calls before execution and returns a branded
[Control Zero]reason to the agent. - Logs every decision and its execution status to a complete audit trail.
- Optionally syncs audit data to your Control Zero backend when the machine is enrolled.
Developer uses Claude Code / Gemini CLI / Codex CLI
|
v
Tool call triggered (e.g., Bash, write_file, shell)
|
v
controlzero hook-check (stdin: tool call JSON)
|
+---> Policy evaluation (first-match-wins)
| |
| +---> ALLOW -> exit 0
| | stderr: [Control Zero] Allowed: <tool>
| |
| +---> DENY -> exit 2
| stdout: JSON block decision (Claude Code)
| stderr: [Control Zero] <reason> (Gemini/Codex)
|
+---> DLP scan on tool arguments
| |
| +---> PII/secret found + action=block -> DENY
|
+---> Tamper check (if policy is signed)
| |
| +---> HMAC mismatch -> flag in audit trail
|
+---> Audit log entry written (~/.controlzero/audit.log)