A gated Dev → QE → Ops workflow harness built on Claude Code subagents. You hand it a spec; it implements, verifies, and ships a pull request — recording every step to a local SQLite telemetry DB and accumulating lessons in LEARNING.md.
The /harness slash command runs in the main thread as an orchestrator. It does not edit code itself. Instead, it delegates each stage to a dedicated subagent with a self-contained prompt, then enforces a gate before advancing.
Stages:
- Dev (
.claude/agents/dev.md) — implements the spec, writes/runs unit tests. Gate: all unit tests pass. - QE (
.claude/agents/qe.md) — verifies every acceptance criterion against a running build (livecurl, regression checks, server lifecycle cleanup). Gate: every criterion green. - Ops (
.claude/agents/ops.md) — branches, commits, opens a PR viagh, and appends lessons learned toLEARNING.md.
If QE fails, the orchestrator loops back to Dev with the failure context. Maximum 2 Dev → QE cycles before the run aborts as harness_failed. Ops never runs on a failed gate.
Persistence:
- Telemetry —
tools/telemetry-mcpis a local MCP server that appends events (harness_started,delegation_start/end,gate_decision,loopback,harness_completed, …) to a SQLite DB. Records what happened. - LEARNING.md — durable, human-readable lessons appended at the end of each run (or when something noteworthy occurs). Records what was learned.
┌────────────────────────────────────────────────┐
│ /harness <spec.md> │
│ (orchestrator — main thread) │
└────────────────────────────────────────────────┘
│
│ reads LEARNING.md + spec
▼
┌────────────────────────────────────────────────────┐
│ │
▼ │ loopback
┌─────────┐ pass ┌─────────┐ pass ┌─────────┐ │ (max 2 cycles)
│ Dev │──────────▶│ QE │──────────▶│ Ops │ │
│ subagent│ │ subagent│ │ subagent│ │
└─────────┘ └─────────┘ └─────────┘ │
│ │ │ │
│ fail │ fail │ │
└──────────┐ └──────────┐ ▼ │
│ │ ┌────────────┐ │
│ │ │ gh PR url │ │
▼ ▼ └────────────┘ │
┌───────────────────────────────┐ │
│ re-spawn Dev w/ failure ctx │────────────────┘
└───────────────────────────────┘
every transition ──▶ mcp__telemetry__recordTelemetry ──▶ telemetry.db
end of run ──▶ append lessons ──▶ LEARNING.md
.claude/
agents/ dev.md qe.md ops.md planner.md (subagent definitions)
commands/ harness.md (the /harness slash command)
specs/ goodbye-endpoint.md hello-world-api.md
tools/
telemetry-mcp/ (local MCP server, SQLite events)
agent-memory/
hello-world-api/ (sample target project)
LEARNING.md (accumulated lessons)
Run the bundled goodbye-endpoint spec end-to-end.
- Node.js ≥ 18,
npm - Claude Code CLI
ghCLI authenticated (gh auth status) — needed for Ops to open a PR- Git repo with a remote (
git remote -v)
-
Clone and enter the repo:
git clone <this-repo-url> cd agent-harness-with-claude-code
-
Install the sample project's deps (so Dev/QE can run tests):
cd hello-world-api && npm install && cd ..
-
Launch Claude Code from the repo root:
claude
-
Run the harness against the goodbye-endpoint spec:
/harness specs/goodbye-endpoint.md -
Watch the operator status lines. Expected sequence:
▶ [1/3] Dev — delegating to dev agent ... ✓ Dev passed ▶ [2/3] QE — delegating to qe agent ... ✓ QE passed ▶ [3/3] Ops — delegating to ops agent ... ✓ Ops — PR: https://github.com/<you>/.../pull/<n> ✓ harness_completed — PR <url>
Adds GET /goodbye to hello-world-api mirroring GET /hello:
GET /goodbye→{"message":"Goodbye, World!"}GET /goodbye?name=Foo→{"message":"Goodbye, Foo!"}- New
tests/goodbye.test.jswith two supertest cases - All existing tests still pass; unknown routes still return 404
After the run you'll see a new PR on GitHub, a new commit on a feature/goodbye-endpoint* branch, and any noteworthy observations appended to LEARNING.md.
Drop a markdown file into specs/ with these sections (see specs/goodbye-endpoint.md as a template):
- Objective — one paragraph
- Module Contracts — files to add/modify
- Endpoint / Behavior Specification — exact inputs and outputs
- Test Specification — concrete test cases
- Acceptance Criteria — checkboxes QE will verify one by one
- File List — paths touched
- Out of Scope — explicit non-goals
Then: /harness specs/<your-spec>.md.
Events stream to a SQLite DB via the mcp__telemetry__recordTelemetry tool exposed by tools/telemetry-mcp. Inspect runs with sqlite3 against the DB the MCP server writes to.
- Ops will detect missing git repo / remote and surface a clear message rather than fail mid-stage.
- The harness runs autonomously between gates — no per-stage prompts. Only blockers and terminal states are surfaced.
- LEARNING.md is read at the start of every run and re-consulted on stage failure; lessons feed forward into subsequent runs.