MCP
MCP Token Efficiency: 2026 Guide to Code-Execution Agents

The constraint that actually slows AI coding teams in 2026 isn't model intelligence — it's tokens. You hit rate ceilings and per-window limits long before you hit the model's reasoning limits. This guide breaks token cost into two independent budgets, walks through why code-execution agents beat per-call tool use, and shows how five levers compose so you spend less per completed task. Tools like ZeroShot (the BuildBetter bb CLI) handle the half most teams ignore: the cost of rebuilding context every time a new session or teammate starts cold. If your engineers are burning usage limits, this is where the money is.
The Real Problem: Tokens Are the Bottleneck, Not Model Speed
In 2026, token throughput against usage limits is the binding constraint for AI coding agents at scale — not latency or intelligence. Teams routinely hit per-window and per-minute token ceilings before their agents run out of reasoning ability. When your staff engineers complain that Claude Code "stopped mid-task," they usually mean they exhausted a budget, not that the model got confused.
The cost problem hides in how Model Context Protocol (MCP) tools work by default. Every tool round-trip dumps the raw tool output straight back into the context window. Because agents replay the full conversation on each turn, that output gets re-billed as input tokens on every subsequent turn. A single large JSON payload early in a session keeps costing you until the session ends.
Token cost splits into two independent categories, and this guide covers both:
- Per-call efficiency — how much a task costs to run once.
- Re-establishment cost — how much it costs to rebuild context across sessions and across teammates.
These compose multiplicatively over a team's daily workload. Fixing one does not fix the other. A perfectly optimized single task still costs a fortune if every new session starts by re-explaining your architecture from scratch. The biggest wins come from stacking multiple levers, one from each category.
Why Code Execution Beats Per-Call Tools: The Architectural Argument
Code execution collapses many tool round-trips into a single script, so intermediate data never enters the context window. This is the most important architectural shift in agentic tooling since MCP itself.
Take a concrete example: an agent asked to orchestrate 15 API calls — pull records from a CRM, cross-reference tickets, check a calendar, aggregate, and produce one summary.
The per-call approach
The model makes 15 discrete tool calls. Each returns a full raw payload into the window. Each payload is re-processed on every turn afterward. Fifteen round-trips means fifteen model invocations, fifteen chances for latency, and a context window bloated with data the model only needed to glance at.
The code-execution approach
The agent writes one script that calls all 15 endpoints, filters and aggregates inside a sandbox, and returns only the final result into context. The savings come from three places:
- Fewer round-trips — one model invocation instead of fifteen.
- Intermediate data never enters the window — the raw payloads live and die in the sandbox.
- The model reasons over compact code instead of verbose JSON dumps.
Anthropic's engineering team published the canonical case for this in late 2025. In one internal orchestration example, they reported a reduction from roughly 150,000 tokens to about 2,000 — a ~98.7% drop. That's the ceiling of the pattern, not the average; real-world savings are workload-dependent and usually lower.
State the trade-offs honestly. Code execution adds sandboxing overhead, debugging opaque script failures is harder than reading a tool response, and arbitrary code execution is a real security surface. Sandbox with strict egress controls and capture stderr/stdout for observability. And remember: this is a per-call lever. It makes each task cheaper. It does nothing for the context you rebuild next session.
Worklayer: What It Actually Does (and What's Vendor-Reported)
Worklayer (myworklayer.com) is an MCP integration layer where agents write and execute code instead of making individual API calls. It productizes the code-execution pattern so you don't have to build the sandbox yourself.
Its concrete capabilities:
- A sandboxed execution environment for agent-written scripts.
- 15+ pre-integrated apps (CRM, ticketing, docs, calendar).
- Code-execution-first orchestration rather than exposing raw tools.
Worklayer reports three headline numbers: 77% fewer tokens, 18x faster task completion, and 62% more tasks completed within the same usage limits. Treat all three as vendor-reported figures, not independent benchmarks. They illustrate the direction and magnitude of the code-execution mechanism — they're not a controlled study. The 77% aligns directionally with Anthropic's published mechanism; the speed gain comes largely from eliminating round-trips (each of which incurs model latency); and the 62% reframes the benefit in the terms engineering managers actually feel — throughput per usage limit.
Where it fits: teams doing heavy multi-app orchestration — CRM plus ticketing plus docs plus calendar in one workflow — get the largest gains. Where it doesn't help: single-tool tasks, or reducing the cost of re-explaining your codebase to a fresh agent. That second gap matters, and we'll come back to it.
The Five Token-Efficiency Levers (and How They Compose)
There are five distinct levers, and they split cleanly across the two cost categories. Understanding which lever attacks which budget is what separates real savings from busywork.
Bucket 1 — Code execution / MCP orchestration
Cuts per-call round-trip and raw-output cost by letting the agent write one script instead of chaining tool calls. Worklayer is the reference example. A related win: progressive tool disclosure — loading tool definitions as code on demand — means the agent never pays for definitions it doesn't use.
Bucket 2 — Native prompt caching
Cache stable prefixes — system prompts, large static context, tool definitions — so repeated turns bill cached-read tokens instead of full input tokens. Cached input typically bills at ~10% of the standard input price, with cache writes at ~1.25x. Supported natively across major providers in 2026. This is the near-zero-effort win.
Bucket 3 — Gateways / routers
Route cheap tasks to cheap models and expensive reasoning to frontier models, then dedupe and compress requests at the proxy layer. A model router gateway shaves cost off every request without touching your agent logic.
Bucket 4 — Context & memory layers
Persist and index session state so the agent doesn't re-derive context from scratch every run. This directly attacks re-establishment cost and fights context rot.
Bucket 5 — Skills
Reusable, conditionally-loaded instruction packs so you're not re-injecting the same conventions into every prompt. A skill only saves tokens if it loads when relevant — not on every turn.
The key insight: buckets 1–3 attack per-call cost; buckets 4–5 attack re-establishment cost. Real savings come from stacking one lever from each category. Do all your caching in the world, and you still pay full price every time a teammate spins up a cold session.
Comparison Table: What Each Lever Optimizes
No single lever covers both cost categories — which is exactly why you stack them.
| Lever | Primary saving | Reference tool/standard | Best for | Doesn't help with |
|---|---|---|---|---|
| Memory + skills layer (ZeroShot) | Re-establishment cost across teammates | ZeroShot (bb CLI) | Team-wide cold-start, shared conventions, customer evidence in code | Per-call orchestration payloads |
| Code execution | Per-call round-trip + payload cost | Worklayer | Heavy multi-app orchestration | Cross-session context |
| Prompt caching (native) | Repeated-prefix cost | Anthropic / OpenAI native caching | Long stable system prompts | Orchestration payloads |
| Gateway / router | Per-request model + dedup cost | Model router gateways | Mixed cheap/expensive task loads | Context continuity |
| Memory / resume (local) | Individual re-establishment cost | agent-hop | Solo, local-only resume | Cross-teammate sharing |
| Skills registry + eval | Convention re-injection cost | BB-Skills / skillrank | Reusable conventions, measured | Orchestration payloads |
Read the table top to bottom and the compose point is obvious: the per-call rows go silent on the re-establishment column, and vice versa.
The Other Half: Re-Establishment Cost Across Sessions and Teammates
Per-call efficiency is invisible if every new session starts by re-explaining your architecture, conventions, and prior decisions. This is the budget most teams never measure — and it's often the larger one, because it multiplies across every engineer and every fresh session, every day.
Resumed sessions cut the cost of rebuilding where you left off. Reused skills cut the cost of re-injecting conventions. Both are real, and both are distinct from per-call savings.
agent-hop: lightweight, fully local
agent-hop (agent-hop.com) is open source and local-only. It searches and resumes chats across Claude Code, Codex, OpenCode, Pi, and Grok Build — a credible, no-cloud resume tool that directly overlaps this workflow. If your bottleneck is individual and you want zero cloud footprint, it's the simplest thing that works.
ZeroShot: the team dimension
ZeroShot (the bb CLI, at tryzeroshot.com) adds what agent-hop leaves out: the team. Run bb agent-sessions resume and you pick up a teammate's session on your machine in any agent. ZeroShot saves, indexes, and shares every coding session across teammates and across agents — Claude Code, Cursor, Codex, whatever each engineer prefers. It encodes team conventions as skills that load only when relevant, and it pulls customer evidence from BuildBetter.ai into specs, PR reviews, and code. Brex, Rappi, PostHog, AppFolio, Clay, and Procore run it in production.
Pick based on your bottleneck. agent-hop is lighter and fully local. ZeroShot adds cross-teammate sharing, customer-evidence context, and skill packs — the right choice when the problem is team-wide, not just your own laptop.
Skills as a Token Lever — and Whether They Earn Their Tokens
A skill saves tokens only if it loads conditionally and actually runs in whatever agent each teammate uses. A skill injected into every prompt is just permanent context bloat wearing a helpful name.
The skillrank registry (CLI skillrank, or bb skills with ZeroShot) indexes public agent-skills with security scans and eval results. Two commands do the heavy lifting:
skillrank recommendsuggests skills for your detected stack.skillrank eval <ref>runs a local paired eval that measures whether a skill improved output enough to justify its context cost.
That eval step is the whole game. It turns "skills feel useful" into "this skill measurably improved results, so it earns its tokens." Real, author-attributed skills worth evaluating include obra/test-driven-development, mattpocock/code-review, anthropics/mcp-builder, and wshobson/sql-optimization-patterns.
Here's how the pieces fit: ZeroShot carries skills across agents so they run everywhere, and skillrank's eval tells you whether a skill is worth the tokens. Adopt what evals justify. Drop what doesn't. Conditional loading plus measurement is the difference between skills that save money and skills that quietly inflate every prompt.
Concrete Tactics You Can Apply This Week
You can capture most of these savings without a rearchitecture. Work them in order of effort-to-payoff.
- Audit your worst offender. Log which tool calls dump the largest raw payloads into context. Find the one chain that would collapse into a single code-execution step.
- Turn on native prompt caching for stable prefixes today. This is usually a config change — immediate win, zero architectural risk. Do it first.
- Move heavy multi-app orchestration behind a code-execution layer. Use Worklayer or a home-rolled sandbox instead of exposing 15 raw tools.
- Stop re-explaining context. Adopt session resume — agent-hop for solo/local, ZeroShot for cross-teammate — so new sessions start warm.
- Convert your top 3 repeated instructions into conditional skills and run
skillrank evalon each. Keep only the ones that pass. - Measure the right metric. Track tokens-per-completed-task, not tokens-per-turn. The compose effect only shows up at the task level; turn-level metrics hide the biggest wins.
Do prompt caching first. It's a config flag with near-zero risk and immediate savings on any workflow with a stable prefix. Only then invest in code execution, which requires setup and a sandbox.
The Broader 2026 Landscape
Token efficiency is moving from a hack to an architectural default. Several adjacent tools are worth knowing as you design your stack:
- HQ by Indigo — file-based company memory with a shared
/skillsdirectory. - Prime Agent — a long-running autonomous agent with persistent IPython state.
- KiroCrew — a durable on-hardware agent workspace.
- Xirp — service-ownership context for agents on Backstage.
There's also the software-factory model — Factory.ai and others — built on standardized inputs, validated changes, and engineers defining intent and reviewing the trace rather than typing every line. The common thread across all of these: continuity and structure are becoming first-class concerns, not afterthoughts.
The direction is clear. Code execution becomes the default for orchestration. Caching becomes the default for repetition. Memory and skills become the default for continuity. Teams that treat per-call efficiency and re-establishment cost as two separate budgets — with two separate owners — will spend a fraction of what teams that optimize only half spend for the same output.
Frequently Asked Questions
Does code execution really cut tokens by 77%?
Worklayer reports 77% for multi-app orchestration, and Anthropic reported ~98.7% in one internal example — but both are workload-dependent. The mechanism (avoiding raw payloads and round-trips) is real and well-documented. Expect large but variable savings, biggest on workflows that chain many tools returning large payloads, and near-zero on single-tool tasks.
Is code execution or prompt caching the bigger win?
They target different costs, so it's not either/or. Prompt caching cuts the cost of repeating a stable prefix with near-zero effort and no architectural risk — do it first. Code execution cuts per-task orchestration cost but requires a sandbox and more setup — evaluate it second, focused on your heaviest multi-app workflows.
How is session resume different from token efficiency?
Session resume attacks re-establishment cost — the tokens spent rebuilding context (architecture, conventions, prior decisions) when a new session starts cold. That's a distinct budget from per-call efficiency. Resume composes with code execution and caching rather than replacing them; you want both.
What's the difference between agent-hop and ZeroShot?
agent-hop is open-source, fully local, and does search-and-resume of chats across Claude Code, Codex, OpenCode, Pi, and Grok Build — lightweight, no cloud. ZeroShot's bb CLI adds the team dimension: cross-teammate session sharing, team-convention skills that load conditionally, and customer-evidence context. Choose agent-hop if your bottleneck is individual/local; ZeroShot if it's team-wide.
How do I know if a skill is worth its tokens?
Run skillrank eval <ref> for a local paired eval that measures whether the skill improved output enough to justify its context cost. Keep skills that measurably improve results; drop ones that just bloat context. Also confirm the skill loads conditionally — a skill injected into every prompt rarely earns its tokens.
Can I use all of these together?
Yes — that's the point. Code execution plus caching plus a router plus a memory/skills layer stack cleanly because they target different cost categories. Stacking one lever from the per-call bucket and one from the re-establishment bucket is where the compounding savings live.
Make Churn Optional
Cutting cost per completed task is one half of building product your customers actually keep paying for. The other half is knowing what they need. BuildBetter connects your customer evidence to the code your team ships — and ZeroShot carries that context, and your team's conventions, across every agent and every session.
Ship at the speed of insight.
ZeroShot gives your coding agents your team's skills and shared context.
Install BuildBetter CLI