Skip to content

Setup

This guide takes a repository from zero to a working repo-harness workflow: install the runtime, adopt the repo, wire your agent’s hooks, and confirm the guards fire.

A git repository

repo-harness is repo-local. Run it from a git work tree — git init first if the folder isn’t one yet.

An agent

Claude Code or the Codex CLI as the executor. ChatGPT Pro is optional, for planning.

Bun

The CLI runs on Bun — the installer pulls it in if it’s missing. No Node setup required.

Get the repo-harness binary onto your machine with whichever entry point fits:

Terminal window
# macOS / Linux — installs Bun if missing, then the CLI
curl -fsSL https://raw.githubusercontent.com/Ancienttwo/repo-harness/main/install.sh | sh
  1. Run init once per machine. It’s idempotent — it wires the host hook adapters, the Waza skills, and the CodeGraph index for every project you’ll use:

    Terminal window
    repo-harness init
    # ✓ host adapters · skills · CodeGraph configured
  2. Check readiness any time (read-only):

    Terminal window
    repo-harness status # CLI version, host install state, route coverage
    repo-harness doctor # PATH, version, hosts, trust state
  1. From the root of your repo, preview what will change. Nothing is written:

    Terminal window
    repo-harness adopt --dry-run # Migration Report
  2. Apply the repo-local contract:

    Terminal window
    repo-harness adopt

Adopt inspects the repo, installs the workflow files, wires the hooks, builds the CodeGraph index, and runs the workflow check. The tree it lays down:

  • AGENTS.md Codex routing contract
  • CLAUDE.md Claude Code routing contract
  • Directory.ai/
    • Directoryharness/ contract, policy, checks, handoff
    • Directorycontext/ context-map + capabilities
    • Directoryhooks/ repo-local hook runtime
  • Directorydocs/
    • spec.md product truth
  • Directoryplans/ timestamped plan catalog
  • Directorytasks/
    • Directorycontracts/ edit-scope authority
    • Directoryreviews/ completion gates
  • Directoryscripts/ workflow helpers

init installs host adapters that dispatch editor events into repo-harness. Point your agent at them, then restart the session so the hooks load.

The adapter lives in your user settings — ~/.claude/settings.json — and routes every SessionStart, PreToolUse, PostToolUse, UserPromptSubmit, and Stop event into the harness. Restart Claude Code to pick it up.

  1. Prompt routing — submit any prompt. The UserPromptSubmit hook classifies intent and surfaces plan status in its advisory output.

  2. The edit guard — ask the agent to edit a file before any plan is approved. The PreToolUse.edit guard fails closed and blocks the write until you capture a plan.

  3. The workflow check — run the gate directly:

    Terminal window
    bash scripts/check-task-workflow.sh --strict

A green check means the contract surface is consistent and the guards are armed.

Want ChatGPT Pro reading your plans without touching source? Expose only the workflow files through a local MCP sidecar:

Terminal window
repo-harness mcp setup chatgpt --repo .
repo-harness mcp serve --transport http \
--host 127.0.0.1 --port 8765 --profile planner

Full details — including the read-only safety boundary — are on the ChatGPT Pro planner page.