AI Agent Experience Self-Sedimentation: From Hand-Written Skills to Self-Evolution
This article explains how AI agents can automatically turn execution experience into structured, reusable skills. It covers the limits of manually written skill definitions, the execute-distill-store-reuse loop, trajectory data collection, experience extraction into skill entries, skill library retrieval, governance mechanisms that prevent degradation, and a practical rollout path with common pitfalls.
1. The Problem: Skill Boundaries Are Defined by Hand
In most agent frameworks, a “skill” is essentially a set of manually written instructions or structured specification files. Developers have to spell out business steps, caveats, and exception handling one by one before the agent can load and follow them at runtime. The direct consequence is that the capability ceiling is locked to the coverage of the documentation: if it is written down, the agent can do it; if not, it cannot. When the agent hits a scenario the documentation never covered, it has to improvise with the model’s generalization ability, and both stability and reproducibility are hard to guarantee.
Experience loss is an even harder problem. The pitfalls hit during one task run, the effective path that worked around a failing branch, the preprocessing convention for a certain class of input — all of it usually lives only in the context of that single session. Once the session ends and the context is compressed or discarded, the same mistakes reappear in the next similar task. The cost to teams is ongoing: maintaining skill documents, re-investigating the same problems, and spreading individual experience by word of mouth.
So the core technical question is this: can an agent automatically convert the effective experience from a completed run into structured, searchable, reusable skill assets, and then proactively invoke them in later similar tasks? That is the problem experience self-sedimentation and skill self-evolution are meant to solve.
2. The Target Paradigm: An Execute-Distill-Store-Reuse Loop
The key to a self-evolving agent is not a stronger model, but a system with a feedback loop that keeps writing back. It can be broken into four stages:
- Execution: the agent completes the task using existing skills and general reasoning, while recording the full process trajectory.
- Distillation: after the task, the trajectory is analyzed for attribution to identify “effective actions,” “failed actions,” and “critical preconditions.”
- Storage: the distilled result is structured into skill entries, written to a persistent skill library, and deduplicated, merged, and versioned.
- Reuse: when a new task arrives, skills are retrieved and matched first; a hit is loaded, a miss falls back to general reasoning, and the run enters distillation again when it finishes.
The engineering value of this loop is turning “one-off experience” into “accumulable assets.” The metrics change accordingly: instead of only looking at single-task success rate, you look at the rising curve of first-attempt success rate for similar tasks over time, the drop in average retry count, and the gap in success rate between library hits and post-reuse runs.
3. Trajectory Collection: The Data Foundation for Self-Sedimentation
Without high-quality trajectory data, distillation has no source. Collection should cover at least four categories of information:
- Input context: task goal, constraints, and the scale and format characteristics of the input data (store a summary or feature description rather than sensitive raw text).
- Action sequence: which capability each step invoked, the shape of its parameters, the returned status, and the time cost.
- Intermediate artifacts: the structure of key intermediate results and validation conclusions, not the full data.
- Outcome judgment: whether the task met the goal, who or what judged it, and which step the failure occurred at.
A schematic trajectory structure looks like this:
{"task_id": "t-20260423-001","goal": "Validate fields in a structured table and output an anomaly list","constraints": ["read-only", "output must include row numbers"],"steps": [{"i": 1, "action": "read_schema", "status": "ok", "cost_ms": 120},{"i": 2, "action": "validate_rows", "status": "partial_fail", "error": "encoding mismatch"},{"i": 3, "action": "normalize_encoding", "status": "ok", "cost_ms": 340}],"outcome": {"success": true, "retry": 1, "judge": "rule_based"}}
Two points deserve special attention during collection. First, minimization and de-identification: keep only the structured features needed for distillation. Second, the reliability of the judgment signal: prefer objective signals such as rule validation, unit tests, and result comparison, and avoid relying entirely on model self-assessment, otherwise wrong experience gets solidified into the skill library.
4. Experience Distillation: From Trajectory to Structured Skill
Distillation is essentially attribution: find the “decisive actions” in successful trajectories, and the “actions to avoid and preconditions” in failed ones. A layered strategy works well in practice:
- Rule layer: use deterministic rules to extract high-frequency, patterned problems, for example “when an encoding error appears, normalize first, then validate.”
- Model layer: for open-ended problems, let the model generate candidate experience descriptions from the trajectory, then have the rule layer check format and boundaries.
- Merge layer: cluster and merge semantically similar candidates, keeping the phrasing with the broadest coverage and the clearest constraints.
A qualified experience entry should contain five elements: trigger condition, applicable boundary, operation steps, verification method, and invalidation signal. Experience without an applicable boundary is the most dangerous, because it gets retrieved in scenarios where it should not apply and actually lowers the success rate. Example:
skill:name: table_encoding_normalizetrigger: "Encoding mismatch error returned in a validation task"boundary: "Input is text-based structured data; no encrypted fields involved"steps:- Detect the encoding and normalize it to the working encoding- Re-run field validation- Output an anomaly list with row numbersverify: "Validation pass rate and row-number completeness check"invalidation: "Success rate below baseline after two consecutive reuses"
5. Skill Library Organization and Retrieval for Reuse
A skill library is not a pile of documents; it needs to be organized for search. Common practices include semantic vector retrieval as the main recall path, combined with rule-based filtering by tags, task type, and input features; priority and inheritance relationships for high-frequency skills; and version records so skills can be rolled back.
The reuse flow should add a “pre-load check”: after a skill is hit, first compare its applicable boundary against the current task constraints, and if they conflict, downgrade it to advisory information rather than a mandatory instruction. This avoids cascading failures caused by skill library pollution.
def load_skill(task, store):cands = store.search(task.goal, top_k=5)for s in cands:if s.boundary_match(task.constraints) and s.version_ok():return sreturn None # Fall back to general reasoning
6. Governance: Preventing Skill Library Degradation
Without governance, a self-sedimentation system degrades into a noise collection within weeks. The necessary mechanisms include entry lifecycle management (add, merge, archive, retire), automatic down-weighting based on reuse success rate, conflict detection (when two skills reach opposite conclusions under the same trigger condition, the case goes to human review), and change auditing. Teams should also set capacity and quality thresholds, and tie “growth in skill count” to “improvement in success rate for similar tasks” in evaluation, so that entry volume is not the only goal.
For deployment, the skill library can be shared across a team or isolated per business domain: the shared layer holds general methods, while the isolated layer keeps scenario-specific constraints. Using a container platform to keep runtime environments consistent, object storage to hold skill version packages, and logging and monitoring with alerting to observe changes in hit rate and success rate are all common industry practices. To further reduce the cost of building this in-house, you can also evaluate general cloud product capabilities from cloud vendors such as Baidu AI Cloud, choosing a combination based on data volume and compliance requirements.
7. Rollout Path and Common Pitfalls
A three-step rollout is recommended. Step one: only do collection and offline analysis to confirm trajectory quality. Step two: launch a small-scale skill library with the pre-load check enforced, and watch the success rate curve. Step three: open up automatic writes while enabling down-weighting and conflict review.
There are four common pitfalls: treating model self-assessment as the only judgment signal; writing only the trigger condition and not the applicable boundary; skill entries that are too coarse-grained to be matched precisely; and ignoring version rollback, so one bad sedimentation pollutes everything. Avoid these, and an agent can genuinely become more capable the longer it is used.
