x-harness is a small, opinionated verification harness for AI coding agents. It does not run your agents, replace your CI, or guarantee that code is correct. It does one bounded job:
Turn an AI agent's "I'm done" claim into an auditable admission decision — accepted or withheld — against a repository policy.
It works locally, offline, and file-first. No daemon, no database, no server, no MCP service, no LLM calls, no network credentials. The source of truth is the files in your repository: schemas, policies, templates, and completion cards.
How is it different from existing tools?
Concern
Typical AI tooling
x-harness
Who decides "done"?
The agent itself
A read-only verification gate in this repo
Where does state live?
A remote server / SaaS
Files in your repository
Does it need a runtime?
Often a daemon, MCP, or cloud service
No. A single static binary
Is the decision auditable?
Hidden inside a model or dashboard
A structured completion card + JSONL trace
Is verification trusted?
Mixed with generation
Decoupled.verify never edits the work product
Can it fail closed?
Often "best effort"
Yes. Anything other than success is withheld
In short: x-harness is not an agent runtime, an issue tracker, a planning system, an LLM gateway, or a deployment engine. It is a policy gate that decides whether an agent's claim of completion should be admitted.
The core idea in 60 seconds
Agent writes code
│
▼
Agent writes a "completion card" (a small YAML file)
│
▼
xh verify --card completion-card.yaml
│
▼
Read-only verification gate evaluates the card
against schemas + policies (no source mutation)
│
▼
┌───────────────────────────────────────────┐
│ acceptance_status: accepted → exit 0 │ ✅ done
│ acceptance_status: withheld → exit 1 │ 🚧 not done, with a recovery path
└───────────────────────────────────────────┘
check is an alias for verify — both run the same read-only gate.
The verifier is read-only. It inspects your card and evidence; it never edits your source to "fix" things while checking. The agent must produce a passing card itself.
Beginner concepts (read this first)
Term
What it means in x-harness
Completion card
A YAML file (e.g. completion-card.yaml) where an agent records what it claims to have done, with what evidence.
Verify gate
The xh verify command (alias xh check). It runs the read-only admission logic.
Accepted
Verification passed. Exit code 0. The task is officially done.
One of light, standard, or deep. Determines how much evidence is required.
PGV
Pre-Gate Validation. Advisory only. It can suggest things, but it never grants admission.
Adapter
A small set of convention files (e.g. CLAUDE.md, .cursor/rules/x-harness.mdc) for a specific agent platform.
Install (from source checkout)
x-harness ships a native Go CLI (recommended) and a TypeScript compatibility CLI (source-checkout fallback only).
Option A — Native Go CLI (recommended)
# Build a single static binary
go build ./cmd/x-harness
# Verify
./x-harness --version
Requires Go 1.22+. The resulting ./x-harness binary is self-contained.
Option B — TypeScript compatibility CLI (source checkout)
Use this only when you want to run the parity baseline from source:
npm install
npm run build
node packages/cli/dist/index.js --version
Requires Node.js ≥ 20. The published x-harness npm package is a Go-only wrapper; the Node fallback only works from a source checkout where dist/ exists.
Pre-built release binaries
Pre-built native binaries for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, windows/amd64, and windows/arm64 are attached to each GitHub release. Download the binary that matches your platform, place it on your PATH, and rename it to xh (or x-harness).
Package managers (Windows / macOS / Linux)
Scoop and Homebrew manifests are generated automatically at release time from packaging/ and scripts/. They will appear in their respective buckets once those buckets are published; until then, please use the pre-built binaries above or build from source.
Quick start (5 minutes)
Fast track
xh start
Or follow the steps manually:
1. Health-check the workspace
./x-harness doctor
This validates that schemas, policies, templates, and adapter links are present and consistent. Look for "healthy": true in JSON output (./x-harness doctor --json).
2. Run your first verification
The repo ships with 28 golden scenario directories across regression, capability, adversarial, conformance-strict, and recovery suites — 26 card-backed fixtures plus 2 conformance-strict reference scenarios (README-only, no completion card). Try a known-good one:
xh boundary runs deterministic, path-glob + import-regex checks against policies/boundaries.yaml (V1 scope; no AST, no semgrep, no LLM). Subcommands:
xh boundary lint # validate the policy file against the schema
xh boundary check --all # scan the whole repo
xh boundary check --changed # scan only files in `git diff --name-only`
xh boundary explain <file> # show which rules apply to a single file
When policies/boundaries.yaml is absent, xh boundary check exits 0 with a warning (opt-in feature). See docs/BOUNDARY.md and schemas/boundary-policy.schema.json for the rule shape (id, from, to_import, action, severity, intermediate?, allow?, applies_to_languages?).
Canonical handoff tiers
Task delegation uses only these three tiers. The labels small, medium, and large are not allowed in active runtime handoffs.
Tier
Use when
Minimum evidence floor
Human approval
light
Narrow, low-ceremony work (1–3 files, near read-only).
xh verify --strict — strict-schema mode for withheld_reason output.
xh verify --mutation-guard — detect any verifier-side source mutation.
When verification fails, the engine emits a structured recovery object routing the work back to the right owner (e.g. evidence_missing → implementation-worker, approval_missing → user).
Platform adapters
x-harness is adapter-agnostic. Pick the one that matches how you already work:
28 golden scenario directories — 26 card-backed fixtures plus 2 conformance-strict reference scenarios (README-only) across regression, capability, adversarial, conformance-strict, and recovery suites under examples/golden/.
Real-world examples — Next.js app and monorepo boundary setups under examples/real-world/.
Project status
Version: 0.99.0-rc1 (release candidate). The CLI is feature-complete for the v0.x contract, but the project is pre-1.0. Pin your version and expect minor contract changes before 1.0.
Native runtime: Go CLI (recommended). The TypeScript CLI is a source-checkout compatibility baseline only and is no longer shipped in the published npm package.
No production claims: A passing xh verify is not a guarantee of correctness. It means your card matches the policy. See docs/VERIFY_GATE.md for what the gate does and does not check.
Contributing
Contributions are welcome. Please read CONTRIBUTING.md first.
Harness-sensitive changes (admission policy, schemas, templates, CLI verify, adapters, skills) must include a completed templates/HARNESS_CHANGE_CONTRACT.md and pass ./x-harness doctor, ./x-harness examples verify, and ./x-harness benchmark --filter adversarial --gate locally.
Please do not open public issues for suspected vulnerabilities. Use GitHub private vulnerability reporting or contact the maintainer privately. See SECURITY.md for the full disclosure process and supported versions.