HookStack

Ship fast. Break nothing.Claude Code hooks — plus Codex & Copilot — in one command

Security, quality and workflow guardrails your agent can’t skip.

  • 106 hooks
  • Open-source · MIT
  • Hooks unit-tested
  • Security scanned

Up and running in 60 seconds

project root
0 / 106 selected
$ npx hookstack-cli@latest install

Will writes the hooks into .claude/hooks and patches settings.json — nothing else.

or fine-tune it hook by hook

Browse the Claude Code hooks catalogue

14 hooks

Security

3 event types

Guardrails that block dangerous actions before they run — pushes to main, leaked secrets, destructive commands.

PreToolUseMessageDisplayPermissionRequest
PreToolUse· Bash
PreToolUse· Bash
PreToolUse· Write|Edit
PreToolUse· Write|Edit
PermissionRequest
MessageDisplay
PreToolUse· Write|Edit
PreToolUse· Write|Edit
PreToolUse· Read
MessageDisplay
PreToolUse· Bash
PreToolUse· Bash
PreToolUse· Bash
PreToolUse· Write|Edit
17 hooks

Context

5 event types

Inject project conventions, git state, and environment into every session, so the agent codes like a teammate from the first turn.

SessionStartPreToolUseUserPromptSubmitPostToolUseFailure
UserPromptSubmit
SessionStart
UserPromptSubmit
UserPromptSubmit
PostToolUseFailure
SessionStart· compact
UserPromptExpansion
SessionStart
SessionStart
PreToolUse· WebSearch
SessionStart
PreToolUse· Read
PreToolUse· Read
PreToolUse· Read
PreToolUse· WebFetch
SessionStart
UserPromptSubmit
37 hooks

Validation

6 event types

Quality gates that typecheck, lint, and test on every change — nothing ships broken, nothing ships untested.

PostToolUseStopPreToolUseFileChanged
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
PreToolUse· Bash
Stop
Stop
Stop
Stop
Stop
PostToolBatch
FileChanged· *.ts|*.tsx|*.js|*.jsx
TaskCompleted
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PreToolUse· Bash
Stop
PostToolUse· Write|Edit
FileChanged· registry.json
Stop
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
FileChanged
PreToolUse· Write|Edit
PreToolUse· Write
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
PreToolUse· Bash
Stop
9 hooks

Notification

7 event types

Alerts, chimes, and messages that keep you in the loop the moment work happens — without watching the terminal.

NotificationSessionEndPostToolUseStop
Notification
SessionEnd
PostToolUse
Notification
Stop
Notification
SubagentStart
SubagentStop
StopFailure· rate_limit
22 hooks

Workflow

15 event types

Automation that reroutes, bootstraps, and tidies the workspace — isolated worktrees, deps installed, env reloaded.

SessionStartPreToolUseFileChangedStop
PreToolUse· Edit|Write
SessionStart
SessionStart
Stop
PreCompact
SessionStart
SessionEnd
ConfigChange
CwdChanged
PermissionRequest· ExitPlanMode
FileChanged· .env|.env.local|.envrc
WorktreeRemove
StopFailure
TaskCreated
PermissionDenied
SessionStart· startup
InstructionsLoaded
SessionStart
FileChanged· *.mjs|registry.json
PreToolUse· Bash
PostToolUse· Write|Edit
SessionStart
7 hooks

Documentation

4 event types

Docs that stay current — changelogs, READMEs, and knowledge refreshed automatically as the code evolves.

StopPostCompactFileChangedSessionStart
PostCompact
FileChanged· README.md
Stop
SessionStart
Stop
Stop
Stop
Select hooks (+ button) to generate your settings.json configuration.

Hooks vs slash-commands vs prompt instructions

Three ways to steer Claude Code — only one is guaranteed to run on every action.

Agentic hooksSlash-commandsPrompt instructions
How it runsNode.js script, outside the modelYou type it; the model interpretsText the model may follow
Deterministic?Yes — fires unconditionallyNo — the model decidesNo — probabilistic
Can it be skipped?NoYesYes
Token costZero (separate process)Consumes contextConsumes context
Best forGuardrails, gates, automationOn-demand interactive tasksSoft guidance & style

New to hooks? Read the guides or learn who builds HookStack.

Learn more about Claude Code hooks

Frequently asked questions

What is an agentic hook?
An agentic hook is a Node.js script triggered by Claude Code lifecycle events — PreToolUse, PostToolUse, SessionStart, Stop. Hooks enforce deterministic behavior in agentic workflows: block dangerous commands, run tests automatically, inject context, and notify your team — without relying on the LLM to remember.Read the full guide →
How do agentic hooks improve vibe coding?
Vibe coding lets an AI agent like Claude Code drive most of your implementation while you set direction. Hooks add CI-like guardrails that fire on every agent action — making your agentic workflow production-safe, auditable, and repeatable regardless of what the model decides to do.Read the full guide →
Does HookStack work with GitHub Copilot?
Yes. The hookstack-cli installs the same hooks for GitHub Copilot — the hook scripts (.mjs) are identical, only the config file paths are adapted. Run npx hookstack-cli@latest install --copilot in your project root. Because Copilot and Claude Code share the same lifecycle events (PreToolUse, PostToolUse, SessionStart, Stop), a HookStack hook is portable with no code changes.
Does HookStack work with OpenAI Codex?
Yes. The hookstack-cli installs the same hooks for OpenAI Codex into a .codex/hooks.json config file, with the hook scripts in .codex/hooks/. Use npx hookstack-cli@latest install --codex-project to commit the config with your repo, or --codex-profile to apply it to every project via ~/.codex/hooks.json. Codex and Claude Code share the same lifecycle event names (PreToolUse, PostToolUse, SessionStart, Stop), so the hook code (.mjs) is identical — only the config format differs.
Why are Claude Code hooks better than prompt instructions?
Prompts are probabilistic — the model may or may not follow them. Claude Code hooks are deterministic Node.js scripts that execute unconditionally on matching events. No drift, no hallucination, no forgotten rules. That guarantee is what makes agentic workflows trustworthy in production.Read the full guide →
How do I install Claude Code hooks with HookStack?
Browse the catalogue, select the hooks you want, then run the generated npx hookstack-cli@latest install command in your project root. HookStack writes the scripts to .claude/hooks/ and patches your settings.json — nothing else touched.Read the full guide →
I already use Claude Code commands like /gen-test-unit or /create-worktree — aren't hooks the same thing?
Commands are interactive: you type them, Claude reads and acts on them inside the conversation. Hooks are the opposite — Node.js scripts that fire unconditionally outside the model, triggered by lifecycle events (PreToolUse, PostToolUse, Stop…). The model never sees them, never decides whether to run them, and can't skip them. Commands steer the AI; hooks constrain it.Read the full guide →
Do hooks consume tokens from my context window?
No. Hooks run in a separate process, outside the model entirely. They can inject context back into the session via stdout, but the hook scripts themselves — and whatever they compute — are never sent to the model unless you explicitly return a message. Commands, on the other hand, are part of the conversation and consume context. Hooks are a zero-cost enforcement layer.Read the full guide →