---
published: true
id: lifecycle
title: Lifecycle
description: Knowledge captured in João Lopes' learning graph.
tags:
- software
- process
locale: en
resource: https://joaolopes.dev.br/knowledge/concepts/en/lifecycle/
created: '2026-03-28'
---

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

## 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.

## Source
- [Automate Workflows with Hooks — Anthropic Docs](https://docs.anthropic.com/en/docs/claude-code/hooks-guide)

## Related
- PreToolUse
- PostToolUse
