Agent Memory Layer Design: Completing the Thin Harness Architecture
This article explains why a thin harness combined with thick capability modules is not enough for AI agents, and how a dedicated memory layer adds the missing ability to learn from experience. It covers a three-part model of harness, skills, and memory; a five-tier memory structure; write and forgetting policies based on salience, generalizability, and evidence; retrieval and injection with token budgets; the coordination boundary with the thin harness; evaluation and governance metrics; and a staged rollout path.
1. A Design Principle That Is Often Misread
“Thin harness, thick capability modules” is an architectural principle that has been cited repeatedly in agent engineering in recent years: converge flow control, context management, and tool invocation into a runtime shell that is as thin as possible, and accumulate domain knowledge, operating procedures, and validation rules into capability modules that can be invoked repeatedly. Its engineering value is clear — the thinner the shell, the more predictable the behavior and the lower the upgrade cost; the thicker the capabilities, the broader the coverage and the faster the delivery.
But the principle is often misread as “the more capability modules the better, and the more stable the better.” One detail in the original text deserves attention: the “never forgets” property of capability modules sounds like an advantage, but it is actually a synonym for determinism — the same input always produces the same output. Determinism is the foundation of reliability, but it is not a source of growth. A system that only repeats itself gains nothing essential from doing the same kind of task a hundred times versus doing it for the first time; human proficiency, by contrast, comes precisely from forgetting and filtering: you do not need to remember every detail of riding a bike, only the disposition “I can ride a bike.”
So what is really missing is not the 101st capability module, but the layer that creates associations between capabilities and accumulates experience from execution — memory.
2. Three Elements: Skeleton, Muscles, and Nerves
Comparing an agent to a human body makes the responsibilities of each element clearer:
- Harness = skeleton: determines structure, posture, and direction of movement; handles session orchestration, context assembly, tool routing, failure retries, and termination conditions.
- Skills = muscles: determine strength, speed, and concrete actions; package reusable operations into deterministic units.
- Memory = nervous system: connects skeleton and muscles, converts historical experience into dispositions, and makes the next action more accurate than the last.
The key difference lies in the layer where change happens. Muscle growth comes from structural change under repeated stimulation; a capability module, called a hundred times, undergoes no internal change at all. The memory layer performs exactly this “structural change” work: extracting dispositions from task traces, for example “this user prefers conclusions first,” “step three of this kind of flow is the most error-prone,” “this path has historically been about 30% faster.” These dispositions are not new capabilities; they are experiential adjustments grown on top of existing capabilities.
Illustrative pseudocode can express the difference:
# Thin shell + thick skills only: constant resultresult = skill.execute(input)# With a memory layer: execution + experience overlayctx = memory.retrieve(task_type, user, scene)result = skill.execute(input, ctx) # same skill, better parameterizedmemory.reflect(trace, outcome, feedback) # distill experience for next time
3. Memory Tiers: Not One Big “History Pile”
The approach most likely to fail in engineering is stuffing all history into one long context. A workable approach is to tier it, with different write policies, lifecycles, and retrieval methods per tier:
- Working memory: intermediate state of the current task, confirmed constraints, to-dos, and assumptions. Short lifecycle, archived when the task ends.
- Episodic memory: task traces and outcomes, including failure causes, retry counts, and human correction points. Used for retrospectives and few-shot example retrieval.
- Semantic memory: stable facts distilled from multiple episodes, such as domain terminology, system constraints, and interface usage conventions.
- Disposition memory: preferences and style, such as output length, structural templates, tone, and refusal boundaries.
- Procedural memory: executable “playbooks,” meaning multi-step experience solidified into parameterized checklists or sub-workflows.
The point of tiering is governance: preferences can be overridden, facts need verification, playbooks need versioning, and episodes need expiration and eviction.
4. Writing and Filtering: Forgetting Is a Feature, Not a Defect
The real difficulty of a memory system is on the write side. If everything is recorded, noise quickly drowns out the signal. Three gates are recommended:
- Salience: trigger a write only when an anomaly, rework, human intervention, or significant performance difference occurs.
- Generalizability: only rules that abstract into something holding across tasks enter the store; one-off coincidences stay in the episodic tier.
- Verifiability: written content must carry evidence (trace fragments, evaluation results); without evidence it is not promoted to semantic or disposition memory.
A minimal implementation could be:
def should_remember(trace) -> bool:if trace.human_corrected: return True # human correction, high valueif trace.retries >= 2: return True # repeated failure exposes a gapif trace.latency_delta > 0.3: return True # path quality differencereturn Falsedef promote(item):if item.evidence and generalizes(item, min_support=3):semantic.append(distill(item)) # episode -> semantic/dispositionepisodic.append(item) # otherwise short-term reference only
The trio of “support threshold + evidence + distillation” is equivalent to installing active forgetting: experience that fails to clear the bar decays naturally, avoiding memory bloat.
5. Retrieval and Injection: Making Memory Actually Affect Execution
Memory changes behavior only when it enters the context. Retrieval should follow a “few but accurate” principle:
- Structured filtering first: coarse-filter by task type, scene tags, user dimension, and time decay, then fine-rank by vector similarity.
- Hard budget constraint: set an explicit token budget for memory (for example 10%–20% of total context); when exceeded, evict by relevance and freshness.
- Conflict resolution: newer evidence wins; annotate confidence and source explicitly; never write unverified dispositions as hard rules.
- Switchable off: high-risk scenarios should support a “cold start mode” that uses only deterministic capabilities and suppresses disposition memory to guarantee reproducibility.
query = {task_type, scene, user_id, constraints}cands = filter(memory, query) # structured coarse filtertopk = rank(cands, by=[similarity, recency]) # fine rankingprompt = assemble(base_prompt, skills, topk[:budget])
6. The Coordination Boundary With the Thin Shell
After introducing memory, the shell should still be thin, but it must take on three explicit new responsibilities: the memory read/write interface, injection budget control, and observability instrumentation for “whether memory was used correctly.” The principle: the shell carries no domain knowledge and only handles lifecycle and policy; capability modules stay unaware of memory details and only accept an optional context field; the memory layer executes no actions and only supplies dispositions and evidence. Once the three are decoupled, replacing any one implementation causes no cascading changes.
7. Evaluation and Governance
A memory layer without evaluation is a liability. At least four categories of metrics are recommended:
- Effectiveness: trends in first-pass rate, rework rate, and human intervention rate for similar tasks.
- Efficiency: changes in average step count, tool invocation count, latency, and cost.
- Memory health: hit rate, adoption rate, expiration rate, conflict rate, and injected volume per task.
- Security and compliance: sensitive-data masking coverage, unauthorized retrieval interception rate, and the proportion that is explainable and traceable.
Governance also needs three bottom lines: memory must be viewable, correctable, and deletable; strict isolation across users; and disposition content must never override security and compliance hard constraints. If general-purpose cloud capabilities are used, traces and metrics can land in general categories such as object storage, logging services, and monitoring and alerting, with a message queue decoupling write spikes and a container platform hosting the retrieval service, avoiding binding to any proprietary interface.
8. Rollout Path
- First add episodic memory and offline retrospectives, doing “after-the-fact analysis” only, without changing online behavior.
- Add disposition memory and budgeted injection, and watch first-pass rate and rework rate.
- Introduce distillation and forgetting policies, solidifying high-frequency experience into procedural playbooks.
- Finally close the evaluation loop and governance dashboard, achieving controllable evolution that gets more accurate with use.
Conclusion
“Thin shell, thick capabilities” solves maintainability and coverage; the memory layer solves growth. Determinism and evolution do not conflict: capabilities stay constant, dispositions update with experience, and forgetting does the filtering. With all three in place, an agent turns from a “repetitive executor” into a “collaborator that gets more proficient with use.”
