Paper Summary – CODESKILL

1. Introduction

There used to have 2 ways of skill evolving:

  • Sequential Skill Editing: Update/Edit Skill after each incoming trace.
  • ReasoningBank-style Retrieval Memories: Distill experience from an agent’s past executions into transferable memory items, store them in an external memory bank, and at inference time retrieve the semantically most relevant items and inject them into the agent’s context for reuse.

The thought of Trace2Skill likes Human Experts: inspect broad traces, abstract recurring patterns, and write compact procedures that are reusable across cases.

2. Trace2Skill

There three stages of Trace2Skill:

  • Collect Trajectories
  • Propose Trajectory-Level Patches in Parallel
  • Consolidate Patches into One Portable Skill

2.1 Skill & Problem Formalization

A skill directory S = (M, ℛ)nowadays mainly consists of two parts:

  • The root SKILL.md file, denoted as M
  • The auxiliary files including references, scripts, or assets denoted as ℛ.

The root document M stores broadly applicable procedural knowledge, while auxiliary files ℛ provide deterministic tools or lower-frequency details.

Let πθ be a fixed LLM agent using skill S.

Let 𝒫(S; πtheta, 𝒟) denote the pass rate of that agent on task set 𝒟.

An evolving set 𝒟evolve, and a disjoint test set 𝒟test, skill evolution constructs a new skill from evolving-set trajectories without updating θ: S* = ℰ(S0, Devolve; πθ),   P(S*; πθ, Dtest) > P(S0; πθ, Dtest). 

[!NOTE]

The evolving set 𝒟evolve is to evolve the skill; the 𝒟 itself dose not change.

The work evaluates two initializations for S0:

  • human-expert skill
  • LLM-generated draft skill

2.2 Stage 1: Trajectory Generation

This stage uses a Re-Act-Style harness. For each evolving-set task, the fixed agent runs with S0 and produces a trajectory τi containing the query, reasoning/tool-use history, final output, and a binary correctness outcome.

The resulting corpus 𝒯 is split into:

  • Failures $T^- $
  • Successes $T^+ $

2.2 Stage 2: Parallel Patch Proposal

A group of analyst sub-agents independently proposes skill patches from individual trajectories.

Failures are sent to an error analyst $A^- $ ,successes to a success analyst 𝒜+.

And analyst read 𝒮0 and propose a patch for it, leading to a patch pool. 𝒫 = 𝒫− ∪ 𝒫+ The analyst roles are intentionally asymmetric.

  • 𝒜+ uses a single-pass workflow to identify reusable behavior patterns from successful trajectories.
    1. Read trajectory
    2. Abstract reusable pattern
    3. Read S0, write a skill patch
  • 𝒜− uses a ReAct-style loop that can inspect traces and artifacts, compare outputs against ground truth, and validate candidate fixes before proposing a patch.
    1. Read trajectory + artifacts + ground-truth value
    2. Suppose a reason for the failure
    3. Write a minimal repair fix to verify the failure reason. If the reason is not correct , go back to step 2.
    4. If the reason confirmed, write a skill batch.

In short, for failure trajectory, this stage need analyst to find out the reason.

Here’s a example of the skill patch:

2.3 Stage 3: Patch Consolidation

In stage 2, the work produces many patches storing in a patch pool.

In stage 3, the work needs to consolidate the patches into one coherent update patch p* and apply it to S0.

Patches are merged hierarchically for L = ⌈logBmerge|P|⌉ levels; at each level ℓ, up to Bmerge patches are synthesized into one patch: p(ℓ + 1) = ℳ(πθ, S0, {p1(ℓ), …, pBmerge(ℓ)}),   ℓ = 0, …, L − 1 where ℳ deduplicates, resolves conflicts, and preserves non-overlapping insights.

πθ itself serves as trajectory generator, analyst, and merge operator, so no external evolution/teacher model is required.

The final p∗ is translated into diff-style edits and applied with deterministic guardrails:

  • reject edits to missing files
  • withhold line-range conflicts
  • validate the updated skill format

2.3.1 Patch Consolidation

Now we have:

  • Patch Pool: P = P+ ∪ P−
  • Preliminary Skill: S = (M, ℛ)

Now we need to consolidate the patches from patch pool into the S0.

There are too many patches to be consolidated. If all patches are consolidated at the same time, there may have many conflicts. So the authors consolidate the patches in many times. L = ⌈logBmerge|P|⌉

  • Bmerge: merge batch size, how many patches can be merged in one round.
  • L: merge level.
  • P: size of patch pool; how many patches need to be merged.

e.g. 323 patches in patch pool, Bmerge = 32.

  • Level 1: 11 merges, 10 time ℳ (Merge Operator, the LLM itself) merges 32 patches, and 1 time ℳ merge 3 patches; totally generate 11 new patches.
  • Level 2: Merge 11 patches into one final patch.

本文链接:https://wangyier.top/paper-summary-trace2skill/

版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 The Great Library!