repo-harness is a CLI, a set of hooks and a set of skills that wrap an existing repository so that can do long-running engineering work in it — across sessions, machines and worktrees — and leave...
Overview
repo-harness is a CLI, a set of hooks and a set of skills that wrap an existing repository so that can do long-running engineering work in it — across sessions, machines and worktrees — and leave...
README
repo-harness is a CLI, a set of hooks and a set of skills that wrap an existing
repository so that Claude, Codex and Pi can do long-running engineering work
in it — across sessions, machines and worktrees — and leave behind evidence a
human can review in minutes.
It is built for solo developers and small teams who let AI write the code and keep the human job to one thing: deciding whether to accept the change.
Why
Coding agents are fast, but three things break as soon as work spans more than one chat:
| Without a harness | With repo-harness |
|---|---|
| Context lives in a chat thread and dies with it. | The GitHub issue and PR own the task. Any new session re-reads them and resumes the exact next step. |
| Every session re-greps the repo to rediscover its structure. | A ~12 KB stable root context, ~1 KB capability contracts loaded only for the files being touched, and a CodeGraph index for callers/callees. |
| “Done” means “the agent said it’s done.” | The PR carries changed files, executed checks, residual risk and rollback. Execution evidence and acceptance are separate, typed authorities. |
| Agents wander outside the repo or into private folders. | Typed hooks guard the edit boundary and print one [Guard] reason + one Fix: line when they block. |
Quick start
Prerequisites: a Git working tree, Bun ≥ 1.4.0 (the
installer installs or upgrades it for you), and hc
(herdr-core) for host readiness. macOS/Linux need bash; Windows needs Git for
Windows. No Node.js required.
# 1. Install the CLI and user-level hook adapters
curl -fsSL https://raw.githubusercontent.com/aimpact-inc/repo-harness/main/install.sh | sh
# Windows (PowerShell)
irm https://raw.githubusercontent.com/aimpact-inc/repo-harness/main/install.ps1 | iex
Already have Bun? Use bunx -p repo-harness@latest rh install instead.
# 2. From the root of the repository you want to adopt: preview, then apply
rh init --dry-run # reports every file it would write; writes nothing
rh init
Init ends with a === Migration Report === that lists what was created or
refreshed and an --- External Tooling --- readiness block. That’s it — open
Claude or Codex in the repo, hand it an issue, and the hooks take over.
Upgrading, uninstalling, Pi, Windows tool pinning and cleanup semantics are in the usage guide.
How it works
flowchart TB
Issue["GitHub issuescope · deps · acceptance"] --> Start
subgraph Session["Agent session (Claude · Codex · Pi)"]
direction LR
Start["SessionStart hookloads context + state pointers"] --> Work["Bounded workbranch or worktree"]
Work --> Guard["Edit guardsscope · _ops/ · _ref/"]
Guard --> Verify["Typecheck +affected tests"]
Verify -->|fail| Work
end
Verify -->|pass| PR["Pull requestchanges · checks · risk · rollback"]
PR --> Review["Acceptance reviewwhen risk requires it"]
Review --> Merge["Mergepublication merge"]
Work -. Stop hook .-> Checkpoint["Evidence checkpointpublishes accepted evidence only"]
PR -. next session re-reads issue, PR, branch .-> Start
Three layers, each with one owner:
| Layer | What lives there | Owner |
|---|---|---|
| Task authority | Scope, claims, status, dependencies, review evidence | The GitHub issue and its PR |
| Repo context | docs/spec.md, docs/prds/, docs/reference-configs/, tasks/lessons.md, .ai/context/, .ai/harness/ |
Your repository (written by rh init) |
| Runtime | CLI, typed hook handlers, helpers (rh run ), skills |
The globally installed package — never vendored into your repo |
The user-level adapters in ~/.claude/settings.json and ~/.codex/hooks.json
route host events into repo-harness-hook. For repositories that haven’t opted
in, the hook exits silently.
One task, two sessions
A session can end in the middle of a task. The next session — on another day, host or agent — continues from the branch, the issue and the PR, not from the old chat. No local handoff file is written:
sequenceDiagram
autonumber
participant I as GitHub issue + PR
participant A as Session A (Codex)
participant R as Repo files
participant B as Session B (Claude)
A->>I: Read scope, claims, linked PRs
A->>R: Work on a branch, run checks
A->>I: Push commits, write result and next step in the PR
Note over A: Session ends (context limit, reboot)
A-->>R: Stop hook publishes the existing evidence checkpoint
B->>R: SessionStart emits Effective State(issue + branch from the branch name)
B->>I: Re-read issue, latest claim, PR
B->>R: Continue from the step the PR names
B->>I: Final checks, risk and rollback in PR
Design principles
- Files over chat. Durable truth lives in the issue, the PR and repo files. Chat history, transcripts and agent memory are caches.
- Evidence over narration. A passing check proves a command ran; acceptance is its own receipt. Reviewers read the PR description first, then the diff and the trace.
- Guardrails, not autopilot. Hooks load context and enforce edit boundaries. They never make product decisions, merge, publish or bypass review.
- The Bot decides, the harness supplies. repo-harness keeps no scheduler, budget ledger or unattended controller. Your Bot (or you) schedules work through the CLI and Herdr; repo-harness provides the tools and the evidence.
- Lean context. Load the smallest stable context, then only the capability blocks the touched files need.
What you get
| Session continuity | The branch names the issue; the issue and PR carry scope and the next step, so any agent resumes without the original chat. |
| Typed hook runtime | 6 public routes (Claude 5, Codex 5), each bound to exactly one in-process handler. |
| Safety hook | CredentialGuard (I1), UserFileGuard (I2), RecursiveDeleteGuard, EditScopeGuard, ApplyPatchScopeGuard. |
| Progressive context | Root context plus per-capability contracts, backed by ArchContext and CodeGraph. |
| Acceptance review | A persistent, sandboxed reviewer in a linked checkout, up to three repair rounds per PR. |
| Operator console | A loopback-only local web board for tasks, repos, agents, skills, hooks and architecture. |
| Refactor signals | Measured cycles and layering violations with evidence; you accept, defer or reject. |
| MCP sidecar | Lets a local MCP client read real repo state and write PRDs, with no source-code write access by default. |
Command cheat sheet
| Goal | Command |
|---|---|
| Install / reconcile the global runtime | rh install · rh update |
| Read-only health check | rh setup check |
| Adopt a repository | rh init --dry-run → rh init |
| Run a workflow helper | rh run |
| Board for a parent issue | rh board --parent --json |
| List open parent issues | rh board parents --json |
Open the local console (needs the operator plugin: rh install --plugins ,operator) |
rh operator serve |
Clean up finished worktrees (needs the operator plugin) |
rh worktrees list → rh worktrees clean --ids … --expected-digest … |
| Architecture facts / review prompt | rh arch module list --json · rh arch module review-prompt --json |
| Refactor suggestions | rh arch refactor recommendations · rh arch refactor decide accept|defer|reject --reason "…" |
| Acceptance review | rh review round|status|close … (details) |
| Merge an accepted PR | rh publication merge (policy) |
MCP sidecar (needs the mcp plugin: rh install --plugins ,mcp) |
rh mcp serve --repo . --profile planner · rh mcp doctor --repo . |
| Reference docs | rh docs list · rh docs show harness-overview |
| Remove leftovers / uninstall | rh upgrade [--apply] · rh uninstall --dry-run |
Reviewing agent work
Start with the PR description: goal, scope, changes, commands that passed,
external acceptance, residual risk and rollback. Then the diff, then the latest
run trace. Accept only when checks pass and external acceptance is pass,
not_required, or an explicit override.
| Agents read first | Humans review first |
|---|---|
| The current prompt and referenced files | PR description |
AGENTS.md / CLAUDE.md |
Changed files and diff |
| The GitHub issue and PR | Verification records and run trace |
| Latest claim status on the issue | Residual risk and rollback |
When summaries disagree with the issue, PR or checks, the source artifacts win.
Execution evidence and acceptance are separate authorities. A green check is not an approval, and a reviewer record is not a merge permission:
flowchart LR
Checks["Checks ranexecution evidence"] --> Receipt
Review["Acceptance reviewpass · not_required · override"] --> Receipt
Receipt["Acceptance receiptbound to the final content"] --> Gate{"Base-branch policyacceptance_merge = on?"}
Gate -->|yes| Merge["publication merge"]
Gate -->|no| Human["Human merges"]
Operator console
rh operator serve starts a local web board on loopback only. It
shows what needs you, what to continue, stage counts and today’s merges across
every registered repository. It needs the operator plugin, which an all
selection includes.
The console is read-only except for three bounded writes: local agent config, docs sessions that return a Draft PR, and worktree cleanup. It never sends messages to coding sessions or dispatches work. Details: usage guide.
Skills
Both hosts get the same skill names. Bot skills choose scope, workers and acceptance; Worker skills carry out assigned steps.
| Skill | Group | Purpose |
|---|---|---|
repo-harness |
Bot | Route explicit harness actions |
repo-harness-check |
Bot | Plan scoped work, review plans, assess recorded checks |
repo-harness-product |
Bot | PRD drafting and Goal preparation |
repo-harness-issue-flow |
Bot | Issue/PR-driven multi-agent development: split, dispatch, follow CI |
repo-harness-ship |
Bot | Explicit publication and cleanup decisions |
repo-harness-cross-review |
Bot | Generic review |
obsidian-memory |
Bot | Explicit memory recall or persistence |
repo-harness-setup |
Worker | Install, migration, repair or scaffold |
repo-harness-test |
Worker | Source tests and real fixtures |
repo-harness-architecture |
Worker | Model, projection or diagram work |
repo-harness-archimap |
Worker | Refresh the architecture map docs/architecture/archimap.html |
windows-python-first |
Worker | Native Windows file and shell work through Python |
The manifest at assets/skill-commands/manifest.json is the source of truth.
merge-gate is a CLI judge and has no packaged SKILL.md. hooks-init,
docs-init and create-project-dirs are internal init steps, not public
commands. More in the usage guide.
Supported hosts
| Host | Hooks | Notes |
|---|---|---|
| Claude | 5 routes via ~/.claude/settings.json |
Full session, edit, bash, subagent and Stop coverage |
| Codex | 5 routes via ~/.codex/hooks.json |
Mark the hooks file as trusted in Codex Settings |
| Pi | Session, notices, edit/write, bash, Stop | Optional; registered automatically when pi is on PATH |
What repo-harness is not
- Not a hosted agent gateway, product runtime or database service.
- Not a replacement for your repo’s build, test, deploy or release process.
- Not a scheduler: it never dispatches work on its own or executes refactors.
- Not vendored: downstream repos call
rh run; no helper scripts are copied into them.
Documentation
| Topic | Where |
|---|---|
| Install in depth, update, upgrade cleanup, uninstall, rollback | docs/usage.md |
| Harness overview: flow, roles, tools | harness-overview.md |
| Hook routes, guards and debugging | hook-operations.md |
| Agentic development flow (Geju, P1/P2/P3, PRDs) | agentic-development-flow.md |
| Install profiles and plugins | install-profiles.md |
| Bot integration and merge policy | control-bot-boundary.md |
| MCP sidecar | general-repo-mcp.md |
| External tooling (herdr, CodeGraph, ArchContext) | external-tooling.md |
| Architecture map | docs/architecture/ |
| Product spec | docs/spec.md |
Contributing
git clone https://github.com/aimpact-inc/repo-harness.git ~/Projects/repo-harness
cd ~/Projects/repo-harness && bun src/cli/index.ts update
bun run check:ci # the single CI-equivalent gate
Hook handlers live in src/cli/hook/, helpers in scripts/, canonical
reference docs in assets/reference-configs/ (projected into
docs/reference-configs/). See the maintainer reference
for release lanes and skill sync.
Acknowledgements
| Tool or repo | Used for |
|---|---|
| Hylarucoder / Geju | The P1/P2/P3 due-diligence method behind the planning and decision discipline |
Waza by TW93 (think, hunt, check, health) |
Daily planning, bug hunts, verification and health checks |
mermaid |
Authoring and readability review for architecture diagrams |
herdr (hc) |
Peer-terminal runtime: dispatch, collaboration, hosting the acceptance reviewer |
CodeGraph (@colbymchenry/codegraph) |
Symbol-aware navigation and impact tracing |
None of these are bundled dependencies; see external tooling for how each is installed.
Release & license
- npm:
[email protected]· workflow stamp[email protected][email protected] - History:
docs/CHANGELOG.md - License: MIT — see
LICENSE
Recommended Tools
Try a different keyword or remove a filter.
Install
npx skillfish add ancienttwo/repo-harness