Skip to main content

Smart Optimizer

The Smart Optimizer cuts wasted tokens from coding-agent sessions on your developers' machines. It compacts the output of commands and MCP tools before it reaches the model, and it can choose the model for each session. Your developers don't have to do anything.

Open Monitor > Tokens > Settings > Optimizer. The Willow Optimizer lever on the Optimize view opens the same place.

How it reaches devices​

The optimizer runs on the device, not in the gateway. When you turn it on, the scan agent installs optimizer hooks into each coding agent you selected on its next sync. The hooks fail open: if one fails, the agent's call goes through unchanged. When you turn the optimizer off, the scan agent removes the hooks.

The scan agent must be deployed on a device for the optimizer to reach it.

Turn it on​

  1. Turn on Enable Willow Optimizer. The other controls stay disabled until you do.
  2. Under Platforms, turn on each coding agent to optimize: Claude Code, OpenAI Codex, or Cursor. GitHub Copilot is listed as Not supported yet.
  3. Choose a Rollout scope. Everyone (org-wide) applies the optimizer to every device that reports to your organization.
  4. Set up the tool optimizer and smart model selection.
  5. Select Save Changes.

Nothing is rolled out until you save with Enable Willow Optimizer on. Changes apply on each device's next sync. The line above Save Changes shows the current state, for example The optimizer is off.

Tool optimizer​

The tool optimizer compacts command and tool results before they reach the model. Turn on Enable tool optimizer, then choose what it covers:

SwitchWhat it covers
Bash commandsCommon shell commands. The card shows how many are on, for example 12 of 13 commands optimized.
MCP toolsOutput from MCP tools. Every MCP tool is optimized until you list specific tools.

Select Customize to open the Tool Optimizer page:

  • Bash commands lists each command with its own switch: git status, git diff, git log, git add / commit / push, grep / rg, ls / tree, npm / jest / vitest test, cargo test, pytest, go test, ruff check, docker ps, and cat / read. Use Filter commands to find one, and Add to add a command.
  • MCP tools is empty by default, which optimizes every MCP tool. Once you add a tool, only the listed tools are optimized. Use Add, or pick tools from your MCP servers under Or pick from your MCPs.

Select Save Changes on that page. While the Willow Optimizer is off, the page shows a banner: nothing you set there applies until you turn it on.

Smart model selection​

Turn on Enable smart model selection to let Willow choose the model for each session. When it is off, every prompt runs on the model the user picked.

To cap what expensive models can spend instead, use model limits.