Context windows make agents look stateful right up until the moment they need to resume tomorrow, survive a restart, or remember a user preference from last week. When facts, workflow progress, and approvals live only in the prompt, every new turn becomes a reconstruction job, and the failure is architectural rather than model-level.
The most useful design rule here is simple: keep authoritative state outside the prompt, and enforce memory scope in storage rather than in instructions. A prompt can ask the model to behave as if data belongs to one user or task, but that is only a hint. Durable memory gets safer and more reliable when the records themselves are explicitly typed, versioned, and namespaced by tenant, user, task, or agent.
That changes how we structure memory. The prompt becomes working memory for the current turn. Durable storage holds the source of truth. Retrieval is only a way to pull in the few records that matter now, not a substitute for proper state management. Once you make that separation, you stop trying to squeeze whole histories into every call and start deciding which state should exist independently of any one inference.
A practical TypeScript shape from the write-up looks like this:








