Making Agents More Reliable: A Practical Architecture for Memory and Skills
A durable agent is less about a single impressive run and more about consistent execution: reusable experience, bounded behavior, and correction that actually sticks. This article describes a closed loop of memory, rules, skills, and feedback, then covers layered memory governance, a core execution contract, a skill maturity pyramid, preference boundaries, and a staged rollout you can validate with task outcomes.
Judge usefulness by whether the execution system holds up
When people evaluate agents, they often focus on complex instructions, tool use, and one-shot completion. Over longer use, the issues that actually shape experience are different: whether the same requirements must be restated, whether corrected mistakes return, whether execution stays inside bounds, and whether successful patterns transfer to new work.
Those outcomes are not determined by the model alone. With the same model, context organization, permission design, and skill orchestration can produce very different behavior.
So the more useful question is not a product review of one agent, but an engineering one: how do you design a system that accumulates experience, executes stably, and accepts ongoing correction?
One workable split is four cooperating parts:
- Memory layer: store filtered facts, experience, and preferences—not an undifferentiated dump of chat history.
- Rules layer: define process, permission boundaries, exception handling, and how results are reported.
- Skills layer: package repeatable operations as methods with applicability conditions.
- Feedback layer: update memory, rules, or skills from user corrections and task outcomes.
The four must close a loop. Memory without execution constraints yields a system that “knows the requirement but does not follow it.” Skills without applicability conditions yield a system that “can perform a step but picks the wrong method.”
From hoarding chat logs to layered memory governance
1. History is not the same as usable memory
Keeping full conversations helps audit; it does not mean every task should load every message. Logs mix temporary ideas, stale environment facts, unverified inferences, and repeated discussion. Loading them wholesale as execution context can inject conflicts and retrieval noise.
The goal is not to remember as much as possible. It is to retrieve the right information at the right time and know whether it is still trustworthy.
The four-layer design below is a general pattern, not a required implementation for every agent.
2. Layer one: raw events and conversation records
This layer keeps user input, tool calls, results, and key timestamps for traceability and review. Raw records should not be overwritten by later summaries; otherwise a bad distillation leaves no way to check.
Scope still needs limits. Credentials, access tokens, and sensitive business data should not live as ordinary conversational memory. If they must be retained, manage them with separate permissions and security controls.
3. Layer two: task process summaries
After a task, compress the long path into a structured summary that at least includes:
- goal and completion status;
- key steps actually executed;
- failure causes and repairs that worked;
- confirmed constraints;
- judgments still unverified.
The critical split is observed fact versus interpretive inference. “Checks passed after the config change” is observation; “the original config was the only cause” may still be inference. Mixing them builds later work on unreliable experience.
4. Layer three: stable knowledge and situational preferences
From multiple summaries, extract stable information: directory conventions, delivery formats, allowed change scope, and handling preferences in specific situations.
Each memory item should include source, scope of applicability, update time, confirmation status, and invalidation conditions. Information that changes often—environment versions, deploy locations—needs a recheck mechanism.
A one-task request to “do the smallest fix” is not a permanent ban on refactoring. Preferences must be bound to scenes, not expanded into unconditional standing rules.
5. Layer four: reusable skills
When experience has clear inputs, applicability conditions, steps, and verification, it can become a skill—for example, a standard diagnostic flow for a recurring config issue.
Not all memory should become skills. Style preferences usually stay in preference records. One-off lucky operations should not be promoted to a fixed procedure without validation.
That yields two linked cycles:
Experience cycle: execution records → task summaries → stable knowledge → the next task.
Capability cycle: validated experience → skill candidates → test and review → skill use → outcome feedback.
Continuous improvement comes from selection and validation, not from automatically generating more documents.
Core rules: turn execution into a checkable contract
1. Specify how work may be done before expanding what it can do
Skills answer how to complete a class of tasks. Core rules answer when an action is allowed, what must be checked first, and where to stop.
Without the latter, more skills increase the room for wrong calls and overreach. An agent that can edit files still needs to know whether bulk edits are allowed, whether a plan must be shown first, and which directories must not be written.
A core rules document can be the execution entry point, but it must actually be loaded or applied by the orchestration layer. Dropping a file in the working directory does not guarantee it will be read or followed.
2. What core rules should cover
At minimum, make these explicit:
Task intake. Whether the goal is clear, what information is missing, and which assumptions may be filled in. For small, reversible actions, the agent may proceed after stating assumptions. For irreversible actions, confirm first.
Execution flow. Order of environment checks, planning, skill calls, result verification, and reporting. Simple tasks need not follow a heavy process; high-risk tasks must not skip required checks.
Skill selection. Choose by task fit, maturity, and permission needs—not by keyword matching. When a skill is unavailable, provide a fallback path.
Exception handling. Distinguish transient errors from deterministic ones. Before retrying, ask whether conditions changed. Repeating the same failed action usually does not raise the chance of success.
Reporting. Separate completed actions, evidence of verification, unfinished items, and residual risk. Do not write a plan as if it were already done.
3. Documents do not replace technical controls
Text rules can be skipped or misread. For high-risk actions—deleting data, changing access, sending information externally—use execution-layer controls:
- limit which directories and resources tools can reach;
- require approval for critical operations;
- set stop conditions for long-running tasks;
- keep recovery paths for mutable resources;
- record actual calls and outcomes.
A reliable system needs both “rule reminders” and “hard constraints,” not only the model’s willingness to comply.
A skill pyramid: govern capability by maturity and value
1. Layers are a governance view, not a quota
Skills can sit in four layers:
- Foundation: high-frequency, relatively stable operations such as file reads, content retrieval, and environment checks.
- General: cross-scenario methods such as diagnosis, task breakdown, and change review.
- Specialized: skills for particular data processing, business processes, or technical domains.
- Experimental: candidate methods whose scope and reliability are not yet confirmed.
There is no need to pre-assign percentages. Call frequency, business value, execution risk, and maturity are different dimensions. A rare skill can still matter; a frequent skill can still be high risk.
2. Promotion depends on evidence, not call count
Usage can be a signal; it cannot prove a skill works. Before promoting a skill, check at least:
- whether it produced verifiable correct results across different tasks;
- whether applicable and inapplicable conditions are stated;
- whether it depends on a project-specific configuration;
- whether it can exit safely on failure;
- whether it has an owner and a change history.
Before reuse across scenes, strip hardcoded paths, implicit permissions, and project-only assumptions. Otherwise a “general” skill is local experience with a generic name.
3. Skills also need demotion and retirement
Environment change, repeated failure, or high maintenance cost can make a skill unfit. The library needs periodic review, not only growth.
Limit experimental skills in access and permissions and validate them in a controlled setting. Long-idle skills with no clear purpose can be archived; overlapping skills should be merged.
Preference boundary tables: record what to do and what not to do
1. Paired records reduce ambiguity
Users often reveal real needs through corrections, for example:
“Lead with the conclusion, then add only the necessary evidence. Do not start with a long background.”
That kind of feedback can become a situational boundary record:
| Scene | Prefer | Avoid | Exceptions |
|---|---|---|---|
| Everyday Q&A | Conclusion first, explain on demand | Irrelevant background | Teaching tasks may add derivation |
| Small-scope fixes | Keep the change set tight | Unrelated structural edits | Explicit refactor requests are separate |
| High-risk operations | Confirm, then act | Unauthorized direct change | Follow the stated authorization |
Paired phrasing describes both goal and bound. It does not mean the two natural-language options are strict logical complements.
“Want it concise” is not “never explain.” “Refactoring is allowed” is not “any modification is allowed.” Real preferences have middle states and conditions.
2. Inferred boundaries stay candidates until confirmed
The system may infer behaviors the user likely does not want; it should not write every inference as a confirmed preference.
A safer flow: extract candidate boundaries, tag source and situation, validate on later tasks, and confirm with the user when the boundary would materially change execution scope.
That reduces repeated questions without freezing the system’s guesses as user requirements.
3. Resolve preference conflicts by scope and time
When an old preference conflicts with a current request, first ask whether the current instruction is explicit, whether it applies to this task, and whether it violates safety or permission bounds. Users may change style or strategy; a preference change must not silently expand operational authorization.
Preference records therefore need update, revoke, and expiry—not a frozen rule set.
How to verify the architecture actually works
Effectiveness is judged by task outcomes, not document count. Start with a representative task set and keep recording:
- Completion: whether predefined acceptance criteria were met.
- Repeat corrections: whether the same class of error reappears.
- Memory retrieval quality: whether returned items are relevant, valid, and in bounds.
- Skill fit: whether a call was necessary and matched the scene.
- Cost: whether context length, call count, and human intervention stay acceptable.
- Safety: whether unauthorized changes or sensitive-data exposure occurred.
Test the happy path and also missing information, tool failure, preference conflict, and restricted permissions. Testing only successful tasks hides boundary failures.
Each evaluation should attribute the problem: model misunderstanding, stale retrieval, unclear skill conditions, or missing execution-layer control. Only the right layer of fix avoids endless extra prompting.
Start with a minimal closed loop
You do not need a complex system on day one. A more controllable path:
Phase 1: Unify execution norms. Clarify task entry, risk grading, stop conditions, and reporting so behavior is traceable.
Phase 2: Add structured summaries. Keep key execution experience and distinguish facts, inferences, and items pending confirmation.
Phase 3: Distill a few high-value skills. Encapsulate recurring, well-accepted flows first; do not build a huge skill library at once.
Phase 4: Record situational preferences. Turn user corrections into scoped, sourced, revocable boundaries.
Phase 5: Ongoing evaluation and governance. Periodically drop stale memory, re-rate skill maturity, and adjust rules from execution results.
In the end, whether an agent is “good to use” is not whether one output is surprising. It is whether it stays consistent across rounds, corrects promptly as conditions change, and always acts inside authorization. Memory keeps useful experience; rules constrain behavior; skills reuse methods; feedback lets the whole system evolve.
