█

AI/TLDR

Buy me a coffee
Buy me a coffee

Freehand

Microsoft Research's minimal agent harness that leaves the decisions to the model

Autonomous Coding AgentsOpen source
Updated
1 Dec 2026
Language
Python
License
MIT
Coverage
1 story

What's new

1 Dec 2026

Microsoft Research releases Freehand with its paper and publishes the freehand-ai package on PyPI. The authors report it beats the first-party harnesses of Codex, Claude Code and Gemini CLI in all 11 tested settings at 49% lower cost.

Latest news

IN SHORT

What is Freehand?

Freehand is an open-source agent harness from Microsoft Research, released with the paper "Freehand: The Bitter Lesson Comes to Agent Harnesses" (arXiv:2612.02442). It sits in the Autonomous Coding Agents category of the AI Coding tools and is open-source, written in Python and licensed MIT. To get started: install.

Updated Markdown version ↗

Overview

Diagram comparing mainstream harnesses, with detailed rules, 20+ preset tools and auto-compaction, to Freehand's short prompt, one bash tool and model-managed memory.
Mainstream harnesses fix the strategy, tools and memory policy in advance; Freehand hands those choices to the model.Freehand README ↗

Freehand is an open-source agent harness from Microsoft Research, released with the paper "Freehand: The Bitter Lesson Comes to Agent Harnesses" (arXiv:2612.02442). Its idea is the opposite of most coding agents: instead of detailed instructions, a fixed tool suite, preset timeouts and automatic compaction, Freehand gives a frontier model a runtime prompt of about 200 words, a single `bash` tool and control over its own context, and lets the model decide the rest.

After every turn the model sees a meter with its context size, token usage (including the cached share), cost and elapsed time. It sets its own command timeouts, can start detached jobs, and prunes its own history through bash. Automatic compaction exists but is off by default. The authors argue that fixed harness rules help weaker models but hold frontier models back, and the paper reports that with lower-tier models the first-party harnesses do better again.

Bar charts of Freehand's mean score, cost per task and time per task against first-party harnesses, OpenCode, Pi and DeepSeek Harness.
The authors' averages over five benchmarks with GPT-6-astra and Claude Opus 5.5: 63.2% solved at $3.23 per task for Freehand.Freehand README ↗

In the paper's tests across five domains and three frontier model families, Freehand outscored each model's first-party harness (Codex, Claude Code, Gemini CLI) in all 11 settings, by 5.1 points on average at 49% lower cost. These are the authors' own results. The project is MIT-licensed, written in Python, and marked alpha: it has no sandbox and runs commands with your permissions. It runs on macOS and Linux, with the CLI and web UI also working under WSL2.

What it does

  • A minimal model-facing setup: a ~200-word runtime prompt and one `bash` tool, with command timeouts set by the model and support for detached jobs
  • The model manages its own context; automatic compaction is available but off by default
  • A per-turn meter showing context size, token usage with cached share, cost and elapsed time
  • Three interfaces over the same sessions: a terminal UI, a browser UI (`freehand web`) and a beta desktop app
  • Sessions with resume, per-turn undo, interrupt, model switching, streaming Markdown and HTML export
  • Headless mode (`freehand -p`) that writes activity to stderr and the final summary to stdout, for scripts and CI
  • Works with OpenAI (ChatGPT Plus/Pro sign-in or API key), Anthropic, experimental GitHub Copilot, and any OpenAI-compatible Chat Completions endpoint, including gateways such as LiteLLM

Getting started

Freehand needs Python 3.10+ on macOS or Linux (WSL2 works for the CLI and web UI). It has no sandbox, so run it in a project you are comfortable letting the model change.

Install

Use the install script, or install the `freehand-ai` package with pip or uv.

bashbash
curl -LsSf https://raw.githubusercontent.com/microsoft/FreeHand/main/install.sh | sh
# or
pip install freehand-ai
# or: uv tool install freehand-ai

Sign in to a model provider

OpenAI is the default: sign in with a ChatGPT Plus or Pro plan, or pass an API key. Anthropic is also supported.

bashbash
freehand login            # Continue with ChatGPT (Plus or Pro)
freehand login openai     # or an OpenAI API key
freehand login anthropic  # then run: freehand --provider anthropic

Start a session in your project

Run Freehand inside the directory you want it to work on. `-c` continues the last session in that directory.

bashbash
cd your/project
freehand
freehand -c

Run it headless or in a browser

`-p` runs one task without the interactive UI; `freehand web` opens the same sessions in a browser window.

bashbash
freehand -p "fix the failing test"
freehand web

Use another endpoint

Any OpenAI-compatible Chat Completions API works through the `openai-chat` provider.

bashbash
freehand --provider openai-chat --api-base <url> --api-key-env <VAR>

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Run a frontier model on long coding, terminal or research tasks with less harness overhead and a lower token bill
  • Compare a model's raw ability against first-party harnesses such as Codex or Claude Code on your own tasks
  • Script one-shot agent jobs in CI with headless mode, reading the final summary from stdout
  • Study harness design: a small, readable baseline for testing which harness rules still help a given model

How Freehand compares

Freehand alongside other open-source autonomous coding agents tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
opencode★ 231kOpenCode is an open source AI coding agent that runs in your terminal, with built-in build and plan agents and an optional desktop app.
Claude Code★ 158kAnthropic's agentic coding tool for the terminal, IDE and GitHub: it understands your codebase, executes routine tasks, explains code and handles git workflows from natural-language commands.
Orca★ 154kOpen-source desktop workspace that runs Claude Code, Codex, OpenCode and other CLI coding agents in parallel, each in its own git worktree, with a mobile companion app.
OpenAI Codex★ 137kOpenAI's cloud and CLI coding agent that writes features, fixes bugs, and proposes code changes across a repo, running tasks in parallel.
Pi★ 125kMinimal terminal coding agent harness with four built-in tools, extended through TypeScript extensions, skills and prompt templates instead of forks.
Gemini CLI★ 110kAn open-source command-line AI agent from Google that connects your terminal to Gemini models for reading code, editing files, running shell commands, and searching the web.
autoresearch★ 101kKarpathy's minimal harness that hands a coding agent a single-GPU LLM training script and lets it run fixed five-minute experiments, keeping or discarding each change on its own.
Freehand—Microsoft Research's minimal agent harness that leaves the decisions to the model