NOTICKET Add CLI-vs-MCP token efficiency benchmark harness - #51
Draft
alexander-rykhlitskiap wants to merge 5 commits into
Draft
NOTICKET Add CLI-vs-MCP token efficiency benchmark harness#51alexander-rykhlitskiap wants to merge 5 commits into
alexander-rykhlitskiap wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
Kodem Security Scan Summary
Note: Kai marked all findings as likely false positives. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Andy asked in Slack whether we
have proof we can point to that the CLI helps users spend ~25% fewer tokens than MCP for
high-volume agent pipelines. We don't — so this adds the instrument that produces that number
instead of the number itself.
What
benchmarks/token-efficiency/— runs the same natural-language Apollo task through headless Claudetwice per case and reports the token delta:
cliarm — no MCP servers (--strict-mcp-configwith an empty server map), Bash plus theshipped
apollo-cliskill copied into the run's scratch cwd.mcparm — onlyapollo-work(https://mcp.apollo.io/mcp), Bash denied so it can'tshell out to the CLI and win on its behalf.
Everything else is pinned: same prompt, same model, same turn cap, a fresh
mkdtempcwd per run(no
CLAUDE.md, no project settings) and--settings '{}'so the operator's global settings,plugins and enabled MCP servers don't leak into either arm.
node benchmarks/token-efficiency/run.ts # Node >= 23.6Three cases, spanning the shapes that drive the difference:
single-enrichfiltered-searchchained-pipelineReports raw
totalTokens, a cost-weightedbillableEquivalent(cache reads at 0.1x, cache writesat 1.25x) and billed USD; median of N reps per arm; per-case percentages plus both an
equal-weighted mean and a pooled average, because those differ and the difference matters.
Results
Executed.
results/2026-08-21-sonnet-5.md—claude-sonnet-5, Claude Code 2.1.238, 3 reps/arm/case, medians:Equal-weighted mean +25.2%; pooled +48.8%. All 18 runs passed the completion gate.
The mean lands on the claimed "25% fewer tokens" almost exactly — but it is the average of +54%,
−40% and +61%, so no real workload is described by "about a quarter". The direction flips with
workload shape. The CLI wins where it can chain calls and
jq-project before results reach thecontext window.
On
filtered-search, a traced rep of each arm shows projection working as advertised — MCP put15,730 B into context vs the CLI's
jq-projected 2,401 B (55,022 B vs 9,419 B across all toolresults) — but it doesn't matter: every model call re-reads the whole conversation, so ~11k tokens
saved is ~2% of a 400k-token run while turn count is ~98%. And Apollo's
people searchreturns only11 fields per person (465 B each), so there was little fat to trim in the first place.
One finding worth separate attention: in this client version the ~90
apollo-worktools aredeferred behind
ToolSearch, not loaded up front — so the usual "MCP pays for every schema everysession" justification does not apply here. Any CLI advantage should be attributed to payload
projection and call chaining instead.
Two defects worth reviewing, because they produced confident wrong numbers
The first sweep reported +33.9% / −68.7% / −50.3% (mean −28.4%). Both causes are in the results doc:
"this will cost 10 credits, proceed?" — cheap, and not the task. Scored naively, bailing out
looks like efficiency. Both arms now get an identical pre-approval prompt suffix and every run
must pass
gradeComplete().costly cases.
Verification
benchmarks/sits outsidetsconfig.json'sinclude(src/**/*.ts) and outsidepackage.json'sfiles, so it is neither typechecked bynpm run typechecknor published. It has, however, now beenrun end to end 20+ times against the live API. Known rough edge:
num_turnsfrom the CLI isunreliable (one 2.75M-token run reported
num_turns: 1while returning a complete answer), so turncounts in the output are indicative only.