Imagine that a user asks an AI assistant for “a system that can quickly search through my documents.” A good engineer would ask questions first. What types of documents: text, images, or both? What do you want to search by: keywords, metadata, or full text? How fast is “quickly”: milliseconds or seconds?
Foundation models usually do not ask. They start to write code. Research shows that when a request needs clarification, models generate code instead of asking questions in more than 60% of cases. The result is software with the wrong features, rework, and sometimes failed projects. This problem becomes more important as AI agents build more software. In this project, we built AlignMind, a system that helps users refine their requirements through conversation before any code is written.
This post is based on our paper Towards Conversational Development Environments Using Theory-of-Mind and Multi-Agent Architectures for Requirements Refinement, written with Keheliya Gallaba, Ali Arabat, Mohammed Sayagh, and Ahmed Hassan. The paper has the full method, setup, and results.
Design
AlignMind is based on four ideas.
Several specialized agents
One model with one large prompt that tries to do everything does not work well. AlignMind divides the work between agents. A router agent sends each message to the correct agent. A requirement refiner agent asks clarifying questions. A workflow generator agent turns the final requirements into a plan. A workflow refiner agent lets the user change the plan. Theory-of-Mind helper agents give information about the user to the other agents.
Theory of Mind
Theory of Mind is the ability to understand what another person knows, wants, and feels. Good engineers use it all the time. They explain things differently to a beginner and to an expert, and they notice when a client is frustrated. AlignMind’s helpers estimate three things: the user’s expertise (novice, intermediate, or expert), the user’s feelings (positive, neutral, or negative), and how the user’s goal divides into smaller topics. The refiner agent uses this information to choose its questions and its tone.
Dividing the goal into topics
Large requests are divided into subtopics, and each subtopic gets specific questions. For a weather app, the subtopics can be user needs and goals, core features, weather data sources and APIs, technology stack, and deployment platforms. Each subtopic gets up to five clarifying questions. The agent moves to the next topic when it decides it has enough answers, or when it reaches the limit of five questions.
Iteration
AlignMind keeps the state of the conversation, so the requirements become more detailed over many rounds. When the requirements are clear, it writes a summary and a step-by-step workflow in natural language. The user can then change the workflow.
How we evaluated it
We compared AlignMind with a baseline foundation model in 150 scenarios. Three LLM judges scored the results.
- Quality. AlignMind had a median score of 10 out of 10. The baseline had 9.08. AlignMind was better in 81.33% of scenarios, and the difference was statistically significant for all three judges (p < 0.001).
- Detail. The requirements from AlignMind had a median of 266.5 content words. The baseline had 33. That is about 8 times more detail.
- Depth of conversation. AlignMind conversations had a median of 13 rounds. Baseline conversations had 4. The baseline often stopped before the important questions were asked.
- Grounding. Most cases had a perfect consistency score (5 out of 5). There was no significant difference in hallucination between AlignMind and the baseline. The longer requirements still came from what users actually said.
What engineers told us
We also asked six software engineers with 4 to 20 years of experience to use an early version of AlignMind. The feedback was mostly positive. One engineer said that it “helps you reflect on and reason about requirements.” Another said, “I wouldn’t have created such a detailed list myself.”
They also found problems. Some requirements were generic and felt like a template. Some questions repeated. The conversation sometimes followed a fixed pattern that did not fit the user. This feedback led us to add the Theory-of-Mind helpers, so that the questions fit each user better.
Beyond software
The same approach can help in other fields where people must state complex needs clearly. Examples are clinical requirements in healthcare, compliance needs in finance, and safety specifications in automotive engineering. The Theory-of-Mind modules can be replaced, so organizations can add modules with knowledge of their field.
Requirements are also not only text. Teams use conversations, diagrams, and documents. A future version should use multimodal models to include these inputs.
Takeaways
AI development tools should understand what users want before they build. AlignMind shows that a multi-agent system with Theory-of-Mind helpers can have deeper conversations and produce much more detailed requirements, without more hallucination. It uses more compute than a single model, but we think the large improvement in requirements is worth the cost. We see this as a step toward development environments that start with the user’s intent.
