TypeScript hooks for coding agents

One manifest.
Four formats.

swiz translates its TypeScript hook definitions for Claude Code, Cursor, Gemini CLI, and Codex CLI. Hooks add context before tools run, validate the result afterwards, and audit unfinished work before the session stops.

$ bun install && bun link Read the docs
107
Hooks
TypeScript scripts sharing a common utility layer
12
Event types
Every moment in the agent loop is covered
4
Agents
Claude, Cursor, Gemini CLI, Codex CLI
0
Compromises
Rules apply to every agent, every time
Four checkpoints

Checks around every agent action

swiz adds context when a prompt arrives, blocks unsafe tool calls before execution, inspects results afterwards, and audits the session before it stops.

Trigger
Prompt received
Add Git status, active tasks, and session context to the prompt.
Pre-tool
Before execution
Reject secret commits, lint bypasses, force pushes, and edits without tasks.
Post-tool
After execution
Inspect output, test results, CI state, and task progress.
Gate
Before stop
Keep the session open until changes, CI, and tasks are resolved.
Core capabilities

Built-in disciplines agents forget

Hooks enforce standards that agents consistently skip when left to their own judgment.

🛑
Stop hooks that mean it
24 stop hooks audit uncommitted changes, failing CI, unresolved tasks, stale branches, open PRs with review requests, and secrets in diffs — and block until every issue is resolved.
🔒
Pre-tool gatekeeping
Block @ts-ignore, eslint-disable, force pushes, credential leaks, and workflow permission escalations before they ever execute.
🌐
Cross-agent, one manifest
Tool names, event names, and config formats differ across agents. swiz translates automatically at install time. Write once, enforce everywhere.
Task-driven enforcement
Agents must create tasks before editing code, keep them updated every ten tool calls, and supply real evidence before marking anything complete. No faking done.
🔁
Self-directed loop
swiz idea and swiz continue together create a closed loop — the agent's own outputs become the next inputs, expanding the project without external prompts.
Daemon-backed dispatch
A long-lived Bun server handles hook dispatch, git state caching, CI polling, and issue sync simultaneously across projects — hooks respond in milliseconds.
107 hooks

What gets enforced

Every hook is TypeScript, shares utilities from a common layer, and produces polyglot JSON that every supported agent understands.

Stop (24)
last line of defence
  • Uncommitted changes & unpushed commits
  • Failing or in-progress GitHub Actions CI
  • Secrets in staged diffs
  • Open PRs with change requests
  • Incomplete tasks without evidence
  • TODO / FIXME in new code
  • Lockfile drift after package.json edits
  • CLAUDE.md / MEMORY.md over threshold
PreToolUse (44)
block before execute
  • No tasks before editing files
  • Secret / credential patterns
  • eslint-disable & @ts-ignore
  • Force push to main
  • Workflow permission escalations
  • Offensive language patterns
  • Repeated lint / test runs
  • Commit without /commit skill
PostToolUse (24)
validate after execute
  • Test failure detection
  • Auto-steer on drift
  • Task output streaming
  • Narrator TTS for assistant text
  • JSON file validation
  • Git status context injection
UserPromptSubmit (6)
context injection
  • Git status & branch state
  • Active task list
  • Memory size warnings
  • Session context summary
SessionStart (4)
session bootstrap
  • Prior session task recovery
  • Daemon startup check
  • Environment validation
PreCompact + others (5)
lifecycle
  • Compaction guard
  • Subagent convention injection
  • Notification routing
Agent support

Every agent, same rules

swiz translates tool names and event names at install time. Hook scripts never need to know which agent triggered them.

Claude Code
Nested matcher groups in ~/.claude/settings.json. Full support across all 5 event types.
Full
Cursor IDE
Flat list format in ~/.cursor/hooks.json (version 1). All events fire in the IDE.
Full
Gemini CLI
Nested matcher groups in ~/.gemini/settings.json. Full support across all 5 event types.
Full
Codex CLI
Tool mappings fully tracked. Ready to activate when Codex ships user-configurable hook support.
Ready
Autonomous operation

The self-directed loop

When swiz idea and swiz continue are used together, the agent's own outputs feed back as the next inputs — creating a closed loop that expands the project without external prompts.

Agent completes work
swiz stop hooks audit
swiz idea generates next step
swiz continue resumes
Agent works again
Hooks enforce quality at every turn. The loop only advances when the previous step is actually done.
Get started in two commands
Requires Bun. After install, run swiz install to write hooks into your agents, and swiz status to verify.
# clone and link globally $ bun install $ bun link # install hooks into your agents $ swiz install $ swiz status