Skip to content

Does a Command Use Fewer Tokens Than Asking the AI in Natural Language?

Jaime Marco · 2026-10-23

If an AI agent can do a task in two ways, by being asked in natural language or by running a script, the second usually spends fewer tokens and fails less. But "usually" is not "always", and understanding why helps you decide.

Where the Tokens Go

When you ask the model for something in natural language, the work goes through it: it reads, interprets, reasons and writes the result. All of that consumes tokens, and every intermediate step is a chance to make a mistake. When a script, a command or a hook does the work, the model only decides what to run and reads the result. The work itself is done by deterministic code, which costs next to nothing and always does the same thing.

A Clear Example: Moving Files

Moving a file from one system to another by reading it, interpreting it, holding it in memory and recreating it is expensive and fragile. In a PDF, losing a single character is enough to make the copy wrong, and on top of that you have spent tokens reproducing content you never needed to touch. With a tool that moves the file directly (for example, an MCP server for your file service), the model only gives the order. The cost is minimal and the result is exact.

Hooks and Commands

The same logic explains why a check like "you cannot commit if the tests fail" works better as a hook than as an instruction: the hook is code that runs before the command, does not depend on the model remembering, and spends no tokens interpreting anything. A custom command that chains several steps also reduces variability, because the steps are no longer reinterpreted every time.

When It Is Not That Simple

There are caveats. External tools also take up context: their definitions are loaded and their results are read. A badly written script that returns too much output can cost more than the original task. And there are tasks where interpretation is exactly what the model brings, such as deciding what to do with an unexpected result.

Nor is everything solved by choosing the most powerful model. For light, repetitive tasks, such as triaging tickets, a smaller model with good context is usually enough. Doing it well requires measuring and agreeing with the team, and it takes time.

Quick Summary

Whatever can run as deterministic code should run as code: it is cheaper, more precise and more repeatable. Keep natural language for what requires interpretation, watch how much context your tools take up and measure before optimizing.