TL;DR
HarnessBridge replaces manually engineered, rigid LLM agent harnesses with a lightweight, learnable bidirectional controller. By dynamically compressing interaction histories and filtering out unproductive actions with grounded feedback, it slashes token costs by up to 90% while maintaining or boosting agent success rates across diverse models.
What Problem Does This Paper Address?
LLM agents tackling complex, long-horizon tasks (like software engineering or web navigation) rely on an intermediate layer called a harness to format environment observations and validate actions. Currently, these harnesses are built using static, manually engineered heuristics.
As agent trajectories grow longer, two major issues emerge:
- Context Bloat: The context window gets clogged with redundant, stale, or low-value information, driving up token costs and distracting the agent.
- Execution Loops: Agents frequently get stuck in unproductive loops, repeating invalid commands or pursuing dead ends without advancing the task.
The authors address this by asking a fundamental question: Can we turn the agent-environment interface into an end-to-end learnable generation problem?
Methods
The authors introduce HarnessBridge, a lightweight learnable harness policy ($\pi_h$) that parameterizes the agent-environment interface as two bidirectional projections:
- Observation Projection ($P_{obs}$): This module dynamically decides whether to
PASS,COMPRESS, orDROPindividual units of the interaction history. It also extracts an active-state index—a high-level summary of unresolved errors and pending goals—and places it at the top of the context window so the agent doesn't lose track of its current state. - Action Projection ($P_{act}$): This module intercepts the agent's proposed actions before they hit the environment. It either passes valid actions or rejects unproductive/ungrounded actions, returning trajectory-grounded feedback (concern, evidence, and actionable suggestions) to guide the agent's next attempt.
Crucially, HarnessBridge preserves the raw trajectory as an authoritative record, meaning context compression is non-destructive. Both projections are parameterized within a single lightweight model (initialized from Qwen3.5-0.8B) and trained via unified instruction fine-tuning.
Datasets
- Harness Supervision Dataset: A newly curated dataset containing 5,405 high-quality examples of bidirectional projections. It was generated using successful trajectories from SWE-bench Verified with a Qwen3.5-35B-A3B generator and filtered using an LLM judge (GLM-4.7-Flash) to ensure faithful compression and grounded action rejections.
- Evaluation Benchmarks: The system was evaluated on SWE-bench Verified and Terminal-Bench 2.0 (used as an out-of-domain testbed to evaluate generalization).
Key Insights and Ideas
- Harnessing Small Models for Big Gains: A remarkably small 0.8B parameter model can act as an effective traffic controller for massive commercial models (like GPT-5.4 or Claude-Opus). The interaction control patterns it learns are highly transferable across different model families.
- Non-Destructive Context Management: Instead of permanently overwriting history with lossy summaries, keeping the raw history as an authoritative background store allows the system to generate clean, "provenance-aware" views on the fly without risking irreversible information loss.
- The Power of Saying "No": Simply blocking an agent from executing a redundant or poorly reasoned action—and explaining why using a direct quote from the history—is often enough to break infinite failure loops and redirect the agent toward success.
Key Results
- Performance Boost: On Terminal-Bench 2.0, HarnessBridge achieved a 33.7% success rate with Qwen3.5-35B-A3B, outperforming the baseline Terminus 2 harness by 11.2 absolute percentage points while reducing token consumption by 46.8%.
- Massive Token Savings: When paired with commercial models on Terminal-Bench 2.0, HarnessBridge reduced input token usage for GPT-5.4 by 89.5% and for GPT-5.4-Nano by 90.7% while preserving or improving task success rates.
- Ablation Validation: Ablation experiments confirmed that removing either the action projection or the observation projection severely degrades the agent's success rate, proving that bidirectional mediation is essential.
Limitations and Future Work
- Domain Specificity: The evaluation is strictly confined to coding and terminal-based environments (SWE-bench and Terminal-Bench). While the underlying mechanism is generic, its efficacy in other tool-heavy domains like web navigation or multi-step web research workflows remains to be empirically validated.
- Evaluation Depth: Due to high API and computational costs, the authors reported single-run results rather than multi-run averages, meaning subtle variance trends might not be fully captured.
Summary updated