BrainBox: Local Behavioral Memory for Coding Agents
Description
A coding agent that returns to a familiar repository usually arrives as a stranger. It searches for files it opened yesterday and replays tool sequences it has run a hundred times. BrainBox is a local memory that learns these habits from the agent's own activity. It records which files, tools and errors occur together and strengthens directed associations through repetition. It then recalls likely files by fusing query matches with associative, temporal and frequency evidence, and a short sequence model predicts the next tool. Memory lives in SQLite on the developer's machine, and neither learning nor recall calls a language model.
This second version replaces the first paper's estimated token savings with a replay evaluation on recorded agent trajectories. Each task is scored using only memory built from earlier tasks, against recency, frequency, BM25, co-occurrence and random baselines. On 40 tasks from two held-out SWE-rebench repositories, next-tool prediction reaches an MRR@3 of 0.767 against 0.748 for the strongest baseline (paired 95% interval for the difference: +0.012 to +0.027). On 97 local sessions it scores 0.686 against 0.662 (+0.010 to +0.036). File retrieval is more modest. Next-file prediction is level with recency, and on local sessions plain frequency ranks edited files better than BrainBox. Every score is conditioned on targets that memory could have seen, and only 17% of public next-file targets qualify. The evidence supports a precise claim: from an agent's own history, BrainBox reliably predicts the next tool and ranks familiar files about as well as the best simple heuristics. Whether that makes real tasks shorter remains to be measured.
Files
brainbox.pdf
Additional details
Related works
- Is supplemented by
- Software: https://github.com/thebasedcapital/brainbox (URL)