TransHarness: Transferable Coding Agent Harness Evolution (76.4% DeepSWE, 95.5% TB-2.1)

TransHarness (arXiv:2611.33757) solves benchmark overfitting in self-evolving coding agents by learning event-triggered diagnostic intervention policies from just 300 out-of-distribution trajectories. Filtered by cross-task replay selectivity and independent semantic checks, it reaches 76.4% on DeepSWE v1.1 and 95.5% on Terminal-Bench 2.1, beating GPT-6 Astra by 2.4 and 5.6 points.
TransHarness: Transferable Coding Agent Harness Evolution (76.4% DeepSWE, 95.5% TB-2.1): TransHarness (arXiv:2611.33757) solves benchmark overfitting in self-evolving coding agents by learning event-triggered diagnostic intervention policies from just 300 out-of-distribution trajectories. Filtered by cross-task replay selectivity and independent semantic checks, it reaches 76.4% on DeepSWE v1.1 and 95.5% on Terminal-Bench 2.1, beating GPT-6 Astra by 2.4 and 5.6 points. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Eliminates Cross-Benchmark Regression Crashes: While Meta-Harness gains +2.0 on evolution tasks and drops -4.1 on DeepSWE v1.1, TransHarness holds regressions to 9.7% with 13.0% recovery (+3.2 net).
- Works Across Mature Native Harnesses & Strong Models: Boosts DeepSeek Harness to 95.5% on Terminal-Bench 2.1 (+5.6pp) and Qwen Code to 63.7% on DeepSWE v1.1 (+7.9pp) with zero weight updates.
- Selective Replay Gate G(n): Rejects policies activating on >=90% of pairs or hitting more passing runs than failing runs (n_- >= n_+).
- Diagnostic Reassessment Beats Prescribed Fixes: Triggering evidence-grounded reassessment outperforms hardcoded repair instructions by +10.9 percentage points (76.4% vs 65.5%).
- Direct Fit for Smoke Monkey Harness Hooks: Maps directly onto pre-tool, post-tool, context-update, and completion lifecycle callbacks.
import { createAgent } from '@smoke-monkey/harness';// Implement TransHarness-style selective diagnostic intervention (trigger + reassessment, not hardcoded fix)const agent = createAgent({agentId: 'transharness-evolved-coder',provider: 'deepseek',model: 'deepseek-v4.1-flash',workspacePath: process.cwd(),tools: ['filesystem', 'terminal', 'search', 'git'],permission: 'ask-default',});let editedTests = false;agent.on('tool.after', (event) => {const file = String(event.data.args?.path ?? '');if (event.data.toolName === 'write_file' && file.includes('test')) {editedTests = true;}});// Selective completion-gate diagnostic: intervene ONLY when tests were modified without checking task specagent.on('phase.changed', (event) => {if (event.data.phase === 'verify' && editedTests) {agent.injectSystemNote('Diagnostic Audit: Verify any test edits against original task requirements; repair only failures caused by your diff and report unrelated baseline failures.');}});async function main() {const res = await agent.run('Fix cache invalidation on partial NOT-updates in src/store/cache.ts and verify.');console.log('TransHarness loop status:', res.status);}main().catch(console.error);
Watch: Related Video Guides
How to Evaluate Coding Agents
How to Evaluate AI Agents: Benchmark Design | Stanford CS329Z Lecture 12 with John Yang
The Harness Overfitting Trap & TransHarness Regression Bound
TransHarness (arXiv:2611.33757) is a transferable harness-evolution framework that improves coding agents without updating model weights. By deriving event-triggered diagnostic policies from 300 out-of-distribution trajectories and screening them via cross-task replay and semantic checks, it reaches 76.4% on DeepSWE v1.1 and 95.5% on Terminal-Bench 2.1.
Most self-evolving harnesses (SICA, Meta-Harness, Self-Harness) evaluate candidates on the same benchmark family they optimize against. As baseline solve rates p_0 climb above 70%, the paper proves a sharp transfer bound: net improvement Delta = (1 - p_0)r - p_0 q is positive only when regression rate q < ((1 - p_0)/p_0) * r. At p_0 = 0.73, even a 13% failure-rescue rate collapses into a net loss if an intervention disrupts more than 4.8% of already-passing trajectories. In reproduction tests on DeepSWE v1.1, Meta-Harness gained +2.0% on the evolution set but *lost* -4.1% on DeepSWE (-16.8% regressions).
Cross-Benchmark Transfer Comparison (DeepSWE v1.1, Mini-SWE + DeepSeek V4.1 Flash)
| Evolution Method | DeepSWE v1.1 Score ↑ | Net Delta | Failure Recovery (Rec.) ↑ | Passing Regression (Reg.) ↓ |
|---|---|---|---|---|
| Base Harness (Mini-SWE) | 73.2% | — | — | — |
| Meta-Harness | 69.0% | -4.1pp | +12.7% | -16.8% |
| Self-Harness | 73.5% | +0.3pp | +13.3% | -13.0% |
| RRSI | 73.5% | +0.3pp | +11.5% | -11.2% |
| TransHarness (7 Policies) | 76.4% | +3.2pp | +13.0% | -9.7% |
Contrast Policies, Replay Selectivity Gate & Semantic Screening
Each TransHarness policy u = (s, g, c) binds a lifecycle location s (model call, tool, context update, or completion), an executable trigger g(h_t, e_t), and diagnostic guidance c. Crucially, c tells the agent *what evidence to re-check* rather than dictating a source-task patch.
- Same-Task Contrast & Author Review: Comparing passing (
tau+) and failing (tau-) runs on the same SWE-bench Pro task isolates divergent decisions (e.g., weakening a test instead of fixing a cache key). Review tightens obligations—requiring tests to run while scoping repairs strictly to current-diff failures. - Cross-Task Replay Gate (`G(n)`): Every candidate replays across
Nheld-out source pairs to count activations on failed-only (n_-), passed-only (n_+), and both (n_±) runs. The gateG(n) = I[n_± / N < 0.9] * I[n_- >= n_+]kills indiscriminate prompts and regression-prone triggers. - Independent Semantic Selection: Without seeing replay counts, an evaluator scores diagnosis validity (
v_d), source-solution independence (v_s), and evidence grounding (v_a), keeping onlyv_d * v_s * v_a = 1before freezingH_B.
State-of-the-Art Results & Ablation Proof: Timing vs. Guidance
Using just 100 out-of-distribution SWE-bench Pro tasks (300 trajectories sharing zero of DeepSWE's 91 repositories, domain TV distance 0.70), TransHarness improves every tested model and mature native harness across both DeepSWE v1.1 (113 tasks) and Terminal-Bench 2.1 (89 tasks).
Cross-Model & Native Harness Gains (3-Run Mean %)
| Model & Harness Stack | DeepSWE v1.1 (Base -> +TransHarness) | Terminal-Bench 2.1 (Base -> +TransHarness) |
|---|---|---|
| DeepSeek V4.1 Flash + Mini-SWE / Terminus 2 | 73.2% -> 76.4% (+3.2) | 84.3% -> 86.5% (+2.2) |
| DeepSeek V4.1 Flash + DeepSeek Harness | 70.8% -> 75.2% (+4.4) | 89.9% -> 95.5% (+5.6) |
| Qwen3.8-Flash-Next + Mini-SWE / Terminus 2 | 65.5% -> 69.0% (+3.5) | 85.4% -> 86.5% (+1.1) |
| Qwen3.8-Flash-Next + Qwen Code | 55.8% -> 63.7% (+7.9) | 86.5% -> 89.9% (+3.4) |
| GLM-5.3 Flash + Mini-SWE / Terminus 2 | 63.4% -> 67.3% (+3.9) | 77.5% -> 82.0% (+4.5) |
| *GPT-6 Astra (Strongest Public Baseline)* | *74.0%* | *89.9%* |
Ablations prove both halves of (g, c) are load-bearing: firing the same guidance immediately at the first event drops DeepSWE from 76.4% to 72.6% (Reg. jumps 9.7% -> 13.3%), while replacing diagnostic reassessment with a prescribed fix crashes performance to 65.5% (Reg. 16.5%).
Prompt Engineering Lesson for Harnesses
Never hardcode 'fix all failing tests' in a global system prompt. TransHarness shows global unconditional repair obligations drive regression up to 17.7%, whereas triggered diagnostic prompts ('verify whether test changes match the spec') raise recovery while preserving winning paths.
Implementing Replay-Gated Hooks in Smoke Monkey Harness
Smoke Monkey Harness natively exposes lifecycle events (phase.changed, tool.before, tool.after, permission.required), making it straightforward to enforce TransHarness-style selective policies without modifying model weights.
# Replay a candidate Smoke Monkey Harness policy across 100 paired OOD trajectories
npx tsx scripts/replay-policy.ts \
--archive ./trajectories/swe-pro-100.jsonl \
--policy ./policies/verify-test-scope.ts \
--assert-selectivity "n_both_ratio<0.9,n_fail>=n_pass"- Log Paired Execution Traces: Store failing and passing session transcripts from Smoke Monkey Harness into a local contrast archive.
- Enforce `G(n)` Before Deployment: Never promote a new system-prompt rule or post-tool hook to production unless replay proves it fires more frequently on failing trajectories (
n_- >= n_+) and activates selectively (< 90%overlap). - Scope Interventions to `verify` and `recover` Phases: Attach diagnostic checklists to specific context signatures (such as modified test files or repeated non-zero exit codes) instead of padding the initial context.
Frequently Asked Questions
Q:How does TransHarness prevent benchmark overfitting when evolving coding agents?
TransHarness evolves policies on an independent 100-task OOD set (300 trajectories) and applies two filters before freezing: a cross-task replay gate rejecting indiscriminate or regression-biased triggers, and an independent semantic check verifying source-task independence and evidence grounding.
Q:What scores did TransHarness achieve on DeepSWE v1.1 and Terminal-Bench 2.1?
Paired with DeepSeek V4.1 Flash, TransHarness reached 76.4% on DeepSWE v1.1 (Mini-SWE) and 95.5% on Terminal-Bench 2.1 (DeepSeek Harness), beating GPT-6 Astra (74.0% and 89.9%) by 2.4 and 5.6 percentage points.
Q:Why does TransHarness use diagnostic guidance instead of prescribed instructions?
In DeepSWE ablations, replacing evidence-based reassessment with a fixed prescribed correction dropped accuracy from 76.4% to 65.5% and raised regressions from 9.7% to 16.5% because rigid fixes fail under distribution shift.
Q:Does TransHarness require fine-tuning or updating LLM weights?
No. All improvements come purely from frozen event-triggered harness intervention policies composed around unmodified open-weight or API models.
Q:Can TransHarness improve mature agent harnesses like Qwen Code and DeepSeek Harness?
Yes. On DeepSWE v1.1, TransHarness boosted Qwen Code by +7.9 percentage points (55.8% to 63.7%) and DeepSeek Harness by +4.4 points (70.8% to 75.2%).
Related Alternatives & Comparisons
Claude Code Runtime Alternative: Open Source Stdio MCP Agent Harness
Openai Codex Alternative Open Source: Free Open Source AI Agent & Runtime (2026)
Open Source Devin Alternative: Build Autonomous Software Engineers in TypeScript
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.