Apply to my task
arXiv:2610.31854 ★ 92 Oct 22, 2026

SWE-Clar: clarify requirements before coding, and test understanding with separate questions

Key result

The client answered the question, but that doesn't mean the agent understood. Even when a requirement is fully spelled out in the conversation, the agent sometimes restates it wrong. The SWE-Clar approach lets you catch that error before any code is written. The agent asks questions, then restates the requirements in its own words, and you check the restatement against what you meant. A wrong restatement of a requirement is an early warning that the code for it will fail. Without questions, the agent almost always fails a project from scratch. With questions, results improve several-fold.

01

TL;DR

SWE-Clar is a benchmark (a set of test tasks) built on 100 real Upwork jobs. It checks how a coding agent first figures out the requirements with the client and then builds the project from scratch with no further hints. Here's the setup: the agent asks questions, the context gets "frozen," and then two isolated branches run. In one, the agent writes code and has to pass acceptance tests. In the other, it answers control questions about the requirements, and its answers are checked against a reference. That way you can see separately what the agent understood and what it built.

The key finding: the client answered the question ≠ the agent understood. Even when a requirement is fully spelled out in the conversation, the agent sometimes restates it wrong at the end. When the agent answers a question about a requirement wrong, the code for that requirement usually fails its test. Without clarifying questions, the agent almost always fails the project: it builds on guesses instead of knowledge. With questions, results improve several-fold, but close only half to two thirds of the gap to the "full spec up front" level. Even with a full spec, the agent doesn't solve every task.

The practical point: a question phase before coding is necessary, but not sufficient. Let the agent ask questions while you're available, and make it restate the requirements in its own words so you can check its understanding before it starts. The fuller the brief, the better the result.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: The agent studies the materials and asks the client questions → rounds of "question — verified answer"
        (especially: how the software is run, what the inputs and outputs are)
STEP 2: The client answers, confirms, or corrects the agent's interpretations → the answers
        are checked by a supervisor (accuracy, completeness, didn't go beyond the question)
STEP 3: The agent decides on its own that clarification is done → the context is "frozen"
        (request + dialogue + what the agent saw in the working folder)
STEP 4a: Implementation branch: the agent writes code with no access to the client → acceptance tests
STEP 4b: Understanding-check branch (a separate run): the agent answers questions
        about the requirements → a judge compares them to the reference (correct / partial / wrong)

Steps 1–3 happen in one conversation. Branches 4a and 4b are separate runs from the same frozen context. The check questions must not hint to the agent what to put in the code.

03

Example

Task: The owner of a cosmetics store on Amazon asks Claude Code for a script that calculates unit economics for every SKU from exported sales reports. The request goes like this: "I need to calculate margin per product so I know what to cut from the catalog." The requirements the client didn't mention are endless: fees, fulfillment, returns, taxes, output format.

Prompt:

You are a freelance developer. The client is me, an Amazon store owner.
My original request: "I need a script that calculates margin per product from my Amazon
Seller Central report exports so I know what to cut from the catalog." The export files are in the /data folder.

PHASE 1. CLARIFICATION (no writing code).
- Study the files in /data.
- Ask me questions in batches of 3–5 until you understand what's needed.
- Be sure to clarify: how I'll run the script, what I feed in, what I want to get out.
- Offer your own interpretation ("Here's how I understood it: ... Right?"), not just open questions.
- Ask about exceptions and edge cases: returns, cancellations, products with no sales.
- When you're ready, write "CLARIFICATION COMPLETE" and list 5–7 requirements in your own words.

PHASE 2. IMPLEMENTATION — only after my "ok." From then on I'm unavailable, no more questions.

Result: The agent won't start coding right away. Instead it sends a series of questions with candidate interpretations: how to calculate fees, what to do with returns, what format the report should take. After your answers, it gives you a list of requirements in its own words. You'll see where it misunderstood, correct it, and only then give the go-ahead for code.

04

Why It Works

The weakness: given an incomplete task, the model fills in the gaps with guesses and confidently writes code. Without questions, it fails almost every task. But even after the client answers, understanding isn't guaranteed: the model later restates some fully disclosed requirements incorrectly.

The strength: the model is good at writing clarifying questions and restating requirements in its own words. You can check that restatement against what you meant. An error in the restatement predicts a code failure on that requirement.

How the method uses this: - The question phase gathers what's missing while you're available. - A separate restatement of requirements is a cheap check before the expensive implementation. - Isolating the check from the code keeps the control questions from tipping the model off and skewing the check.

Control knobs: - Interpretations instead of open questions ("Here's how I understood it...") → the client confirms or corrects faster. - Mandatory topics (how it runs, input, output) → plug the most expensive holes. - Question batch size → smaller batches mean more rounds, but less confusion. - Answer review (someone else checks your answers for accuracy and completeness) → fewer errors in the brief itself.

05

Prompt Template

The available text of the paper has no full prompts (the roles are in Appendix F). The template below is built from the mechanics the paper describes: mandatory clarification of critical details, confirmation of interpretations, no code until clarification is over.

You are a {contractor_role}. The client is {who_the_client_is}.
Original request: "{initial_request}". The materials are in {folder_or_files}.

PHASE 1. CLARIFICATION (no writing code).
- Study the materials and figure out what the request is missing.
- Ask questions in batches of {number}.
- Be sure to clarify: how the result is run, what goes in,
  what should come out, how to handle {critical_exceptions}.
- Offer your own interpretation ("Here's how I understood it: ... Right?").
- When you think you have enough, write "CLARIFICATION COMPLETE" and list
  the requirements in your own words.

PHASE 2. IMPLEMENTATION — only after my "ok."
The client is unavailable; there will be no more questions. Build {deliverable} and test it yourself.

Placeholders: - {contractor_role} — developer, analyst, writer. - {initial_request} — your real, incomplete request, as is. - {critical_exceptions} — the "sharp corners" you already know about: returns, cancellations, empty data.

🚀 Quick start — paste into a chat:

Here's a template for a clarification phase before implementation. Adapt it to my task: [your task].
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask what the task is, what materials you have, how the result will be run, and which exceptions you already know about. That way the clarification phase goes straight for the most expensive holes instead of generic stuff.

06

Limitations

⚠️ It's a benchmark, not a proven technique: the authors measured how models cope; they didn't test whether "restating requirements before coding" specifically improves results. The link between a correct answer and working code is shown as a correlation.

⚠️ The client in the experiment is a model: the client, the client's reviewer, and the judge were all played by the same LLM. A real person answers worse, less consistently, and more slowly.

⚠️ Clarification doesn't close the whole gap: it recovers only part of the lost performance. A full spec up front is still noticeably better. Questions don't replace a good brief.

⚠️ Answers and code are different things: sometimes a requirement is stated correctly but the code doesn't implement it. And the reverse: the answer is incomplete but the code passes the test. A restatement is a signal, not a guarantee.

⚠️ Narrow scope: new projects from scratch, local development, the client available only at the start. For changes to existing code and ongoing work with a client, the conclusions transfer less well.

07

How They Tested It

The Upwork team took 100 real greenfield jobs worth $4,000 and up. From records of client–freelancer conversations, a model extracted the requirements critical to delivering the work: both stated outright and inferred from context. From those they built 512 control questions with reference answers, plus acceptance tests. Nine top models acted as freelancer agents. A single model played the client, supervisor, and judge. The idea was to separate understanding from execution: after the dialogue the context was frozen and two isolated branches were launched.

The most telling part is the comparison of three conditions on two weaker models. With no questions to the client, the agents passed 5–6% of tasks. With the clarification protocol, 39–49%. With a full spec up front, 71–75%. Clarification closes 51–62% of the gap, and the rest is the price of details nobody mentioned. The best model passed 67% of tasks, the worst 39%. The higher the score for restating requirements, the better the code result: a 0.89 correlation across nine models.

Next they compared answers and code requirement by requirement. The test pass rate for a requirement with a correct answer was 86–91%. With a wrong answer, 34–68%, noticeably lower. But the link isn't perfect: 6–8% of requirements with a correct answer still fail in code. Something else was surprising: for 3–6% of requirements the client fully disclosed, the agent still states them wrong. Disclosing information and understanding it are not the same thing.

08

Adaptations and Extrapolations

🔧 Technique: add a control restatement → catch misunderstandings before code

In the paper, the understanding check is a separate run. A practitioner can do the same in everyday work. After "CLARIFICATION COMPLETE," ask:

Answer three questions in writing, without looking at the code: 
1) What does the program do in the case of {edge_case_1}? 
2) What does it do if {edge_case_2}? 
3) How is it run and what does it return? 
Point out where you're not sure.

You compare the answers with your expectations and correct them before implementation. This is an extrapolation: the paper showed that wrong answers predict failure, but didn't test this technique as a way to prevent it.

🔧 Technique: a second chat as a "supervisor" → fewer errors in your answers

In the paper, the client's answers are checked by a separate agent: accuracy, completeness, didn't go beyond the question. If you're answering a lot of the agent's questions, send your answers to another chat and ask it to find contradictions and gaps. Then send the corrected version back.

09

Resources

  • SWE-Clar: Can Coding Agents Clarify Incomplete Client Requirements and Deliver Greenfield Software? (Preprint, under review)
  • Code and data: https://github.com/upwork/SWE-Clar
  • Authors: Jialei Li, Dingxian Wang, Xiaoyan Zhao et al. — University of Science and Technology of China, National University of Singapore, Upwork Inc.
  • Related benchmarks mentioned in the paper: SWE-Lancer, ClarifyCodeBench, Ambig-SWE, SWE-Together, SWE-Interact, ICAE-Bench

Research digest

Key result

The client answered the question, but that doesn't mean the agent understood. Even when a requirement is fully spelled out in the conversation, the agent sometimes restates it wrong. The SWE-Clar approach lets you catch that error before any code is written. The agent asks questions, then restates the requirements in its own words, and you check the restatement against what you meant. A wrong restatement of a requirement is an early warning that the code for it will fail. Without questions, the agent almost always fails a project from scratch. With questions, results improve several-fold.

Principle

A three-step process: questions → restatement → code. In the paper, after the questions the context is frozen and two separate branches run. In one, the agent writes code. In the other, it answers control questions about the requirements. That way you can see separately what the agent understood and what it built. Understanding is checked separately from the code, while it's still cheap to fix. It's like going over the estimate with your contractor before the remodel starts. Tearing down walls afterward is too late. In a regular chat, the restatement replaces the second branch: the agent lays out the requirements in its own words, you check them and give the "ok."

Why it works

Given an incomplete task, the model doesn't ask. It fills in the gaps with guesses and confidently writes code. That's why almost everything fails without questions. Questions gather what's missing while you're reachable. But even after the answers, understanding isn't guaranteed: the model later restates some fully disclosed requirements incorrectly. An error in the restatement predicts a code failure on that requirement, and a restatement costs pennies compared to implementation. The model is also good at writing questions and at restating. Use that. What else helps: questions in the form "Here's how I understood it: ... Right?" instead of open ones, mandatory topics (how it runs, input, output), and small question batches so nothing gets tangled. Honest caveat: questions close only half to two thirds of the gap to the "full spec up front" level. They don't replace a good brief.

When to apply

Building from scratch → small projects and scripts from an incomplete request, especially when you're available only at the start and then the agent works alone. Also fits texts, reports, and analysis where "filling in the blanks" is costly (transfer of the findings there wasn't tested). NOT a fit for changes to existing code or ongoing work where you're around the whole time. There, the paper's conclusions transfer less well. Caveats: it's a benchmark, not a proven technique. The client in the tests was played by a model; a real person answers worse and more confusingly. A correct restatement doesn't guarantee working code.

Mini recipe

1. Ban code at the start: state outright that phase 1 is questions only, no writing code. 2. Name the mandatory topics: how the result is run, what goes in, what should come out. 3. Demand hypotheses: have the agent write "Here's how I understood it: ... Right?" instead of firing off bare questions. 4. Keep batches small: 3–5 questions at a time. More rounds, but less mess. 5. Ask about sharp corners: returns, cancellations, empty data, products with no sales. 6. Collect the restatement: the agent writes "CLARIFICATION COMPLETE" and lists 5–7 requirements in its own words. 7. Check and correct: find where it misunderstood. Only then give the "ok" for code. 8. Make yourself unavailable: in phase 2 there are no questions; the agent tests the result itself.

Examples

[BAD]: `Write a script that calculates margin per product from an Amazon report export` [GOOD]: `You are a freelance developer. I'm an Amazon store owner. Request: "A script that calculates margin per product from the export so I know what to cut from the catalog." The files are in /data. PHASE 1 (no writing code): study the files, ask questions in batches of 3–5. Be sure to clarify: how I run the script, what I feed in, what I want out. Offer interpretations ("Here's how I understood it: ... Right?"). Ask about returns, cancellations, and products with no sales. When you're ready, write "CLARIFICATION COMPLETE" and list 5–7 requirements in your own words. PHASE 2: implementation only after my "ok." After that I'm unavailable.` What you get: the agent won't dive straight into code. It'll ask how to calculate fees and what to do with returns. Then it sends a restatement, and you'll see where it misunderstood, for example "returns are subtracted from revenue, but I wanted them subtracted from profit."

In plain words

AI models fail spectacularly at building from scratch when the client hands over a murky spec. Here's how LLMs work: instead of stopping to ask, the model happily fills the gaps with hallucinations and, with a straight face, writes a ton of code that misses the target. The authors of SWE-Clar exposed the core problem of today's coding agents: they confidently build garbage because they confuse their own guesses with the client's actual requirements.

It's like hiring a contractor, telling him "make the living room look nice," and he silently coats every wall in toxic-pink gloss because that felt right to him. And if you try to explain something out loud, he'll nod, say "got it, boss," and still lay tile instead of hardwood. That's a catastrophic communication breakdown: the agent technically listens but filters the input through its own fantasies.

To measure this circus, they built the SWE-Clar benchmark on 100 real Upwork jobs. The setup is brutally strict: the agent gets a vague spec, asks the client clarifying questions, and then the context is frozen solid and two isolated branches are launched. The first checks the greenfield code with acceptance tests; the second tests understanding with control questions about the requirements. The result is sobering: even when the model is forced to ask the right questions, it still manages to misread the answers.

They tested on freelance work, but the same rake is lying around everywhere. You order a unit-economics script for your Amazon store, say "calculate the margin," and the model silently drops the platform fees, returns, and taxes, handing you a useless number. This applies to any business: until there's a strict spec-validation protocol, trusting agents like Claude Code with greenfield development is a pure lottery with negative expected value.

Bottom line: autonomous coders can't handle greenfield development yet if the project is more complex than a boilerplate script. Stop expecting telepathy: an incomplete spec guarantees failure. Either you obsessively spell out every detail for the agent, or it'll write perfect code for a parallel universe and leave you with an empty wallet and broken software.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on SWE-Clar: clarify requirements before coding, and test understanding with separate questions arXiv:2610.31854

Sign in to apply this study New accounts get 50 free credits.