According to Microsoft Research, AI coding agents increasingly help developers fix bugs and implement features, but every model interaction consumes tokens. In typical sessions, agents send instructions, tool descriptions, and history to their models, often repeating inefficient patterns across repositories.

TokenEconomizer addresses this problem by converting completed sessions into guidance for subsequent tasks. The plugin was tested on Claude Code using 60 tasks from SWE-Bench, a benchmark containing real bug fixes from open-source Python projects. The researchers identified three recurring sources of waste: agents rediscovering how to run repository-specific tests, loading tools they never use, and repeatedly encountering the same errors across multiple attempts.

The plugin operates through three mechanisms. Micro-skills capture repository-specific knowledge as one-line notes added to the agent's starting context after multiple sessions confirm a pattern. Tool pruning removes tools unlikely to be needed while retaining core functions for commands and file editing. Failure-loop intervention detects when an agent encounters repeated failures and either suggests alternative approaches or alerts the developer.

Microsoft Research notes that while they tested three popular open-source plugins, each achieved cost savings in some repositories but not others, suggesting that effective cost control must adapt to individual code repositories rather than apply uniform strategies.

TokenEconomizer integrates with existing coding agents through their standard interfaces, allowing developers to use it alongside tools they already rely on. The plugin updates its repository knowledge after each session and revises its decisions as new evidence accumulates. The open-source nature enables community contribution and broader adoption.

Original sourceMicrosoft Research ↗

Read the original announcement for complete details and context.

Independent editorial summary based on the original announcement. Illustration is conceptual.

Back to all stories