Source: Sonpaorong Muchhim, LinkedIn post with an animated diagram, "Agentic Memory: short-term vs. long-term, inside the agent harness" (posted about 2026-12-01). No linked paper or repository: this is a practitioner explainer, so the summary checks its arithmetic and its model rather than any benchmark.
For: staff engineers designing or reviewing an agent harness that runs long, multi-step, permissioned work.
The claim in one paragraph
Agent reliability is decided less by the model than by the harness that controls what enters each model call. The harness owns two layers: the context window (short-term, spent on this call) and long-term stores (kept across sessions). Models are swappable; the memory you build is the durable asset. Four things have to be right: context is a compounding cost, memory management is core engineering, more memory can mean more noise, and reliability is not only in the weights.
The arithmetic, checked
The post's cost example holds. If every call resends the whole context, starting at C0 tokens and growing by d per step, N calls consume N·C0 + d·N(N−1)/2 input tokens.
| Calls | Start | Growth per step | Input tokens |
|---|---|---|---|
| 20 | 20K | 3K | 400K + 570K = 970K |
| 40 | 20K | 3K | 800K + 2,340K = 3.14M |
The second term is quadratic, so doubling the steps costs 3.2 times the tokens. Three things the example leaves out:
Growth is not even. Real per-step growth is dominated by tool results, which are spiky (a file read or a search dump can be 20K on its own). That is why clearing tool results is usually the cheapest lever, ahead of summarizing history.
Caching changes the price, not the window. The post says this correctly. A cached prefix is billed at a fraction and prefills faster, but it still occupies the window and still competes for attention.
Compaction turns the curve piecewise. Each compaction resets C to a summary size, so cost becomes a sum of short quadratics. The price is whatever the summary dropped.
The model in the diagram
The GIF animates a ten-step loop around a two-layer memory:
Users send a request (and get the reply).
The orchestrator assembles the context.
Long-term memory is retrieved: search, rank, inject.
More is loaded on demand during the task.
The LLM reasons over the context and picks tools.
A human approves high-risk actions.
Tools act on real systems (APIs, MCP servers).
Results enter the context.
Auto-compaction fires as the window fills (the frame shows it "62% full", illustrative).
Outcomes and lessons are written back to long-term memory.
Layer 1, the context window, is drawn as a stack. The bottom is loaded at session start and prompt-cached: system prompt, tool and MCP definitions, memory files. Above it, added during the task: retrieved memory, conversation history, tool results, then free space for reasoning and output. Three controls act on it: load on demand, auto-compaction, clear tool results.
Layer 2, long-term memory, is split by kind: semantic (facts and domain rules, in graph and vector stores), episodic (past cases and outcomes, in session logs), procedural (how the work gets done, in memory files and playbooks) and user profile (preferences, role, tone). Maintenance is listed as deduplicate, update, expire, delete on request.
Also in the harness: skills loaded when needed, subagents with isolated windows, state (plans and checkpoints), loop control (stops, retries, limits), a sandbox, guardrails (permissions, injection defence), and evals and tracing.
Where it is strong
It puts the cached prefix and the task-grown region in one picture. That is the right mental model for cost: anything in the prefix is cheap per call but permanent for the session, and editing a memory file mid-session invalidates the cache from that point.
It names forgetting as a first-class operation (expire, delete on request), not an afterthought.
"Bad memory can be worse than no memory" matches measured results: retrieved memory can lose to searching raw history.
Where it is thin
Two taxonomies, loosely joined. The text lists long-term memory by storage (vector or hybrid RAG, GraphRAG, memory files, databases); the diagram lists it by kind (semantic, episodic, procedural, profile). They are different axes. A design review should fix both: what a memory is, and how it is retrieved.
Access control is stated, not drawn. The post says memory must decide who can access it, but the diagram's only permission box is a harness guardrail. Nothing shows a read filtered by the caller's current rights. A reader's comment names the failure: a user who loses access to a file today should not get it back from yesterday's notes.
Expiry is not supersession. Expire handles age. It does not handle a memory that is fresh, accurately retrieved and wrong because the situation changed. That needs versioning or a valid-time model, and a test that the agent revises its answer when new evidence contradicts an old memory.
The write path has no gate. Step 10 writes outcomes and lessons back with no review, scoring or provenance. That is the usual route for memory poisoning, from a bad lesson or from injected tool output.
No numbers beyond the cost example. "More context can weaken focus" is consistent with long-context degradation results, but the post cites none.
Failure modes to design against
Compaction drops the one detail a later step needs (an ID, a constraint, a user correction).
Stale or superseded memories outrank current evidence because they score higher on similarity.
Memory leaks across permission boundaries: written under one user's rights, read under another's.
Lessons written from a failed or injected run become standing instructions.
Memory files grow until the cached prefix crowds out free space.
Review checklist
What is in the cached prefix, how large is it, and what invalidates it?
Which per-step growth dominates, and is there a policy for tool results before compaction?
What does compaction keep, and is the pre-compaction history still retrievable?
Is every memory read filtered by the caller's current permissions?
How is a superseded memory retired, and is there a test for it?
Who or what approves a memory write, and does each memory record where it came from?
Are retrieval relevance and grounding evaluated separately?
The visual
The author's animated diagram (© Sonpaorong M.) is not reproduced here. See the original post on LinkedIn: https://www.linkedin.com/posts/sonpaorong-m_aiengineering-aiagents-agentharness-share-7533610981978161152-BEAf/