# Reduce token usage in Pi

> Pi already does 2 of the fixes for you, and 2 settings cut more. Agent type: building my own agent. From Use Fewer Tokens, by StackOne.

Last checked: 30 Nov 2026, against the vendor's own pages.

## What Pi already does
- **Load tools when needed**: MCP tools default to codemode exposure, so scripts find them with searchTools() instead of every tool loading up front. ([source](https://github.com/earendil-works/pi/blob/4a080252f06caf63a525d7873c5d94d3c23887e0/packages/coding-agent/docs/mcp.md#L195), read 30 Nov 2026)
- **Let the agent run code over results**: MCP tools default to codemode exposure: the model calls them from one script instead of one call per tool. ([source](https://github.com/earendil-works/pi/blob/4a080252f06caf63a525d7873c5d94d3c23887e0/packages/coding-agent/docs/mcp.md#L195), read 30 Nov 2026)

## Settings that cut more in Pi
- **Clear old tool results**: /compact, and the compaction settings for automatic compaction. ([source](https://github.com/earendil-works/pi/blob/4a080252f06caf63a525d7873c5d94d3c23887e0/packages/coding-agent/docs/compaction.md), read 30 Nov 2026)
- **Read web pages as text**: npm i -g agent-browser, then add "run agent-browser skills get core and follow it" to AGENTS.md. ([source](https://github.com/vercel-labs/agent-browser), read 30 Nov 2026)

## With StackOne
- **Deep Query**: Data Sync on the list action, then list_tickets_s1query({ filter, source, aggs })
- **Load tools when needed**: Add https://mcp.stackone.com/mcp; Advanced Tool Search is on by default
- **Ask for fewer fields**: source on any _s1query call, listing only the fields the answer uses
- **Keep live questions live**: Keep the live action next to the _s1query tool
- **Tool Policies**: Tool Policies on the project

## Other techniques for your own agent
- [Turn off tools you don't use](https://usefewertokens.com/techniques/fewer-tools/): fits. Filter the tool list per step.
- [Prompt caching](https://usefewertokens.com/techniques/prompt-caching/): fits. cache_control on the Claude API; automatic on OpenAI.
- [Cap tool output](https://usefewertokens.com/techniques/output-caps/): fits. Reshape results with toModelOutput in the Vercel AI SDK.
- [Run side tasks on a smaller model](https://usefewertokens.com/techniques/smaller-subagents/): fits. Route side tasks to a smaller model.
- [Lower the effort setting](https://usefewertokens.com/techniques/effort/): fits. The effort parameter on the Claude API.
- [Batch scheduled jobs](https://usefewertokens.com/techniques/batch/): fits. Message Batches API, 50% off.
- [Keep instruction files short](https://usefewertokens.com/techniques/instruction-files/): partly. Keep the system prompt short.
- [Measure what fills the window](https://usefewertokens.com/techniques/audit-commands/): partly. Log input tokens per request.

## Links
- Optimizer set to Pi: https://usefewertokens.com/harnesses/pi/
- Pi on the MCP clients scorecard: https://mcpclients.dev/clients/pi/
- How to reduce AI agent token usage: https://www.stackone.com/blog/reduce-ai-agent-token-usage/
