Contract-Coding: Towards Repo-Level Generation via Structured Symbolic Paradigm
The paper introduces Contract-Coding, a structured symbolic paradigm that bridges vague user intents and executable code via Autonomous Symbolic Grounding to overcome context-fidelity trade-offs in repo-level generation, achieving significantly higher functional success and structural integrity on the Greenfield-5 benchmark compared to state-of-the-art agents.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Problem: The "Vibe Coding" Chaos
Imagine you ask a team of brilliant but slightly confused architects to build a massive, 20-story skyscraper. You don't give them blueprints; you just say, "Build me a cool place where people can live, work, and fly drones." This is what the paper calls "Vibe Coding" (or Intent-Driven Engineering).
In the past, AI agents tried to do this by talking to each other in a long, linear line:
- Agent A says, "Okay, I'll build the foundation."
- Agent B reads Agent A's notes, says, "Okay, I'll build the first floor," but accidentally changes the door width.
- Agent C reads Agent B's notes, says, "Okay, I'll build the second floor," but forgets that the door is now too narrow.
As the building gets taller, the instructions get messy. By the time they reach the 20th floor, the foundation is wrong, the elevators don't fit, and the whole thing collapses. This is called Architectural Collapse. The AI gets "lost in the middle" of too many details.
The Solution: The "Language Contract"
The authors propose a new way called Contract-Coding. Instead of letting the agents talk to each other directly, they force them to all agree on a Master Blueprint first.
Think of this Language Contract as a strict, unchangeable rulebook or a legal contract that acts as the "Single Source of Truth."
Here is how it works, step-by-step:
1. The "Architectural Thumbnail" (The Contract)
Before anyone lays a single brick, the AI creates a high-level summary of the building.
- Old Way: Agents try to remember every detail of the foundation while building the roof.
- New Way: The AI writes a "Contract" that says: "The foundation must be 10 meters wide. The first floor must have a 2-meter door. The roof must be red."
- The Magic: This contract is short and simple. It doesn't contain the messy details of how to build the door, just what the door must look like.
2. The "Topological Hypervisor" (The Traffic Controller)
Once the Contract is written, it acts like a traffic controller or a game master.
- In the old way, Agent B had to wait for Agent A to finish before starting.
- In this new way, the Contract allows everyone to work at the same time.
- Agent A builds the foundation. Agent B builds the first floor. Agent C builds the roof.
- Why? Because they aren't looking at each other's messy notes. They are all looking at the same Contract. As long as they follow the rules in the Contract, they can't mess each other up.
3. The "Referee" (The Auditor)
This is the most clever part. The system has a Referee (an Auditor agent) that constantly checks the work.
- If Agent B builds a door that is 3 meters wide (violating the Contract), the Referee immediately stops them.
- The Referee doesn't just say "Wrong." It goes back to the Contract and updates it: "Okay, we need a 3-meter door now."
- Then, it tells Agent A (who built the foundation) to fix their work to match the new rule.
- This prevents small mistakes from becoming big disasters later.
Why is this better? (The "Sub-linear" Magic)
The paper uses a fancy term: Sub-linear Context Scaling. Let's translate that.
- The Old Problem: If you want to build a 100-story building, the AI has to read 100 pages of notes. If you want to build a 1,000-story building, it has to read 1,000 pages. Eventually, the AI's brain (memory) gets full, and it forgets the beginning.
- The Contract-Coding Solution: No matter how big the building gets, the Contract stays roughly the same size. It's like a map. Whether you are walking a mile or a thousand miles, you only need to look at the map, not read a diary of every step you've taken.
- Result: The AI can build huge, complex systems without getting confused or forgetting the rules.
Real-World Analogy: The Orchestra
- Old Way (Linear): A conductor tells the violinist to play, then the violinist tells the drummer, who tells the bassist. If the violinist makes a mistake, the drummer gets confused, and the bassist plays the wrong song.
- Contract-Coding: The conductor hands out a sheet of music (The Contract) to every musician. Everyone reads the same sheet. They can all play their parts at the exact same time (Parallelism). If a musician plays a wrong note, a Sound Engineer (The Auditor) hears it, stops the music, and updates the sheet of music for everyone to see.
The Results
The researchers tested this on building complex software "games" (like a city simulator or a dungeon crawler).
- Competitors: Other AI systems often built "hollow skeletons" (buildings with no rooms) or "logical detachments" (doors that lead nowhere).
- Contract-Coding: Even though it wasn't perfect at every tiny detail, it built structurally sound systems. The "building" didn't collapse. The doors were in the right place, and the elevators worked.
Summary
Contract-Coding is like giving a team of AI builders a strict, shared rulebook instead of letting them chat in a chaotic line.
- Define the Rules First: Create a short, clear contract.
- Work in Parallel: Let everyone build at the same time based on the rules.
- Audit Constantly: A referee checks if the work matches the rules and updates the rules if needed.
This stops the AI from getting overwhelmed by complexity and allows it to build massive, reliable software systems that used to be impossible.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.