How we built TokenEconomizer into the VibeiDE Brain

The Economizer in VibeiDE is our own implementation of the published TokenEconomizer design from Microsoft Research, Microsoft Security and UC Berkeley, not the plugin itself. It makes no model calls, writes nothing into your repository and loads nothing while the Brain is off for a project. This page explains what we kept, what we changed and what we left out.

14-day trial. No card. Provider costs are separate.

An implementation of the design, not the plugin

TokenEconomizer ships as a Python plugin that writes into the repository and asks a model for some of its decisions. The Brain in VibeiDE has a stricter contract: no model call, no key, no Python, no file written into your repository and nothing loaded while a project is off. So we wrote the three mechanisms again inside VibeiDE, against the published design and its constants, and kept only what fits that contract. Nothing from the plugin is bundled, installed or run.

Two ways to read a tool call

The Economizer has to see what an agent ran and what came back. For Claude Code in a terminal it reads Claude Code’s own hooks, answered before Claude reads the tool result. For Codex, and for Claude Code when it runs without hooks, it reads the event stream VibeiDE already keeps for Task Activity. Both become one shape: the tool, the command, the paths, the output and whether it failed. Output is clipped, read once and never stored.

Facts are fixed sentences, because commands are untrusted

A fact is given to every later task, and it comes from commands an agent typed and output a repository printed. So the Economizer never keeps free text. A fact is one of four fixed sentences with checked parameters: a short command form in plain words, a tool name, a host name or a variable name. The value of a variable is named only when it is short and plain and its name does not look sensitive. Anything else gives no fact.

When a fact is kept, given and retired

We use TokenEconomizer’s lifecycle. A candidate becomes a fact after three tasks confirm it. It is given only while the waste it prevents shows up in at least 40 percent of at least four tasks that touched it. A score that favours recent tasks retires it, for example when the old spelling of a command works again in two tasks in a row.

A loop guard without a judge model

The plugin asks a model whether a flagged turn is really stuck. The Brain has no model to ask, so the guard runs the design’s conservative preset: it waits until seven turns have ended well in the project and never acts inside the length a good turn normally runs. A turn counts as stuck only when it ran long, keeps editing the same files, errors are dense and the same failure repeats.

The redirect travels in Claude Code’s own hook answer

The note reaches Claude Code as additional context in the answer to its own tool hook, attached to that tool result and read in the same turn. It repeats the agent’s own counts back, says it is automated and carries no outside knowledge. Codex has no such channel in VibeiDE: the only way into a running Codex turn is a steer, which would read as your words. So a stuck Codex turn gets only the line for you.

What we left out, and how we checked it

We did not build pruning of Claude Code’s built-in tools or Codex capability packages, and tools you installed yourself are not ours to remove. Only the two tool servers VibeiDE attaches are candidates. We checked the whole path with real Claude Code and Codex on an isolated copy of the app: a fact formed over four tasks, and the next task received it and ran the working command directly. We state no size of saving.

Sources: TokenEconomizer on GitHub, TokenEconomizer paper.

Necessary cookies support sign-in, security, your language and this choice. Optional categories stay off until accepted.

First-party page views and acquisition measurement, plus Google Analytics 4 (Google Ireland, data may reach the US). Advertising personalization stays off.

With Analytics enabled, retain Google, Microsoft and Reddit ad click identifiers and share download, signup, activation and purchase conversions with the relevant ad provider. No personalized advertising.

Privacy · Cookie inventory