Command Code vs Claude Code: The Read Tool That Saves Billions of Tokens

Command Code vs Claude Code: The Read Tool That Saves Billions of Tokens

Command Code 对决 Claude Code:节省数十亿 Token 的读取工具

On August 9, 2026, Ahmad Awais shared a deep dive on X about the read tool in Command Code, his coding agent. The claim is big: the read tool saves billions of tokens a month compared to Claude Code. The full post now lives in the Command Code docs. This article is my summary of that post, written in simple English. If you build agents, or just use them, the lessons are useful.

2026 年 8 月 9 日,Ahmad Awais 在 X 上分享了一篇关于其编码智能体 Command Code 中“读取工具(read tool)”的深度解析。他提出了一个重磅观点:与 Claude Code 相比,该读取工具每月可节省数十亿个 Token。完整文章现已收录在 Command Code 的文档中。本文是我对该文章的简明总结。无论你是智能体开发者还是使用者,这些经验都非常实用。

Why a read tool matters: Coding agents read files all the time. Every edit starts with a read. Every search result becomes a read. A plan step opens three files. Command Code sees about 50 million reads a month. Each read costs tokens. If one read brings in 500 useless tokens, that is 25 billion useless tokens a month. Worse, those tokens stay in the conversation, and they cost tokens again on every later turn. That is why coding agents feel expensive. The bill is mostly reads, not clever reasoning. Think of the read tool as a compiler. It turns your files into the model’s context. Every small choice inside it is a token decision, repeated millions of times.

为什么读取工具如此重要?编码智能体时刻都在读取文件。每一次编辑都始于读取,每一次搜索结果也转化为读取,执行一个计划步骤可能需要打开三个文件。Command Code 每月大约处理 5000 万次读取。每次读取都会消耗 Token。如果一次读取引入了 500 个无用 Token,那么每月就是 250 亿个无用 Token。更糟糕的是,这些 Token 会留在对话上下文中,并在后续的每一轮对话中重复计费。这就是为什么编码智能体显得如此昂贵——账单的大头在于读取,而非复杂的推理。可以将读取工具视为编译器,它将你的文件转化为模型的上下文。其中的每一个微小选择都是一个 Token 决策,并会被重复数百万次。

The difference: spend more vs spend less. Claude Code’s read tool is simple. Ask it to read a 3,000-line file, and it returns all 3,000 lines. Ask for a file with a 3,900-character minified line, and it returns the whole line. No limits at all. That works for Claude Code because its models are strong enough to ignore the noise. It spends more tokens to succeed. Command Code runs on open models. Those models cannot handle a messy read. Users also pay for every token. So Command Code had to spend less. That one constraint forced every design decision below.

区别在于:多花钱还是少花钱。Claude Code 的读取工具很简单。让它读取一个 3000 行的文件,它就返回全部 3000 行;让它读取一行 3900 个字符的压缩代码,它也返回整行。没有任何限制。这对 Claude Code 来说行得通,因为它的模型足够强大,可以忽略这些噪音。它通过消耗更多 Token 来换取成功。而 Command Code 运行在开源模型上,这些模型无法处理混乱的读取内容。同时,用户需要为每一个 Token 付费,因此 Command Code 必须节省开支。这一约束促成了下文提到的所有设计决策。

What Command Code’s read tool does differently: Three limits, not one. 2,000 lines per file, 128 KB per read, 2,000 characters per line. Each limit stops one kind of bad file: big files, wide files, and minified one-line files.

Command Code 的读取工具做了哪些改进? 设置三重限制而非单一限制:每个文件最多 2000 行,每次读取最多 128 KB,每行最多 2000 个字符。每一项限制都能拦截一种“糟糕文件”:超大文件、超宽文件以及压缩后的单行文件。

Clear messages instead of silence. If a file is empty, it says “file is empty”. If the read goes past the end, it says “try a smaller offset”. The model knows what happened and what to do next, so it stops guessing and retrying.

提供清晰的反馈而非沉默。如果文件为空,它会提示“文件为空”;如果读取超出范围,它会提示“尝试更小的偏移量”。模型能够明确发生了什么以及下一步该做什么,从而避免了盲目猜测和重复尝试。

Auto-retry for tricky filenames. macOS names screenshots with special characters that look normal but are not. The tool retries 7 versions of the name before giving up.

针对复杂文件名的自动重试。macOS 截图的文件名包含看起来正常但实际特殊的字符。该工具在放弃前会尝试 7 种不同的文件名变体。

“Did you mean?” for typos. If a file is not found, it suggests close matches. This catches mistakes like AGENT.md vs AGENTS.md.

针对拼写错误的“您是指……吗?”功能。如果找不到文件,它会建议相似的文件名。这能有效纠正诸如 AGENT.md 和 AGENTS.md 之间的混淆。

Refuses dangerous files. It will not read /dev/zero or /dev/urandom. These files never end, so reading them would hang the agent forever.

拒绝读取危险文件。它不会读取 /dev/zero 或 /dev/urandom。这些文件永无止境,读取它们会导致智能体永久卡死。

Caches that expire on use. If the same file is read twice, the second read returns a short note. But the note removes itself after one use, so the model never points at old context forever.

使用即过期的缓存。如果同一个文件被读取两次,第二次读取会返回一条简短的注释。但该注释在使用一次后会自动移除,确保模型不会永远指向过时的上下文。

Images are compressed, not dropped. A 4K screenshot is compressed step by step until it fits. The tool also tells the model the new size, so clicks on the image still point to the right place.

压缩图片而非丢弃。4K 截图会被逐步压缩直到符合要求。该工具还会告知模型新的尺寸,确保对图片的点击依然能定位到正确位置。

Notebooks become clean documents. Raw .ipynb files are messy JSON. The tool returns labeled cells and attaches plots as images, so one big table cannot eat the whole read budget.

将 Notebook 转化为整洁文档。原始的 .ipynb 文件是混乱的 JSON。该工具会返回带有标签的单元格,并将图表作为图片附加,防止一个巨大的表格耗尽整个读取预算。

The benchmark: Command Code compared its read tool with nine other harnesses: Claude Code, OpenCode, Cline, Kilo, Codex, Grok, Hermes, pi, and OpenClaw. Most have the basic limits. Very few have the extras: retrying filenames, clear recovery messages, or blocking dangerous files. Those extras do not show up in a demo. They matter in hour nine of a long session, when a read fails and the model needs a way back.

基准测试:Command Code 将其读取工具与其他九种工具进行了对比:Claude Code、OpenCode、Cline、Kilo、Codex、Grok、Hermes、pi 和 OpenClaw。大多数工具只有基础限制,极少数具备额外功能:如文件名重试、清晰的恢复消息或拦截危险文件。这些额外功能在演示中看不出来,但在长会话的第九个小时,当读取失败且模型需要恢复路径时,它们就显得至关重要。

One honest note: the page says the benchmark itself was produced by AI with little human review, and the authors expect some errors. The read tool itself was reviewed by a dozen engineers over a full release cycle.

诚实说明:文档页面提到,基准测试本身是由 AI 生成的,人工审核较少,作者预计会存在一些错误。但读取工具本身已经过十几位工程师在完整发布周期内的审核。

What you can learn: Give your tools recovery messages. A tool that fails should say what happened and what to send next. Silence makes the model guess. Fix the invisible failures. If a problem is invisible to the model, fix it in the tool, not in the prompt. Check the cheap things first. Limits, input checks, and a blocklist of dangerous paths stop expensive loops. Constraint is a feature. Being forced to save tokens made Command Code build a better tool.

你可以学到什么: 为工具提供恢复消息。工具失败时应说明原因及下一步操作。沉默只会让模型盲目猜测。 修复隐形故障。如果问题对模型不可见,请在工具端修复,而不是在提示词(Prompt)中。 优先检查低成本项。限制、输入检查和危险路径黑名单可以阻止昂贵的循环。 约束即特性。被迫节省 Token 反而促使 Command Code 构建了更好的工具。

My take: the read tool looks boring, but it is the most important part of an agent harness. This post is the best explanation I have seen of why. Which tool in your agent’s harness would you check first? I would start with the one that returns empty results.

我的看法:读取工具看起来很枯燥,但它是智能体框架中最核心的部分。这篇文章是我见过对此解释得最好的文章。你最想先检查智能体框架中的哪个工具?我会从那个返回空结果的工具开始。