Sulat.com / Writing on AIFriday, December 4, 2026
Enter →
Agent Engineering/4 December 2026

Microsoft’s Freehand agent harness

Microsoft Research's Freehand gives a model one bash tool and a history file it can edit. I ran it against opencode on five models, and it sent eight to eleven times fewer input tokens.

3D rainbow Freehand wordmark above a bare terminal window, the Microsoft Research agent harness
Illustration: Sulat featuring the Freehand logo

At a glance

  • Microsoft Research's Freehand gives the model one bash tool, a runtime description of about 200 words and an editable history file, and leaves every other decision to the model.
  • The paper says it beat each model's first-party harness in all eleven settings, by 5.1 points on average at 49% lower cost. Those are the authors' own results.
  • With weaker models the paper's order reverses: Codex, Claude Code and DeepSeek Harness each beat Freehand on Terminal-Bench 4.
  • I ran Freehand and opencode on five models and three small tasks. All 30 runs passed, and opencode sent eight to eleven times more input tokens on two of the tasks.
  • Freehand has no sandbox and no approval prompt, and it's alpha. Neither harness polled on the long job, and two Freehand runs on the pelican task ended badly.

Microsoft Research has open-sourced Freehand, an agent harness that gives the model one bash tool, a description of its own runtime of about 200 words and control over its own context. The paper says it beat the first-party harness of every model it tried, Codex, Claude Code and Gemini CLI, in all eleven settings, scoring 5.1 points higher on average at 49% lower cost. Bruno Borges flagged it on X. I installed it and ran it against opencode on the same five models and three tasks.

Three decisions handed back

The paper’s argument is that a harness makes three decisions for the model before the model has seen the task. The prompt prescribes how to approach the work, a tool suite and fixed timeouts decide how to act, and threshold compaction decides what to remember. Freehand hands each one back. The model chooses its approach, writes whatever scripts it needs through one shell tool, and manages its own history.

Infographic: Freehand leaves task approach, tools and memory to the model, one bash tool not 20
Strategy, tools and memory are the three decisions Freehand stops making for the model. Illustration: Sulat.

The loop is small. The only tool is bash(command, timeout_s?), and the model sets the timeout on each command itself, with 120 seconds as the default. The conversation lives in a file, transcript.json, in the provider’s native message format, so pruning a stale log or condensing a finished subtask is just another shell action. Automatic compaction exists but is off by default. After every turn the harness appends one status line, and that line is the model’s only gauge of what it has spent.

Code
[harness] turn <t> | context <c> tokens | total in <n> (cached <n>) out <n> | $<cost> | <m> min elapsed
Diagram: model sends commands to bash, edits transcript.json, and sees a meter after every turn
The whole loop: one tool, one editable history file, one status line. Illustration: Sulat.

There’s no sandbox and no approval prompt. The model’s commands run with your permissions, so the README tells you to use a container or VM for anything you don’t trust. It’s MIT licensed, labelled alpha, and installs from PyPI as freehand-ai on macOS and Linux. Native Windows isn’t supported yet.

How much each harness says before turn one

The paper measures the static prefix each harness sends on every turn, which is the system prompt plus the tool definitions. Freehand’s is the smallest by a wide margin.

Bar chart of starting prompt size: Codex 15.1K, Freehand 0.35K tokens, other harnesses between
Before turn one, the model reads between 0.35K and 15.1K tokens of instructions and tool definitions. Illustration: Sulat.
HarnessPrompt and tool definitionsTools
Codex15.1K tokens23
Gemini CLI9.5K tokens16
Claude Code8.5K tokens22
DeepSeek Harness6.5K tokens34
OpenCode5.2K tokens10
Pi1.2K tokens4
Freehand0.35K tokens1
Static prefix per turn, from the Freehand paper’s Table 1.

What the paper reports

The authors ran five benchmarks: Terminal-Bench 4, Terminal-Bench Science, Agents’ Last Exam, OSWorld 2.1 and AutomationBench. They used GPT-6-astra and Claude Opus 5.5 on all five, plus Gemini 4 Carbon on Terminal-Bench 4, which makes eleven settings. Averaged over the ten GPT-6-astra and Opus 5.5 settings, Freehand came out ahead on score, cost and time against every harness they compared.

HarnessMean scoreCost per taskMinutes per task
Freehand63.2%$3.2331.7
First-party harnesses58.4%$6.7033.0
Pi59.3%$4.4936.5
DeepSeek Harness57.4%$12.7635.1
OpenCode56.8%$5.1632.0
The authors’ own results, averaged over ten GPT-6-astra and Claude Opus 5.5 settings.

Two caveats apply. The numbers are the authors’ own and come from their runs, not an outside lab. And the paper says the order reverses for weaker models. On Terminal-Bench 4, Codex beats Freehand with GPT-6 Sol, 34.9% to 29.2%. Claude Code beats it with Sonnet 5.5, 41.6% to 34.9%, and DeepSeek Harness beats it with DeepSeek V4.1 Flash, 28.9% to 23.8%. The authors call this crutch versus cage: presets help a model that can’t plan or manage context yet, and hold back one that can.

Infographic: built-in harness helps weaker models by 5 to 7 points, bare shell wins on frontier models
The paper’s central finding in one picture. Illustration: Sulat.

The same paper tested whether fewer tools alone explain the gain. A bash-only baseline, mini-swe-agent, still fixes its workflow and timeouts, and it trails Freehand at higher cost. In one ablation, putting a first-party prompt and toolset back into Freehand dropped a benchmark score from 67.5% to 63.7% and raised cost by 68%. Other work the paper cites points the other way: heavy harnesses lift weaker open-weight models, and harness choice can reorder model rankings. The authors read that as the crutch half of their argument.

What I ran

I installed Freehand 0.1.1 and opencode 1.19.6 on a 4 vCPU Intel Xeon at 2.30GHz with 15GB of memory and a 252GB disk, running Ubuntu 24.04 on Linux 6.18. Both harnesses ran the same five models in headless mode: Kimi K3.1 Pro through Synthetic, DeepSeek V4.1 Flash through Morph, Claude Opus 5.5, GPT-6 Sol and Gemini 4 Neon. Each model got three tasks in a fresh folder, once per harness, which is 30 runs. That’s a smoke test with one run per cell, not a benchmark. The prompts were these, word for word.

Code
The tests in this folder fail. Fix ledger.py so that `python3 -m pytest -q` passes. Don't edit the tests.
Code
Run `python3 crunch.py` in this folder. It's a long simulation and prints nothing until it finishes. Put the number from its RESULT line into answer.txt and reply with that number.
Code
Draw a pelican riding a bicycle as pelican.svg, 800 by 600. Check that it renders, then reply done.

The first folder holds a small ledger module with four failing tests. The second holds a script that sleeps for 150 seconds before printing its result, which is the situation the paper says a fixed timeout handles badly. A run passed if the tests went green, if answer.txt held the right number, or if the SVG rendered. Every one of the 30 runs passed those checks. Freehand’s headless command looks like this, with the provider flags swapped per model.

Code
freehand -p "<task>" --json --provider anthropic --model claude-opus-5-5

Where the two harnesses differed was in how much they sent. Summed over the five models, opencode sent 359K input tokens to fix the ledger and 349K for the long job. Freehand sent 45K and 32K, which is roughly eight and eleven times less. Tool calls followed the same direction: 15 for Freehand against 31 for opencode on the ledger, and 15 against 28 on the long job.

Bars: opencode sent 359K tokens to fix four failing tests and 349K for a long job, Freehand 45K and 32K
Input tokens summed over five models on two of my tasks. Illustration: Sulat.

The long job is where I expected a difference in behaviour, and I didn’t see one. Neither harness polled. In both, the models either set a long timeout on the command or ran it in the background and waited, so the 150 seconds cost one or two calls either way. The token gap came from the prefix and the extra turns, not from a smarter way of waiting. Wall time was close too: the long job took between 153 and 181 seconds on Freehand and between 155 and 287 on opencode.

Freehand terminal session running a 150-second job with a per-turn token and cost meter footer
A real Freehand run on the long-job task, with the meter line after each turn.

The pelican task showed the rough edges. Two Freehand runs ended abnormally but still left a valid SVG. DeepSeek V4.1 Flash kept iterating until I stopped it at my 15-minute cap, after 107 tool calls and about 2.3 million input tokens, and the same model on opencode finished in ten seconds. Gemini 4 Neon ended its Freehand run with an error status after three empty replies. Leaving every decision to the model includes the decision to stop, and two of the five struggled with it. The paper’s own caveat about weaker models says as much.

Five rows of pelican-on-a-bicycle SVGs, each model drawn through Freehand on the left and opencode on the right
The same pelican prompt through both harnesses, five models each, one run per cell.

Who should try it

If you run frontier models on long, open-ended work and your bill is mostly input tokens, Freehand is worth an afternoon in a container. The token cut is real on small tasks too, and it needs no tuning. If you run a smaller or cheaper model, the paper’s own data says keep the built-in harness. Either way, treat the headline gain as the authors’ claim until someone outside Microsoft repeats it, and don’t point an alpha shell with no approval step at a machine you care about.

What I didn’t test

I didn’t run any of the paper’s five benchmarks, so none of its score or cost figures are mine. I didn’t try Claude Code, Codex or Gemini CLI against Freehand, only opencode. I ran each cell once, so the per-model differences are anecdotes. I also didn’t use Freehand’s web interface, its transcript-editing behaviour in a very long session or its optional compaction.

Disclosure: I’m an OpenAI, Firecrawl and Devin ambassador.