Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Skill Self-Evolution: Trace-Driven Multi-Generation Optimization Loop

This article details a self-evolution framework for business Skills that uses execution traces and evaluation feedback to iteratively optimize Skill definitions through a candidate pool, module-based mutations, and deterministic selection, enabling continuous improvement while preserving traceability and avoiding regressions.

Background and Problem

Business Skill fixes typically start from a failed case: inspect execution trace, identify missing rules, modify SKILL.md, and re-run evaluation. As scenarios grow, two problems emerge: fixing one scenario may break another, and after multiple modifications it becomes hard to judge which version is better and which rule contributed the gain.

The authors organize this process into a traceable search loop: using a golden evaluation set, ground truth, and execution traces to generate feedback, letting the model propose controlled modifications, while deterministic programs handle boundary checks, version comparison, and state maintenance. Humans define business boundaries and make final delivery decisions.

Method Selection: Why GEPA?

Four Agent/Skill self-evolution papers are compared against existing golden set, trace, and rubric pipelines. The comparison focuses on optimization signals, edit scope, candidate validation, and engineering fit. Experimental gains from papers do not directly translate to business gains.

Paper References

GEPA : https://arxiv.org/abs/2507.19457

SkillOpt : https://arxiv.org/abs/2605.23904

EvoSkill : https://arxiv.org/abs/2603.02766

Trace2Skill : https://arxiv.org/abs/2603.25158

Comparison Across Aspects

Method :

GEPA: Reflects on execution traces and natural language feedback to propose candidates; searches and exploits versions with complementary abilities. This project further adopts per-case comparison and global candidate pool.

SkillOpt: Updates Skill via controlled add/delete/replace edits, using text learning-rate budget, rejection edit history, and independent validation score constraints.

EvoSkill: Three roles (Executor, Proposer, Skill-Builder) divide labor: execute tasks, diagnose failures, generate/modify Skills, then verify and select candidates.

Trace2Skill: Batch collects execution traces, analyzes failures and successes separately, proposes local patches, then hierarchically merges into consistent Skill updates.

Advantages :

GEPA: Trace reflection aligns with existing Ground Truth, rubric, Trace pipelines; can search complementary strengths across cases. MVP converges to SKILL.md first.

SkillOpt: Edits are controlled, preventing SKILL.md from growing longer and worse.

EvoSkill: Clear role responsibilities; supports generating structured Skill folders and helper scripts; modifications are traceable.

Trace2Skill: Batch analysis and patch merging leverage large existing trace volumes; suitable for initial Skill versioning or batch enhancement; actual speed depends on concurrency and data volume.

Disadvantages :

GEPA: Each new version requires full re-evaluation on validation cases, taking longer.

SkillOpt: Requires maintaining edit budget, train/validation split, rejection history, and slow-update mechanisms; worthiness depends on project budget measurement.

EvoSkill: Multi-role orchestration and Skill folder generation increase engineering complexity; paper experiments use Claude Code but framework is not limited to it.

Trace2Skill: Core is batch trace analysis and merging, not the candidate-scoring search loop of this article; adding multi-generation search would require candidate validation and selection orchestration.

GEPA is chosen because the project already possesses a golden evaluation set, standard answers, complete execution traces, and structured scoring, enabling reuse for a reflection-and-validation loop. The candidate pool preserves local advantages across cases, avoiding premature convergence to a single version.

Distinction: The article's single-module modification, full evaluation per candidate, direct parent-child admission rule, and deterministic greedy override form a GEPA-style engineering design adapted to business constraints, not identical to the original paper's fixed rules.

Technical Design: From Single Edit to Multi-Generation Search

2.1 Global Flow

The overall flow follows GEPA's core idea: using evaluation results and execution traces on the golden set as raw signals, generating per-case reflection feedback, then attributing and mutating, through multiple rounds of "select → feedback generation → reflection mutation → full evaluation → keep best" to continuously search for better Skill versions. During evolution, the golden set, ground truth, rubric identity, model, and execution config are frozen to ensure versions are compared under the same caliber. Server-side dynamic data and model randomness still need disclosure via run evidence and re-runs; config freezing alone does not eliminate all variance.

Global flow diagram
Global flow diagram

The flow consists of the following steps:

Evolution Preparation : Determine the Skill to optimize; freeze golden evaluation set, evaluation criteria, execution model, tools, and runtime environment; set max generation rounds and sub-candidate evaluation budget; complete manual Module review. Baseline evaluation and model reflection costs are recorded separately.

Initial Version Full Evaluation : Run all golden cases concurrently with current Skill; record per-case execution traces and structured evaluation results (total score, per-dimension scores, atomic question answers, judgment evidence) to form baseline for version comparison. Evaluation phase itself does not generate reflection feedback for Skill optimization.

Select Parent Version : Choose a parent version from currently retained versions as the starting point for this round. Parent's full evaluation artifacts are reused directly, no re-run needed.

Generate Reflection Feedback : Read parent version's per-case execution traces and structured evaluation results, combine with golden evaluation expectations, to generate per-case reflection feedback for the reflection LM. This feedback is derived data produced by the self-evolution process from evaluation artifacts, not a field directly saved by the existing evaluation system.

Reflect and Generate Child Version : Based on per-case reflection feedback, perform attribution and generate a new child Skill version. This step only proposes one targeted mutation.

Validity Check and Isolated Deployment : Confirm child version structure is complete, can be loaded and executed correctly; deploy to isolated evaluation environment to avoid affecting current production version.

Child Version Full Evaluation : Run all golden cases concurrently on the new child version, obtaining per-case scores, execution traces, and structured judgment results fully consistent with parent version caliber. After evaluation, no extra feedback is generated immediately; when this version is later selected as parent, it enters the feedback generation step.

Parent-Child Admission Judgment : Compare child version with its direct parent on per-case scores, not on overall average. If parent is no worse than child on all cases and strictly better on at least one case, parent strictly dominates child → child not admitted. If child dominates parent, or they are mutually non-dominating (each better on different cases), child is admitted. If all case scores are identical, considered no effective improvement → child not admitted. Regardless of admission, record mutation, parent-child relationship, evaluation results, and judgment reason for traceability.

Update and Continue Iteration : Admitted child version enters global candidate pool. If budget not exhausted, next round starts by recomputing per-case leading candidates' active frontier from global pool and selecting new parent from active frontier; else search ends. Even admitted candidates, if later strictly dominated by another candidate, do not enter active frontier or parent sampling range, but their version and evaluation records remain in candidate pool.

Final Version Confirmation and Release : After search ends, select version with highest average score on golden evaluation set from all retained versions; complete specification check and output version diff and evolution report. Search ends by restoring evaluation space seed version; report enters final review. After manual confirmation and spec check, write back to target SKILL.md; release, commit, and code review follow independent processes.

2.2 Candidate Pool Design

The candidate pool uses a "global save, dynamic select" design:

Global Candidate Pool : Seed version and all child versions that passed admission judgment. Participates in parent sampling only after entering active frontier.

Active Frontier : Candidates currently leading on different cases. Participates in parent sampling.

Failed Attempts Set : Child versions that failed validation, evaluation, or admission judgment. Does not participate in parent sampling.

Current Champion : Candidate with highest overall average score in global pool. Only used for final selection.

Candidate pool structure
Candidate pool structure

Where t denotes current iteration round. Active frontier is a temporary result computed from global pool for exploration, not direct release qualification. Candidates not in current active frontier are not deleted from global pool.

Candidate Data Structure

Each admitted candidate records at least: candidate_id: Unique candidate identifier parent_candidate_id: Direct parent version identifier artifact_ref: Location of candidate SKILL.md; combined with frozen full Skill directory restores artifact content_hash: Content digest for identity verification and deduplication case_scores: Per-case scores for all golden cases mean_score: Average score across all golden cases evaluation_manifest_ref: Corresponding evaluation manifest, locating traces, structured judgments, and reports feedback_ref: Reflection feedback used to generate this child version diff_ref: Child version's modifications relative to parent admission: Admission result, comparison object, and judgment reason deploy_receipt_ref: Deployment receipt recording space, Skill version, and artifact hash target_module: Unique target Module modified in this round

Each evolution task must freeze golden cases, rubric, execution model, and execution config, and record Judge and server runtime identities. Candidate identity must run through deployment and real execution evidence. Current implementation fixes rubricId and contentMd5, but this cannot be equated to all online dependencies being frozen.

Admission Rules

After child version completes full evaluation, it is compared only with its direct parent, not with other versions in global pool. This explains a single mutation's effect while preserving complementary abilities; subsequent parent sampling is decided by global pool's active frontier.

Let:

N : total golden cases

i : case index

P : parent version

C : child version

s_P(i) : parent score on case i

s_C(i) : child score on case i

Parent strictly dominates child condition:

Dominance formula
Dominance formula

Symbol meanings:

≻: Left candidate strictly dominates right candidate

∀: Holds for all cases

∃: At least one case exists

∈: Belongs to a set

≥: Greater than or equal (no worse than)

>: Strictly greater

∧: Both conditions hold simultaneously

{1, …, N}: Set of all golden case indices

Actual continuous score comparison uses epsilon=1e-6: "no worse than" allows epsilon tolerance; "strictly better" must exceed epsilon; all differences within tolerance are considered equal. Admission outcomes:

Parent strictly dominates child → Child not admitted

Child strictly dominates parent → Child admitted

Mutually non-dominating, each has better cases → Child admitted

All case scores identical → No effective improvement, child not admitted

Child content identical to existing candidate → Deduplicated via content_hash, no re-evaluation or re-admission

Thus, admission rules retain two types of versions: those overall better than parent, and those with new advantages on some cases despite possible local regressions. The latter may contain local regressions; final delivery must disclose these regressions; admission does not guarantee no regression.

Active Frontier Computation

At each round start, active frontier is recomputed from global candidate pool P<sub>t</sub> .

Step 1: Find Highest Score per Case

For each case i , find max score in global pool.

Max score per case
Max score per case

Step 2: Find Leading Candidates per Case

All candidates achieving max score on case i form set L(i) . Multiple candidates can tie for first.

Leading candidates per case
Leading candidates per case

Step 3: Deterministic Greedy Cover to Converge Candidate Set

Define candidate c 's leading case set:

Leading case set definition
Leading case set definition

Candidates leading no cases do not enter active frontier. For overlapping coverage, deterministic ordering avoids different results from same score matrix:

Initialize uncovered set as all cases.

Select candidate covering most uncovered cases.

Tie-break: higher average score → higher worst-case score → earlier creation → smaller ID lexicographically.

Remove covered cases from uncovered set; repeat until all cases covered.

This greedy cover retains per-case leading abilities, avoids redundant candidates in sampling. It does not guarantee minimal candidate count, nor equals full Pareto non-dominated set.

Step 4: Weighted Parent Sampling

After cover selection, chosen candidates form active frontier F<sub>t</sub> . Candidate's sampling weight equals number of cases it leads:

Sampling weight formula
Sampling weight formula

Parent sampling probability:

Sampling probability formula
Sampling probability formula

Weight uses all leading cases in global pool, not just newly covered ones. Random seed and steps saved to task manifest for reproducible recovery.

Computation Example

Assume global pool has candidates A, B, C, D; golden set has three cases. Scores:

A: Case1=1.0, Case2=0.6, Case3=0.3, Average=0.63

B: Case1=0.7, Case2=1.0, Case3=0.4, Average=0.70

C: Case1=1.0, Case2=1.0, Case3=0.5, Average=0.83

D: Case1=0.8, Case2=0.7, Case3=0.9, Average=0.80

Case 1 max = 1.0 (A, C). Case 2 max = 1.0 (B, C). Case 3 max = 0.9 (D). Leading sets: A→{Case1}, B→{Case2}, C→{Case1,Case2}, D→{Case3}. Greedy cover: C covers Case1,Case2; D covers Case3. A and B excluded. Active frontier = {C, D}. Weights: C=2, D=1. Sampling probabilities: C=2/3, D=1/3. D's average lower than C but retains independent advantage on Case3, keeping evolution opportunity.

Data Maintenance

Global pool only appends; no modification or deletion of admitted candidates.

New candidate admission updates per-case score matrix.

Each round start recomputes active frontier from latest score matrix.

Current champion recomputed from global pool, not limited to active frontier.

Execution traces, structured judgments, and Skill snapshots stored by reference to avoid duplication.

Child versions dominated by parent are not admitted to global pool but a failed attempt record is kept (parent, content hash, diff, per-case scores, elimination reason, evaluation artifact refs) for avoiding duplicate modifications, analyzing degradation causes, and debugging evaluation anomalies. These records do not participate in subsequent parent sampling. Runtime state must also save budget counters, random steps, and pending rounds; saving candidate list alone is insufficient for reliable recovery.

Final Version Selection

Active frontier only used for next-round parent selection. After search ends, final version is still chosen from global pool by overall average score.

Candidate c 's overall average:

Average score formula
Average score formula

Final version:

Final version selection formula
Final version selection formula

Where P<sub>T</sub> is global pool at search end; arg max selects candidate maximizing average. Parent selection emphasizes capability diversity across cases; final selection picks best overall average.

Implementation uses epsilon-quantized sorting for average, then tie-breaks by worst case, passed case count, modification lines, creation order for unique result. Final report should unify modification caliber: current code counts lines relative to direct parent, while cumulative diff relative to seed better assesses final delivery impact; this caliber needs alignment.

Same golden set used for reflection and champion selection; average increase first indicates improvement on search set. Independent holdout set should not enter reflection/mutation inputs; used for final generalization verification.

2.3 Skill Module Design

Borrowing GEPA's modular optimization idea, the candidate SKILL.md is split into multiple independently optimizable business Modules; each round only one Module is selected for reflection and mutation, rest remain unchanged.

Module Division Method Comparison

Single Module (Whole SKILL.md) : Entire SKILL.md as one Module. Pros: Simple, no extra config. Cons: Edit scope too large; fixing one scenario breaks others.

Fixed Document Sections : By sections: input, process, constraints, output. Pros: Clear boundaries, suits uniform Skills. Cons: Relies on uniform section structure; Skills' sections inconsistent; same capability often scattered across sections, still needs per-Skill config.

Business Capability-Based (Chosen) : Each user-intent-triggered business capability with independent execution flow and output rules as a Module; common rules separate. Pros: Aligns with eval cases and failure attribution; mutation scope more complete. Cons: Requires per-Skill Module config once.

Module Structure

A SKILL.md is divided into following Modules (not all required):

routing (default auto-evolution allowed): Modify when routing missing or misrouted.

capability.<name> (default auto-evolution allowed): Main evolution target; eval cases should map to a specific capability.

shared.response (default auto-evolution allowed): Shared output rules/templates.

shared.boundaries (default auto-evolution allowed): Modify when failure attribution points to boundary judgment.

shared.guardrails (default NOT auto-evolution allowed): Hard protection rules: permissions, security, compliance, irreversible operation confirmations.

Example query-object-ranking Skill contains two independently attributable/modifiable capabilities:

routing
capability.object_ranking
capability.object_detail
shared.response
shared.boundaries

Module responsibilities and typical failures:

routing : Frontmatter description, trigger conditions, Step 0. Responsibility: Identify ranking query or object query, select corresponding mode. Typical failures: Ranking request not triggered, or object query routed to ranking mode.

capability.object_ranking : Step 1.2, Steps 2-4 TOP ranking rules and output. Responsibility: Select analysis task, query and output object TOP ranking. Typical failures: Multi-task without user selection, or ranking output error.

capability.object_detail : Step 1.1, Steps 2-4 single object mode rules and output. Responsibility: Query specified object by name/ID, merge multiple data groups. Typical failures: Single object query output as TOP list, or multiple data groups not merged.

shared.response : Markdown, table, numeric display rules shared by both modes. Responsibility: Ensure consistent public output format. Typical failures: Table format error or public field missing.

shared.boundaries : Non-applicable scenarios, object name vs category confusion handling, shared exception rules. Responsibility: Distinguish object query from category, group, target, attribution etc. Typical failures: Category or group query incorrectly enters this Skill.

From capability view: "which objects have most pending records" maps to capability.object_ranking; "check example object A's example metric" maps to capability.object_detail. This Skill lacks permissions/safety/irreversible ops, so no forced shared.guardrails. Example illustrates business boundaries; whether auto-evolution can start still requires separate check of case ground truth and evaluation readiness.

Division Suggestions for Different Skill Types

Single processing path : One capability.runtime; optionally add shared.boundaries and shared.guardrails.

Multiple processing paths : Each independently attributable/modifiable path gets a capability.<name>.

Contains public output specs : Add shared.response beyond capability Modules.

Contains public business boundaries : Place applicability conditions, business thresholds, exception inputs, fallback rules into evolvable shared.boundaries.

Contains permissions/high-risk ops : Place permissions, security, compliance, irreversible confirmations into read-only shared.guardrails.

Primarily capability identification and routing : Separate evolvable routing; modifying Skill trigger scope requires routing eval case coverage.

Module count should not be excessive. Only split when two parts correspond to different capabilities or processing paths, can be independently attributed, and independently modified.

Module Boundary Definition Comparison

Inline Delimiters in SKILL.md : Directly mark Module start/end positions in body. Pros: Precise positioning. Cons: Must modify all existing Skills, introduce evolution markers in business files.

External module_spec Config (Chosen) : Record Module-to-SKILL.md content range mapping in independent config. Pros: No modification to existing Skill; allows manual review and version control. Cons: Skill structure changes require config sync.

Model Dynamic Identification Each Round : Model temporarily judges Module boundaries during reflection. Pros: No pre-config needed. Cons: Boundaries unstable; may identify differently each round.

Module Config and Usage Constraints

module_spec

generated at Skill's first evolution entry. Generation and usage rules:

Initial Config : Current tool generates draft by headings/keywords; human merges/splits spans by business capability, confirms read-only rules.

Evolution Start : Recalculate SKILL.md content digest; if differs from source_hash, pause evolution and re-confirm Module boundaries.

Module Selection : Based on failure case attribution results, select most relevant mutable Module; not fixed round-robin.

Single-Round Mutation : Reflection model reads full parent version as context, but defaults to modifying only one target Module per round; other content unchanged.

Mutation Validation : Check actual diff is entirely within target Module, and read-only Modules unchanged.

Complex Attribution : Single case involves multiple Modules, points to read-only rules, or cannot be reliably located → human confirmation; no automatic cross-Module modification.

After Module mutation, child version undergoes full evaluation, parent-child admission judgment, and candidate pool update per Section 2.1 global flow; not repeated here.

2.4 Attribution Mutation Prompt Design

Attribution and mutation use two independent prompts: attribution prompt runs per case; mutation prompt runs after target Module selection.

Attribution Prompt Inputs

Current Skill : Full SKILL.md content of parent candidate.

User Question & Ground Truth : Current case input and dimension-organized trusted standard answer for expected behavior judgment.

Module Config : module_spec including Module ID, content range, and modification permission.

Execution Trace : Structured messages from Zelda execution trace interface: user input, assistant replies, tool calls, tool results.

Evaluation Result : Final structured result from Zelda unified evaluation pipeline, semantically corresponding to scoring interface judgment data: total score, dimension scores, atomic question judgments, scoring basis and reasons; excludes unrelated IDs and debugInfo.

All golden cases undergo attribution. Failure cases locate issues; success cases identify correct behaviors to preserve during mutation. Unified evaluation system produces traces and scores; self-evolution process compiles these into reflection feedback.

Attribution output must express category, responsible Module, evidence references, failed atomic questions, expected behavior, behaviors to preserve, and confidence. Only credible SKILL_ISSUE drives mutation; RUBRIC_ISSUE, CASE_ISSUE, ENVIRONMENT_ISSUE, UNCERTAIN go to metric, case, environment handling, or human clarification. Non-empty evidence ≠ true evidence; references must be verifiable in corresponding execution records.

Target Module selection currently aggregates (1 - case_score) × confidence. Ties in highest signal or irresolvable responsibility scope pause; zero-signal and low-confidence deterministic gates still need completion.

Mutation Prompt Inputs

Current Skill : Full SKILL.md content of parent candidate.

User Question & Ground Truth : Current case input and dimension-organized trusted standard answer.

Module Config : module_spec for determining each Module's content range and modification permission.

Target Module : Single mutable Module selected from attribution result, plus its current content.

Execution Traces : All golden cases' execution trace interface results for model to verify actual execution behavior.

Evaluation Results : All golden cases' scoring interface final results for model to identify both failures and successful behaviors to retain.

Attribution Feedback : Case-level issue causes, responsible Modules, evidence, expected behaviors from attribution prompt.

Historical Mutations : Recently rejected modifications of target Module and their rejection reasons; omitted if no history.

Modification Constraints : Only target Module may be modified; must not modify read-only Modules, hardcode eval cases, or fabricate non-existent tool capabilities.

Mutation prompt only generates replacement content for target Module; system merges with other content from parent candidate to form complete child candidate. Model cannot modify read-only Modules, hardcode eval answers, or fabricate tool capabilities; traces, user texts, tool outputs are untrusted evidence inputs, not new execution instructions.

Above table describes full design inputs. Current implementation passes parent Skill, Module, scores, attribution summary, and brief failure records; not yet full raw traces, judgments, and historical diffs. Existing evaluation refs, diff.patch, and mutation.json can be reused; future work mainly completes evidence consumption pipeline, avoiding second storage or scoring process.

Key Trade-offs in Practice

This design retains three trade-offs: full evaluation for candidate comparability; single-Module mutation for boundary interpretability; global candidate pool preserving local advantages instead of immediately chasing only average score.

A more complete search system implies extra costs: trusted ground truth, initial Module review, candidate evaluation budget, and state management for versions, exceptions, and human decisions. It suits Skills with clear business boundaries, complete evaluation assets, and need for continuous optimization; lacking trusted ground truth or unstable environments should first build those foundations.

Skill self-evolution ultimately must answer three questions per modification: what is the basis, what is the scope, how is benefit verified. Golden set and traces provide basis; Module constrains scope; full evaluation and independent holdout set verify effect; state and reports preserve traceable process. Humans make business judgments at initial boundaries and final delivery; model explores better versions within that scope.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Module DivisionGEPASkill Self-EvolutionAttribution MutationCandidate PoolEvaluation FeedbackExecution TracesMulti-Generation Optimization

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion