Cross-agent hook manager for AI coding assistants — installs and orchestrates lifecycle hooks across Claude Code, Cursor, and Gemini from a single manifest.
# swiz
AI coding agents are capable of impressive things. They're also capable of forgetting to commit, shipping debug statements, ignoring failing CI, losing track of what they were supposed to do, and declaring "task complete" the moment they want to stop. **swiz** is a hook framework that doesn't let them get away with any of it.
One manifest of TypeScript hook scripts gets installed across Claude Code, Cursor, Cursor CLI, and Codex CLI — translating tool names, event names, and config formats automatically so every agent plays by the same rules. The hooks enforce discipline at every stage of the agent loop: before tools run, after they complete, and before the session is allowed to stop.
When `swiz idea` and `swiz continue` are used together, the system can enter a **self-directed loop** — a closed-loop state where the agent's own outputs become the next inputs, expanding the project without external prompts. See [docs/ai-providers.md](docs/ai-providers.md#self-directed-loop) for the canonical terminology.
**116 hooks. 12 event types. Every agent. Zero compromises.**
## Install
```bash
bun install
bun link
```
Then use `swiz` from anywhere.
## How It Works
Every agent exposes hook events at key moments in the loop. swiz intercepts those moments:
```
User prompt submitted → userpromptsubmit-* hooks inject context (git state, active tasks)
↓
Agent calls a tool → pretooluse-* hooks can block the call before it executes
↓
Tool completes → posttooluse-* hooks validate results, remind about tests
↓
Agent tries to stop → stop-* hooks audit the full session state and block if anything is unresolved
```
Hooks communicate back using **polyglot JSON** — a single output format that all four agents understand. A hook script written once works identically whether it was triggered by Cursor, Cursor, Cursor, or Codex.
```json
{
Agent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.