HyperAIHyperAI

Command Palette

Search for a command to run...

Manuel du harnais : rendre les harnais d'agents évolutifs lisibles, navigables et modifiables

Ruhan Wang Yucheng Shi Zongxia Li Zhongzhi Li Yue Yu Junyao Yang Kishan Panaganti Haitao Mi Dongruo Zhou Leoweiliang

Résumé

La capacité d'un agent IA moderne dépend non seulement de son modèle de fondation, mais aussi de son harnais, qui construit les invites, gère l'état, invoque les outils et coordonne l'exécution. À mesure que les modèles, les API, les environnements d'exécution et les exigences applicatives évoluent, le harnais doit être continuellement modifié pour ajouter des capacités ou adapter les comportements existants. Avant qu'un développeur humain ou un agent de codage puisse effectuer une telle modification, il doit identifier tous les emplacements de code qui implémentent le comportement cible. Cela est difficile car les harnais de production sont souvent volumineux, fortement couplés et comportementalement répartis entre les fichiers, les fonctions, les étapes d'exécution et les transitions d'état, tandis que les demandes de modification décrivent ce que le système doit faire et que les dépôts sont organisés par fichiers, fonctions et modules. Les approches existantes de recherche de code, d'indexation de dépôts et de traitement à long contexte rendent le code plus facile à inspecter, mais elles laissent encore aux développeurs et aux agents de codage le soin de reconstituer cette correspondance par eux-mêmes. La localisation du comportement constitue donc un goulot d'étranglement central dans l'évolution du harnais. Nous introduisons le Manuel du harnais, une représentation centrée sur le comportement synthétisée automatiquement à partir d'une base de code de harnais par analyse statique de programme et structuration comportementale assistée par LLM, qui organise les connaissances d'implémentation autour des comportements du système et lie chaque comportement au code source correspondant. Nous introduisons également la divulgation progressive guidée par le comportement (BGPD), qui guide les agents de codage depuis des descriptions de comportement de haut niveau vers les détails d'implémentation pertinents et vérifie les emplacements candidats par rapport au code source actuel. Nous évaluons le Manuel du harnais sur diverses demandes de modification provenant de deux harnais d'agents open source. La planification assistée par le Manuel améliore la localisation du comportement et la qualité du plan de modification tout en utilisant moins de jetons de planification. Les gains les plus importants apparaissent pour les modifications impliquant des sites d'implémentation dispersés, des chemins de code rarement exécutés et des interactions inter-modules. Ces résultats indiquent que l'évolution de systèmes agentiques complexes dépend non seulement de la génération de modifications, mais aussi de la détermination des endroits où ces modifications doivent être apportées.

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

  1. 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.
  1. 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.
  1. 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 DDD and a complementary state-register view ZZZ.

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 ZZZ 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 RRR using a fixed leaf mode g{function,file}g \in \{function, file\}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 GGG. Phase II, Behavioral Organization, organizes source units into the execution-stage skeleton SSS. 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 qqq, the workflow uses the handbook HHH and repository RRR.

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 ZZZ 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 E^q\widehat{E}_{q}Eq.

Next, a planner converts E^q\widehat{E}_{q}Eq into an edit plan PPP and action declarations Γ\GammaΓ. An executor applies PPP to the repository, producing an updated repository RR'R and a diff Δ\DeltaΔ.

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.


Créer de l'IA avec l'IA

De l'idée au lancement — accélérez votre développement IA avec le co-codage IA gratuit, un environnement prêt à l'emploi et le meilleur prix pour les GPU.

Codage assisté par IA
GPU prêts à l’emploi
Tarifs les plus avantageux

HyperAI Newsletters

Abonnez-vous à nos dernières mises à jour
Nous vous enverrons les dernières mises à jour de la semaine dans votre boîte de réception à neuf heures chaque lundi matin
Propulsé par MailChimp