Forward-deployed / Learning zone
Agentic AIa standalone module
Lesson 03

Context & memory

TL;DR

A model has no memory between calls. An agent's "mind" on any given step is exactly what's in its context window: instructions, conversation, tool results, retrieved knowledge. That window is finite, and everything in agentic AI fights over it. So agents are built around a memory hierarchy: the context window as working memory (fast, tiny, and its attention degrades as it fills), retrieval that pulls just-in-time knowledge from large corpora, and persistent memory (files, notes, profiles, learned procedures) that survives across sessions. The craft — context engineering — is curating the smallest high-signal set of tokens per step. That means compacting old turns, summarizing tool floods, offloading to notes, and resisting the temptation to stuff the window just because it's big.

🎯 For the AI PM

Why it matters — Context is the agent's real scarce resource, and it's also your cost line. Every token in the window is paid for on every step, and quality degrades as the window fills — long-running agents get dumber and pricier at the same time. Most "the agent forgot / ignored my instruction / lost the plot" complaints are context-management failures, not model failures.

What it changes in your decisions — "What does the agent remember, for how long, across what boundary?" becomes a spec question with privacy teeth. Memory that delights one user ("it knows my preferences") is a liability across users. A user-visible, editable memory is a different product from a silent one.

Ask yourself — "At step 30 of a long task, what is actually in this agent's window — and what fell out?"

Risk if ignored — An agent that aces 5-step demos and quietly falls apart on 50-step real work. Or a memory feature that resurfaces something a user assumed was forgotten — in front of the wrong audience.

The memory hierarchy

The memory hierarchy

Context window as working memory · external memory as big, cheap, durable

A big window is headroom, not a strategy — the craft is curating the smallest high-signal set per step.

Context window — working memory, paid every step
Instructions (system prompt)
Recent turns & tool results
Retrieved snippets (just-in-time)
External memory — big, cheap, durable
Knowledge corpora — docs, code, tickets
Agent notes & scratchpads — plans, progress
Persistent memory — profiles, preferences, procedures
Corpora → retrieval / search → just-in-time snippets
Notes → reread when needed → recent turns
Persistent memory → loaded at session start → instructions
Recent turns → compaction: summarize, drop stale output → notes
Recent turns → write-back: "remember this" → persistent memory

Context engineering

The discipline has a name because the naive strategy — append everything, forever — reliably fails. The working techniques:

At enterprise scale, this discipline separates a toy from a product. A cleverly prompted assistant answers one question well. A product operates across a canvas of entitlements, policies, compliance frameworks, and strategy — and that context has to arrive through a pipeline, per request, not through whatever survived the conversation. The tell that the pipeline is missing is inconsistency across sessions — like a roadmap assistant that recommends entering the SMB market on Monday and enterprise-only on Tuesday, because nothing carried the strategic context forward. When users report an agent as "unreliable," check what its window actually contained on each occasion before blaming the model.

What "the agent remembers me" really means

Product memory is three separate features wearing one name. Scope them separately:

Failure modes

Practitioner checklist