Egor Urvanov

Hooks

Harness · hooks

Hooks — scripts the harness runs automatically at set moments of the agent’s work: before an action, after a file edit, on finish. An agent treats a rule in the instructions as advice, while a hook always runs, so hooks close the blocks that allow no exceptions.

ruleagenthookalways firesactionbefore an action · after an edit · at the enda rule in instructions is advice✕rm -rf: blocked, no exceptions● model, people, systems, data  ● agent and harness  ● risk, stop, boundaryA rule is advice, a hook always fires

Frequently asked questions

What is a hook?

A script the harness runs automatically at a set moment of the agent’s work: before an action, after a file edit or at the end.

How is a hook different from a rule?

The agent treats a rule as advice and may break it, while a hook always runs. That is why prohibitions with no exceptions are enforced with hooks.

Source: Claude Code hooks reference

Where it appears · 8

More 3

Related terms

Whole glossary

© 2026 Egor Urvanov