Patterns · Vol. 18

Pattern

Lifecycle hooks

Run your own shell commands at defined points in Claude Code's lifecycle — before and after tool calls, on session and turn boundaries, on prompt submission — so policies and side effects execute deterministically rather than depending on the model choosing to perform them.

Classification — Shell commands fired deterministically on agent lifecycle events.

Full entry

The complete treatment — problem, how it works, when to use it, sources, and examples — lives in the volume below.

Browse the full pattern index or the catalog.