Async Hooks - Claude Code
Run hooks in the background without blocking the session.
Async hooks detach from the event and run in the background so the session keeps moving. Good for telemetry, notifications, and anything Claude doesn't need to wait on.
What it does
Mark a hook async and Claude Code launches it but doesn't wait for the exit code. The session proceeds; the hook runs on its own. If the hook fails, it fails silently - the session never knew. This is the right pattern for fire-and-forget side effects.
When to use it
- Shipping logs to an analytics backend.
- Posting Slack notifications when something happens.
- Kicking off secondary builds or caches.
- Anything where the user shouldn't feel the latency.
Gotchas
- Async hooks can't block or modify the event. If you need to prevent something, use a sync hook.
- Failures don't surface. Check logs separately to catch problems.
- Too many async hooks firing quickly can starve system resources.
Official docs: https://code.claude.com/docs/en/hooks.md#run-hooks-in-the-background
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




