Harness Handbook: Making Evolving Agent Harnesses Readable,Navigable, and Editable

Ruhan Wang, Yucheng Shi, Zongxia Li, Zhongzhi Li, Yue Yu, Junyao Yang, Kishan Panaganti, Haitao Mi, Dongruo Zhou, LeoweiliangarXiv 2026 · arXiv

TL;DR

Evolving AI agents requires constantly modifying their "harness"—the underlying code that manages prompts, state, and tool execution. This paper introduces the Harness Handbook, an automated framework that uses static analysis and LLMs to create a behavior-centric map of a codebase, linking high-level system features directly to the exact lines of code implementing them. By guiding coding agents through a step-by-step navigation strategy, it significantly improves code modification accuracy while reducing overall LLM token costs.

What Problem Does This Paper Address?

Building a modern AI agent involves more than just picking a foundation model; it requires a complex software layer called an agent harness to orchestrate prompts, manage memory, and invoke tools. As application requirements change, this harness must constantly evolve.

However, when a developer or an automated coding agent is tasked with making a change, they hit a major bottleneck: behavior localization. A modification request describes what the system should do in natural language, but code repositories are organized structurally by files, modules, and functions. Because production-grade harnesses are often large, tightly coupled, and have execution logic scattered across multiple files and state transitions, finding every single line of code that needs an edit is incredibly difficult. Traditional code search and long-context windows help inspect code but still force the developer to manually bridge the gap between abstract behavior and raw source code.

Methods

The authors present a two-part solution: an automated documentation pipeline and a structured navigation workflow.

  1. The Harness Handbook Representation: Instead of organizing code knowledge by files, the handbook structures it into a three-level hierarchy based on system behavior:
  2. L1 (System Overview): High-level architecture, execution models, and global data flows.
  3. L2 (Component Overview): The inputs, outputs, and responsibilities of specific execution stages.
  4. L3 (Unit Deep Dive): Source-grounded implementation details for individual functions or files.
Overview of the Harness Handbook representation
  1. The Construction Pipeline: The handbook is built automatically in three phases:
  2. Phase I (Static Fact Extraction): A deterministic parser extracts functions, call graphs, and state accesses into a program graph without using an LLM.
  3. Phase II (Behavioral Organization): Maps these code units into execution stages using either function-as-leaf mode (for fine-grained control using a seed skeleton) or file-as-leaf mode (for repository-scale inference).
  4. Phase III (Hierarchical Synthesis): An LLM generates plain-language behavioral descriptions ("cards") for each unit, ensuring every piece of documentation is strictly anchored to a verifiable code location.
  5. Behavior-Guided Progressive Disclosure (BGPD): When a coding agent receives a modification request, it doesn't read the whole codebase. Instead, it navigates the handbook from coarse to fine (L1 to L3), following state registers and call graphs to isolate candidate code locations. It then verifies these candidates against the live repository before generating a byte-exact edit plan.
  6. Automatic Resynchronization: When code changes produce a repository diff, the handbook incrementally updates only the affected behavioral cards rather than rebuilding the entire index.

Datasets

The framework was evaluated using two open-source agent harnesses that represent opposite ends of the architectural spectrum:

  • Terminus-2: A compact, Python-based terminal agent (6 source files, 103 internal functions) evaluated using function-as-leaf mode.
  • Codex: A massive, multi-surface Rust monorepo (2,267 source files, 34,363 internal functions) evaluated using file-as-leaf mode.

The authors curated 30 realistic, behavior-driven modification requests for each harness (60 total). These requests were balanced across three categories: Query (altering existing rules), Cross-file (adding features spanning multiple modules), and Search-Hostile (changes affecting hidden, mirrored, or rarely executed code paths).

Key Insights and Ideas

  • Localization is the Real Bottleneck: The primary challenge in automated software engineering for complex agentic systems isn't writing the code edits—it's figuring out where to put them.
  • Operational Organization Beats Raw Context: Simply throwing a massive context window or a standard directory map at an LLM planner results in "scope bloat" and missed dependencies. Reorganizing repository knowledge around what the system does yields much cleaner planning.
  • Elevating Weaker Planners: One of the most striking findings is that giving a weaker planner model access to the Harness Handbook allows it to match or exceed the localization accuracy of independent reference plans written by much stronger models acting without it.

Key Results

The authors compared a Handbook-Assisted planning arm against a Baseline arm (direct repository exploration using standard file-reading and search tools) powered by DeepSeek-V4-Pro:

  • Improved Plan Quality: Across three independent LLM judges (GPT-5.5, Opus 4.8, and DeepSeek-V4-Pro), the Handbook-Assisted arm achieved significantly higher win rates, outperforming the baseline 38.3% vs 28.3% on Codex and 45.6% vs 26.7% on Terminus-2.
  • Lower Token Costs: Counterintuitively, adding a multi-layered handbook reduced the planner's token consumption by 12.7% on Codex and 8.6% on Terminus-2 because the progressive disclosure policy prevented the agent from loading irrelevant source code into its context window.
  • Higher Precision and Recall: The handbook boosted F1 scores for identifying correct edit sites by 5.0 to 18.8 percentage points across both granularities (file and symbol level) and slashed complete localization failures (the "Wrong" rate) by up to 25.9 points on Codex.

Limitations and Future Work

  • Initial Construction Overhead: While the handbook saves tokens during the code-modification phase, the initial construction pipeline requires a non-trivial amount of LLM processing to write the behavioral summaries.
  • Skeleton Dependencies: In function-as-leaf mode, the system relies on a trustworthy, hand-authored seed skeleton to define the primary execution stages.
  • Self-Evolution: The authors note that the ultimate goal is to use the Harness Handbook for autonomous agent self-improvement. By treating the handbook as a shared behavioral memory, an agent could independently loop through localization, planning, code execution, and documentation resynchronization as it updates its own system.

Summary updated

Abstract

The capability of a modern AI agent depends not only on its foundation model but also on its harness, which constructs prompts, manages state, invokes tools, and coordinates execution. As models, APIs, environments, and requirements evolve, the harness must be continually modified. Before such a change can be made, a developer or coding agent must identify all code locations that implement the target behavior. This is difficult because production harnesses are large, tightly coupled, and behaviorally distributed, while modification requests describe what the system should do and repositories are organized by files and modules. Code search, repository indexing, and long-context processing ease inspection, but still leave this behavior-to-code mapping to be recovered by hand. Behavior localization is therefore a central bottleneck in harness evolution. We introduce the Harness Handbook, a behavior-centric representation synthesized automatically from a harness codebase via static analysis and LLM-assisted structuring, linking each behavior to its corresponding source. We also introduce Behavior-Guided Progressive Disclosure (BGPD), which guides agents from high-level behaviors to relevant implementation details and verifies candidate locations against the current source. On diverse modification requests from two open-source harnesses, Handbook-Assisted planning improves behavior localization and edit-plan quality while using fewer planner tokens, with the largest gains on scattered sites, rarely executed paths, and cross-module interactions. Evolving complex agentic systems thus depends not only on generating edits, but also on determining where those edits should be made.
BibTeX
@misc{wang2026harness,
  author = {Ruhan Wang and Yucheng Shi and Zongxia Li and Zhongzhi Li and Yue Yu and Junyao Yang and Kishan Panaganti and Haitao Mi and Dongruo Zhou and Leoweiliang},
  title = {{Harness Handbook: Making Evolving Agent Harnesses Readable,Navigable, and Editable}},
  year = {2026},
  eprint = {2607.13285},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.13285},
}
Figure