Summary (Overview)

  • HarnessEvolve is a self-evolving agent framework that optimizes the entire agent harness (prompts, skills, tools, and execution logic) by learning from reference trajectories—execution paths produced when the agent is given ground-truth answers.
  • The framework addresses three core challenges in self-evolution: credit assignment failure (identifying which step caused an error), shortcut learning (agents memorizing task-specific patterns), and catastrophic forgetting (degrading previously acquired capabilities).
  • HarnessEvolve uses a decoupled multi-agent architecture with four independent modules: execution, evaluation, optimization, and gating, ensuring that optimization decisions are auditable and cannot be gamed by the execution agent.
  • It consistently outperforms state-of-the-art baselines (GEPA, ACE, SkillOpt) across all five benchmarks, including a 21.6 percentage point improvement over the strongest baseline on the CloudCoreNetwork-QA dataset.
  • Ablation studies confirm that reference-guided error diagnosis is the most critical component, with the quality gate and error clustering also contributing significantly to performance.

Introduction and Theoretical Foundation

Background and Motivation

Large language models (LLMs) have enabled autonomous agents that tackle complex tasks across domains. At the core of such agents is their harness: the prompts, skills, tools, and execution logic that shape their capabilities. The design of harnesses has evolved through several waves:

  1. Handcrafted workflows: Human experts explicitly design execution logic, search topologies, and collaboration structures (e.g., ReAct, CoT). These offer high controllability but lack flexibility and remain bounded within human-designed frameworks.
  2. Skill-augmented agents: Humans provide skills in natural language while models operate within autonomous perception-planning-action-observation loops (e.g., Claude Code, OpenClaw). These enable dynamic trial-and-error but remain bounded by the quality of human-provided skills.
  3. Self-evolving agents: Systems that autonomously synthesize, refine, and iteratively improve their own harness from environmental feedback.

Three Fundamental Challenges

The paper identifies three fundamental challenges hindering reliable self-evolution:

  • Credit Assignment Failure: In long-horizon tasks, agents receive only binary success/failure signals. When failure occurs, the agent cannot identify which specific action caused it because later errors are downstream consequences of earlier mistakes.
  • Shortcut Learning: Without safeguards, agents tend to hardcode answers or inject excessive task-specific in-context examples into the harness, causing data leakage and prompt bloat that inflate training accuracy without genuine capability gain.
  • Catastrophic Forgetting: Since each harness update is optimized on a subset of trajectory data, it may conflict with previously acquired competence, gradually degrading existing capabilities.

Theoretical Foundation

The paper argues that these challenges cannot be resolved by designing yet another iterative prompt optimization algorithm; they necessitate a system-level architectural shift. HarnessEvolve decouples the execution agent from the evolutionary pipeline, assigning execution, evaluation, optimization, and gating to independent modules.

Methodology

Problem Formulation

Given a task corpus T={(qi,ai)}i=1M\mathcal{T} = \{ (q_i, a_i^*) \}_{i=1}^M of M query-answer pairs split into training Ttrain\mathcal{T}_{train}, validation Tval\mathcal{T}_{val}, and test Ttest\mathcal{T}_{test} sets, and a base execution agent AexecA_{exec} powered by a frozen LLM, the goal is to find the optimal execution agent AA^* by iteratively optimizing its harness on Ttrain\mathcal{T}_{train} without human intervention, such that accuracy on Tval\mathcal{T}_{val} is maximized.

Architecture Overview

HarnessEvolve uses four independent agent modules:

  • Execution agent (AexecA_{exec}): The target of optimization, runs tasks from Ttrain\mathcal{T}_{train} using its harness. Also produces reference trajectories when given ground-truth answers.
  • Evaluation agent (AevalA_{eval}): (1) Evaluates task accuracy and identifies failed trajectories; (2) verifies that reference trajectories are genuine execution paths rather than shortcuts.
  • Optimization agent (AoptA_{opt}): Analyzes failed trajectories, compares them against reference trajectories to identify root causes, clusters errors into systematic patterns, and generates candidate harness modifications.
  • Gate agent (AgateA_{gate}): Enforces quality checks (data leakage and prompt bloat inspection) and performance checks (accuracy improvement without degradation).

Key Mechanisms

1. Reference-Guided Error Diagnosis

Prior to the optimization loop, AexecA_{exec} is run on all tasks with ground-truth answers to produce reference trajectories τi+\tau_i^+. The evaluation agent verifies each trajectory for genuineness (checking that it follows a legitimate reasoning chain rather than trivially restating the answer). During optimization, failed trajectories τi\tau_i^- are compared against reference trajectories to identify the first point of divergence tit_i^*—the earliest step where the action deviates—enabling fine-grained root-cause localization.

2. Error Clustering

Individual error signals Fi=(si,mi,hi)\mathcal{F}_i = (s_i, m_i, h_i) (severity, error cause, fix hint) are clustered by error cause mim_i into groups P={C1,,CK}\mathcal{P} = \{C_1, \ldots, C_K\}, following three principles:

  • Cause-Based Grouping: Groups formed by error cause rather than coarse severity labels
  • Root-Cause Priority: Prioritize the first action divergence point as the root error cause
  • Long-Tail Protection: Preserve single-member clusters to ensure rare but critical failure patterns are not absorbed

3. Quality Gate

The gate agent checks candidate updates for:

  • Data leakage: Whether edits directly embed failed queries and ground-truth answers into harness files (LLM-as-judge with score threshold ηleak=0.8\eta_{leak} = 0.8)
  • Prompt bloat: Whether newly injected in-context examples exceed threshold ηblo=5\eta_{blo} = 5

A candidate update passes if and only if, for every file in the update, the data leakage score does not exceed ηleak\eta_{leak} and the number of injected in-context examples does not exceed ηblo\eta_{blo}.

4. Performance Gate

A candidate agent AcandidateA_{candidate} is accepted if and only if it improves accuracy on the current batch by at least margin δ while not degrading on any recent batch beyond tolerance ε:

Acandidate is accepted    {Acc(Acandidate,Bj)Acc(Acurrent,Bj)δ,maxl[max(1,jR),j1][Acc(Acurrent,Bl)Acc(Acandidate,Bl)]ϵ.(1)\mathcal{A}_{\text{candidate}} \text{ is accepted} \iff \left\{ \begin{array}{l} \operatorname{Acc}(\mathcal{A}_{\text{candidate}}, B_j) - \operatorname{Acc}(\mathcal{A}_{\text{current}}, B_j) \geq \delta, \\ \max_{l \in [\max(1, j-R), j-1]} \left[ \operatorname{Acc}(\mathcal{A}_{\text{current}}, B_l) - \operatorname{Acc}(\mathcal{A}_{\text{candidate}}, B_l) \right] \leq \epsilon. \end{array} \right.\tag{1}

5. Epoch-End Selection

At epoch completion, all snapshots in the pool V are evaluated on the validation set, and the best-performing one is selected:

AcurrentargmaxAVAcc(A,Tval),AAcurrent.(2)\mathcal{A}_{\text{current}} \leftarrow \arg \max_{\mathcal{A} \in \mathbb{V}} \operatorname{Acc}(\mathcal{A}, \mathcal{T}_{\text{val}}), \quad \mathcal{A}^* \leftarrow \mathcal{A}_{\text{current}}.\tag{2}

Implementation Details

  • Models: Qwen3.6-27B (post-trained with domain-specific fine-tuning) and DeepSeek-V4-Flash (no fine-tuning)
  • Frameworks: LAMAgent (in-house, for enterprise datasets) and OpenClaw (for open-source datasets)
  • Hyperparameters: Tatt=5T_{att} = 5 (max reference attempts), Pbatch=10P_{batch} = 10 (batch patience), Pep=5P_{ep} = 5 (epoch patience), E=20E = 20 (epoch limit), b=40b = 40 (batch size), R=2R = 2 (replay buffer size), δ=0.0\delta = 0.0 (step margin), ϵ=0.025\epsilon = 0.025 (degradation tolerance), ηleak=0.8\eta_{leak} = 0.8, ηblo=5\eta_{blo} = 5, Trev=3T_{rev} = 3 (revision limit)

Empirical Validation / Results

Main Results on In-House Datasets

Table 1: Main results on in-house datasets. Accuracy (%) is reported. Best results are in bold.

MethodCloudCoreNetwork-QA (Qwen)CloudCoreNetwork-QA (DeepSeek)Wireless-QA (Qwen)Wireless-QA (DeepSeek)
Base43.447.579.085.9
GEPA65.357.682.486.5
ACE59.364.684.390.1
SkillOpt61.965.389.089.3
HarnessEvolve86.985.989.792.8

On CloudCoreNetwork-QA with Qwen3.6-27B, HarnessEvolve improves accuracy from 43.4% (Base) to 86.9%, outperforming the strongest baseline GEPA at 65.3% by 21.6 percentage points.

Main Results on Open-Source Datasets

Table 2: Main results on open-source datasets. Accuracy (%) is reported. Best results are in bold.

MethodSearchQAOfficeQASpreadsheetBench
Base86.562.844.3
GEPA88.664.069.6
ACE90.068.952.2
SkillOpt89.466.974.6
HarnessEvolve92.970.976.4

Cross-Framework Generalization

Table 3: Cross-framework transfer: skills optimized on OpenClaw, evaluated on four frameworks. Accuracy (%) is reported. Best results are in bold.

FrameworkSearchQA (Base)SearchQA (HarnessEvolve)OfficeQA (Base)OfficeQA (HarnessEvolve)SpreadsheetBench (Base)SpreadsheetBench (HarnessEvolve)
Hermes95.095.077.980.872.173.2
OpenCode90.092.775.680.357.587.9
LAMAgent92.994.374.475.045.080.0
DeepSeek Harness93.695.079.179.756.486.8

Ablation Study

Table 4: Ablation study results on CloudCoreNetwork-QA (Qwen3.6-27B). Accuracy (%) is reported. Best results are in bold.

VariantCloudCoreNetwork-QA
HarnessEvolve (full)86.9
M1: w/o reference trajectory57.8
M2: w/o error clustering68.6
M3: w/o quality gate80.1

Key findings:

  • M1 (w/o reference trajectory): Largest degradation (86.9% → 57.8%), confirming reference-guided diagnosis is the most critical component
  • M2 (w/o error clustering): Significant degradation (86.9% → 68.6%), confirming error aggregation is essential for coherent modifications
  • M3 (w/o quality gate): Moderate degradation (86.9% → 80.1%), indicating the quality gate helps prevent shortcut learning

Self-Evolution Curve

The evolution curves show that a substantial fraction of candidate updates are rejected by the two-tier gating mechanism, indicating effective filtering of low-quality modifications. The peak accuracy in the snapshot pool increases gradually throughout evolution, reaching its highest point at the final harness.

Theoretical and Practical Implications

Theoretical Implications

  1. Credit Assignment Resolution: The reference-guided error diagnosis approach provides a principled method for isolating root causes in long-horizon tasks, addressing a fundamental limitation of sparse-reward environments.

  2. Guarded Evolution: The two-tier gating mechanism (quality + performance) offers a theoretical framework for stable self-improvement, balancing exploration of new capabilities with preservation of existing ones.

  3. Comprehensive Harness Optimization: Unlike prior methods optimizing only single components (e.g., SkillOpt optimizes only skill.md), HarnessEvolve demonstrates that optimizing the entire harness—including Python scripts, prompt instructions, tool-argument specifications, and execution logic—yields substantially better results.

Practical Implications

  1. Enterprise Deployment: The significant gains on enterprise datasets (CloudCoreNetwork-QA: 21.6 percentage points over strongest baseline) demonstrate practical viability for complex multi-skill enterprise tasks.

  2. Framework Transferability: Skills optimized by HarnessEvolve transfer across four different agent frameworks without re-optimization, indicating generalizable improvements rooted in error patterns rather than framework-specific shortcuts.

  3. Reliability: The decoupled architecture ensures optimization decisions are auditable, addressing deployment concerns about uncontrolled self-modification.

Conclusion

HarnessEvolve presents a comprehensive solution for reliable agent self-evolution by:

  1. Overcoming credit assignment failure through reference-guided error diagnosis
  2. Preventing shortcut learning via the quality gate (data leakage and prompt bloat inspection)
  3. Mitigating catastrophic forgetting through the performance gate with epoch-end validation

The framework consistently outperforms state-of-the-art baselines across all five benchmarks spanning open-domain and enterprise scenarios, with substantial gains on complex multi-skill tasks. Future directions may include extending the framework to more diverse task domains, exploring additional gating mechanisms, and investigating the interaction between harness optimization and model fine-tuning.

Related papers