# kosa8 hooks

Check coding agents' tool calls before they run (Claude Code, Cursor, Codex, Gemini, Copilot)

Puts kosa8's tool-call rules in front of the coding agents running on this
machine (not in a sandbox). Before the agent runs a shell command, reads or
writes a file, calls an MCP tool or fetches a page, kosa8 decides: allow, deny
with the reason, or ask you. Every decision, and every session start and end,
goes in the signed audit log (`kosa8 audit ls`, the desk's Agent hooks panel).

  kosa8 hooks install claude-code     the hook in ~/.claude/settings.json
  kosa8 hooks install cursor          the hook in ~/.cursor/hooks.json
  kosa8 hooks install codex           the hook in ~/.codex/hooks.json
  kosa8 hooks install gemini          the hook in ~/.gemini/settings.json
  kosa8 hooks install copilot         the hook in ~/.copilot/hooks/kosa8.json
  kosa8 hooks policy                  the organization's policy (--org), as cached
  kosa8 hooks status                  what is installed, and whether kosa8d answers
  kosa8 hooks test                    send sample calls through the installed hook
  kosa8 hooks log                     the latest decisions
  kosa8 hooks uninstall               take kosa8's entries out again

--mode sandbox also moves the agent's shell commands into a kosa8 sandbox with
the project folder mounted, instead of running them on this machine.
--cloud records every decision in your kosa8 Cloud organization's audit log and
sends agent.tool_call.blocked webhooks.
--org decides with your organization's central policy from kosa8 Cloud (cached,
refreshed every few minutes, used offline); --org --forward-audit also has kosa8d
send each decision's metadata to the organization's Cloud audit log and SIEM.

Plans: hooks on this machine are part of Solo and up; --cloud is part of Team and up.

The hook fails closed: if kosa8d is not running, every checked call is refused
with a message saying so. Start it with `kosa8 daemon start`.

## Example

```
  kosa8 hooks install claude-code
  kosa8 hooks status
  kosa8 hooks log
```

## Subcommands

- [`kosa8 hooks install`](https://docs.kosa8.com/reference/hooks-install.md): Install kosa8's hook into a coding agent (Claude Code, Cursor, Codex, Gemini CLI, Copilot CLI)
- [`kosa8 hooks log`](https://docs.kosa8.com/reference/hooks-log.md): Show the latest decisions the hooks made (from the audit log)
- [`kosa8 hooks policy`](https://docs.kosa8.com/reference/hooks-policy.md): Show the organization's hook policy that --org hooks decide with (--refresh fetches it now)
- [`kosa8 hooks sandbox-run`](https://docs.kosa8.com/reference/hooks-sandbox-run.md): Run one shell command in the project's kosa8 sandbox (what sandbox mode rewrites commands to)
- [`kosa8 hooks status`](https://docs.kosa8.com/reference/hooks-status.md): Show where kosa8's hook is installed, and whether kosa8d is answering
- [`kosa8 hooks test`](https://docs.kosa8.com/reference/hooks-test.md): Send sample tool calls through the installed hook and show kosa8's answers
- [`kosa8 hooks uninstall`](https://docs.kosa8.com/reference/hooks-uninstall.md): Take kosa8's hook out of an agent (every agent when none is named)

---
Source: https://docs.kosa8.com/reference/hooks/
