@inproceedings{yu-lin-2026-contract,
title = "Contract Before Code: Failure-Compiled Contracts for Long-Horizon Coding Agents",
author = "YU, Jiangnan and
Lin, Kisson Songqi",
editor = "Kamalloo, Ehsan and
Gontier, Nicolas and
Rozanov, Nikolai and
Hashemzadeh, Maryam and
Arora, Akhil",
booktitle = "Proceedings of the Second Workshop for {RE}search on Agent Language Models ({REALM} 2026)",
month = oct,
year = "2026",
address = "Budapest, Hungary",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2026.realm-1.72/",
pages = "1032--1041",
ISBN = "979-8-89176-485-9",
abstract = "Long-horizon coding agents can make many edits before testing a task-wide assumption about an API, authentication mode, environment, or persistent state. A late verifier then exposes that the implementation rests on a false premise. We call the missing step contract acquisition and propose Contract Before Code (CBC), harness-level middleware that compiles historical failures into executable preflight gates. CBC normalizes trajectories, extracts recurring failure signatures, and compiles contracts containing an applicability condition, a probe template, and a planning consequence. At inference time, it retrieves applicable contracts and runs instantiated probes before broad implementation work. Among 1,421 parsed failed SWE-Marathon trajectories, weak labels identify candidate rates of 2.6{\%} overall and 17.5{\%} on stripe-clone; these are not root-cause prevalence estimates. A 120-trajectory human audit reports 76.3{\%} contract precision and 71.4{\%} executable-probe synthesis. Across four service/API-clone tasks and 32 runs per method, CBC achieves 31.3{\%} success (95{\%} CI 18.0{--}48.6), an observed 21.9-percentage-point increase over vanilla, with 55.6{\%} fewer pre-verification edits at 1.11{\texttimes} normalized token cost. The small end-to-end study supports preliminary within-family benefits; broader transfer and the stability of these gains remain unestablished."
}<?xml version="1.0" encoding="UTF-8"?>
<modsCollection xmlns="http://www.loc.gov/mods/v3">
<mods ID="yu-lin-2026-contract">
<titleInfo>
<title>Contract Before Code: Failure-Compiled Contracts for Long-Horizon Coding Agents</title>
</titleInfo>
<name type="personal">
<namePart type="given">Jiangnan</namePart>
<namePart type="family">YU</namePart>
<role>
<roleTerm authority="marcrelator" type="text">author</roleTerm>
</role>
</name>
<name type="personal">
<namePart type="given">Kisson</namePart>
<namePart type="given">Songqi</namePart>
<namePart type="family">Lin</namePart>
<role>
<roleTerm authority="marcrelator" type="text">author</roleTerm>
</role>
</name>
<originInfo>
<dateIssued>2026-10</dateIssued>
</originInfo>
<typeOfResource>text</typeOfResource>
<relatedItem type="host">
<titleInfo>
<title>Proceedings of the Second Workshop for REsearch on Agent Language Models (REALM 2026)</title>
</titleInfo>
<name type="personal">
<namePart type="given">Ehsan</namePart>
<namePart type="family">Kamalloo</namePart>
<role>
<roleTerm authority="marcrelator" type="text">editor</roleTerm>
</role>
</name>
<name type="personal">
<namePart type="given">Nicolas</namePart>
<namePart type="family">Gontier</namePart>
<role>
<roleTerm authority="marcrelator" type="text">editor</roleTerm>
</role>
</name>
<name type="personal">
<namePart type="given">Nikolai</namePart>
<namePart type="family">Rozanov</namePart>
<role>
<roleTerm authority="marcrelator" type="text">editor</roleTerm>
</role>
</name>
<name type="personal">
<namePart type="given">Maryam</namePart>
<namePart type="family">Hashemzadeh</namePart>
<role>
<roleTerm authority="marcrelator" type="text">editor</roleTerm>
</role>
</name>
<name type="personal">
<namePart type="given">Akhil</namePart>
<namePart type="family">Arora</namePart>
<role>
<roleTerm authority="marcrelator" type="text">editor</roleTerm>
</role>
</name>
<originInfo>
<publisher>Association for Computational Linguistics</publisher>
<place>
<placeTerm type="text">Budapest, Hungary</placeTerm>
</place>
</originInfo>
<genre authority="marcgt">conference publication</genre>
<identifier type="isbn">979-8-89176-485-9</identifier>
</relatedItem>
<abstract>Long-horizon coding agents can make many edits before testing a task-wide assumption about an API, authentication mode, environment, or persistent state. A late verifier then exposes that the implementation rests on a false premise. We call the missing step contract acquisition and propose Contract Before Code (CBC), harness-level middleware that compiles historical failures into executable preflight gates. CBC normalizes trajectories, extracts recurring failure signatures, and compiles contracts containing an applicability condition, a probe template, and a planning consequence. At inference time, it retrieves applicable contracts and runs instantiated probes before broad implementation work. Among 1,421 parsed failed SWE-Marathon trajectories, weak labels identify candidate rates of 2.6% overall and 17.5% on stripe-clone; these are not root-cause prevalence estimates. A 120-trajectory human audit reports 76.3% contract precision and 71.4% executable-probe synthesis. Across four service/API-clone tasks and 32 runs per method, CBC achieves 31.3% success (95% CI 18.0–48.6), an observed 21.9-percentage-point increase over vanilla, with 55.6% fewer pre-verification edits at 1.11× normalized token cost. The small end-to-end study supports preliminary within-family benefits; broader transfer and the stability of these gains remain unestablished.</abstract>
<identifier type="citekey">yu-lin-2026-contract</identifier>
<location>
<url>https://aclanthology.org/2026.realm-1.72/</url>
</location>
<part>
<date>2026-10</date>
<extent unit="page">
<start>1032</start>
<end>1041</end>
</extent>
</part>
</mods>
</modsCollection>
%0 Conference Proceedings
%T Contract Before Code: Failure-Compiled Contracts for Long-Horizon Coding Agents
%A YU, Jiangnan
%A Lin, Kisson Songqi
%Y Kamalloo, Ehsan
%Y Gontier, Nicolas
%Y Rozanov, Nikolai
%Y Hashemzadeh, Maryam
%Y Arora, Akhil
%S Proceedings of the Second Workshop for REsearch on Agent Language Models (REALM 2026)
%D 2026
%8 October
%I Association for Computational Linguistics
%C Budapest, Hungary
%@ 979-8-89176-485-9
%F yu-lin-2026-contract
%X Long-horizon coding agents can make many edits before testing a task-wide assumption about an API, authentication mode, environment, or persistent state. A late verifier then exposes that the implementation rests on a false premise. We call the missing step contract acquisition and propose Contract Before Code (CBC), harness-level middleware that compiles historical failures into executable preflight gates. CBC normalizes trajectories, extracts recurring failure signatures, and compiles contracts containing an applicability condition, a probe template, and a planning consequence. At inference time, it retrieves applicable contracts and runs instantiated probes before broad implementation work. Among 1,421 parsed failed SWE-Marathon trajectories, weak labels identify candidate rates of 2.6% overall and 17.5% on stripe-clone; these are not root-cause prevalence estimates. A 120-trajectory human audit reports 76.3% contract precision and 71.4% executable-probe synthesis. Across four service/API-clone tasks and 32 runs per method, CBC achieves 31.3% success (95% CI 18.0–48.6), an observed 21.9-percentage-point increase over vanilla, with 55.6% fewer pre-verification edits at 1.11× normalized token cost. The small end-to-end study supports preliminary within-family benefits; broader transfer and the stability of these gains remain unestablished.
%U https://aclanthology.org/2026.realm-1.72/
%P 1032-1041
Markdown (Informal)
[Contract Before Code: Failure-Compiled Contracts for Long-Horizon Coding Agents](https://aclanthology.org/2026.realm-1.72/) (YU & Lin, REALM 2026)
ACL