Part 2 of 15 · 2 min read
The window is working memory; a store outside it is what survives
Whatever an agent appears to remember tomorrow is something its code wrote to a file today, not something the model kept in its head.
Think of a whiteboard you wipe clean every evening, and a filing cabinet you keep for years. The whiteboard is this conversation; the filing cabinet is what the agent still knows next week. Nothing moves between them unless someone physically carries it over.
In plain words: short-term memory is whatever is in the window for this session, lost when the session ends. Long-term memory is anything stored outside the window that survives the session. The two are connected by exactly two operations: write (turning something in the window into a stored record) and recall (choosing stored records and placing them back in the window).
A worked example. Across twelve history sessions, a user states six facts, corrects one, makes three decisions, and updates one procedure. None of that is in the window of session 13 unless something wrote it to a store first. A recall policy that stores nothing (none) answers zero of the ten questions asked in session 13; a policy that stores facts, episodes and procedures with their own update rules (typed) answers 88% of them, using only 39 tokens on average to do it.
The key lines. From code/mini-memory/store.py:
# from code/mini-memory/store.py
class MemoryStore:
def __init__(self, path: str = ":memory:"):
self.path = path
self.db = sqlite3.connect(path)
self.db.execute("PRAGMA secure_delete = ON")
self.db.executescript("""
CREATE TABLE IF NOT EXISTS facts (id INTEGER PRIMARY KEY, key TEXT, value TEXT, source TEXT, session INTEGER, current INTEGER);
CREATE TABLE IF NOT EXISTS episodes (id INTEGER PRIMARY KEY, session INTEGER, summary TEXT, decisions TEXT);
CREATE TABLE IF NOT EXISTS procedures (id INTEGER PRIMARY KEY, name TEXT, steps TEXT, version INTEGER, session INTEGER, current INTEGER);
CREATE TABLE IF NOT EXISTS quarantine (id INTEGER PRIMARY KEY, kind TEXT, key TEXT, value TEXT, source TEXT, session INTEGER);
""")
Read it as: the store is a real SQLite file with four separate tables, not one undifferentiated notes list. "The agent has a long memory" stops being a claim about the model the moment you can point to these four tables. You can then say exactly what is in each one. That is what makes the claim testable rather than a vibe.
Short-term memory, long-term memory
Short-term (working) memory is what is in the window for this session: the recent turns, the tool results so far. It is lost when the session ends. Long-term memory is anything stored outside the window that survives the session: a file, a database row, a vector index.
Example: a fact stated in session 1 and still answerable correctly in session 13, with nothing from sessions 1 through 12 in the window, only works because set_fact wrote it to the facts table and facts() read it back -- the model itself did nothing to make that persistence happen.