type: user

role: user

content: Fetch the README for https://github.com/anthropics/cwc-long-running-agents via WebFetch at https://raw.githubusercontent.com/anthropics/cwc-long-running-agents/main/README.md. If that 404s, try https://raw.githubusercontent.com/anthropics/cwc-long-running-agents/master/README.md. Also try fetching https://api.github.com/repos/anthropics/cwc-long-running-agents to get repo metadata (description, topics, created_at). Return all content you find. Research only — no file writes.

userType: external

entrypoint: sdk-ts

gitBranch: HEAD

slug: mellow-wobbling-swan


type: attachment


type: message

role: assistant

type: text

text: I'll fetch the README and repository metadata for you using WebFetch.

service_tier: standard

attributionAgent: Explore

type: assistant


ToolSearch

query: select:WebFetch

type: direct

speed: standard


tool_name: WebFetch


text: Now I'll fetch the README and repository metadata:


WebFetch

prompt: Return the complete README content


prompt: Extract the repository description, topics, and created_at date


content:
Based on the provided repository data:

**Description:** The repository has no description listed.

**Topics:** No topics are assigned to this repository.

**Created Date:** May 6, 2026

The repository "cwc-long-running-agents" is owned by Anthropics and is publicly available under the Apache License 2.0. It currently has 491 stargazers and 55 forks.


content:
# Harness Primitives for Long-Running Claude Agents - Complete README

## Overview

This repository provides modular, reusable building blocks for constructing sophisticated agent harnesses. The content demonstrates how Claude Code's `/goal` command works under the hood and lets developers assemble customized versions suited to their specific needs.

## Core Concept

The repository ships three fundamental mechanisms that form a quality loop:

1. **Default-FAIL Contract** - Every criterion begins in a false state; agents must present evidence before marking tasks complete
2. **Fresh-Context Evaluator** - A separate agent without write capabilities grades work from a clean context window
3. **Agent-Maintained Handoff** - Agents document progress and commit work to version control for seamless session continuity

Two additional operator-control mechanisms enable monitoring and mid-run intervention.

## Key Differences: Built-In vs. Custom

| Aspect | `/goal` Feature | Custom Harness |
|--------|-----------------|-----------------|
| Loop Runner | Claude Code's built-in system | Your own implementation |
| Completion Judge | Separate fast model | Your evaluator agent |
| Compatibility | Interactive Claude Code, headless mode, Remote Control | Claude Code, headless, Agent SDK |

## Implementation Approaches

### Option 1: Use `/goal` Directly
A single-line command within Claude Code that leverages a separate model to monitor completion conditions after every turn.

### Option 2: Custom Loop with Evaluator
Implement your own cycle using a contract file (`test-results.json`), verification hooks, and a dedicated evaluator subagent. This approach works across Claude Code, headless environments, and the Agent SDK.

## Getting Started

**Quick start:** Copy the `.claude/` directory from this repository into your project root and make hook scripts executable.

**Selective approach:** Each primitive is self-contained; review files individually and adopt only what serves your use case.

## The Three Core Primitives Explained

### Default-FAIL Contract
Prevents premature success claims by requiring agents to read evidence files before updating a results file. The hook layer enforces this structurally rather than relying on prompt instructions alone.

### Fresh-Context Evaluator
A specialized subagent reviews completed work against specifications without having participated in the build process, providing objective pass/fail verdicts and specific improvement guidance.

### Agent-Maintained Handoff
Agents write structured progress notes and commit incremental work to git. New sessions read these notes first, maintaining continuity across context windows.

## Monitoring Long Runs

The repository enables terminal-based observation without dashboards:

```
watch -n 2 'tail -20 PROGRESS.md'              # Agent's notes
watch -n 5 'git log --oneline -8'              # Saved work
watch -n 5 'find screenshots -name "*.png" | tail -5'  # Observations
```

## Advanced Patterns

The documentation references additional layers including unattended loops, planner agents, sprint contracts, grading rubrics, browser-based evaluation, and model-version adaptation strategies.

## Scope and Disclaimer

This repository represents example patterns from Anthropic's engineering research, not a production-ready system. It's designed as a reference for understanding agent harness architecture and a starting point for customization rather than a turnkey solution.


text:
Perfect! I've successfully fetched both resources. Here's what I found:

## README Content

The repository contains documentation for **Harness Primitives for Long-Running Claude Agents**. Key highlights include:

**Core Concept:**
- Three fundamental mechanisms forming a quality loop:
  1. Default-FAIL Contract - criteria start false; agents must present evidence before marking tasks complete
  2. Fresh-Context Evaluator - separate agent without write capabilities grades work from clean context
  3. Agent-Maintained Handoff - agents document progress and commit work to version control

**Two Implementation Approaches:**
1. Use `/goal` directly within Claude Code (single-line command)
2. Custom loop with evaluator using contract files, verification hooks, and dedicated evaluator subagent

**Key Features:**
- Comparison table showing differences between `/goal` feature vs. custom harness
- Three core primitives explained in detail
- Monitoring patterns using terminal commands (watch, tail, git log)
- Reference to advanced patterns (unattended loops, planner agents, sprint contracts, grading rubrics)
- Note that this is example patterns from Anthropic's engineering research, not production-ready

**Quick Start:** Copy `.claude/` directory and make hook scripts executable

## Repository Metadata

- **Owner:** anthropics
- **Created:** May 6, 2026
- **License:** Apache License 2.0
- **Visibility:** Public
- **Stars:** 491
- **Forks:** 55
- **Description:** None listed
- **Topics:** None assigned

The repository is a reference implementation designed for understanding agent harness architecture and as a starting point for customization.