Self-Evolving AI Agents: From Manual Configuration to Self-Accumulated Skills

    This article examines why most AI agents stop improving after their first run, and what it takes to make them accumulate reusable experience. It contrasts configuration-as-behavior with experience-as-capability, introduces a four-layer memory model (L0 session context, L1 factual constraints, L2 procedural skills, L3 evaluation samples), and details a skill descriptor schema plus the decision logic for when a task should be crystallized. It then covers seven engineering essentials of the crystallization loop — trigger detection, abstraction, parameterization, risk-tiered gating, indexing and recall, on-demand loading, and feedback evaluation — along with security, least-privilege, auditability, usability, a four-stage evolution roadmap, six metrics worth tracking, and five common pitfalls. The key takeaway: the dividing line is not whether an agent remembers, but whether experience has been structured into a capability that can be invoked again.

    1. One Data-Cleaning Task, Two Very Different Endings

    Take a common scenario: ask an agent to read a CSV file, clean and normalize its fields, and write the result into a database. On the first run, both types of agents do fine. The difference shows up on the second run.

    The first type of agent remembers that this topic came up before — but its “memory” is conversation-history memory. It can confirm that something similar was discussed, yet it does not proactively translate that history into executable steps. So the flow is walked through again: a human re-describes the goal, re-specifies the field mapping rules, and re-corrects the edge cases. The memory exists, but it is never invoked.

    The second type of agent asks at the end of the first run whether the operation sequence should be saved as a reusable unit. After confirmation, it archives it. A week later, when a similar request arrives, it executes the steps that were already validated, asking for confirmation only when the data characteristics deviate from expectations.

    Same base model, same dataset, and a week later the efficiency gap is orders of magnitude. The dividing line is not “does it remember” but “has the experience been structured into a capability that can be invoked again.”

    2. The Core Problem: Three Translation Costs in Hand-Maintained Memory

    Abstract the difference above and you find that hand-maintained memory requires a human to perform three translations:

    1. Recall — remembering what was done;
    2. Summarize — compressing scattered operations into a repeatable flow;
    3. Transcribe — rewriting that flow into instruction text the agent can read (preference lists, role descriptions, operating conventions).

    The agent handles only a fourth step: execution. All three prior steps fall on the human, and they must be paid again every time the environment changes.

    Seen from the other direction, the criteria for “agent self-evolution” come down to just two:

    • Proactive recall: when a similar task appears, retrieve historical experience without being prompted.
    • Proactive crystallization: after a task completes, decide on its own whether the experience is worth fixing in place, and write it into a reusable asset once authorized.

    Only when both hold is the loop closed. Satisfying one of them is still fundamentally “humans doing knowledge management and machines doing execution.”

    3. Engineering Comparison of the Two Paradigms

    Configuration-as-Behavior

    Preferences and constraints are externalized as text, and agent behavior is driven by that text. The advantages are clear: fully controllable, versionable, reviewable, shareable across the team, and a behavior change takes effect with a single commit. The costs are equally clear: knowledge exists in prose form with no execution guarantee; the maintenance burden transfers linearly to humans; vague text produces vague execution; and this kind of memory is static — it does not improve with each additional run.

    Experience-as-Capability

    After a task completes, the operation sequence is distilled into a reusable unit carrying metadata, parameters, and failure branches; subsequent tasks load it by semantic matching. The advantages are decreasing marginal cost, high consistency across similar tasks, and the ability to accumulate organization-level best practices. The risks are that distillation quality depends on an evaluation mechanism; a growing number of units creates retrieval and governance problems; and cross-project reuse can import wrong paths, permission assumptions, and data definitions.

    The conclusion is not either/or. A mature design uses static configuration as the foundation and self-crystallization as an incremental layer, with a clear division of labor: humans own the non-negotiable boundaries (compliance, permissions, data definitions), and the machine accumulates the negotiable methods (steps, parameters, exception handling).

    4. A Practical Four-Layer Memory Model

    • L0 — Session context: the current task window, which solves only “this round” and expires on exit.
    • L1 — Factual constraints: environment addresses, data definitions, coding conventions, lists of prohibited operations. Written by humans; changes require review.
    • L2 — Procedural experience: reusable task units (operation units / flow templates), distilled by the machine, reviewable by humans, rollback-capable.
    • L3 — Evaluation samples: successful executions crystallized into regression cases, used to verify that later changes have not degraded capability.

    Most teams implement only L0 and L1, which is why their agents are stuck at “the first time.” L2 determines efficiency; L3 determines how long the whole system survives.

    A sketch of the directory and metadata organization (fields are design references only):

    1. # skills/csv_to_db.yaml
    2. name: csv_normalize_load
    3. version: 1.3.0
    4. intent: "Clean a CSV into a normalized table and bulk load it"
    5. triggers: ["csv", "import", "load", "column cleaning"]
    6. inputs:
    7. source_path: string # parameterized, never hard-code the path of this run
    8. target_table: string
    9. encoding: {default: utf-8}
    10. column_map: {type: mapping}
    11. steps:
    12. - profile: sample the first N rows, measure null rates and type distribution
    13. - validate: check primary-key uniqueness and enum value ranges
    14. - clean: trim whitespace, normalize date formats, flag outliers instead of dropping them silently
    15. - dry_run: print a row-level diff preview before writing
    16. - commit: bulk write, roll back to the transaction boundary on failure
    17. guards:
    18. destructive: false
    19. requires_confirmation: [commit]
    20. data_sensitivity: internal
    21. metrics:
    22. last_success_rate: 0.98
    23. avg_human_interventions: 0.2

    Three points matter here: paths and table names must be parameterized, otherwise what gets crystallized is only a script for “this one time”; the destructive level and confirmation points must be declared explicitly; and the unit must carry metrics so that low-quality units can be identified and retired during governance.

    5. Seven Engineering Essentials of the Crystallization Loop

    1. Trigger detection. After a task ends, assess reusability: the number of steps exceeds a threshold, inputs and outputs are structured, and the task is not one-off (for example, it does not involve temporary credentials or temporary data). All three must hold before the unit enters the distillation process. This avoids fixing an accidental success into a “rule.”
    2. Distillation and abstraction. Make implicit decisions explicit: boundaries that used to be “handled by inspection” now have to be written as conditions and default values. The output of this step should be readable by a human and capable of being rejected by a human.
    3. De-noise and parameterize. Separate “characteristics of this dataset” from “regularities of the flow itself” — the former goes into parameters, the latter into steps. Hard-coded values are the number-one source of skill degradation.
    4. Risk-tiered gating. Read-only units, or units that can be validated in a sandbox, may take effect automatically. Units involving database writes, deletions, permission changes, or external calls require mandatory human confirmation. High-risk operations do not get exempted from review just because they have been crystallized.
    5. Indexing and recall. Combine semantic search with weighted ranking over tags, version, and success rate. When recall is weak, prefer an explicit question over silently running the wrong flow. The cost of a mis-recall is usually higher than the cost of one more question.
    6. On-demand loading. Injecting full skill text crowds out context and introduces irrelevant instructions. Load only the name, intent summary, and trigger conditions first, then load the full steps after a successful match, and set a hard cap on the context budget.
    7. Feedback and evaluation. Record the success rate, number of human-intervention rounds, elapsed time, and rollback count for every invocation; failure samples are automatically converted into L3 regression cases. Without this, the capability curve rises and then declines, invisibly.

    The skeleton for the crystallization decision can be very short:

    1. def maybe_crystallize(task) -> Skill | None:
    2. if not task.success: return None
    3. if task.steps < REUSE_MIN_STEPS: return None
    4. if task.is_one_off or task.has_ephemeral_input: return None
    5. if find_similar(task.intent) and similarity(task) < UPDATE_THRESHOLD:
    6. return propose_update(task) # update instead of creating new, to suppress duplicates
    7. return propose_new(task) if task.risk_level <= AUTO_ADMIT else propose_review(task)

    6. Security and Compliance: Not an Optional Section

    • Data minimization. No plaintext credentials, keys, or sensitive personal fields in memory or in the skill repository; reference credentials rather than copy them, and mask sensitive columns in previews and logs.
    • Least privilege. Create a dedicated restricted account for the agent, and take the intersection between the operation scope a skill declares and what the account is actually authorized to do. Re-validate permissions when reusing across projects so that “outdated assumptions” are not inherited.
    • End-to-end auditability. Who crystallized what and when, who approved it, and which data was affected must all be queryable, traceable, and rollback-capable. For change-type operations, prefer a staged rollout: run on a sample subset first, then go full scale.
    • Isolation and verification. Distillation and validation happen in a sandbox or staging environment; artifacts enter the production skill library only after passing evaluation, so that bad units are not amplified by frequent hits.

    7. Usability: Making It Affordable for Non-Experts

    Command-line interaction has a relatively high barrier, which is a practical reason this kind of capability struggles to reach a broad audience. The way to lower that barrier is not to hide capability but to turn decision points into natural language:

    • Complete parameters through guided Q&A on the first task instead of asking users to read documentation first;
    • Render the crystallization confirmation as a visible card that clearly shows what will be saved, which sensitive items are involved, and whether production data is affected, with conservative defaults;
    • Provide a shared template library of skills within the organization so that common tasks (data cleaning, report generation, batch validation) work out of the box rather than being described from scratch;
    • Push observability down to the platform layer: operational logs, distributed tracing, metrics monitoring, and alerting can be adopted through standard cloud service offerings, with a container platform hosting the execution environment, object storage hosting the skill and sample repositories, and a message queue decoupling long-running tasks — there is no need to build these in-house.

    8. Evolution Roadmap and Metrics

    • Stage 1: humans write configuration, machines execute. The goal is to fix data definitions and boundaries in place.
    • Stage 2: semi-automatic crystallization — the machine proposes, humans confirm. The goal is to validate distillation quality.
    • Stage 3: automatic distillation plus tiered review, establishing versioning and retirement mechanisms for the skill library.
    • Stage 4: automatic evaluation and optimization, adjusting retrieval weights and default parameters based on regression results.

    Six metrics are worth watching: first-pass completion rate for similar tasks, average number of human-intervention rounds, skill hit rate and mis-recall rate, share of high-risk crystallized units, average end-to-end latency, and monthly active reuse rate of the skill library. The first two reflect the user experience, the middle two reflect risk, and the last two reflect whether the system is genuinely getting better.

    9. Five Common Pitfalls

    Treating one accidental success as a general rule; getting the steps right but the metadata wrong, so recall fails exactly when it should happen; full-memory injection causing context pollution and instruction conflicts; crystallizing without ever retiring, letting the skill library swell into a noise source; and having no regression samples, so capability degradation is discovered long after the fact.

    Conclusion

    The dividing line for intelligence is not whether an agent can complete a task once, but whether a human has to teach it again the second time. Hand-maintained configuration is the controllable starting point; autonomous distillation of experience is the scalable endpoint; and between the two sits the engineering skeleton of parameterization, tiered review, retrieval and recall, and regression evaluation. Build that closed loop, and an agent stops being an “obedient executor” and becomes a “practitioner that accumulates.”