---
title: "Effective harnesses for long-running agents"
description: "Long-running coding agents lose all memory between context windows, and compaction alone doesn't stop them from trying to one-shot an app, leaving half-finished work, or declaring the project done early."
url: "https://swe.quest/articles/effective-harnesses-for-long-running-agents-987ba1b5b74b4050"
canonical: "https://www.anthropic.com/research/effective-harnesses-for-long-running-agents"
source: "Anthropic Engineering"
published: "2025-11-26"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["ai-agents","ai-coding","llms","testing"]
---

# Effective harnesses for long-running agents

A post on [Anthropic Engineering](https://swe.quest/sources/anthropic.md), published 2025-11-26, 9 min read, How-to. Original: [https://www.anthropic.com/research/effective-harnesses-for-long-running-agents](https://www.anthropic.com/research/effective-harnesses-for-long-running-agents)

## Summary

Long-running coding agents lose all memory between context windows, and compaction alone doesn't stop them from trying to one-shot an app, leaving half-finished work, or declaring the project done early. The proposed harness for the Claude Agent SDK splits work between an initializer agent and a coding agent. The initializer writes an init.sh script, a claude-progress.txt log, an initial git commit and a JSON feature list (200+ end-to-end features, all marked failing). Each later coding session reads git logs and progress notes, smoke-tests the app, implements one feature, verifies it end-to-end with browser automation via Puppeteer MCP, then commits and updates progress. JSON proved less prone to inappropriate edits than Markdown, and browser-based testing caught bugs that unit tests and curl missed.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)

## Prerequisites

- LLM context windows ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- coding agents and tool use ([easy posts on AI agents](https://swe.quest/tags/ai-agents.md?difficulty=easy))
- git basics

## Keywords

Claude Agent SDK, Claude Opus 4.5, Puppeteer MCP, MCP, context compaction

## Related posts

- [Agent-driven development in Copilot Applied Science](https://swe.quest/articles/agent-driven-development-in-copilot-applied-science-57df9b7433878456.md): GitHub Engineering · 2026-03-31 · Medium · 9 min read · AI for coding, AI agents, Developer productivity, Evaluation, Testing
  A Copilot Applied Science researcher built eval-agents, a set of Copilot SDK-based agents that automate analysis of coding-agent trajectories from benchmarks like TerminalBench2 and SWEBench-Pro, and developed it primarily through coding agents.
- [Context Engineering Is Just Writing Things Down](https://swe.quest/articles/context-engineering-is-just-writing-things-down-529d8105d51bf0f4.md): Fly.io · 2026-02-23 · Medium · 5 min read · AI for coding, AI agents, Developer productivity
  Agent output quality depends more on project and environment context than on model capability, and that context can be built from plain files on disk.
- [Harness engineering: leveraging Codex in an agent-first world](https://swe.quest/articles/harness-engineering-leveraging-codex-in-an-agent-first-world-2c11ac81997bc6aa.md): OpenAI · 2026-02-11 · Medium · 14 min read · AI for coding, AI agents, Developer productivity, Static analysis, Observability
  A small OpenAI team built and shipped an internal product of roughly a million lines over five months with zero manually written code, merging about 1,500 Codex-authored PRs at around 3.5 PRs per engineer per day, an estimated 10x faster than writing it by hand.
- [Scaling Managed Agents with stable interfaces](https://swe.quest/articles/scaling-managed-agents-with-stable-interfaces-06b4cb4f85923c79.md): Anthropic Engineering · 2026-04-08 · Medium · 9 min read · AI agents, System design, Sandboxing & isolation, Resilience, LLMs
  Claude Managed Agents splits a long-running agent into three virtualized interfaces: an append-only session log, a stateless harness that calls Claude and routes tool calls, and sandboxes reached through a generic \`execute(name, input) → string\` tool call.
- [Our Claude Code Cheatsheet](https://swe.quest/articles/our-claude-code-cheatsheet-ac83fd2d04af578f.md): Neon · 2025-10-14 · Medium · 9 min read · AI for coding, AI agents, Developer productivity
  A Neon engineer's working cheatsheet for Claude Code covers Plan Mode, parallel task agents for multi-lens code review, and context management with /clear, /compact, /context and @file references.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
