AI memory and state: how AI remembers across sessions
An AI model wakes up blank on every new session unless software saves and reloads information for it. Practical AI systems split memory into three separate layers: working context for the active chat, durable memory for evolving preferences and facts, and workflow state that checkpoints where a multi-step job left off.
Why your assistant forgets your pricing format every Monday morning
You spend ten minutes teaching an AI chat how your company formats job estimates: always separate labor from materials, list permit responsibility explicitly, and keep the cover note under four sentences. The next morning you open a fresh thread and it hands you a generic wall of text as if you had never spoken.
That blank slate happens because a model does not keep a running diary on its own. Software around the model builds memory out of three distinct layers: short-term memory (what is inside the active context window right now), long-term memory (durable facts and preferences saved between sessions), and workflow state (exact checkpoints of an in-progress multi-step run). Treating those three layers as one bucket is how agents get slow, confused, and unreliable.
What a clean durable memory record looks like
Instead of dumping raw chat logs into future prompts, reliable systems save small, typed memory records with provenance and an expiration rule:
Structured AI memory record (JSON)
{
"memory_id": "mem_2026_0142",
"scope": "org:acme_roofing",
"kind": "preference",
"fact": "Always separate labor and materials on residential repair quotes.",
"source": "owner_feedback_2026_11_18",
"verified": true,
"updated_at": "2026-11-18",
"expires_at": "2027-05-18"
}Durable memory vs. RAG vs. workflow state
Store it in durable memory when
- It is an evolving user or team preference (tone, formatting rules, recurring decisions).
- It is a small, stable fact learned across conversations that applies to many future sessions.
- You can attach a clear scope (this user vs. whole company), a source, and a way to edit or delete it.
Keep it in RAG or workflow state when
- It belongs in managed company documents (SOPs, warranty PDFs, price books). Put those in RAG so one document edit updates everything.
- It is temporary progress for one active job (step 3 of 5 completed, waiting on human approval). Store that in structured workflow state or a database table.
- It contains sensitive PII, one-off passwords, or temporary exceptions that should never resurface in a later chat.
For builders designing memory stores and checkpointing for production agents.
Stale-memory drift and context rot: Auto-saving every preference without timestamps or conflict resolution creates contradictions (for example, an old "use net-15" memory competing with a new "use net-30" policy). Loading dozens of loosely related memories into every turn accelerates context rot. Prefer explicit write triggers, superseding old records on update, and retrieving only the top few scoped facts.
Memory poisoning from untrusted inputs: If an agent reads outside emails or web pages and is allowed to write straight to long-term memory, indirect prompt injection can plant a persistent bad rule that fires on future sessions long after the bad email is gone. Gate memory writes on trusted user turns or human confirmation, and log every write in your trace.
Checkpointing vs. conversational memory: Long-running agents should persist execution state (current step, tool outputs, pending approval ID) in a normal relational database so a crashed process resumes cleanly without replaying side effects. Enforce strict tenant isolation and deletion hooks so removing a user or customer purges their stored memories too.
Try this in 2 minutes
Audit what your AI tools are currently remembering about your work:
-
Open your AI app's saved memories list
Check the settings panel in ChatGPT, Claude, or your team workspace and scan the saved facts for outdated or wrong entries.
-
Delete stale or sensitive items
Remove one-off project details, old pricing notes, or any customer PII that accidentally got saved as a general memory.
-
Move stable team rules into a shared file or skill
If a preference applies to everyone on your team, write it into a shared instruction file or AI skill rather than relying on one person's chat memory.
Building an agent that needs clean memory and state?
We design custom agents with clear separation between working context, inspectable durable memory, and database-backed workflow checkpoints so your automations resume reliably and never drift on stale assumptions.
Connect the architecture: What is context engineering?, What is RAG?, and What is an agentic harness?. Look up terms in the AI glossary.
Common questions about AI memory and state
What is the difference between short-term and long-term AI memory?
Short-term memory is the text inside the model's active context window during the current conversation or run. Long-term memory is information saved outside the model and reloaded in future sessions.
How is AI memory different from RAG?
RAG retrieves passages from a managed library of company documents like manuals and policies. Memory stores smaller, evolving facts and preferences learned across interactions with a user or team.
What is workflow state in an AI agent?
Workflow state is the structured record of where an active multi-step job stands (completed steps, fetched IDs, pending approvals) stored in software so the run can pause, wait for a human, or recover from a crash cleanly.
Why can AI memory make answers worse over time?
If old preferences or one-off exceptions pile up without dates or cleanup, contradictory memories compete in the prompt and steer the model using outdated rules.
Can an attacker corrupt an AI agent's long-term memory?
Yes, if an agent writes to long-term memory while processing untrusted emails or web pages. Restricting memory writes to verified user interactions and keeping memories inspectable prevents persistent poisoning.
Should team-wide formatting rules live in chat memory or a skill?
Put team-wide rules in a shared skill or workspace instruction file, not personal chat memory. That way every employee gets the same version and updates happen in one place.