AI Agent Memory Layer: Completing the Thin Harness Architecture
This article examines why a thin scheduling framework paired with pluggable capability modules is not enough for AI agents that need to improve over time. It explains the difference between determinism and growth, maps the three layers of agent design to a skeleton, muscles, and a nervous system, and details how to build a memory layer in practice: what to write, how to retrieve by scene similarity, how to handle decay and conflicts, and how to keep memory observable and rollback-friendly. It also covers common pitfalls and a minimal path to getting started.
1. A Misread Design Principle: Determinism Is Not Growth
The principle of a “thin scheduling harness with thick capability modules” is often reduced to a slogan: the framework only schedules, and all capabilities are pushed down into pluggable modules. This design is highly attractive from an engineering standpoint—the same input always produces the same output, behavior is predictable, testable, and rollback-friendly, and reliability is built on exactly this kind of determinism.
But determinism comes with an easily overlooked cost: the system does not get better through use. An execution unit that never forgets and never distills makes no structural difference between its hundredth run of a similar task and its first. It is repeating, not learning. This article argues that what such architectures lack is not more capability modules, but a separate layer that turns experience into dispositions—a memory layer.
2. The Value of Forgetting: From Remembering Details to Forming Dispositions
Human memory forgets, and forgetting is not a defect but a filtering mechanism: what matters is retained, what is secondary fades, and what remains crystallizes into dispositions, intuition, and craft. You do not need to remember the precise posture of every cycling attempt—you only need to “know how to ride a bike.” That “knowing how” is precisely what forgetting has distilled for you.
Capability modules work the opposite way. They neither forget nor distill. Every invocation is a fresh execution with no relation to history. So when the number of capability modules grows from ten to a hundred, the agent simply has more isolated capabilities—no links between them, no accumulation, no preferences grown out of real usage.
Two kinds of “thick” need to be distinguished here: thick in quantity, and thick in experience. The former comes from writing more modules; the latter can only be deposited through use. A common predicament in the industry is that the module library keeps growing while actual performance stalls—because only the former is increasing.
3. Mapping the Three Layers: Skeleton, Muscles, and Nervous System
Comparing an agent to the human body makes the layering intuitive:
- The scheduling framework is the skeleton: it determines structure, posture, and direction of movement, and constrains the overall flow and the space of available actions.
- Capability modules are the muscles: they determine strength, speed, and concrete actions, and are replaceable, composable execution units.
- The memory layer is the nervous system: it connects skeleton and muscles, feeds the result of the last movement back into the next, and makes actions progressively more precise.
Muscles without a nervous system contract in isolation every time. A hundred squats strengthen muscle because tissue undergoes structural change under repeated stimulus; a capability module that executes the same task a hundred times undergoes no change at all. The memory layer is what performs this “structural change”: extracting dispositions from each task—for example, that a certain class of users prefers short conclusions, that a particular step has historically been the most error-prone, or that one execution path takes noticeably less time than another.
It is worth stressing that these dispositions are not new capability modules. They are experiential adjustments grown on top of existing capabilities. What they change is invocation parameters, execution order, and validation strictness—not the capabilities themselves.
4. The Real Opposite of “Never Forgetting”
“Never forgetting” describes the determinism advantage of capability modules. That engineering value is real and should not be dismissed. But the objective function an agent needs is not “the same output forever,” but “better than last time on the same class of scenario.” The latter cannot be provided by determinism alone; it depends on memory.
The difference can be expressed like this:
Capability module: each call = pure function execution, output determined only by inputMemory layer : each call = pure function execution + experience overlay, output gradually optimized with history
This also explains why memory cannot simply be stuffed into conditional branches of the scheduling framework. Hard-coded if-else is static experience and cannot grow with usage; memory must be independent data and processes that are writable, retrievable, and subject to decay.
5. Engineering the Memory Layer
1. Writing: Only Distill Reusable Dispositions
Not every interaction is worth remembering. It is advisable to write only three kinds of information: repeatedly confirmed user preferences, execution paths verified as effective, and root-cause labels from failure cases. On write, structure it as “scene features + disposition conclusion + confidence + source,” and avoid storing large blocks of raw conversation.
{"scene": "code change description generation","preference": "conclusion first, no more than 200 words","confidence": 0.82,"evidence": 12}
2. Retrieval: By Scene Similarity, Not Chronological Order
The value of memory depends on whether it can be retrieved at the right moment. In practice, similarity matching is usually done on scene features first, then results are ranked by confidence and freshness, and only the top few entries are injected into the context to control prompt length and noise.
3. Decay and Conflict Resolution
Memory must be allowed to expire. Lowering the weight of entries not reused for a long time, and letting conclusions backed by stronger new evidence override older ones, is key to avoiding “memory pollution.” Memory without a decay mechanism eventually degrades into an unmaintainable historical burden.
4. Observability and Rollback
Memory is mutable state, so it must be governed like data: record the source of changes, support per-entry rollback, and filter sensitive information out of injected content. In cloud environments you can typically use object storage for snapshots, message queues to drive asynchronous writes, and logging services with monitoring and alerting to track hit rates and abnormal fluctuations. These all belong to general capability categories and can be selected according to your own environment.
6. Common Pitfalls
- Equating memory with longer context: context is a capacity problem, memory is a distillation problem, and piling up unlimited history only amplifies noise.
- Letting memory directly rewrite capability modules: experience should influence how capabilities are invoked, not continuously fork new modules, otherwise the module library will swell out of control.
- Ignoring the evaluation loop: without an offline evaluation set and online feedback, you cannot tell whether a given memory entry brings improvement or regression.
7. Conclusion
A thin scheduling framework with thick capability modules solves “doing things predictably”; the memory layer solves “getting better the more you do.” The former is the foundation of engineering reliability; the latter is the source of long-term competitiveness. Designing memory as an independent layer—with clear write criteria, retrieval strategy, decay rules, and governance—is what lets an agent move from repeated execution to accumulated experience. To implement this in a Baidu AI Cloud environment, you can start with general storage, asynchronous messaging, and observability capabilities, get one minimal loop working end to end, and then gradually expand the granularity and coverage of memory.
