Microsoft Research's Freehand Beats Rival Coding Agents at Half the Cost
Microsoft open-sources a minimalist coding agent that gives frontier models one bash tool and a 200-word prompt, outscoring Codex and Claude Code at half the cost.
Takeaways
- Microsoft open-sourced Freehand, a minimal coding agent: ~200-word prompt, one bash tool, self-managed context.
- Beat Codex, Claude Code and Gemini CLI by 5.1 points at 49% lower cost across 11 benchmark settings.
- Model sets its own timeouts, prunes its own history, and sees a live meter of tokens, cost and time.
- With weaker models like GPT-6 Sol or Claude Sonnet 5.5, first-party harnesses still win.
- No sandbox: shell commands run with your permissions, so containers are required for untrusted code.
- Install via
uv tool install, works on macOS, Linux and WSL2; native Windows coming soon.
Microsoft Research has released Freehand, an open-source harness for running coding agents. A harness supplies the prompts, tools, memory management, and execution controls around a model. Freehand reduces that layer to shell access, a scratchpad, and a resource meter, allowing the model to choose its own workflow.
According to Microsoft Research, Freehand recorded the highest score and lowest cost in 11 configurations across five benchmarks using GPT-6-astra, Claude Opus 5.5, and Gemini 4 Carbon. It also had the shortest mean completion time. In paired comparisons with first-party harnesses, Freehand scored 5.1 percentage points higher while costing 49% less per task.
A shell, a scratchpad, and a meter
Many coding agents encode workflows in long system prompts, expose more than 20 predefined tools, impose fixed command timeouts, and compact context automatically at a token threshold. Freehand leaves those decisions to the model, based on the premise that the most capable models can manage tools, time, and context directly.
| Area | Freehand | Typical harness |
|---|---|---|
| Strategy | A descriptive runtime prompt with no prescribed workflow | A long system prompt containing rules and procedures |
| Execution | One Bash tool that the model uses to assemble commands and utilities | A collection of predefined tools for files, search, tests, and other operations |
| Timeouts | Model-selected timeouts and support for detached jobs | Fixed limits and polling intervals |
| Memory | Model-directed context pruning during execution | Automatic compaction at a fixed token threshold |
Each task begins with roughly 350 prompt tokens and one tool. After every turn, the model receives a meter showing context size, token use and its cached share, accumulated cost, and elapsed time. Those measurements let the model adjust its context and spending while the task is running.
Eleven wins, with limits
The reported results include comparisons with Codex, Claude Code, OpenCode, Pi, DeepSeek Harness, and the Bash-only mini-swe-agent. Two benchmark rows show the size of Freehand's lead:
| Benchmark and model | Freehand | First-party harness |
|---|---|---|
| Terminal-Bench 4 Claude Opus 5.5 |
61.9% at $3.38 per task | Claude Code: 54.9% at $4.91 per task |
| OSWorld 2.1 GPT-6-astra |
76.2% at $3.96 per task | Codex: 68.3% at $14.94 per task |
The OSWorld comparison puts Codex's per-task cost at almost four times Freehand's. Microsoft also reran the harnesses on the same machines and API endpoints to reduce infrastructure differences; the competing harnesses took 17% to 62% longer in those controlled runs.
These figures remain benchmark results rather than evidence for every repository or development workflow. Model pricing, cache behavior, task mix, and command latency can all change the outcome, so teams evaluating the harness will need workload-specific measurements.
Scaffolding helps cheaper models
Freehand's advantage disappeared with lower-tier models on Terminal-Bench 4. Each first-party harness outscored it in the three reported comparisons:
| Model | First-party harness | Freehand |
|---|---|---|
| GPT-6 Sol | Codex: 34.9% | 29.2% |
| Claude Sonnet 5.5 | Claude Code: 41.6% | 34.9% |
| DeepSeek V4.1 Flash | DeepSeek Harness: 28.9% | 23.8% |
The results narrow the paper's claim to the strongest tested models. Teams routing routine work to cheaper models may still benefit from explicit tools, prescribed workflows, and automatic context management.
Shell access raises the risk
Freehand includes no sandbox or command-approval prompt. Model-generated commands run immediately with the current user's permissions, giving the agent access to the files, credentials, processes, and network resources available in that environment.
Repositories and tasks that are not fully trusted should run in a container or virtual machine with limited mounts and scoped credentials. The same isolation is appropriate when testing a new model or an unfamiliar OpenAI-compatible endpoint.
Install and connect
Freehand supports macOS, Linux, and Windows through WSL2. Native Windows support is listed as forthcoming. Installation and startup require the following commands:
curl -LsSf https://raw.githubusercontent.com/microsoft/FreeHand/main/install.sh | sh
freehand login
cd your/project
freehand
The installation script adds uv when needed, then installs Freehand with an isolated Python 3.12 runtime. Authentication options include a ChatGPT Plus or Pro account, an OpenAI API key, an Anthropic API key, or any OpenAI-compatible Chat Completions endpoint. The project also documents integration through a LiteLLM gateway.
Developers can run the terminal interface shown above, launch a browser interface with freehand web, or use the beta desktop application.
A testable choice for agent builders
Freehand is part of Microsoft Research's AgentOpt series, which examines optimization across agent skills, training environments, evaluators, and runtime harnesses. This release isolates the harness question: how much orchestration does a high-capability coding model need?
For developers building agent systems, the project offers a small reference implementation for comparing model-led control with hand-tuned prompts and tool layers. Its benchmark lead depends on model capability, and its unrestricted shell requires isolation, but the design can be tested directly against real repositories and internal tasks. The MIT-licensed source is available on GitHub.