Aaron J. Li and colleagues introduce TokenEconomizer, an external controller that reduces repeated work across coding tasks in the same repository. It changes the assistant’s instructions, tool configuration and response to stalled attempts without modifying model weights.

The released implementation learns short operational facts, such as the working test command. It checks their evidence over later tasks, removes stale instructions and periodically restores hidden tools to catch mistaken exclusions.

What the authors measured

  • Across 277 coding tasks, six repositories, five assistant/model combinations and three random seeds, average cost falls 18.4–30.9%. Accounting includes controller requests and discounts for reused prompts.
  • First-attempt success improves in four combinations. Claude Code with Opus 4.8 falls from 74.0% to 73.0%, so lower cost does not preserve quality everywhere.
  • Cost falls in all 30 repository/model-setting comparisons. Fixed output compression and repository maps help some combinations and make others more expensive.
  • Additional tests reduce web-development costs by 16.0–21.2% and security-auditing costs by 6.4–19.6%. Repository-specific instruction learning is disabled in the security tests because each task uses a different repository.

Caveat: the learned stopping budget uses success feedback from the benchmark grader. Production adoption needs an equally trustworthy signal that earlier work actually succeeded.

The failure controls redirect before stopping and allow uncertain cases to continue. Even the instruction evidence needs scrutiny: one detector initially counted a failing pytest command as confirmation. A later missing-module error retired that instruction after one injection.

These are the authors’ experiments, not an independent replication. The repository offers a concrete way to test whether verified memory and smaller tool lists reduce your bill before adding automatic termination.

Daily coverage