English · 简体中文 · 日本語 · 한국어 · Français · Español
Freehand
🧭 Freehand is part of the AgentOpt series, which covers each part of an agent system: SkillLens · SkillOpt · Resource2Skill · EnvOpt · EvalOpt · Freehand. See the AgentOpt series page.
An agent harness that leaves the decisions to the model.
Freehand gives a frontier model a runtime description of about 200 words, one bash tool, and control over its own
context. Against Codex, Claude Code, Gemini CLI, OpenCode, Pi and DeepSeek Harness, on five benchmarks with three model
families, it scored highest and cost least in every setting we ran, and it was fastest on average.
Use it with a frontier model. Freehand leaves the decisions to the model, so it pays off when the model can make them well: with weaker models, traditional harnesses still do better (Results).
Quick start · Paper · Usage · Gateways · Benchmarks · Security · Changelog
Alpha. Freehand has no sandbox: the model's commands run with your permissions and nothing asks first. Use a container or VM for code you do not trust (how), and read the security model.
Install
Supported platforms: macOS and Linux. The CLI and web interface also run in Linux under WSL2. Native Windows: coming soon. Desktop builds target macOS (Apple Silicon and Intel) and Linux (x64); see desktop/README.md for build details.
On macOS or Linux:
curl -LsSf https://raw.githubusercontent.com/microsoft/FreeHand/main/install.sh | sh
The script installs uv if it is missing, then Freehand with its own Python 3.12. If you
already have uv, the same thing is uv tool install --python 3.12 git+https://github.com/microsoft/FreeHand.
freehand update upgrades either. To work on Freehand itself, see Development.
Quick start
Terminal
freehand login # Continue with ChatGPT (Plus or Pro); or an API key: freehand login openai | anthropic
cd your/project
freehand # interactive session in this directory
freehand -c # continue the last session here
freehand -p "fix the failing test" # headless: activity on stderr, the final summary on stdout
freehand web # the same sessions in a browser window
Every command, key, slash command and setting is in docs/usage.md and docs/config.md.
Desktop app (beta)
GPT-6-astra in the desktop app, from launch. The model's 22 seconds of work play at 2× speed.
The desktop app is optional. It puts files, changes, Git and a terminal next to the conversation, and shares its
sessions and settings with the terminal, so a session started in one continues in the other. Signed installers are
not published yet, so build it from source (Node 22.12 or later, and freehand from Install):
git clone https://github.com/microsoft/FreeHand.git && cd FreeHand/desktop
npm install
npm run app # builds desktop/dist/mac-arm64/Freehand.app; `npm start` runs it without building
Sign in from the app, or with freehand login. More in desktop/README.md,
docs/web-ui.md and docs/workbench.md.
The idea
https://github.com/user-attachments/assets/ed6a45ba-9923-444d-b872-0a55e5368f16
The Bitter Lesson holds that knowledge built into AI systems helps at first and is eventually outgrown by general methods. Mainstream harnesses build in a great deal: prompts prescribe how to approach a task, tool suites and timeouts fix how to act, and threshold compaction decides what to remember, all before the model has seen the task. For weaker models these presets are a crutch; for frontier models they become a cage. Freehand follows one rule: give the model a shell, its own memory, and a meter, and let it decide everything else.
| Decision | Typical harness | Freehand |
|---|---|---|
| How to approach the task (strategy) | rules, workflows and reminders in a long system prompt | a purely descriptive runtime prompt, with no rules |
| What tools to use (execution) | dozens of pre-designed tools | one bash tool, from which the model builds what the task needs |
| How long a command runs (execution) | fixed timeouts and poll intervals | the model sets each command's timeout and can run jobs detached |
| What stays in context (memory) | automatic compaction at a fixed threshold | the model manages its own context at runtime |
Before the task begins the model sees about 0.35K tokens and one tool. After every turn it also sees its own meter: context size, tokens (with the cached share), cost and elapsed time.
The model-facing side stays this small on purpose. The human-facing side is complete: the desktop app (beta), a
browser interface (freehand web) and a terminal interface, with streaming Markdown, interrupt, sessions and resume,
per-turn undo, model switching, cost and context display, and HTML export.
Results
Across 11 settings (five benchmarks with GPT-6-astra, Claude Opus 5.5 and Gemini 4 Carbon), Freehand had the highest score and the lowest cost in every one, and the shortest mean time per task. Against the first-party harnesses it scored 5.1 points higher at 49% lower cost, and it also beat OpenCode, Pi, DeepSeek Harness and the bash-only mini-swe-agent. In a controlled side-by-side rerun on the same machines and API endpoints, each of the other harnesses took 17–62% longer.
| Benchmark | Model | Freehand (score · cost per task) | First-party harness (score · cost per task) |
|---|---|---|---|
| Terminal-Bench 4 | GPT-6-astra | 57.1% · $3.12 | Codex 54.6% · $5.88 |
| Claude Opus 5.5 | 61.9% · $3.38 | Claude Code 54.9% · $4.91 | |
| Gemini 4 Carbon | 57.1% · $8.76 | Gemini CLI 49.5% · $13.72 | |
| Terminal-Bench Science | GPT-6-astra | 63.8% · $7.71 | Codex 58.1% · $12.99 |
| Claude Opus 5.5 | 55.2% · $8.16 | Claude Code 54.3% · $12.86 | |
| Agents' Last Exam | GPT-6-astra | 67.5% · $1.92 | Codex 63.6% · $4.45 |
| Claude Opus 5.5 | 66.5% · $1.16 | Claude Code 62.2% · $2.29 | |
| OSWorld 2.1 | GPT-6-astra | 76.2% · $3.96 | Codex 68.3% · $14.94 |
| Claude Opus 5.5 | 80.1% · $2.09 | Claude Code 74.9% · $7.49 | |
| AutomationBench | GPT-6-astra | 49.5% · $0.56 | Codex 44.8% · $0.89 |
| Claude Opus 5.5 | 54.4% · $0.19 | Claude Code 47.9% · $0.27 |
With lower-tier models the order reverses. On Terminal-Bench 4 the first-party harness scores higher with GPT-6 Sol (Codex 34.9% vs. 29.2%), Claude Sonnet 5.5 (Claude Code 41.6% vs. 34.9%) and DeepSeek V4.1 Flash (DeepSeek Harness 28.9% vs. 23.8%). Freehand is built for frontier models; with a smaller model, that model's first-party harness may serve you better.
The other baselines, ablations and analysis are in the paper; docs/benchmarks.md shows how to run the benchmarks with Freehand.
Models and providers
| Provider | How to sign in |
|---|---|
| OpenAI (default) | freehand login, with a ChatGPT Plus or Pro plan, or freehand login openai with an API key |
| Anthropic | freehand login anthropic, then freehand --provider anthropic |
| Any OpenAI-compatible Chat Completions API | freehand --provider openai-chat --api-base <url> --api-key-env <VAR> |
| A gateway such as LiteLLM, for GPT, Claude and Gemini behind one key | docs/gateway.md |
/model switches the model, and the provider with it, in a running session.
Security
Freehand is a local tool that acts with your permissions. It has no sandbox and no approval prompt: you draw the boundary around Freehand, and inside it every decision is the model's.
- Commands run as you, with your files, network, credentials and environment variables.
- For code you do not trust, use a container or VM: docs/container.md.
- Repository content is untrusted input.
AGENTS.mdand project skills load only in folders you have trusted. - No telemetry. Freehand talks only to the model service and MCP servers you configure (in the web and desktop interfaces, public web links in replies also load site favicons from Google's favicon service; see docs/security.md).
The full model, including undo, local files and the browser interface, is in docs/security.md. To report a vulnerability, see SECURITY.md.
Development
git clone https://github.com/microsoft/FreeHand.git && cd FreeHand
uv sync --extra dev
uv run pyflakes src tests
uv run pytest -q
The code layout and the rules for a change are in CONTRIBUTING.md and AGENTS.md.
🧭 AgentOpt Series
Freehand is part of the AgentOpt series from Microsoft Research. Each project tackles one part of an agent system: its skills, its training environments, the evaluator that judges it, or the harness it runs in. Projects are listed by release date.
| Project | What it does | Paper | Code | Project page |
|---|---|---|---|---|
| SkillLens | Studies what makes model-generated skills useful, from experience to extraction to use | arXiv | Code | Project page |
| SkillOpt | Trains reusable natural-language skills for frozen agents | arXiv | Code | Project page |
| Resource2Skill | Distills human tutorials and resources into executable agent skills | arXiv | Code | Project page |
| EnvOpt | Builds the training environments an agent needs | arXiv | Code | Project page |
| EvalOpt | Evolves evaluators for open-ended tasks from human feedback | arXiv | Code | Project page |
| Freehand (this repo) | An agent harness that leaves the decisions to the model | arXiv | Code | Project page |
More AgentOpt projects are on the way. Overview: AgentOpt series page.
Contributing
This project welcomes contributions and suggestions. See CONTRIBUTING.md.
Citation
If you find Freehand useful in your research, please cite:
@article{zeng2026freehand,
title = {Freehand: The Bitter Lesson Comes to Agent Harnesses},
author = {Zeng, Zezi and Zhao, Yuke and Tian, Muzhao and Yang, Yifan and Dai, Qi and Liu, Bei and Qiu, Kai
and Zhuang, Bohan and Zhu, Jihua and Luo, Chong},
journal = {arXiv preprint arXiv:2612.02442},
year = {2026}
}
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
Freehand is not affiliated with or endorsed by OpenAI, Anthropic or Google. ChatGPT, Codex, Claude, Claude Code, Gemini and Gemini CLI are trademarks of their owners and are named here only to describe compatibility.
License
MIT. See LICENSE.
Metadata
Release files for freehand-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| freehand_ai-0.1.0.tar.gz | 949.4 kB | Without provenance | Details for freehand_ai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| freehand_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for freehand_ai-0.1.0-py3-none-any.whl |
Total release size: 1.6 MB
Release files / freehand_ai-0.1.0.tar.gz
| Download URL | freehand_ai-0.1.0.tar.gz |
|---|---|
| Size | 949.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23821f53d5d7649fba79c9220ef2c8ed115e3f8a6e559a0650861d6a065a7b5a
|
|
BLAKE2b-256 checksum How to use checksums |
2c61cd0589f8d91856e99a703d222c3a3339929c0a7ad5047c41162c3dae6cac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / freehand_ai-0.1.0-py3-none-any.whl
| Download URL | freehand_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 697.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1d0385ee9eb7a49b422250eb605ec0797b2ab64a0bf545ac480d52786c1386d
|
|
BLAKE2b-256 checksum How to use checksums |
6133682d4d598e361b1f92bc1eebc73de643c1822ea8b4283a78dead3a9857a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for freehand-ai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.