# Freehand vs Codex: One Bash Tool Beats 23 in 2026

- URL: https://aiaffer.com/2026/12/freehand-vs-codex-bash-tool-benchmark-2026/
- Published: 2026-12-05
- Updated: 2026-12-05


**Quick answers**

**What is Freehand?**
An open-source agent harness from Microsoft Research that gives a model one bash tool, an editable transcript file, and a per-turn cost meter — and almost nothing else. It is MIT-licensed and marked Alpha.

**Did it really beat Codex and Claude Code?**
In the authors' own benchmarks, yes: across 5 suites and 3 frontier model families, Freehand won all 11 settings against each model's own first-party harness, by 5.1 points on average, at about 49% lower cost per task. No independent replication exists yet.

**Why would fewer tools score higher?**
The paper's argument is that presets decide strategy before the model sees the task. Fixed timeouts, forced file readers, and automatic summarising burn tokens on work the model never asked for, and on strong models those guardrails cost more than they save.

**Does it win on every model?**
No. On weaker models the order flips: Claude Code still leads by 6.7 points on Claude Sonnet 5.5, Codex by 5.7 on GPT-6 Sol, and DeepSeek Harness by 5.1 on DeepSeek V4.1 Flash.

**Is it safe to run?**
Not blindly. Freehand has no sandbox and no command-approval step. Model commands execute with the user's own permissions, so run it only in a disposable container or virtual machine.

**Verification note.** All benchmark numbers in this article come from the Freehand paper, *Freehand: The Bitter Lesson Comes to Agent Harnesses* (arXiv:2612.02442, released December 1, 2026, by researchers at Microsoft Research Asia, Xi'an Jiaotong University, Zhejiang University, and Fudan University). Data cutoff: December 5, 2026. The results are the authors' own runs — 191 evaluation rounds with pinned harness versions and one pricing pipeline at public list prices — and no third-party replication had appeared by the cutoff date. I recomputed the paper's headline percentages from its published per-task costs with a local script, and the arithmetic checks out. The miniature harness in this article runs locally with a deterministic mock model, not a frontier model, and its output is quoted verbatim. Nothing in this article is presented as my own benchmark run.

## What a harness decides before the model sees anything

An agent harness is the loop around a model: it sends the context, runs the actions the model asks for, and returns the results. That loop looks like plumbing, but the Freehand authors show it makes most of the strategic decisions in advance. Before the model reads a single word of the task, a mainstream harness has already fixed the system prompt, the tool list, the timeouts, and the memory policy.

The paper audits nine popular harnesses through source code and captured API requests, and the numbers show how heavy the defaults have become. Codex starts every session with about 15,100 tokens of fixed instructions and 23 callable tools. Claude Code ships 22 tools and about 8,500 tokens. Gemini CLI carries 16 tools and about 9,500 tokens. DeepSeek Harness registers 34 tools. Each of those tokens is paid for on every task, and each tool is a choice the model never got to make.

Freehand cuts that prefix to roughly 350 tokens — about 200 words — and one tool: `bash`, with a timeout the model sets itself, up to 24 hours. The model also gets its own conversation history as an editable file, and a one-line meter after every turn reporting context size, token counts, cost, and elapsed time. Everything else — which files to read, how long to wait, when to summarise — is left to the model. The authors frame the idea with Richard Sutton's *Bitter Lesson*: general methods that scale with compute eventually beat hand-built scaffolding, and the scaffolding that helped early models now acts as a cage for strong ones.

![A heavy armored robot loaded with tools racing a light agile runner with a small backpack](/images/inbody/freehand-vs-codex-bash-tool-benchmark-2026-1.webp)

## What Freehand actually ships

Three primitives replace the usual 20-plus tools:

1. **One bash tool.** The model calls `bash(command, timeout_s)` and picks its own timeout. There is no separate file reader, no search helper, no editor tool. If the model wants a file, it runs `grep` or `sed` itself. If it wants to wait, it waits.
2. **A self-edited transcript.** Instead of an invisible compaction step that summarises history at an arbitrary token threshold, the conversation lives in a `transcript.json` file the model can prune itself. The model decides what to keep and what to drop, with the meter telling it how much room is left.
3. **A per-turn meter.** After every turn, the harness prints context size, cached versus uncached tokens, dollar cost, and elapsed time. The model sees budget pressure directly instead of discovering it through a surprise truncation.

The project ships a terminal UI, a web UI, and a desktop app in beta. It sits inside Microsoft's AgentOpt research line, beside SkillOpt, EnvOpt, and EvalOpt — research artifacts about how agents are hosted, not only which model answers. The repository is MIT-licensed and marked Alpha, which matters for the safety section below.

## The headline numbers

The authors tested GPT-6-astra, Claude Opus 5.5, and Gemini 4 Carbon across five suites — Terminal-Bench 4 (63 tasks), Terminal-Bench Science (70), Agents' Last Exam (105), OSWorld 2.1, and AutomationBench — 946 tasks in total, in 11 settings against each model's own first-party harness. Freehand won all 11.

| Comparison | Baseline cost per task | Freehand cost per task | Saving |
|---|---|---|---|
| Vendor harness mean (Codex, Claude Code, Gemini CLI) | $7.34 | $3.73 | 49.2% |
| DeepSeek Harness mean | $12.76 | $3.23 | 74.7% |
| OSWorld 2.1, GPT-6-astra: Codex | $14.94 | $3.96 | 73.5% |
| 30-second polling trap (mini-swe-agent) | $70.77 | $2.28 | 96.8% |
| Whole-file read (OpenCode) | $13.09 | $2.66 | 79.7% |

The score side is just as striking. Averaged over the ten GPT-6-astra and Claude Opus 5.5 settings, Freehand reached 63.2% against 58.4% for the vendor harnesses, 59.3% for Pi, 57.4% for DeepSeek Harness, and 56.8% for OpenCode. Against whichever baseline scored best in each setting, Freehand kept a 2.7-point lead at 38.6% lower cost. The biggest gap came on OSWorld 2.1 with GPT-6-astra: Freehand scored 76.2% at $3.96 per task while Codex scored 68.3% at $14.94. Normalised runtime was also the shortest on average, at 31.7 minutes per task.

I recomputed those savings from the paper's own per-task costs with a short local script, and the output matches the paper's headline claim:

```python
"""Recompute the Freehand paper's headline cost claims from its own
published per-task numbers (arXiv:2612.02442, Table 2 as reported).
No new measurement: this checks the paper's arithmetic.
Run: python3 freehand_costs.py
"""
rows = [
    ("Vendor harness mean (Codex/Claude Code/Gemini CLI)", 7.34, 3.73),
    ("DeepSeek Harness mean", 12.76, 3.23),
    ("OSWorld 2.1, GPT-6-astra: Codex", 14.94, 3.96),
    ("30s-timeout polling trap (mini-swe-agent)", 70.77, 2.28),
    ("78-page report read (OpenCode)", 13.09, 2.66),
]
for label, baseline, freehand in rows:
    saving = (baseline - freehand) / baseline * 100
    print(f"{label}: ${baseline:.2f} -> ${freehand:.2f} "
          f"({saving:.1f}% cheaper, {baseline / freehand:.1f}x)")
mean_saving = (7.34 - 3.73) / 7.34 * 100
print(f"Headline check: vendor mean saving = {mean_saving:.1f}% "
      f"(paper reports ~49%)")
```

The script printed this output verbatim:

```text
Vendor harness mean (Codex/Claude Code/Gemini CLI): $7.34 -> $3.73 (49.2% cheaper, 2.0x)
DeepSeek Harness mean: $12.76 -> $3.23 (74.7% cheaper, 4.0x)
OSWorld 2.1, GPT-6-astra: Codex: $14.94 -> $3.96 (73.5% cheaper, 3.8x)
30-second-timeout polling trap (mini-swe-agent): $70.77 -> $2.28 (96.8% cheaper, 31.0x)
78-page report read (OpenCode): $13.09 -> $2.66 (79.7% cheaper, 4.9x)
Headline check: vendor mean saving = 49.2% (paper reports ~49%)
```

The arithmetic is sound. What the arithmetic cannot check is whether the result generalises beyond the authors' own harness versions, benchmarks, and pricing pipeline. That is the standard caveat for any single-lab benchmark, and it applies here in full.

## Three ways presets burn money

The paper's most useful contribution is not the leaderboard — it is the three failure traces that show exactly how a preset turns into a bill. Each one names a mechanism, a count, and a price.

**The polling trap.** The mini-swe-agent harness hardcodes a 30-second timeout. A task that needs 24 minutes of waiting cannot finish inside one call, so the agent parks the job in the background and polls the log. One trace shows 334 polling rounds, 403 calls, and $70.77 for a single task. Freehand lets the model set its own timeout, so it waits the full 24 minutes in one call: 42 calls and $2.28. The lesson is not that polling is evil — it is that a timeout chosen before the task is seen will be wrong for exactly the tasks where waiting is the work.

**The reminder flood.** Claude Code truncates tool output at 120 seconds and fires budget reminders as context fills. On one scientific-computing task, that combination produced 298 turns and $8.83 — and a score of zero. The reminders themselves consumed the context they were warning about. Freehand's meter reports the same numbers once per turn in a single line, and the model decides when to prune its own transcript instead of being interrupted by the harness.

**The whole-file read.** OpenCode's file reader loads an entire 78-page financial report into context, then re-sends it on every subsequent call. That trace ran 9.09 million tokens and cost $13.09. Freehand's model converted the report to text on disk first, then grepped the few lines it needed: 1.16 million tokens, $2.66, and the same score. The tool was not the problem — the decision to read the whole file before knowing which lines matter was.

![A stopwatch next to a long scroll of server log lines on a monitor](/images/inbody/freehand-vs-codex-bash-tool-benchmark-2026-2.webp)

One more control result sharpens the point. The authors swapped only Codex's system prompt into Freehand and changed nothing else. On a harmless protein-docking scoring task, the prompt-swapped version refused to answer in all 10 runs during the first turn, while the plain Freehand version passed all 10. A prompt written for safety in one harness became a refusal machine in another. And "bash-only" alone is not enough: mini-swe-agent also exposes only bash, yet it trails Freehand by 3.4 points on Terminal-Bench 4 at 35% higher cost ($4.21 versus $3.12), because its hardcoded timeout interrupts 60% of tasks. The meter and the editable transcript do real work; the single tool is only part of the design.

## Try the shape of it locally

The full Freehand loop needs a frontier model and an API key. The shape of it, though, can be run on any machine with Python: one bash tool, a transcript file the model edits, and a meter line after every turn. The script below implements that loop with a deterministic mock model — a stub that follows a fixed three-step plan — so the run is reproducible without a key. A real deployment swaps the stub for a model call and keeps everything else.

```python
"""A minimal Freehand-style harness: one bash tool, an editable transcript,
and a per-turn cost meter. The model here is a deterministic MOCK that
always runs the next step of a fixed plan, so the loop is reproducible
without an API key. Real Freehand swaps mock_model() for a frontier model.
Run: python3 freehand_minimal.py
"""
import json
import subprocess
import time

TRANSCRIPT = "/tmp/aiaffer-1205/transcript.json"
# Priced at public list rates used in the Freehand paper's accounting
# (placeholder rates for the mock run; real runs price real tokens).
PRICE_PER_1K_TOKENS = 0.003


def mock_model(transcript, task):
    """Deterministic stub: returns the next shell command for the task."""
    steps = [
        "echo 'step 1: list files' && ls /tmp/aiaffer-1205 | head -5",
        "echo 'step 2: count words' && wc -w /tmp/aiaffer-1205/sample_notebook.ipynb",
        "echo 'done'",
    ]
    done = sum(1 for t in transcript if t["role"] == "assistant")
    if done >= len(steps):
        return None
    return steps[done]


def run_task(task):
    transcript = [{"role": "user", "content": task}]
    total_tokens = 0
    start = time.time()
    while True:
        cmd = mock_model(transcript, task)
        if cmd is None:
            break
        result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
        # Meter: context size, tokens, cost, elapsed time (Freehand's 4 fields)
        total_tokens += 350 + len(cmd)  # ~350-token prompt + command tokens
        cost = total_tokens / 1000 * PRICE_PER_1K_TOKENS
        transcript.append({"role": "assistant", "content": cmd})
        transcript.append({"role": "tool", "content": result.stdout.strip()[:200]})
        print(f"[meter] context={len(json.dumps(transcript))} chars "
              f"tokens={total_tokens} cost=${cost:.4f} "
              f"elapsed={time.time() - start:.1f}s")
        print(f"$ {cmd}\n{result.stdout.strip()[:200]}")
    with open(TRANSCRIPT, "w", encoding="utf-8") as f:
        json.dump(transcript, f, indent=2)
    print(f"transcript saved: {TRANSCRIPT} ({len(transcript)} turns)")


if __name__ == "__main__":
    run_task("Inspect the files in /tmp/aiaffer-1205 and count the words "
             "in sample_notebook.ipynb")
```

I ran this script locally on December 5, 2026. The output is quoted verbatim:

```text
[meter] context=346 chars tokens=409 cost=$0.0012 elapsed=0.0s
$ echo 'step 1: list files' && ls /tmp/aiaffer-1205 | head -5
step 1: list files
freehand_costs.py
freehand_minimal.py
notebook_audit.py
sample_notebook.ipynb
[meter] context=555 chars tokens=834 cost=$0.0025 elapsed=0.1s
$ echo 'step 2: count words' && wc -w /tmp/aiaffer-1205/sample_notebook.ipynb
step 2: count words
80 /tmp/aiaffer-1205/sample_notebook.ipynb
[meter] context=641 chars tokens=1195 cost=$0.0036 elapsed=0.1s
$ echo 'done'
done
transcript saved: /tmp/aiaffer-1205/transcript.json (7 turns)
```

The mock proves nothing about model quality — a stub cannot score a benchmark — but it shows the loop mechanics clearly. Each turn prints the same four meter fields the paper describes, the transcript grows by two entries per turn, and the saved file is the entire memory of the run. Anyone adapting this skeleton should add three things before pointing it at a real model: a timeout on `subprocess.run`, a working-directory jail, and a cap on transcript size.

## Where Freehand loses

The reversal is the most honest part of the paper. On Terminal-Bench 4 with lower-tier models from the same families — GPT-6 Sol, Claude Sonnet 5.5, DeepSeek V4.1 Flash — the first-party harnesses win again:

| Model tier | Winner on Terminal-Bench 4 | Margin |
|---|---|---|
| GPT-6 Sol | Codex | 5.7 points |
| Claude Sonnet 5.5 | Claude Code | 6.7 points |
| DeepSeek V4.1 Flash | DeepSeek Harness | 5.1 points |

Switch to the frontier models from the exact same families and the order flips completely, with Freehand winning by 2.5 to 7.6 points. The pooled difference-in-differences reversal is 11.0 points with p < 0.001. The authors read this as presets acting like a crutch early in the capability curve and a cage once the model can plan. A weaker model needs the guardrails to stay on task; a stronger model pays for guardrails it does not need.

![A balance scale weighing a heavy stack of books against a single feather](/images/inbody/freehand-vs-codex-bash-tool-benchmark-2026-3.webp)

That split sets the practical rule. Freehand is a harness for frontier models on hard tasks. Running it on a small or cheap model to save money is backwards: the paper's own data says the cheap model scores worse with Freehand than with its vendor harness. The cost saving only exists when the model is strong enough to use the freedom well.

### The safety gap: no sandbox, alpha

Freehand has no sandbox, no command-approval prompts, and no native Windows release yet. Model commands execute with the user's own permissions and nothing asks first. On a developer workstation that means a model can delete files, exfiltrate a credential from an environment variable, or install a malicious package without a checkpoint. The repository's Alpha label is doing real work here: it signals research code, not a finished tool.

The safe way to try it is a disposable container or virtual machine with no mounted credentials, no SSH keys, and no access to production systems. Treat it the way a careful reader treats any new agent harness — see [my guide to verifying AI-generated GPU kernel speedups](/2026/12/verify-ai-generated-gpu-kernel-speedup-2026/) for the same verify-first habit applied to generated code, and [my note on the same model costing 5x more in a different harness](/2026/11/same-model-5x-cost-coding-harness-2026/) for the earlier evidence that harness design moves cost as much as model choice. For readers deciding whether to run a model locally instead of through any harness, [my guide to running Flint 1.1 locally in Claude Code](/2026/12/flint-1-1-claude-code-local-coding-2026/) covers the local-deployment side.

## Who this fits, and who should skip it

**A good fit:** researchers and engineers running frontier models on long agentic tasks in disposable environments, especially terminal-heavy work such as benchmarking, data pipelines, and system administration. Anyone whose Codex or Claude Code bill looks large relative to the score should read the paper's traces before dismissing the result.

**A poor fit:** anyone on a weaker or cheaper model, anyone who needs guardrails for compliance or safety, and anyone who would run it on a machine holding real credentials. The harness also suits single-task runs better than long-lived assistants, because the transcript file grows without a summarisation policy of its own.

## Verdict: 7/10

Freehand is the most interesting harness paper of the year, and the cost traces alone justify reading it. The score loses points for three reasons: the results are single-lab and unreplicated, the design only helps frontier models, and the Alpha release ships without the sandbox that a bash-only harness needs most. For frontier-model users in a disposable container, it is worth a trial run this week. For everyone else, the paper is a better read than the code is a tool — for now.

---

*Full disclosure: This article contains no affiliate links. No link in this article earns me a commission. Benchmark figures are the paper authors' own results from arXiv:2612.02442 (December 1, 2026); I recomputed the headline percentages locally and the arithmetic matches. The miniature harness ran locally with a mock model, and its output is quoted verbatim — it is a loop demonstration, not a benchmark run.*

