这篇论文用Claude Code和OpenAI Codex CLI做对比实验发现,多数情况下只让AI用代码执行工具反而更便宜,还不影响成功率。只有Claude在SWE-bench上略贵一点点。想省API成本可以看看。
该论文通过三臂消融实验(基线、仅bash、仅代码)在合成计算任务和SWE-bench Mini上,使用Claude Code和OpenAI Codex CLI两个代理,比较了限制为单一execute_code MCP工具的效果。在四个(任务制度, 代理设计)组合中,有三个组合(Artifact/Claude、SWE-bench/Codex、Artifact/Codex)显示限制工具显著更便宜或统计持平,且通过率无显著差异。唯一的例外是SWE-bench/Claude组合,仅代码方向性成本高14.4%但不显著,该差距源于失败轨迹的代价而非成功编辑的税收。结论是工具表面的最廉价选择由任务制度和代理设计共同决定,成本信号主要来自缓存调整成本而非通过率。
When Does Restricting a Coding Agent to execute_code Help? A Regime $\times$ Agent-Design Ablation
Modern coding agents expose multiple tool surfaces -- IDE primitives, bash, and Model Context Protocol (MCP) code-execution -- and the field has shipped three contradictory claims about which one matters. We run the missing crossed comparison: an integrity-clean three-arm ablation (baseline / bash_only / code_only) on synthetic computation tasks and SWE-bench Mini modification tasks, holding model, harness, and prompts fixed, with two agents (Claude Code, OpenAI Codex CLI) so the comparison spans both regime and agent-design axes. Across the four resulting (regime, agent) cells, restricting the agent to a single execute_code MCP tool is cheaper than -- or statistically tied with -- its cheapest tool-rich rival in three cells (significantly on Artifact/Claude and SWE-bench/Codex; directionally on Artifact/Codex), with pass rates statistically tied within each cell. The lone exception is SWE-bench/Claude, where code_only is directionally costlier (+14.4%, not significant); a conditional-cost analysis localizes that gap to failure-cost on doomed-run trajectories, not a per-edit tax on successful runs. Two implications: the cheapest tool surface is jointly determined by task regime and agent design rather than by either axis alone, and the headline cost signal lives in cache-adjusted cost -- not pass rate, which is invariant across surfaces at the model sizes we evaluate. The benchmark harness, task suite, and analysis code are available at https://github.com/hyang0129/onlycodes.