AIHero

    Sessions, Context Windows & Turns

    Stateful

    Carries information forward. Sessions are stateful across turns; agents can be made stateful across sessions via a memory system.

    Matt Pocock
    Matt Pocock

    Carries information forward. A session is stateful across turnscontext accumulates as the session runs, which is why long sessions drift into the dumb zone. An agent can be made stateful across sessions by adding a memory system that persists information into the environment and reloads it at the start of future sessions. The model is never stateful; any apparent continuity is the harness re-feeding context. Counterpart to stateless.

    Where state lives at each layer:

    LayerStateful?How
    ModelNeverParameters are frozen; it sees only what's in each request
    SessionAcross turnsThe harness appends every message and tool result to the context
    HarnessAcross sessionsMemory files, AGENTS.md, handoff artifacts — written down, reloaded later
    EnvironmentAlwaysFiles persist whether or not any session is running

    Each layer's statefulness is built by re-reading something stored a layer below: the session feels continuous because the harness re-sends the message history to the stateless model, and the agent remembers across sessions because the harness re-loads files from the environment. No state is ever stored in the model itself.

    State isn't always wanted. Everything carried forward influences what comes next, so a wrong assumption made early in a session is carried forward too. Clearing is the deliberate act of throwing session state away and starting from what's written down.

    Usage:

    "It remembered my preferences from yesterday — does that mean the model learned them?"

    "No, the agent's stateful because the harness wrote them to a memory file and reloaded them at session start. The model itself saw nothing of yesterday."

    Want more than vocabulary?

    Join AI Hero for practical skills, thinking on AI engineering, and resources that keep you ahead of the curve.

    I respect your privacy. Unsubscribe at any time.

    Share