Docs / Hooks

Where PinkyAI actually attaches

A hook is a small program Claude Code (or Cowork) calls at a fixed lifecycle point, feeding it JSON on stdin and reading a verdict back. pinkyai install registers each event below once; every rule pack, token-saving advisory, and audit mechanism this site describes runs from inside one of them.

The lifecycle events

Run one directly with pinkyai hook <event>, feeding it the same JSON shape Claude Code would — useful for debugging a specific advisory without triggering a whole session.

What runs by default

23 mechanisms run on a fresh install with nothing configured. Every other security guard waits behind security.experimental, and every coaching advisory behind token_savings.coaching_enabled. This list is generated from the engine's own mechanism table; pinkyai mechanisms --json prints the same table, with each mechanism's tier and the reason for it, from your install.

Advisory vs. mandatory, and fail-open

Most token-saving hooks are advisory by default: they surface a nudge but don't block. Security rule packs can be set to enforce, where a deny is real. Either way, PinkyAI's own hooks are built to fail open — if a hook itself errors, the tool call it was evaluating proceeds and the failure is logged, never silently blocked by a bug in the safety layer itself. pinkyai doctor and pinkyai audit-verify are the two commands to check that hooks are actually installed and that the audit trail they write is intact.

Next: Reference MCPs →