Skip to content

concepts

Lifecycle

Knowledge captured in João Lopes' learning graph.

The ordered sequence of events from the start to the end of a process, defining fixed points where behavior can be attached or observed.

↑ Contents

Definition

In software, a lifecycle defines the phases a process moves through and the events emitted at each transition. In Claude Code, the session lifecycle includes session start, user prompt, tool calls (with pre and post events for each), context compaction, and session end. Hooks attach to specific points in this lifecycle. The lifecycle is fixed — the events always fire in the same order — but what happens at each point is determined by the hooks wired to it.

↑ Contents

Source

↑ Contents
  • PreToolUse
  • PostToolUse

Source: OKF Markdown