SIAgentNews.com
← All news

New open-source plugin cuts AI coding costs by up to 30 percent

TokenEconomizer helps AI coding agents learn from past sessions to avoid repeating mistakes and wasting expensive tokens.

· First reported by microsoft.com

Claymation: picture for the story 'New open-source plugin cuts AI coding costs by up to 30 percent'
AI-made claymation for this story. No real people or products are shown.
18.4–30.9%reduction in AI coding costs

The short version

  • TokenEconomizer reduced costs by 18.4–30.9% across 277 real bug-fixing tasks.
  • It identifies and captures recurring patterns as 'micro-skills' to avoid repeating actions.
  • The tool prunes unused tool descriptions from the agent's context to save on token usage.
  • A judge model detects when an agent is stuck in a failure loop and suggests a new approach.
  • The plugin is open-source and keeps all learned data locally on the developer's machine.

Why it matters

For developers using AI to write code, this means lower bills and faster results as the AI gets 'smarter' about specific projects. It proves that making AI more efficient doesn't require retraining massive models, but rather better management of the information they use.

The problem of repetitive AI work

Developers frequently use AI coding agents to work on the same codebases day after day. However, these agents often start every new session from scratch, which leads to significant inefficiencies. They frequently rediscover familiar facts, load tools that are never actually used, and repeat unsuccessful attempts at fixing the same errors.

Every interaction with a large language model costs money because it consumes tokens. In a coding context, the agent must send instructions, tool descriptions, and the history of the current session to the model. When an agent lacks memory of previous work, it wastes these tokens by repeating the same mistakes over and over again.

Research by Microsoft and UC Berkeley highlighted that these wastes are common. For example, in one study, 30% of tool calls in a repository repeated an action from an earlier task. Furthermore, agents were often provided with 23 tool descriptions even though 16 of them were never actually called during the task.

How TokenEconomizer works

TokenEconomizer is an open-source plugin designed to turn completed sessions into guidance for future ones. It acts as a lightweight controller that sits alongside an existing coding agent. It does not require any modifications to the underlying AI model or the agent itself, making it compatible with many different setups.

The plugin uses three specific mechanisms to save costs. First, it identifies 'micro-skills,' which are one-line notes capturing repository-specific knowledge. These notes are only added to the agent's starting context after several sessions confirm the pattern is reliable. If new evidence contradicts a note, the plugin retires it.

Second, it performs tool pruning by removing descriptions of tools that the history suggests the agent is unlikely to use. It always keeps core tools for editing files or running commands. Third, it uses a judge model to watch for failure loops. If the agent gets stuck, the judge model suggests a different approach to prevent the agent from wasting tokens on a dead end.

Testing and performance results

The researchers evaluated the plugin on 277 tasks from the SWE-Bench, which consists of real bug fixes in open-source Python projects. They tested five different combinations of AI coding agents and models. The results showed that TokenEconomizer lowered the average cost per task by 18.4–30.9% across all combinations tested.

The study found that these savings occurred in every repository tested without causing a loss in performance. In some cases, the success rate actually increased. While reducing the model's reasoning effort could also save money, that method led to substantial performance degradation, unlike the experience-driven approach of the plugin.

The savings also scaled as the agent gained more experience. While early tasks might cost more as the system learns, the cumulative costs fell below the default levels by the sixth task in every repository. The researchers also saw similar cost reductions in sequential web development and security auditing tasks.

Privacy and future impact

Because TokenEconomizer is designed as a plugin, it offers several advantages for private development. It does not require its own API key to function, and it keeps all the information it learns on the developer's local machine. This allows teams to benefit from experience-driven efficiency without sending sensitive repository history to a third-party service for training.

The project opens a path toward coding agents that learn how to spend computation more effectively. By focusing on how agents manage their context and tools, developers can create systems that become more resourceful over time. This approach suggests that experience can improve efficiency without the need for expensive model retraining.

The researchers have released the code as an open-source project for the community to explore. They invite developers and researchers to use it as a starting point for building agents that adapt their behavior based on past work. This could lead to a new standard for how AI tools interact with long-term software projects.

What to watch

  • How other AI tools will adopt 'micro-skills' for non-coding tasks.
  • Whether the 'judge model' approach becomes a standard for preventing AI loops.

Try it

Check out the TokenEconomizer project on GitHub to see how it integrates with your existing AI coding tools.

Sources and links

First reported by microsoft.com. Written by the SI Agent News Desk from the reporting above.Written with AI from the source above. Every number is checked against the source. Spot a mistake? Corrections.

Liked it? Say why

Add a line for other readers.

No account needed. We never show your email. Comments with links, ads or abuse are held and not shown. Your comment shows after a quick check.

More AI news