Command Palette
Search for a command to run...
Harness Handbook: 進化するエージェントハーネスの可読性、ナビゲーション性、編集性の向上
Harness Handbook: 進化するエージェントハーネスの可読性、ナビゲーション性、編集性の向上
Ruhan Wang Yucheng Shi Zongxia Li Zhongzhi Li Yue Yu Junyao Yang Kishan Panaganti Haitao Mi Dongruo Zhou Leoweiliang
概要
現代のAIエージェントの能力は、基盤モデルだけでなく、プロンプトの構築、状態管理、ツールの呼び出し、実行の調整を行うハーネスにも依存する。モデル、API、実行環境、アプリケーション要件の変化に伴い、ハーネスは継続的に修正され、機能の追加や既存動作の適応が求められる。人間の開発者やコーディングエージェントがそのような変更を行う前に、対象動作を実装するすべてのコード箇所を特定する必要がある。しかし、本番環境のハーネスは大規模で密結合であり、動作がファイル、関数、実行段階、状態遷移に分散している一方、修正要求はシステムが何をすべきかを記述し、リポジトリはファイル、関数、モジュールで整理されているため、この特定は困難である。既存のコード検索、リポジトリインデックス化、長文脈処理の手法はコードの検査を容易にするが、開発者やコーディングエージェントは依然としてこのマッピングを自力で復元する必要がある。したがって、動作の局所化はハーネス進化における中心的なボトルネックである。我々は、静的プログラム解析とLLM支援の動作構造化を通じてハーネスコードベースから自動合成される動作中心の表現であるHarness Handbookを導入する。これはシステム動作に基づいて実装知識を整理し、各動作を対応するソースコードにリンクする。また、動作ガイド付き段階的開示(BGPD)を導入し、コーディングエージェントを高レベルの動作記述から関連する実装詳細へ導き、候補箇所を現在のソースに対して検証する。2つのオープンソースエージェントハーネスからの多様な修正要求でHarness Handbookを評価した。Handbook支援の計画は、より少ないプランナートークンで動作局所化と編集計画の品質を向上させる。最大の改善は、分散した実装箇所、稀に実行されるコードパス、モジュール間相互作用を含む変更で見られた。これらの結果は、複雑なエージェントシステムの進化が編集の生成だけでなく、それらの編集をどこに行うべきかの決定にも依存することを示している。
One-sentence Summary
Tencent HY LLM Frontier, Indiana University, and colleagues introduce the Harness Handbook, a behavior-centric representation automatically synthesized via static analysis and LLM structuring that maps agent harness behaviors to source code, and Behavior-Guided Progressive Disclosure, which guides coding agents from high-level behavior descriptions to relevant implementation details, thereby substantially improving behavior localization and edit-plan quality for complex modifications to AI agent harnesses, especially when changes involve scattered implementations or cross-module interactions.
Key Contributions
- The paper introduces Harness Handbook, a behavior-centric representation automatically synthesized from a harness codebase through static program analysis and LLM-assisted behavioral structuring, which links each system behavior to its distributed source implementations.
- It presents Behavior-Guided Progressive Disclosure (BGPD), a method that guides coding agents from high-level behavior descriptions to relevant implementation details and verifies candidate code locations against the current source.
- Evaluations on two open-source agent harnesses show that handbook-assisted planning improves behavior localization and edit-plan quality while using fewer planner tokens, with the largest gains for changes involving scattered implementation sites, rarely executed code paths, and cross-module interactions.
Introduction
The authors address the challenge of modifying production-scale agent harnesses, the software layer that coordinates prompt construction, tool invocation, state management, and execution flow in LLM-based agentic systems. As models and environments evolve, developers or coding agents must locate every implementation site responsible for a desired behavioral change, a task the authors term behavior localization. Prior repository representations, such as maps, code search, and summarization, organize code by files and functions but fail to show how scattered code pieces collectively produce a runtime behavior; coding agents still face iterative, error-prone exploration. To bridge this gap, the authors introduce Harness Handbook, a behavior-centric representation that explicitly links what the harness does to the source code that implements it, built automatically through static analysis and LLM-assisted structuring. They also propose Behavior-Guided Progressive Disclosure (BGPD), which guides agents from high-level behavior descriptions to concrete code locations. Evaluations on two open-source harnesses show that Handbook-assisted planning improves behavior localization and edit-plan quality while reducing planner token consumption.
Dataset
The authors construct a harness handbook from an existing code repository; this handbook serves as the structured knowledge source used by the model. Its composition and processing are as follows:
-
Dataset composition and sources
-
The sole source is a code repository R (C, C++, or similar) representing a harness or firmware library.
-
The resulting handbook is a hierarchical document with three levels (L1–L3) and a cross‑stage state‑register overview.
-
Two leaf granularities are available:
-
function‑as‑leaf – each L3 entry covers a whole function or contiguous regions of a function.
-
file‑as‑leaf – each L3 entry represents an entire source file.
-
Key details for each subset/mode
-
function‑as‑leaf mode:
-
Used when a trusted seed skeleton that faithfully reflects execution stages exists and function‑level detail fits a budget.
-
Seed skeleton provides initial stage and state‑register definitions.
-
file‑as‑leaf mode:
-
Used when no seed skeleton is available or function‑level organization would exceed the budget.
-
The pipeline infers the stage skeleton from file summaries and program graph; an optional review loop refines the structure.
-
Both modes produce the same L1–L3 representation and flag unresolved issues in a separate issues record Y.
-
How the data is used
-
The handbook is used as a model input for source localization and resynchronisation tasks; it provides a traceable mapping from behavioural stages back to specific source locations.
-
The training/usage mixture is not a traditional data split but a single constructed handbook; the mode is selected once per project based on trustworthiness of the seed skeleton and budget.
-
Processing and construction pipeline
- Static Fact Extraction (Phase I)
- Language‑specific adapters parse the repository to extract functions, named boundaries, source locations, signatures, and call edges.
- A program graph G keeps only internal calls or calls to named boundaries; unresolved calls are logged, not guessed.
- This phase is deterministic and uses no language model calls.
- Behavioral Organization (Phase II)
- Function‑as‑leaf: proposes function‑to‑stage assignments using source and call graph context; assignments are reviewed iteratively and can map a function to multiple stages or split it into contiguous regions.
- File‑as‑leaf: generates file cards, combines them with the program graph to infer stage skeleton S, organises files by stage, and optionally refines via proposal and review.
- Hierarchical Synthesis and Packaging (Phase III)
- Converts the stage skeleton and organisation into the L1–L3 document tree and cross‑stage state‑register view.
- Each L3 entry is linked to a statically identified source location and validated against the current repository, ensuring traceability.
- The chapter view V is rendered and structured data is packaged for downstream source localisation and future resynchronisation.
Method
The authors introduce Harness Handbook, a system designed to understand and modify an agent harness by organizing source code around runtime behavior. The system comprises three core components: a behavior-oriented representation, a construction pipeline, and a modification workflow.
Harness Handbook Representation Source repositories indicate where code is stored but do not directly reveal how runtime behavior unfolds across files and stages. The Harness Handbook reorganizes this information around behavior while preserving links to the source. As shown in the framework diagram, the representation consists of an L1–L3 document tree D and a complementary state-register view Z.
Readers typically start at L1 (system overview), which summarizes the architecture, execution model, major stages, and global data flow. They then move to L2 (component overview) for the responsibilities, inputs, outputs, dependencies, and local state of a selected stage. Finally, L3 (unit deep dive) links that stage to source-grounded implementation entries. The complementary view Z records state relationships that cross stage boundaries. Two rules maintain the representation's utility: progressive disclosure, where readers move from L1 to L3 only when more detail is required, and behavior-implementation alignment, ensuring every active L3 locator resolves to the current repository.
Construction Pipeline The construction pipeline builds the handbook from a repository R using a fixed leaf mode g∈{function,file}, which determines the granularity of L3 entries. Once the leaf mode is chosen, construction proceeds in three phases.
Phase I, Static Fact Extraction, uses language-specific adapters to parse the repository and extract functions, named external boundaries, source locations, signatures, and call edges. This phase is deterministic and produces a program graph G. Phase II, Behavioral Organization, organizes source units into the execution-stage skeleton S. In function-as-leaf mode, the pipeline uses source and call-graph context to propose function-to-stage assignments, refined through iterative review. In file-as-leaf mode, the pipeline summarizes scanned files as cards and combines them with the program graph to infer the stage skeleton. Phase III, Hierarchical Synthesis and Packaging, converts the stage skeleton and source organization into the L1–L3 document tree and cross-stage state-register view. Each L3 entry is linked to a statically identified source location and validated against the current repository.
Handbook-Guided Modification and Resynchronization After construction, the handbook serves as a behavior-oriented guide for modifying the repository. Given a request q, the workflow uses the handbook H and repository R.
The workflow begins with Behavior-Guided Progressive Disclosure (BGPD), which localizes the requested behavior through coarse-to-fine handbook navigation. BGPD identifies relevant execution stages using L1 and L2, follows the state-register view Z to include coupled stages, and selects relevant L3 entries. It then expands the candidate set along call relations and verifies these sites against the current repository to produce verified evidence Eq.
Next, a planner converts Eq into an edit plan P and action declarations Γ. An executor applies P to the repository, producing an updated repository R′ and a diff Δ.
Finally, any non-empty diff triggers handbook resynchronization. The procedure reparses the changed source, refreshes the program graph, and aligns old and new versions to identify added, removed, and modified units. If the stage skeleton remains valid, only affected entries are refreshed; otherwise, the construction algorithm is rerun. This ensures the handbook remains consistent and up-to-date with the repository.
Experiment
The experiments assess handbook-guided localization for edit planning on two open-source agent harnesses, comparing a baseline that explores code directly against an arm that follows a navigation policy based on the handbook. Handbook assistance consistently improves plan quality across judges and dimensions while reducing planner token usage. It enables a weaker planner to match the localization accuracy of stronger models, cutting complete misses, and these gains persist across request types and difficulty levels.
Handbook guidance consistently improves reference-plan localization metrics (Recall, Precision, F1) across two harnesses, two reference models, and both file and symbol granularities, with F1 gains reaching up to 18.8 points. Recall and precision rise together, indicating better focus rather than simply returning more candidate sites, and the share of requests with zero overlap (Wrong) never increases and falls by as much as 25.9 points, meaning fewer complete localization failures. On the Terminus-2 harness, handbook assistance brought file-level F1 to 84.7% and 89.3% against Opus 4.8 and GPT-5.5 references, respectively, and precision against GPT-5.5 reached 93.3% at both file and symbol granularity. The Wrong rate, which measures requests with no overlap to the reference, dropped by up to 25.9 percentage points; on the Codex harness against the Opus 4.8 reference, Wrong fell from 37.0% to 14.8%.
The evaluation measured the effect of supplementary handbook guidance on reference-plan localization using two harnesses, two reference models, and both file and symbol granularities. Guidance consistently raised recall and precision in tandem, lifting F1 scores by as much as 18.8 points and driving down the rate of completely missed localizations by up to 25.9 percentage points, indicating that the handbook narrows attention rather than simply surfacing more candidates. These gains held across all setups, demonstrating that the guidance robustly improves localization accuracy and reduces outright failures.