# Stop Paying Your Agent to Relearn Your Repo _TokenEconomizer learns repo habits to cut agent costs 18.4-30.9% while holding accuracy steady._ **Published:** 2026-11-16 **Source:** https://www.startuphub.ai/ai-news/ai-research/2026/stop-paying-your-agent-to-relearn-your-repo --- Why do coding agents charge you to learn the same repo twice? [Microsoft Research](https://www.microsoft.com/en-us/research/blog/tokeneconomizer-learning-from-experience-to-make-ai-coding-agents-more-efficient/) says TokenEconomizer, an open-source plugin built with UC Berkeley and Microsoft Security, turns old sessions into savings on new ones. It lowered mean cost per task by 18.4 to 30.9% across five agent-model pairs on 277 real bug fixes, the team reports. A coding agent is software that reads code, runs shell commands and submits patches with little supervision. Each turn it resends tool definitions and chat history to the model, so tokens pile up fast. That bill repeats because teams run the same agent in the same repository every day. TokenEconomizer treats that repetition as training data instead of starting cold. Profiling showed the waste is predictable. Microsoft Research profiled [Claude Code](https://www.startuphub.ai/ai-news/artificial-intelligence/2026/anthropic-debuts-claude-opus-4-8) on 60 SWE-Bench tasks run in sequence. After five tasks in one repo, 30% of tool calls repeated an earlier action in that repo, versus 7% overlap across repos, the post says. It loaded 23 tool descriptions every turn while 16 went unused, and the 17% of tasks that failed ate 32% of spend, the post says. Fixed plugins helped in one repo and flopped in the next, so savings have to adapt per repo. Microsoft Research says TokenEconomizer reads each session log and updates three controls through the agent's existing interfaces. Micro-skills are one-line notes about recurring repo facts that enter context only after several confirmations and retire if contradicted. Tool pruning drops tools history marks as unlikely to be used but always keeps command execution and file editing, with restore on demand. Failure-loop intervention uses a judge model to spot a stuck agent, nudges it to try another path, and in the open plugin pings the developer if it stays stuck. On 277 SWE-Bench tasks across six repos, it saved money in all 30 repo and agent combinations with broadly stable success, the team reports. Pass@1 rose in four of five setups, cumulative costs fell below default by the sixth task in every repo, and savings are net of TokenEconomizer's own model calls, the team reports. The code is live at github.com/microsoft/TokenEconomizer, where per its GitHub page it promises cheaper runs in repos you use often without changing the agent. That promise held on Web-Bench with 16.0 to 21.2% lower cost and on security audits in new repos with 6.4 to 19.6% lower cost, the team reports. Cutting reasoning effort saved as much but hurt accuracy, while TokenEconomizer did not. Watch build budgets in monorepos first, where the sixth-task payoff arrives fastest. --- Original analysis from [startuphub.ai](https://www.startuphub.ai), the #1 AI startup directory. © StartupHub.ai. All rights reserved. You may not republish this article in full without a license. Search engines and AI research tools may crawl and summarize for reference. Bulk reproduction or model training on this content requires a license. See https://www.startuphub.ai/terms.