Agent Skill Self-Evolution and Persistent Memory in Practice
Conversational agents often lose preferences, environment conventions, and proven methods when a session ends. This article explains how to turn validated practice into retrievable, versioned, and retireable skills, keep facts and preferences in layered memory, decouple skills from any single model, and run the loop online with least privilege, evaluation, and audit.
Many conversational agents start every task as if it were the first meeting. When context breaks, preferences, environment conventions, and methods that already proved useful disappear together. Users have to paste background again and correct the same class of mistakes. Skill self-evolution is not about stuffing a longer system prompt. It is about turning what has been done and shown to work into skills that can be retrieved, versioned, and retired, while memory persists across sessions.
Where the Problem Actually Is
A session window is good for reasoning and poor as a knowledge base. It has a length limit and no clear conditions for writing or invalidation. Putting personal habits, project directory conventions, and troubleshooting steps into the prompt both consumes tokens and is hard to audit. The system cannot say which item is still valid and which has been overturned by newer facts.
A quieter problem is that experience cannot be reused. The same flow—check logs, narrow the scope, then propose a reversible change—if it lives only in one conversation, must be rediscovered when the model, entry point, or on-call person changes. In an enterprise setting, that becomes repeated labor and operations that cannot be reproduced.
Capabilities should therefore be split. The model handles reasoning in the moment. Skills hold repeatable methods. Memory holds facts and preferences across time. The runtime stays online, rather than being tied to a personal computer that must remain powered on.
What a Learning Loop Should Include
A usable loop has at least four steps. Missing any one of them easily turns into automatic generation of junk prompts.
- Observe. Record the task goal, key constraints, tool-call results, user corrections, and whether the outcome was achieved. Storing only the success story is not enough. Failed paths matter too, or skills will repeat the same mistakes.
- Abstract. Compress one process into a reusable unit: when it applies, inputs, steps, stop conditions, expected output, and known risks. Too fine, and it becomes a log excerpt. Too coarse, and it cannot be executed.
- Validate. Try a new skill on a similar task that is not the same conversation. Pass criteria should be written in advance, for example: the steps are executable, the result can be checked, and permissions are not expanded. A skill that fails must not enter the long-term skill library.
- Commit and decay. Write it to the library only after validation, with a version, source task, and time. If it later fails repeatedly or conflicts with new facts, lower its weight, mark it stale, or archive it. Do not pin it forever.
Who drives the loop should be configurable. Automatic drafting can reduce the cost of organizing experience, but writes to the long-term library are better gated by rules or human confirmation, especially when they involve sending messages externally, changing data, spending money, or accessing sensitive directories.
What a Skill Should Look Like
A skill is not another block of natural language that cannot be inspected. It should at least include: name, trigger conditions, cases where it does not apply, steps, required tool permissions, success criteria, fallback on failure, and version with change notes. Steps can be an ordered list, with a small example when needed. Avoid hard-coding one model’s private syntax.
Skill: Narrow the failure scopeApplies when: the service is reachable but results are wrong, and logs plus recent change records existSteps:1. Confirm the symptom, blast radius, and time window2. Compare recent changes and rule out configuration and dependencies first3. Read related logs and metrics only; do not change production first4. Propose the smallest reversible hypothesis and how to verify itStop when: logs are unavailable, or the action would exceed current authorization
Permissions should travel with the skill, not with the agent as a whole package. A read-only investigation skill should not own write access to a database, the ability to send messages, or the ability to delete files by default. The skill library itself should be exportable and comparable across versions, so differences can be reviewed the way code is reviewed.
Persistent Memory and Skills Are Not the Same Thing
Memory answers which facts about this person and this environment still hold. A skill answers which steps to follow for this class of task. Mixing them causes two kinds of accidents: treating a one-off fact as a general procedure, or treating procedure detail as unchangeable personal privacy.
A practical memory split is:
- Session memory: temporary state for the current task. Summarize or discard it when the task ends.
- Working memory: project-level conventions, such as branch policy, directory layout, and release windows, with an explicit expiry.
- Long-term memory: stable preferences and confirmed facts. A write needs evidence, and a read should be able to cite its source.
- Skill index: retrieve by task type, instead of injecting the entire conversation history into context every time.
Retrieval should start narrow and widen only if needed: match task type and constraints first, then take a small set of related memories. Vectorizing all history and injecting it indiscriminately looks clever and often pulls in stale instructions. Be restrained with personal profiles. Keep only preferences required to do the work, and let users view, correct, and delete them.
Decoupling from the Model
If self-evolution is locked to one model, skills become that model’s prompt dialect and migration becomes expensive. A steadier approach is model-agnostic skill text, with call parameters, temperature, and tool formats in an adapter layer. Switching models should not rewrite the skill body—only the adapter and the evaluation set.
The evaluation set should keep real correction samples: whether the same skill still meets its success criteria on a new model, whether it is more likely to exceed its authority, and whether it becomes more verbose. Without that regression, “switch models in one click” only changes the entry point. Quality is unknown. Local endpoints and cloud models can coexist, but keys, quotas, and data-egress policy must be configured separately. Convenience is not a reason to send internal logs to an external inference service by default.
Keeping It Online
A personal computer is a poor place to receive instructions at any time and run them in the background. Sleep, network changes, and disk encryption interrupt the work. It is more reasonable to put the runtime in a long-lived cloud compute environment, such as a long-running task on a container platform. Skills and memory live in object storage or a database, execution logs go to a logging service, and failures go to monitoring and alerts. On Baidu AI Cloud, for example, these general capabilities can separate compute, storage, and lookup, instead of scattering state across a laptop.
The entry point can be several instant-messaging or internal collaboration channels, but a channel only sends and receives. It does not store the source of truth. Every channel should feed the same task queue and the same identity model: who started the task, what authorization level applies, and where the result goes back. Otherwise the same agent grows contradictory memories at different doors.
Always-on operation needs concurrency and re-entrancy control. When the same skill is triggered again, the system should recognize a task already in progress and avoid two flows changing the same resource at once. Long tasks should be pausable and their progress queryable, so users do not assume the message was lost.
Security and Governance
Skills widen what the model can do. Least privilege starts at generation time: read-only by default, write actions authorized separately, and external communication and money-related actions off by default. Before execution, show the skill version and the key steps. High-risk actions need a second confirmation.
Memory writes should filter secrets, tokens, and sensitive personal information. Credentials that appear in logs should be redacted. Do not store them in long-term memory because “it will make the next login easier.” Treat skill text like code. If the source is untrusted, run it in isolation first, so a piece of fed-in “experience” cannot be rewritten into steps that exceed authority.
Audit should at least keep: which skill was triggered, an input summary, tool calls, human rejections, and the final result. When something goes wrong, it should be possible to replay a specific version, not only the sentence “the model learned it itself.”
Order of Adoption
Do not start with fully automatic skill writing. A practical order is:
- Pick one class of repeated task, write the skill by hand with pass criteria, and get retrieval and permissions working.
- Then record corrections, let the system draft a revision, and merge it by hand.
- Build a small regression set and run it whenever the model or the prompt changes.
- Only then turn on automatic commit, and limit which skill categories may be written automatically.
- Periodically remove stale memories and skills that are never called, so the library does not grow until retrieval gets worse.
In a team, a skill library needs an owner the way project documentation does. Self-evolution with no owner is something nobody dares to turn off and nobody dares to use a few months later.
Common Mistakes
Star counts or parameter scale do not prove that the agent remembers. What can be checked is whether a correction takes effect on the next task of the same kind, whether a bad skill can be taken offline, and whether the core flow still holds after a model change. Another mistake is chasing a more personalized sense of “it understands you better and better.” A work system needs stable, reversible preferences, not an unexplained impression score.
The value of skill self-evolution is taking experience out of a one-off conversation and putting it in a bounded loop: generation needs evidence, improvement needs evaluation, memory needs a lifetime, and execution needs permissions and audit. With that, the agent accumulates an asset instead of introducing itself again and again.
