---
title: "Discussion on \"exit 0 Means Pass, exit 2 Means Block — Taming AI with Claude Code Hooks\" | Hashnode"
description: "Discussion on \"exit 0 Means Pass, exit 2 Means Block — Taming AI with Claude Code Hooks\". CLAUDE.md guidance is strong, but long sessions can dilute adherence. Hooks enforce behavior at execution time.\nSemantics\n\nexit 0: allow\nexit 2: block\nstderr: feedback to Claude\nstdout: inject context\n\nCommon production patterns\n\nPreToolUse dangerous..."
url: "https://hashnode.com/posts/claude-hooks-exit2/69b66f8f08671a5eb6c63cb6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [exit 0 Means Pass, exit 2 Means Block — Taming AI with Claude Code Hooks](https://plzai.hashnode.dev/claude-hooks-exit2?utm_source=hashnode&utm_medium=feed)

CLAUDE.md guidance is strong, but long sessions can dilute adherence. Hooks enforce behavior at execution time. Semantics exit 0: allow exit 2: block stderr: feedback to Claude stdout: inject context Common production patterns PreToolUse dangerous...

Mar 15 · 1 min read · plzai.hashnode.dev  
Read the article

-   [#\--ai](https://hashnode.com/tag/--ai)

## Written by

[jidonglab](https://hashnode.com/@jidonglab)

@jidonglab · Seoul, South Korea

  
[View profile](https://hashnode.com/@jidonglab)

1 project a week — building in public

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
