# Reduce token usage in OpenCode

> OpenCode already does 3 of the fixes for you, and 4 settings cut more. Agent type: using a coding agent. From Use Fewer Tokens, by StackOne.

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

## What OpenCode already does
- **Load tools when needed**: With Code Mode on, which it is by default for MCP servers, the model finds tools with search() instead of loading them all. ([source](https://github.com/anomalyco/opencode/releases/tag/v2.3.1), read 30 Nov 2026)
- **Let the agent run code over results**: MCP servers run through Code Mode by default in OpenCode 2; "codemode": false on a server exposes its tools directly. ([source](https://opencode.ai/docs/mcp-servers/), read 30 Nov 2026)
- **Prompt caching**: OpenCode caches the stable part of the prompt itself.

## Settings that cut more in OpenCode
- **Turn off tools you don't use**: "disabled": true on an MCP server, or a deny permission for its tools. ([source](https://opencode.ai/docs/mcp-servers/), read 30 Nov 2026)
- **Clear old tool results**: compaction: { auto: true, keep: { tokens: 15000 } } in opencode.json. ([source](https://opencode.ai/docs/config/), 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)
- **Run side tasks on a smaller model**: A subagent with its own model. ([source](https://opencode.ai/docs/agents/), read 30 Nov 2026)

## With StackOne
- **Deep Query**: Add https://mcp.stackone.com/mcp, then ask in plain words
- **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
- **Keep live questions live**: Keep the live action next to the _s1query tool
- **Tool Policies**: Tool Policies on the project

## Other techniques for coding agents
- [Cap tool output](https://usefewertokens.com/techniques/output-caps/): fits. MAX_MCP_OUTPUT_TOKENS, tool_output_token_limit.
- [Keep instruction files short](https://usefewertokens.com/techniques/instruction-files/): fits. CLAUDE.md under 200 lines; Cursor rules under 500.
- [Measure what fills the window](https://usefewertokens.com/techniques/audit-commands/): fits. /context, /usage, /skill-doctor in Claude Code.
- [Lower the effort setting](https://usefewertokens.com/techniques/effort/): fits. /effort in Claude Code.
- [Prompt caching](https://usefewertokens.com/techniques/prompt-caching/): partly. The harness caches for you.
- [Batch scheduled jobs](https://usefewertokens.com/techniques/batch/): not available. Interactive.

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