# Stop Hook

> The event when Claude finishes, where a hook can make it keep going.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** Stop event, stop_hook_active

## Think of it like

It is like a coach who says one more lap before you can sit down.

## Definition

Stop is the hook event that fires when Claude finishes its answer. It does not fire if you interrupt, and an API error fires StopFailure instead. A hook here can block the stop with a reason, and Claude keeps working. A stop_hook_active flag tells the hook it already did this once, so it can avoid a loop.

## Example

Lucy's Stop hook runs the tests. If any fail, it blocks the stop and tells Claude to fix them first.

## Example code

```json
{
  "decision": "block",
  "reason": "Tests are failing. Run npm test and fix them before you stop."
}
```

Send Claude back to work.

## Why it matters

It turns done into done and checked. Claude cannot end a turn with red tests.

## Common mistake

Blocking each time without a check on stop_hook_active. Claude can then loop until it hits the cap.

## Three principles

- **When Claude finishes.** Not on interrupt.
- **Block with a reason.** Claude goes on.
- **Watch for loops.** stop_hook_active.

## Related terms

- [StopFailure Hook](https://learn.benibix.com/term/ai/stopfailure-hook)
- [SubagentStop Hook](https://learn.benibix.com/term/ai/subagentstop-hook)
- [Claude Code Hook](https://learn.benibix.com/term/ai/claude-code-hook)

## Told apart from

- [Stop Hook vs StopFailure Hook](https://learn.benibix.com/compare/stop-hook-vs-stopfailure-hook): People think a Stop hook runs at the end of every turn, whatever happens. It only runs when Claude finishes its answer on its own. A turn cut short by an API error, such as a rate limit, fires StopFailure instead. And only Stop can send Claude back to work. StopFailure ignores what the hook prints, so it is for alerts.

![The order hook events fire in: a session, each turn, and each tool call inside it.](https://learn.benibix.com/diagrams/hook-lifecycle.svg)

---

Source: https://learn.benibix.com/term/ai/stop-hook
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
