Recent advances in coding agents have made them capable of planning, editing, running, and testing complex code bases. Despite their growing ability in coding tasks, these systems still struggle to infer and track user intent, especially when instructions are underspecified or context-dependent. To bridge this gap, we introduce ToM-SWE, a dual-agent architecture that pairs a primary software-engineering (SWE) agent with a lightweight theory-of-mind (ToM) partner agent dedicated to modeling the user's mental state. The ToM agent infers user goals, constraints, and preferences from instructions and interaction history, maintains a \textbf{persistent memory} of the user, and provides user-related suggestions to the SWE agent. In two software engineering benchmarks (ambiguous SWE-bench and stateful SWE-bench), ToM-SWE improves task success rates and user satisfaction. Notably, on the stateful SWE benchmark, a newly introduced evaluation that provides agents with a user simulator along with previous interaction histories, ToM-SWE achieves a substantially higher task success rate of 59.7\% compared to 18.1\% for OpenHands, a state-of-the-art SWE agent. Furthermore, in a three-week study with professional developers using ToM-SWE in their daily work, participants found it useful 86\% of the time, underscoring the value of stateful user modeling for practical coding agents.
翻译:近年来,编码智能体在规划、编辑、运行和测试复杂代码库方面取得了显著进展。尽管这些系统在编码任务中的能力不断增强,但在推断和追踪用户意图方面仍存在困难,尤其是在指令描述不充分或依赖上下文的情况下。为弥补这一差距,我们提出了ToM-SWE——一种双智能体架构,它将一个主软件工程(SWE)智能体与一个轻量级的心理理论(ToM)伙伴智能体相结合,后者专门用于建模用户的心理状态。ToM智能体从指令和交互历史中推断用户目标、约束和偏好,维护用户的**持久记忆**,并向SWE智能体提供与用户相关的建议。在两个软件工程基准测试(模糊SWE-bench和状态化SWE-bench)中,ToM-SWE提高了任务成功率和用户满意度。值得注意的是,在状态化SWE基准测试(一项新引入的评估,为智能体提供用户模拟器及先前的交互历史)中,ToM-SWE实现了59.7%的显著更高的任务成功率,而当前最先进的SWE智能体OpenHands仅为18.1%。此外,在一项为期三周的专业开发者日常工作中使用ToM-SWE的研究中,参与者认为其86%的情况下是有用的,这凸显了状态化用户建模对于实用编码智能体的价值。