Freehand: The Bitter Lesson Comes to Agent Harnesses
Organizations: Xi’an Jiaotong University · Zhejiang University · Fudan University · Microsoft Research ·
Abstract
The Bitter Lesson holds that knowledge we build into AI systems helps at first and is eventually outgrown by general methods. We show that this lesson has now come to agent harnesses. Mainstream harnesses decide a great deal on the model's behalf -- prompts prescribe how to approach a task, tool suites and timeouts fix how to act, and threshold compaction decides what to remember -- and every such decision is fixed before the model has seen the task. For weaker models these presets are a crutch; for frontier models they become a cage. We introduce Freehand, a general-purpose harness built on one rule: give the model a shell, its own memory, and a meter -- and let it decide everything else. Across five domains and three frontier model families, Freehand is better, cheaper, and faster at the same time. It outscores the first-party harness of every model (Codex, Claude Code, and Gemini CLI) in all 11 settings, by 5.1 points on average at 49% lower cost, and runs fastest on average: in a controlled side-by-side rerun, each of the other harnesses takes 17-62% longer. It also outperforms OpenCode, Pi, DeepSeek Harness, and a bash-only harness that still fixes its workflow and timeouts, while with lower-tier models the first-party harnesses win again. As models grow stronger, the best harness is the one that decides the least. Code: https://github.com/microsoft/FreeHand
Figures & tables
| Harness | Static prefix | A1: Representative rules (examples) | A2: Default tools | A3: Default context management |
|---|---|---|---|---|
| Codex CLI | 15.1K | Parallel batching, rg search, test rules, etc. | 23 | Auto-summarization at 90% window |
| Gemini CLI | 9.5K | Research Strategy Execution & validation | 16 | Threshold compression + output masking |
| Claude Code | 8.5K | Read-before-edit, tool priority & reminders | 22 | Auto-summarization + output clearing |
| DeepSeek Harness | 6.5K | Concurrent sub-agents, read-before-edit & reminders | 34 | 8,192-char output pruning + 80% auto-summary |
| OpenCode | 5.2K | Dedicated-tool priority, batch reads & checks | 10 | Overflow summary + recent-tail retention |
| Pi | 1.2K | Explicit read / edit / write tool rules | 4 | Auto-summarization near window limit |
| Benchmark | Model | Harness | Score (%) | Cost (\downarrow$ | Time (min) |
|---|---|---|---|---|---|
| Terminal-Bench 4 | GPT-6-astra | Codex | 54.6 | 5.88 | 19.0 |
| ( 63 tasks, 5 rounds ) | OpenCode | 54.3 | 5.33 | 21.2 | |
| mini-swe-agent | 53.7 | 4.21 | 19.2 | ||
| Pi | 51.1 | 3.89 | 19.6 | ||
| DeepSeek Harness | 51.1 | 16.24 | 33.2 | ||
| Freehand (Ours) | 57.1 | 3.12 | 18.7 |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| Harness | Inspected release / source | Action & loop highlights | Context & memory highlights |
|---|---|---|---|
| Codex CLI | openai/codex ( 0.167.0-alpha.3.2 ) | 23 entry points on gpt-6-astra OpenAI provider (11 direct + 12 in functions.exec ; 22 on custom provider); read/write parallel locks; active-goal continuation. | Auto-compaction base at 90% window; per-tool output truncation; optional TokenBudget ( new_context_window ) off by default. |
| Claude Code | Official releases 2.1.314 / 2.1.319 | 30+ built-in tools enabled by default in standard sessions (22 active in isolated non-interactive print mode; 25 with SDK stdio); concurrency-safe queue; malformed-tool retry & stop-hook cap (8). | Threshold ; old tool-result micro-clearing; circuit breaker after 3 failed compactions. |
| Gemini CLI | google-gemini/gemini-cli | 16 active tools; parallel batching except edit / update_topic ; continuous pattern detection + adaptive LLM loop checker from turn 30. | Default 50% compression fallback (overridable); 256 KiB old function-response masking; 2-call LLM summary + verification. |
| DeepSeek Harness | deepseek-ai/deepseek-harness ( 0.2.3-alpha.2 ) | Cordis plugin stack; 34 default tools (35 with profileContext ), including 7 sub-agent/workflow tools ( subagent , subagent_fork , workflow ); repeat-tool-reminder at 3/5/8 repeats. | Middle-prunes tool outputs chars (4,096 head + 1,024 tail); structured auto-summary at 80% pressure (16% verbatim tail) + image offload. |
| OpenCode | anomalyco/opencode ( v1.19.5 ) | 10 default callable tools ( gpt.txt , 1,492 words; websearch adds 1 when enabled; Claude swaps apply_patch for edit / write ); fuzzy edit matching; depth-1 Task sub-agents. | Overflow at (or ); retains 2K–15K recent tail; prune off by default. |
| Pi | earendil-works/pi | 4 default tools ( read , write , edit , bash ); parallel tool execution by default; 2,000-line / 50 KiB head/tail truncation. | Auto-compaction when ; preserves 20,000 recent tokens without splitting tool results. |
| Benchmark | Tasks | Rounds | Pinned harness versions | Task set & runner notes |
|---|---|---|---|---|
| Terminal-Bench 4 | 63 | 5 | Codex 0.156.1 ; Claude Code 2.1.299 ; Gemini CLI 0.66.0 ; OpenCode 1.19.0 ; Pi 0.87.1 ; DeepSeek Harness 0.2.2rc2 ; mini-swe-agent 2.4.6 ; Freehand | All 63 validated tasks across all evaluated harnesses and all three frontier model families. |
| TB-Science | 70 | 3 | Codex 0.162.1 ; Claude Code 2.1.299 ; OpenCode 1.19.0 ; Pi 0.87.1 / 1.5.2 ; DeepSeek Harness 0.2.2rc2 ; Freehand | Full 70-task scientific computing suite; official container verifiers. |
| Agents’ Last Exam | 105 | 3 | Codex 0.162.1 ; Claude Code 2.1.299 ; OpenCode 1.19.0 ; Pi 0.87.1 / 1.5.2 ; DeepSeek Harness 0.2.2rc2 ; Freehand | Native-shell runner; all 105 scored tasks across physical, life, quantitative, and software sciences. |
| OSWorld 2.1 | 108 | 3 | Codex 0.153.2 ; Claude Code 2.1.170 ; OpenCode 1.19.0 ; Pi 1.5.2 ; DeepSeek Harness 0.2.2rc2 ; Freehand | 108 Ubuntu desktop tasks across LibreOffice, Chrome, OS/system, GIMP, and VS Code; official post-state evaluators. |
| AutomationBench | 600 | 2 | Codex 0.162.1 ; Claude Code 2.1.299 ; OpenCode 1.19.0 ; Pi 1.5.2 ; DeepSeek Harness 0.2.2rc2 ; Freehand | Full 600-task enterprise workflow suite via Harbor 0.22.0 . |
| Benchmark | Model | Harness | Mean SD | Cost ($) | Time (m) | In Tok (M) | Per-round official scores |
| TB4 ( ) | Astra | Codex | 54.6 1.8 | 5.88 0.27 | 19.0 1.1 | 3.32 | 57.1, 55.6, 54.0, 52.4, 54.0 |
| Astra | OpenCode | 54.3 4.1 | 5.33 0.59 | 21.2 1.1 | 2.87 | 60.3, 55.6, 52.4, 49.2, 54.0 | |
| Astra | mini-swe-agent | 53.7 5.5 | 4.21 0.29 | 19.2 1.0 | 1.79 | 57.1, 50.8, 60.3, 54.0, 46.0 | |
| Astra | Pi | 51.1 2.8 | 3.89 0.22 | 19.6 0.9 | 1.90 | 49.2, 49.2, 52.4, 49.2, 55.6 | |
| Astra | DeepSeek Harness | 51.1 3.6 | 16.24 1.24 | 33.2 1.7 | 10.25 | 52.4, 55.6, 52.4, 49.2, 46.0 | |
| Astra | Freehand | 57.1 3.0 | 3.12 0.09 | 18.7 0.9 | 0.99 | 57.1, 54.0, 57.1, 55.6, 61.9 |
| Benchmark | Variant | Score (%) | Cost ($) | Time (m) | In Tok (M) | Per-round official scores |
| TB4 ( , 5r) | Freehand | 57.1 3.0 | 3.12 0.09 | 18.7 0.9 | 0.99 | 57.1, 54.0, 57.1, 55.6, 61.9 |
| Freehand (w/o Self-Management) | 56.8 2.1 | 3.35 0.35 | 21.1 2.2 | 1.40 | 54.0, 58.7, 55.6, 57.1, 58.7 | |
| Freehand (+Codex Prompt+Tools) | 54.6 2.9 | 4.78 0.23 | 18.3 1.1 | 2.11 | 55.6, 54.0, 54.0, 58.7, 50.8 | |
| mini-swe-agent | 53.7 5.5 | 4.21 0.29 | 19.2 1.0 | 1.79 | 57.1, 50.8, 60.3, 54.0, 46.0 | |
| Codex | 54.6 1.8 | 5.88 0.27 | 19.0 1.1 | 3.32 | 57.1, 55.6, 54.0, 52.4, 54.0 | |
| ALE ( , 3r) | Freehand | 67.5 0.4 | 1.92 0.17 | 14.3 1.4 | 0.59 | 67.0, 67.7, 67.7 |
| Model | Harness | Score (%) | Cost ($) | Time (m) | In Tok (M) | Per-round official scores |
|---|---|---|---|---|---|---|
| GPT-6 Sol | Codex | 34.9 1.9 | 2.42 0.54 | 19.3 2.9 | 8.55 | 33.3, 38.1, 33.3, 34.9, 34.9 |
| Freehand | 29.2 5.2 | 0.97 0.05 | 16.3 1.7 | 2.30 | 30.2, 33.3, 33.3, 28.6, 20.6 | |
| Claude Sonnet 5.5 | Claude Code | 41.6 6.3 | 1.70 0.14 | 27.4 2.8 | 7.14 | 36.5, 47.6, 49.2, 38.1, 36.5 |
| Freehand | 34.9 3.2 | 1.75 0.29 | 26.2 3.1 | 4.46 | 38.1, 38.1, 31.7, 34.9, 31.7 | |
| DeepSeek V4.1 Flash | DeepSeek Harness | 28.9 7.3 | — | 192.2 | 24.72 | 17.5, 36.5, 33.3, 27.0, 30.2 |
| Freehand | 23.8 6.3 | — | 191.9 | 18.46 | 22.2, 15.9, 30.2, 30.2, 20.6 |
| Benchmark | Model | Tasks ( ) | Mean turns | Tasks edited | Edits (all) | Edits (if edited) |
|---|---|---|---|---|---|---|
| AutomationBench | GPT-6-astra / Opus 5.5 | 600 / 600 | 16.4 / 11.2 | 0.2% / 0.2% | / | 1.00 / 1.00 |
| Agents’ Last Exam | Claude Opus 5.5 | 105 | 20.8 | 6.7% | 0.47 | 7.00 |
| Agents’ Last Exam | GPT-6-astra | 105 | 21.8 | 22.9% | 0.62 | 2.71 |
| Terminal-Bench 4 | Claude Opus 5.5 | 63 | 54.0 | 28.6% | 0.37 | 1.28 |
| Terminal-Bench 4 | GPT-6-astra | 63 | 30.2 | 39.7% | 0.97 | 2.44 |
| TB-Science | Claude Opus 5.5 | 70 | 109.6 | 58.6% | 7.56 | 12.90 |
| Freehand vs. | Settings | Macro (pp) | 95% CI | Micro ( ) | Cost red. | 95% CI | Macro ( ) | ||
|---|---|---|---|---|---|---|---|---|---|
| First-party harness | 11 | +5.1 | [+3.3, +7.0] | 0.001 | +5.4 ( 0.001) | 49.2% | [41.5%, 54.9%] | 0.001 | 1.2 (0.380) |
| First-party (Astra & Opus) | 10 | +4.9 | [+3.0, +6.8] | 0.001 | +5.3 ( 0.001) | 51.9% | [42.8%, 58.3%] | 0.001 | 1.3 (0.302) |
| OpenCode | 10 | +6.4 | [+4.5, +8.3] | 0.001 | +5.1 ( 0.001) | 37.5% | [26.9%, 45.2%] | 0.001 | 0.3 (0.840) |
| Pi | 10 | +3.9 | [+2.1, +5.8] | 0.001 | +2.5 ( 0.001) | 28.2% | [17.4%, 36.0%] | 0.001 | 4.8 ( 0.001) |
| DeepSeek Harness | 10 | +5.8 | [+3.7, +7.9] | 0.001 | +5.1 ( 0.001) | 74.7% | [70.1%, 78.5%] | 0.001 | 3.5 ‡ |
| Strongest baseline per setting ∗ | 11 | +2.7 | [+0.9, +4.5] | 0.001 | +1.9 ( 0.001) | 38.6% | [29.2%, 46.7%] | 0.001 | 0.9 ‡ |
| Sensitivity subset | Settings | Macro (pp) | 95% CI | Mean cost red. | 95% CI | Avg-setting red. | ||
|---|---|---|---|---|---|---|---|---|
| Excluding Terminal-Bench 4 | 8 | +4.91 | [+2.93, +6.90] | 0.001 | 54.2% | [43.5%, 61.5%] | 49.5% | 0.001 |
| Excluding TB-Science | 9 | +5.52 | [+3.74, +7.37] | 0.001 | 54.2% | [49.5%, 58.4%] | 48.2% | 0.001 |
| Excluding Agents’ Last Exam | 9 | +5.36 | [+3.15, +7.57] | 0.001 | 48.7% | [40.4%, 54.9%] | 44.9% | 0.001 |
| Excluding OSWorld 2.1 | 9 | +4.80 | [+2.63, +6.95] | 0.001 | 40.0% | [29.5%, 47.6%] | 40.6% | 0.001 |
| Excluding AutomationBench | 9 | +5.02 | [+2.78, +7.29] | 0.001 | 49.4% | [41.6%, 55.1%] | 49.3% | 0.001 |
| Benchmark | Model | Baseline | (pp) | 95% CI | W/T/L | Cost | 95% CI | ( ) | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Terminal-Bench 4 ( ) | GPT-6-astra | Codex † | +2.5 | [ 3.8, +8.9] | 0.414 | 1.00 | 13/45/5 | 0.53 | [0.39, 0.67] | 0.001 / 0.001 | 0.3 (0.818) |
| OpenCode | +2.9 | [ 3.5, +9.5] | 0.390 | 1.00 | 12/44/7 | 0.58 | [0.51, 0.67] | 0.001 / 0.001 | 2.4 (0.009) | ||
| mini-swe-agent | +3.5 | [ 3.5, +10.5] | 0.312 | 1.00 | 14/40/9 | 0.74 | [0.52, 0.98] | 0.025 / 0.001 | 0.4 (0.730) | ||
| Pi | +6.0 | [ 1.6, +14.0] | 0.113 | 1.00 | 15/41/7 | 0.80 | [0.71, 0.91] | 0.001 / 0.001 | 0.6 (0.568) | ||
| DeepSeek Harness | +6.0 | [0.0, +12.7] | 0.042 | 0.834 | 16/40/7 | 0.19 | [0.16, 0.23] | 0.001 / 0.001 | 14.5 ( 0.001) | ||
| Claude Opus 5.5 | Claude Code † | +7.0 | [ 1.0, +14.9] | 0.060 | 1.00 | 20/34/9 | 0.69 | [0.61, 0.78] | 0.001 / 0.001 | 4.3 (0.036) |
| Comparison | Bench. | (pp) | 95% CI | 90% CI (TOST) | Cost | 95% CI | ||
|---|---|---|---|---|---|---|---|---|
| Freehand (w/o Self-Management) Freehand | TB4 | 0.3 | [ 6.0, +5.1] | [ 5.1, +4.4] | 1.00 | 1.07 | [0.97, 1.18] | 0.058 |
| Freehand (w/o Self-Management) Freehand | ALE | +0.3 | [ 2.5, +3.1] | [ 2.0, +2.6] | 0.820 | 1.19 | [1.08, 1.31] | 0.001 |
| Freehand (+Codex Prompt+Tools) Freehand | TB4 | 2.5 | [ 8.9, +3.5] | [ 7.9, +2.5] | 0.428 | 1.54 | [1.29, 1.88] | 0.001 |
| Freehand (+Codex Prompt+Tools) Freehand | ALE | 3.8 | [ 7.6, 0.5] | [ 6.9, 1.0] | 0.016 | 1.68 | [1.43, 2.00] | 0.001 |
| Freehand Codex (GPT-6 Sol) | TB4 | 5.7 | [ 13.0, +1.3] | [ 11.7, 0.0] | 0.057 | 0.40 | [0.29, 0.57] | 0.001 |
| Freehand Claude Code (Claude Sonnet 5.5) | TB4 | 6.7 | [ 13.7, +0.3] | [ 12.4, 1.0] | 0.023 | 1.03 | [0.80, 1.32] | 0.804 |
| Model family (first-party harness) | Lower | Frontier | Reversal (DiD) | 95% CI | ||||
|---|---|---|---|---|---|---|---|---|
| Claude family (Sonnet 5.5 Opus 5.5; Claude Code) | 6.7 | +7.0 | +13.7 | [+4.1, +23.5] | 0.001 | 0.001 | 0.001 | 0.001 |
| GPT-6 family (GPT-6 Sol GPT-6-astra; Codex) | 5.7 | +2.5 | +8.3 | [ 1.6, +18.1] | 0.052 | 0.052 | 0.044 | 0.055 |
| Pooled across both families (63 tasks 5 rounds) | 6.2 | +4.8 | +11.0 | [+3.7, +18.6] | 0.001 | — | 0.001 | 0.002 |
| Harness | Mean Time (min) | Mean Rel. Time | Mean Score (%) |
|---|---|---|---|
| Freehand (Ours) | 6.25 | 1.00 | 69.1 |
| Pi | 7.24 | 1.17 | 59.3 |
| Codex / Claude Code | 7.18 | 1.22 | 59.3 |
| DeepSeek Harness | 6.89 | 1.28 | 61.2 |
| OpenCode | 8.70 | 1.62 | 68.6 |
| Benchmark | Model | Freehand (Ours) | Codex / CC | Pi | OpenCode | DeepSeek Harness | |
|---|---|---|---|---|---|---|---|
| AutomationBench | GPT-6-astra | 20 | 1.97 (1.00 ) | 1.94 (0.98 ) | 1.63 (0.83 ) | 2.45 (1.24 ) | 2.50 (1.26 ) |
| AutomationBench | Claude Opus 5.5 | 20 | 0.77 (1.00 ) | 0.80 (1.04 ) | 0.87 (1.13 ) | 0.84 (1.10 ) | 0.86 (1.11 ) |
| Agents’ Last Exam | GPT-6-astra | 9 | 2.81 (1.00 ) | 3.15 (1.12 ) | 2.33 (0.83 ) | 4.39 (1.56 ) | 3.34 (1.19 ) |
| Agents’ Last Exam | Claude Opus 5.5 | 9 | 1.04 (1.00 ) | 2.03 (1.95 ) | 2.04 (1.96 ) | 2.30 (2.21 ) | 2.22 (2.14 ) |
| OSWorld 2.1 | GPT-6-astra | 9 | 3.62 (1.00 ) | 5.97 (1.65 ) | 5.01 (1.38 ) | 12.13 (3.35 ) | 5.99 (1.66 ) |
| OSWorld 2.1 | Claude Opus 5.5 | 9 | 4.24 (1.00 ) | 7.75 (1.83 ) | 6.33 (1.49 ) | 7.26 (1.71 ) | 4.56 (1.08 ) |
LLM Agent Harnesses
LLM agent harnesses are the software and runtime systems that organize an agent’s tools, context, state, execution, and safeguards.
See all 463 papers