Give every memory your agent stores a type and a score. Rank by relevance, recency and importance, so a memory nobody retrieves or depends on loses priority over time. Then "forget" by dropping low scorers out of retrieval, not by deleting the rows you may need later.
Richmond Alake is Director of AI Developer Experience at Oracle. He walked through this in an April 2026 episode, and his short version of the principle is "don't delete, forget."
What are the four kinds of agent memory?
Alake borrows four types from human memory and maps each to a computational form:
- Working memory: the context window (or an external scratchpad). Short-term and limited.
- Semantic memory: the knowledge base and facts about your domain.
- Episodic memory: timestamped interactions, such as past conversations.
- Procedural memory: routines and ways of doing tasks, which many teams already keep as skills or instruction files.
The labels matter at read time. Put retrieved items into the context window under a heading that says what kind of memory each one is and how the model should use it. Alake calls this making the agent memory-aware. A single undifferentiated blob of retrieved chunks leaves the model to guess what each piece is for.
How do you score memories so old ones fade?
With a composite score, recomputed as the system runs. Alake points to a pattern that is easy to implement:
But there are projects. And one of the ones that is really easy to implement, it comes from a paper called Generative Agents, written by folks at Stanford. It got released in 2023. And in that paper, they add an attribute to each memory unit within this agent simulation environment. And that attribute is a computation of three variables, which is the relevance, the recency and the importance of the information.
Richmond Alake, Director of AI Developer Experience at Oracle, on Chain of Thought ep 53
Relevance is similarity to the current query. Recency comes from timestamps. Importance can reflect how many other memory units relate to or call a given memory. When a memory isn't retrieved and isn't a dependency for other memory units, its score drifts down and it falls out of the top results. The row is still there if you need it, which matters in finance and other fields that get audited.
A minimal sketch to adapt. similarity is a hypothetical 0-1 score from your embedder. The weights and half-life are placeholders to tune, not recommended values.
import math from dataclasses import dataclass from datetime import datetime, timezone @dataclass class Memory: kind: str # "working" | "semantic" | "episodic" | "procedural" text: str created: datetime last_used: datetime | None = None importance: float = 0.5 # raise as other memories link to or call this one def score(m, query, now, w=(0.5, 0.3, 0.2), half_life_h=72): age_h = (now - (m.last_used or m.created)).total_seconds() / 3600 recency = 0.5 ** (age_h / half_life_h) return w[0] * similarity(query, m.text) + w[1] * recency + w[2] * m.importance def recall(memories, query, k=8, floor=0.2): now = datetime.now(timezone.utc) # store every timestamp as timezone-aware UTC ranked = sorted(memories, key=lambda m: score(m, query, now), reverse=True) picked = [m for m in ranked[:k] if score(m, query, now) >= floor] for m in picked: m.last_used = now # retrieval keeps a memory alive return picked # nothing is deleted; low scorers just stop showing up Where does context engineering stop and memory engineering start?
At the edge of the context window. Choosing what goes into the window, including compaction and summarization prompts, is context engineering. Alake draws the line where uncompressed information moves to an external store:
How do you know which information to compact, right? How do you prompt the LLM to do the right selection of signals and the right compression, right? That's context engineering. But when you start to move, the uncompressed information to an external store because now you've given your agent the ability to do just-in-time retrieval.
Richmond Alake, Director of AI Developer Experience at Oracle, on Chain of Thought ep 53
Once history lives outside the window, you need to decide how each memory type is created, read, updated and forgotten, and when the agent reads it back.
Should agent memory live in files or a database?
It depends on how far along the product is. Alake's answer: if you're building a proof of concept that executives wanted yesterday, a file system is fine because it saves you from infrastructure decisions. Once customers use it and it has to scale, move to proven systems.
He also argued against one database per data type. A single agent question can need graph traversal (connected accounts), spatial search (nearby clients), vector similarity and relational filters at once, and four separate stores are four things to keep in sync.
FAQ
Is agent memory the same as RAG?
No. RAG is one retrieval path. Memory also covers what gets stored, how it's typed, how it decays and how it's read back across sessions.
What does "don't delete, forget" mean in code?
Keep memory records in durable storage and lower their priority or filter them out of retrieval, instead of deleting rows.
Should I wait for model providers to solve memory?
Alake's view is that everyone, from database companies to model providers, is trying to solve memory, and that a single developer can still build a memory system that remembers better than ChatGPT.
Takeaway
- Tag every stored memory as working, semantic, episodic or procedural.
- Label retrieved memories by type inside the context window.
- Rank with relevance, recency and importance, and tune the weights on your own data.
- Forget by lowering priority, and keep records you may need for audits.
- Start with files for a demo, and revisit storage once real users and scale arrive.
The full conversation, with the transcript, is on Chain of Thought.
Subscribe to the Chain of Thought newsletter for new episodes and write-ups like this one.
Drafted with AI assistance from the episode transcripts.