# Context, State & Memory **Track:** Models, Tools & Agents — AI-Native Full-Stack Development — complete (30) **Framework / surface:** web dev (agent context / app state) **Level:** Intermediate **Prerequisites:** The Agent Loop, Data Modeling, Migrations & Transactions **In one line:** Separate what the model sees now from what the application knows, stores, retrieves, and may remember later. ## Theory, aesthetics & inspiration "Memory" is an overloaded word in AI systems, and the architecture only becomes designable once it is split apart: the model's context window holds what is visible to the current generation; application state holds what the code knows during a run; persistent storage outlives the run; retrieval selects old information back into visibility; summarization compresses a history that no longer fits. These are different mechanisms with different failure modes. The practical distinction current agent SDKs draw — local context the tools can use versus model-visible context the LLM reasons over — matters for both cost and safety: confuse the two and you either waste tokens or leak information the model never needed. Memory is also governed data, not exhaust. What must persist, for how long, owned by whom, inspectable and deletable by the user? A reliable agent does not append its entire history forever; AI-native architecture treats context as a scarce working surface and persistence as application data with rules. **Builder question:** Which information belongs in model context, which belongs only in application state, and which deserves durable storage?