claude-harness-loop
A Planner / Evaluator / Generator harness for Claude Code. Drives
development end-to-end from a GitHub issue through a frozen contract,
gated review, and PR creation — with memory-backed recall so the harness
compounds value across runs.
Status: v0.1.0 — Phases 1, 2, 3, 5, 6, 7 shipped. Phase 4 Generator
lands in a separate cycle. Suitable for pilot use on low-stakes issues
today; treat it as a sharp tool.
What it does
You create a GitHub issue with verifiable acceptance criteria. You run:
/harness-loop <issue-number>
The harness then:
- Plans — the Planner subagent reads the issue, recalls past related
work from Kagura Memory Cloud, detects affected code areas, and emits a
frozen JSON contract with per-criterion verification channels
- Gate 1 — dispatches CxO / PhD reviewers from the
claude-c-suite
and claude-phd-panel plugins against the contract. [C] findings
loop back to the Planner for a re-plan.
- Generates — the Generator subagent (Phase 4, landing separately)
implements the changes
- Evaluates — the Evaluator subagent runs each contract's channel
(
make test-*, Playwright MCP, live MCP tool calls, or /self-review),
binds pass/fail to real exit codes, and writes a verdict. If any
contract fails, the Generator is recalled for another iteration.
- Gate 2 — pre-PR review with another round of CxO reviewers
- PR — creates the PR with
Closes #N
- Gate 3 — release audit, only for release PRs
- Persists — writes a run record to memory so future Planners can
recall it
The "why" of the design — Evaluator before Generator, gates outside
the inner loop, exit-code-bound pass/fail — is in
rules/harness-contract.md.
Dependencies
This plugin has three hard dependencies that must be installed and
configured before /harness-loop will work. The setup order matters —
each dependency below is assumed by the next.
1. Kagura Memory Cloud (required) — two parts
Memory is a hard dependency for the harness. The Planner calls
recall to find past related work. The Evaluator runs the promotion
test against prior troubleshooting memories. /harness-loop persists a
run record via /kagura-memory:remember on every outcome so future
Planners can see what failed and why. Without memory, the harness
degenerates into a one-shot code generator with no compounding value.
You need both a running MCP server and the kagura-memory Claude
Code plugin. They ship from the same repository.
1a. Run a Kagura Memory Cloud MCP server
Self-host from
kagura-ai/memory-cloud.
The README there has Docker Compose instructions. You will end up with
a running MCP server (default: http://localhost:8080) and an API key
scoped to a workspace.
Copy .mcp.json.example to .mcp.json in your project root and fill
in your workspace URL and bearer token:
cp .mcp.json.example .mcp.json
# edit .mcp.json — replace YOUR_WORKSPACE_ID and YOUR_KAGURA_API_KEY
After Claude Code reloads, mcp__kagura-memory__recall and
mcp__kagura-memory__remember should be available as tools. The
Planner and Evaluator call these tools directly.
1b. Install the kagura-memory Claude Code plugin
The /kagura-memory:* slash commands are not part of the MCP
server — they are a separate Claude Code plugin that ships from the
same kagura-ai/memory-cloud repository. /harness-loop calls
/kagura-memory:remember for its run-record persistence step, so the
plugin must be installed alongside the MCP server:
/plugin marketplace add kagura-ai/memory-cloud
/plugin install kagura-memory
After install, these commands become available:
| Command | Used by |
|---|
/kagura-memory:recall | Manual recall during debugging |
/kagura-memory:remember | Called by /harness-loop for run records |
/kagura-memory:session-start | Resume workflow on new sessions |
/kagura-memory:session-summary | Save end-of-session state |
/kagura-memory:guide | Usage help for the memory stack |
/kagura-memory:smoke-test | Verify MCP connectivity after setup |
Verify setup by running /kagura-memory:smoke-test once after
installing both 1a and 1b — it runs a full round-trip and tells you
exactly which step failed if something is wrong.
2. Reviewer plugins for gate1 / gate2 (required)
What they provide: the CxO and PhD reviewer subagents that the
harness dispatches at phase boundaries. Without them, gate1_planner_review
and gate2_pre_pr_review have no one to call — the harness will either
skip the gates (if they are marked enabled: false in the contract) or
fail at the dispatch step.
Install:
# Executive team perspectives (CEO, CTO, PM, CSO, CDO, CAIO, ...)
/plugin marketplace add JFK/claude-c-suite-plugin
/plugin install claude-c-suite