Recipes

Long-horizon computer-use loop harness for Codex and OpenCode agents

Discovered from README cross-links · 2 days ago

Software & DevOps

Wrap existing coding agents in a durable plan-act-verify loop for long tasks.

What they did

They took an existing agent backend (Codex and OpenCode, with Claude Code and DeepSeek also supported) and wrapped it in LongHorizon-Harness, a loop-engineering layer rather than a new model. Instead of giving the agent one prompt and hoping it finishes, they installed the harness with its one-command setup and handed it a single goal. The harness then ran the cycle repeatedly: recover the goal and verified state, pick the next bounded step, execute it in a fresh context, check the real result in the computer environment, then either checkpoint accepted progress or feed failure evidence into the next round. Because each round starts with a fresh context, long runs survive context refreshes, and because verification happens against the actual desktop or terminal state, the agent cannot simply claim success. They used the workbench conversation to read replies and send follow-ups mid-run, letting a finished run continue on its own round ledger instead of replanning from scratch.

How it went

The loop turns single-shot agents into multi-hour workers that checkpoint progress and recover from failure instead of stalling. The project reports measured gains on WeaveBench, OSWorld 2.0, and Terminal-Bench 2.1, and ships frequent point releases fixing approvals, MCP isolation, and output encoding. Polish is high for a research-grade harness: versioned releases, a project website, an arXiv paper, and bilingual docs.

Worth knowing

This is a research harness, not a polished product; Windows has documented limitations and the trajectory dataset is still marked coming soon. It does not train or replace a model, so quality still depends heavily on the underlying backend. Long runs consume real tokens and time, and desktop control needs a working GUI environment plus approval handling. Expect to tune reasoning effort and timeouts per role.

Wiring

Install the harness (Python >=3.10) and point it at a backend: Codex, OpenCode, Claude Code, or DeepSeek Harness. The Manager role decomposes the goal and routes bounded steps; worker rounds execute each step in a fresh context against the desktop or terminal; a verifier checks the real environment state before a checkpoint is accepted. Accepted progress is written to a round ledger, and failures are recorded as evidence for the next round. Follow-up messages sent mid-round are claimed by the next round, so stopping and resuming does not drop them. CLI flags include --reasoning-effort for all roles with per-role overrides such as --manager-reasoning-effort, plus --final-response-timeout for slower closing replies. MCP isolation is handled per backend.

Try it yourself

Set up LongHorizon-Harness in this repo and use Codex as the backend. Read the README and install with the one-command setup, then configure a run that targets this project: give it one goal — audit the test suite, fix failing tests one at a time, and verify each fix by actually running the tests — and let the harness loop plan, act, verify, and checkpoint until the suite is green. Show me the round ledger and the checkpoint files it produces, and tell me which config keys control reasoning effort, final-response timeout, and approval behavior.

Source

Tools in this stack