Agent harness in Go

A small agent harness that streams model output, runs tool calls, cancels cleanly, and replays any failed run from its log.

Builder · 2026–

What it is

A small agent harness written in Go. It runs the agent loop: stream the model's output, execute tool calls, feed results back, and repeat until the task is done. The design follows Fan et al. (2026) on ablating harness components, so every major piece can be switched on or off by a config flag.

How it's built

  • The loop. Streaming, tool calling, and clean cancellation built on goroutines and channels. Transcript state is explicit, and each turn writes a log so any run can be replayed.
  • Ablation flags. Planning, the action space, and context management are each controlled by a config flag.
  • Context management. The system prompt, the task, and recent turns stay verbatim. Old tool outputs become stubs at about 60% of the window, and the oldest middle turns are summarized past about 85%.
  • Planning. An update_plan tool is injected fresh each turn.
  • Action space. Typed tools or bash-only, chosen per model.
  • Safety rails. Read before write, a lint check after each edit, and stuck detection that nudges after 5 identical calls and stops after 8 identical failures.