TARS: A Theory-of-Mind Agent for Personalized In-IDE Code Comprehension

Software Engineering

Summary

The authors created TARS, a smart tool inside Visual Studio Code that helps programmers understand code better by giving explanations tailored to the user's knowledge and style. Instead of just generic answers, TARS adjusts how it explains things based on who is asking and links explanations to the actual code and project documents. When tested with 18 developers on Java code, TARS helped them finish their tasks faster and with less mental effort. The explanations felt more personalized and useful to the users.

Authors

Leopoldo Todisco, Antonio Della Porta, Stefano Lambiase, Fabio Palomba

Abstract

Code comprehension is one of the most time-consuming tasks in software engineering, yet most LLM-based assistants produce explanations that ignore who is asking and force developers into a disruptive copy-paste workflow. We present TARS, an LLM-powered agent integrated into Visual Studio Code that supports program comprehension through autonomous explanations anchored directly to the code under analysis. Built around a lightweight Theory of Mind paradigm, TARS profiles a developer's expertise, role, and stylistic preferences, then adapts the depth and tone of its explanations accordingly, grounding them in project documentation via Retrieval-Augmented Generation. To evaluate TARS, we conducted a controlled experiment with 18 participants on non-trivial Java snippets. Participants using TARS completed tasks 26\% faster, reported lower cognitive load, and found the explanations meaningfully adapted to their profiles.