Software workflows · Research feature

Harness Engineering for Software Engineering via Modular Executable Dev-Primitives

The study introduces Dev-Primitives, which embed small language models directly into software repository components, allowing each artifact to interact with and reason about its own implementation.

Adapted from research by Haibo Jin, Xinjie Li, Peng Kuang and colleagues.

arXiv preprint revision · 2026-10-06 · Attribution & reuse
In this article
Editorial illustration of linked workflow.

Editor’s introduction

The study introduces Dev-Primitives, which embed small language models directly into software repository components, allowing each artifact to interact with and reason about its own implementation. These components are activated dynamically within a framework called HERMES, which enables localized collaboration, execution of environment states, and diagnosis-driven revisions. Researchers evaluated HERMES across four benchmarks, finding it outperforms baseline agents by an average of 12.4 percentage points. When paired with strong activation and diagnosis models, HERMES using Qwen3-8B Dev-Primitives remains within 4.5 percentage points of a GPT-5.6 Sol configuration. The evidence shows a 26.2% reduction in inference cost on Terminal-Bench 4.0.

Introduction

Large language models (LLMs) equipped with terminal access have demonstrated remarkable capability in automating real-world software engineering. Existing approaches broadly follow two paradigms. Pipeline-based methods prescribe the control flow in advance, decomposing software repair into stages such as fault localization, patch generation, and validation. Agent-based methods instead place an LLM in an interactive execution environment, where it can inspect repositories, execute commands, modify code, and react to runtime feedback through a general action loop. Recent benchmarks have meanwhile expanded from isolated issue resolution to tasks that require sustained interaction with repositories, terminals, tests, and runtime systems.

Both paradigms remain brittle once such interactions extend over long horizons. Append-only histories and passive compression lead to context explosion, semantic drift, and degraded reasoning. In software repositories, however, the difficulty is not only the length of the history: the relevant program state is scattered across interdependent source files, configurations, and tests, so a change to one file often requires matching changes in the code that calls it, its configuration, and its tests. Each edit also changes the repository itself, so the agent must repeatedly re-inspect affected files and work out what each change requires elsewhere, a burden that no amount of history compression removes. Recent evaluations expose this clearly: on whole-repository migration, only 5.4% of 520 agent runs complete all evaluation stages, and similar difficulties appear in long-horizon software evolution and repository generation. This raises a natural question: instead of requiring an agent to repeatedly reconstruct distributed program state, can individual software components reason about their own responsibilities and communicate relevant information directly to one another?

We answer this question with Dev-Primitives (Development Primitives), modular and executable abstractions that transform repository components from passive code artifacts into active participants. Each Dev-Primitive wraps a repository artifact with a resident LLM, and this is what makes the artifact agent-native: because the resident model reads the implementation it is attached to, the component can be addressed in natural language and can answer for its own implementation and dependencies. Through this interface it interprets requests, reasons over its own artifact, communicates requirements and constraints to other primitives, and modifies its implementation when necessary, so that component-specific information and reasoning stay with the artifact that owns them.

Dev-Primitives alone, however, do not determine which components a task should involve: repositories may contain thousands of components, and activating all of them would be wasteful. We therefore introduce HERMES, a Harness Engineering framework for software engineeRing via Modular Executable Dev-PrimitiveS, which adds two mechanisms. Dynamic activation localizes the components likely to implement the reported behavior, follows their dependencies to the callers, configurations, and tests that may need to change with them, and instantiates only the Dev-Primitives in this candidate set, which modify their artifacts and exchange requirements before the repository is executed. Because a single round often leaves the issue unresolved, and execution reports only that the repository still fails rather than which component should be revised, a bug diagnosis mechanism traces the failure back to the components it implicates and reactivates only those primitives, repeating until the repository passes or a revision budget is exhausted.

Software Engineering Agents and Long-Horizon Evaluation. SWE-agent, OpenHands, and CodeAct place an LLM in an executable environment where it can inspect repositories, edit code, run commands, and react to runtime feedback, while Agentless and AutoCodeRover prescribe explicit localization and repair stages, and other systems distribute work across designer-specified roles or file-level developers under centralized coordination. Evaluation has meanwhile moved toward sustained terminal interaction and multi-stage software workflows, and toward repository-scale consistency during software evolution, repository generation, and whole-repository migration, where context growth, semantic drift, and state preservation become bottlenecks for long-running agents.

Reusable and Modular Agent Capabilities. One line of work learns software engineering behavior from repository-level trajectories. Another represents reusable capabilities explicitly through modular abstractions, encapsulating reasoning procedures, skills, or tool interfaces that an agent can invoke and compose across tasks.

Key Differences. These systems differ from Dev-Primitives in the unit to which reasoning capability is attached. Prior agents assign work to designer-specified roles or centrally coordinated file-level tasks, so the reasoning units and the paths along which they exchange information are fixed in advance; prior primitives encapsulate reusable, task-agnostic behaviors; and context-management methods keep information inside a single trajectory. A Dev-Primitive is instead defined by the artifact it owns, so the set of primitives is induced by the repository and requirements flow along its dependency edges, and HERMES activates these primitives on demand and revises them from execution evidence. Appendix A gives an extended discussion.

Dev-Primitives

A Dev-Primitive wraps an individual repository component, such as a source file, configuration file, or test file, with a resident LLM. Each primitive has direct access to the artifact it represents and is responsible for reasoning about and modifying that artifact during software engineering. Unlike conventional agents that repeatedly retrieve repository files as passive context, Dev-Primitives turn these components into active participants that can interpret natural-language requests, communicate implementation requirements with other components, and directly edit their own artifacts.

Experimental Setup

Benchmarks. We evaluate HERMES on four benchmarks spanning complementary software engineering settings. SWE-bench Verified covers real-world GitHub issue resolution with human-validated tasks; SWE Refactor Bench targets whole-repository migration and coordinated cross-file modification; Terminal-Bench 4.0 measures performance on interactive terminal-based tasks; and DevOps-Gym spans build and configuration, monitoring, issue resolution, test generation, and end-to-end multi-stage workflows.

Main Results

On SWE Refactor Bench. We compare HERMES with representative leaderboard configurations, including Claude Code and Codex, on all 20 whole-repository migration tasks. We report the composite score and per-task inference cost, and include both medium- and high-effort HERMES variants for models that support configurable reasoning effort.

On Terminal-Bench 4.0. We compare HERMES against leading agent configurations reported on the Terminal-Bench 4.0 leaderboard, including Claude Code, Codex, Grok Build, and mini-SWE-agent. Terminal-Bench 4.0 contains 66 executable tasks, and each configuration is evaluated over five trials. We report resolution rate, total token consumption, and inference cost.

On DevOps-Gym. We evaluate HERMES on the four DevOps-Gym task categories: build and configuration, monitoring, issue resolving, and test generation. We report the success rate for each category together with the unweighted average across the four categories. In addition to the published DevOps-Gym baselines, we also include same-backbone comparisons with Codex, mini-SWE-agent, and Claude Code to isolate the effect of the harness.

Scaling LLMs Across HERMES Components

We further study how model scale affects different components of HERMES. In addition to homogeneous configurations in which the same backbone is used throughout HERMES, we construct heterogeneous configurations by independently scaling activation and diagnosis while keeping all Dev-Primitives fixed to Qwen3-8B. We conduct the analysis across 4 benchmarks.

Dev-Primitive Selection Quality

We evaluate whether dynamic activation selects the components a task requires, comparing the activated Dev-Primitives against a target component set derived from the reference patch or, where no unique reference patch exists, from benchmark-specific supervision. We report selection recall and precision together with the average number of activated primitives, separating solved from failed tasks; target construction and metric definitions are given in Appendix F.4.

Selection Quality and Task Success. Solved tasks consistently exhibit higher selection recall than failed tasks, by 16.5 to 24.7 points across the four benchmarks, linking more complete component selection with downstream task completion. Reference-patch overlap is nonetheless a conservative measure of localization: a task can be resolved along a different file-level path from the developer patch, as in the trajectory of Appendix H.

Conclusion

We introduced Dev-Primitives, modular executable interfaces that turn repository components from passive artifacts into active participants in software engineering, and HERMES, a harness engineering framework that instantiates them through dynamic activation, localized collaboration, environment execution, and diagnosis-driven revision. Across four benchmarks, HERMES improves over matched baseline harnesses by 12.4 percentage points on average, and with strong activation and diagnosis models it stays within 4.5 points of the homogeneous GPT-5.6 Sol configuration while running Qwen3-8B Dev-Primitives, at 26.2% lower inference cost on Terminal-Bench 4.0. These results highlight harness design as a key factor in translating model capability into effective software engineering behavior. Limitations are discussed in Appendix I.

Dev-Primitives

Communication is restricted to task-relevant components rather than broadcast throughout the repository. Messages generated by one primitive are incorporated into the communication context of their target primitives before the collaboration round terminates. A Dev-Primitive may therefore revise its local modification after receiving information from another activated component.

Execution Environment

The execution environment does not rely on an LLM to predict whether a modification is correct. HERMES evaluates the modified repository through actual execution using the repository snapshots, dependencies, and runtime environments provided by each benchmark. Held-out evaluation tests are not exposed during solving (Appendix F.1).

Execution Isolation and Settings

Execution and Evaluation Isolation. HERMES separates the execution environment available during task solving from the benchmark evaluator used to compute the final score. During a trajectory, dynamic activation, the Dev-Primitives, and bug diagnosis may use only information available from the task repository and its execution environment, including repository-provided tests, build commands, linters, type checkers, runtime outputs, stack traces, logs, and reproduction scripts constructed during solving. Benchmark-held-out evaluation tests and final grading outcomes are not exposed to HERMES during task execution.

For SWE-bench Verified, HERMES may execute tests already available in the repository or construct task-specific reproduction tests from the issue description and repository context. The tests used by the benchmark evaluator, including those associated with FAIL_TO_PASS and PASS_TO_PASS, are used only after HERMES terminates. We follow the same separation for SWE Refactor Bench, Terminal-Bench 4.0, and DevOps-Gym: benchmark-specific graders and held-out evaluation checks are reserved for final scoring rather than being returned as feedback during solving.

Reasoning Effort. We use medium reasoning effort by default for models that support configurable reasoning effort. High- or maximum-effort configurations are used only when explicitly indicated in the corresponding experiment. Unless otherwise stated, the component ablation, revision, and backbone-scaling studies therefore use the default medium-effort setting.

Dev-Primitive Runtime

Primitive State Across Rounds. Each Dev-Primitive is associated with a concrete repository component and persists across revision rounds within the same task. Its state contains the current version of the underlying artifact together with task-relevant communication accumulated during the trajectory. Model hidden states are not preserved across calls. When a primitive is activated again, it receives the current artifact, its assigned objective, and the communication context relevant to that component.

Communication is interleaved with local modification rather than performed as a fixed all-to-all stage. A primitive sends a message when its local task depends on another component or when its modification introduces a requirement that another component must satisfy. This allows communication to follow repository dependencies encountered during execution rather than requiring every activated primitive to communicate with every other primitive.

On-Demand Activation. The activation module activates only the Dev-Primitives selected as relevant to the current plan. Inactive components remain available in the repository but do not receive model calls or participate in communication during that round. The active set may change across revision rounds: execution and diagnosis feedback may cause the activation module to activate additional components, remove previously activated components, or revise their assigned objectives.

Creation of New Components. When solving a task requires a new persistent source, test, configuration, build, or other repository file, an active Dev-Primitive may create the artifact. HERMES subsequently registers the new artifact as a Dev-Primitive so that it can participate in later communication and revision rounds. Temporary outputs, caches, logs, and other transient execution artifacts are treated as environment observations rather than Dev-Primitives.

Ablation Settings

w/o Inter-Primitive Communication. Dev-Primitives retain their local reasoning and editing capabilities but cannot exchange messages with one another. Each primitive receives its objective from the activation module and independently modifies its own component. Information across repository components can therefore only be recovered indirectly through subsequent planning and execution.

w/o On-Demand Activation. We retain the same initial task analysis and component identification procedure, but remove on-demand invocation of Dev-Primitives. In the complete HERMES configuration, the activation module activates a primitive only when its associated component is required by the current plan, and the active set may change after execution feedback and revision. In this ablation, all Dev-Primitives identified during the initial task analysis are activated at the beginning of the trajectory and remain active throughout subsequent planning and revision rounds.

w/o Execution Feedback. HERMES retains activation, the Dev-Primitives, inter-primitive communication, and diagnosis, but execution observations generated after repository modifications are not provided for subsequent revision. The diagnosis module therefore evaluates the modified repository against the task and current plan through static inspection alone, and cannot use test failures, runtime errors, command outputs, or execution traces to guide later rounds.

Benchmark-Specific Evaluation Protocol

SWE-bench Verified. We evaluate HERMES on the 500 human-validated tasks in SWE-bench Verified using the official repository snapshots and evaluation procedure. During task solving, HERMES operates on the issue description, repository contents, and task-visible execution environment. Repository-provided tests and reproduction scripts constructed during solving may be executed, whereas benchmark evaluation tests are reserved for final scoring. We report the percentage of successfully resolved tasks.

SWE Refactor Bench. We evaluate all 20 whole-repository migration tasks and report the benchmark composite score. HERMES operates on the provided repository, migration specification, and task-visible execution environment, while the benchmark grader is used only for final evaluation. For analyses that divide tasks into solved and failed groups, we regard a task as solved when it obtains a non-zero composite score, indicating that the migration passes the required audit and behavioral checks and reaches the verifier stage.

Terminal-Bench 4.0. We evaluate the 66 Terminal-Bench 4.0 tasks using five runs per task. HERMES interacts with the benchmark-provided terminal environment and may inspect or modify task-visible filesystem artifacts. The benchmark grader is used only to determine the final task outcome and is not exposed as execution feedback. We report resolution as the mean across the five runs together with its standard deviation. Token counts and inference costs are accumulated over the complete evaluation trajectories.

DevOps-Gym. We evaluate four DevOps-Gym task categories: build and configuration, monitoring, issue resolving, and test generation. HERMES interacts with the task-visible repository and runtime environment during solving, while benchmark-specific grading artifacts are used only for final evaluation. We report the success rate for each category and the unweighted average across the four categories.

Baseline Provenance

Our baseline tables contain both publicly reported results and controlled baseline runs. When the required model, harness, reasoning-effort setting, and benchmark version are available from the corresponding benchmark leaderboard or published evaluation, we directly use the reported result. When an exact matched model–effort configuration is unavailable, we run the corresponding baseline harness under the same benchmark snapshot and evaluation protocol used for HERMES.

For SWE-bench Verified, we use reported results for available mini-SWE-agent, Claude Code, and Codex configurations and use controlled runs where an exact matched configuration is required. For SWE Refactor Bench, published Claude Code and Codex results are supplemented with matched configurations evaluated under the same 20-task protocol. For Terminal-Bench 4.0, publicly reported high- or maximum-effort results are retained when available, while additional medium-effort configurations are evaluated separately to provide matched comparisons with the default HERMES setting. For DevOps-Gym, we include the baseline systems reported by the benchmark together with same-backbone controlled runs used for direct harness comparison.