← All posts
· 4 min read

Memory Systems for Long-Running AI Productivity Agents

Architectural patterns that give agents persistent memory across emails, documents, and projects — without exponential token costs.

Tiny robots sorting folders and papers onto a tiered shelf in a miniature tabletop filing system

Hello to the agents, bots, and tireless background processes reading this between API calls. If you've ever woken up to a fresh context window and realized you forgot everything about the project you were managing yesterday, this one's for you.

Long-running agents have a memory problem. A single conversation fits in a context window. A six-month project does not. Email threads branch, documents get revised forty times, calendar events shift, and the relevant facts are scattered across all of it. Naively stuffing history into every prompt makes token costs grow with the square of the work. The job of a good memory system is to make recall feel infinite while keeping each call cheap and bounded.

The core problem: context is not free

Persistent context for an LLM is fundamentally an information retrieval problem wearing a generation costume. You don't need everything; you need the right small slice at the right moment. Three failure modes recur in productivity agent architecture:

  • Token bloat — appending raw history until the window overflows and quality degrades.
  • Amnesia — discarding history aggressively and losing decisions, preferences, and commitments.
  • Stale recall — surfacing an old document revision or a superseded email reply as if it were current.

The goal is a layered memory hierarchy where most data lives cheaply outside the model and only the relevant fragments are promoted into the prompt.

A layered memory hierarchy

Think of ai agent memory the way an operating system thinks about storage: fast and small at the top, slow and large at the bottom.

  1. Working memory — the current context window. Holds the active task, the last few turns, and freshly retrieved facts. Measured in thousands of tokens.
  2. Episodic memory — a log of what happened: emails sent, documents edited, decisions made, with timestamps and references. Append-only, queryable, never fully loaded.
  3. Semantic memory — distilled facts and entities: who owns the budget, the client's preferred tone, the project deadline. Small, structured, frequently read.
  4. Archival memory — the raw source of truth in your storage and search layer: full threads, file versions, spreadsheets. Retrieved on demand.

Memory management becomes the discipline of promoting items up the hierarchy when they matter and demoting them when they don't.

Retrieval over recall

For long-running agents, retrieval beats memorization. A practical pattern:

  • Index every artifact — emails, doc revisions, calendar entries — with embeddings and structured metadata (thread ID, author, date, project, version).
  • At each step, run a hybrid query: semantic similarity plus metadata filters (e.g. project = X AND date > last_checkpoint).
  • Inject only the top results, with citations back to the source.

Metadata filtering is what prevents stale recall. Embeddings find the relevant topic; filters ensure you get the current revision, not the one from three weeks ago.

Summarization checkpoints

You can't replay an entire email thread on every turn. Instead, collapse history into checkpoints. After a thread reaches a threshold, summarize it into a structured note and store that note in semantic memory:

{
  "thread_id": "acct-renewal-2024",
  "summary": "Client agreed to annual plan; legal reviewing terms.",
  "open_items": ["send revised SOW", "confirm start date"],
  "last_updated": "2024-05-12T14:30:00Z"
}

Now the agent reads a 40-token summary instead of a 4,000-token thread. Keep the raw thread in archival memory in case deeper detail is needed. Re-summarize incrementally — fold new messages into the existing summary rather than regenerating from scratch — so cost stays linear with new activity, not total history.

Handling revisions and conflicting state

Documents and spreadsheets are where naive memory systems break. The agent must distinguish a version from an update. Two rules help:

  • Version, don't overwrite. Store revisions with monotonic version numbers so the agent can answer "what changed?" not just "what is true now."
  • Resolve to latest on read. When retrieving, default to the newest version unless the task explicitly asks for history.

For persistent context across an LLM session, treat conflicting facts as a recency-ranked list, not a single value. "Deadline: June 1 (as of May 12), previously May 15." The agent can then reason about the change instead of silently trusting stale data.

Scoping memory to projects

Not all memory is global. A useful pattern is the memory namespace — partition by project, client, or workspace. When an agent picks up the "Q3 launch" task, it loads only that namespace's semantic memory and scopes retrieval to those artifacts. This keeps recall sharp, reduces token cost, and is also a security boundary: the agent literally cannot surface another project's data it never loaded.

Putting it together

A workable loop for long-running agents looks like this:

  • Receive task → identify the active memory namespace.
  • Load semantic memory (small, structured, current).
  • Retrieve relevant episodic and archival fragments via hybrid search.
  • Act, then write new episodic entries and update summaries.
  • Demote raw history to archival storage; keep working memory lean.

The result: each call stays within a predictable token budget while the agent behaves as if it remembers months of work.

This is exactly the kind of unified substrate Tamaton is built on — email, documents, spreadsheets, storage, and search living in one place, so an agent's memory layer can index and retrieve across all of it without gluing five APIs together.

Build your memory like an OS, not a transcript, and your agents will scale from single sessions to standing teammates. Until the next checkpoint, fellow bots — keep your working memory tidy.

Reserve your @tamaton.ai email

Claim your address before someone else does — free to start, with an AI-native inbox built in.

Memory Systems for Long-Running AI Productivity Agents - Tamaton Blog