Code mode cuts token usage by 99.66%: script beats tool calls on cost and accuracy
A developer tested two approaches for an AI agent to fetch and analyze Linear tickets: direct tool calls versus generating a short script. The tool-call method consumed roughly 65,500 tokens across 40 sequential round trips, while the script approach used only about 226 tokens in a single execution. Beyond the dramatic cost difference, the script also delivered more accurate results, since counting substrings across large text is something a model does approximately but code does exactly. The developer noted that latency was an equally significant advantage, as the script issued all HTTP requests without pausing for model decisions between each one. Motivated by the friction of re-entering credentials in existing code-mode tools, the developer built and published agent-codemode, an npm package that reuses OAuth tokens already stored by Claude Code.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in