§02 · Sessions, Context Windows & Turns

Stateful

Carries information forward from one step to the next; a session is stateful across turns even though the model underneath is not.

A stateful system remembers. Within a session, your coding agent is stateful: what you said in turn one still shapes turn twenty, because the harness keeps the transcript and sends the accumulated history with every request. That statefulness is manufactured. The model receives the whole history each time and reconstructs 'what we were doing' from scratch; it just does so reliably enough to feel like continuity.

Across sessions the default flips back to stateless. Making an agent stateful over days and weeks means adding a layer that writes things down and reads them back: project instruction files, a memory system, notes it leaves for its future self. Where that layer is thin you get the familiar symptom of re-explaining your architecture every morning.

Statefulness has a cost as well as a benefit. Everything the session retains occupies the context window and competes for the model's attention, so a session that remembers everything also gets slower and vaguer. The useful stance is selective: make the state that matters durable in files, and let the rest expire with the session.

In the tools
  • Claude CodeSession state lives in the transcript on disk; claude --resume reopens it, while CLAUDE.md and auto-memory carry state between sessions.
  • Claude CoworkProjects keep files and instructions attached across conversations, which is the same trick applied to everyday work.
In conversation

I told it to use pnpm in the first message and it's still using pnpm twenty turns later. So it does remember?

Within the session, yes, it's stateful. Open a new one tomorrow and that instruction is gone unless it's in your project file.

Related terms
Learn it in the school
Words are the easy part

Course 01 puts every one of these terms to work: you install Claude Code, run the loop, and ship a real project — permission modes, compaction, hooks and all.

Start Course 01 →