Local, stateless Git task contracts, deterministic diff boundaries, post-merge verification, and cross-harness review gates for multi-agent coding workflows.
Built by InterfaceDelta · MIT License · Zero runtime dependencies · Node >= 22.6 · Changelog ·
Choose one installation method (zero runtime dependencies, Node >= 22.6):
Option A (Recommended): Install globally from npm
npm install -g diffpact
Or run without installing globally:
npx diffpact doctor
Option B: Clone from GitHub and symlink globally (runs npm run build automatically)
git clone https://github.com/interface-delta/diffpact.git
cd diffpact && npm link
Option C: Install globally from a local checkout
npm install -g /path/to/diffpact
Verify your environment and try the 30-second self-contained quickstart demo:
diffpact doctor
npm run quickstart
See examples/quickstart/ for the interactive walkthrough and examples/harnesses/ for drop-in Claude Code, Codex CLI, Crush, Gemini/Antigravity, and @vercel/board configs.
Every command supports per-command help:
diffpact <command> --help
diffpact help <command>
Shared message boards (@vercel/board) and subagent harnesses let multiple coding agents claim tasks in parallel—but ticket locks alone do not stop agents from editing forbidden files, skipping test suites while exiting 0, silently altering pinned constants, introducing regressions when two parallel branches are merged, or rubber-stamping their own commits.
diffpact enforces explicit, SHA-pinned Task Contracts directly against Git:
- 100% Local & Stateless: No daemon, no database, no sign-up. Truth is recomputed directly from Git (
HEAD,git diff -M -z, untracked files, and symlink checks) plus RFC 8785 canonical SHA-256 receipts. - Boundary Precedence (
.gitdeny >forbidden>read_only>allowed): Unconditionally blocks.git/metadata/hook tampering, symlinks (120000), submodules (160000), unauthorized edits/renames (-M -z), and destructive shell or inline interpreter commands (Bash,python -c,node -e)before andafter execution. - No Silent Zero: Empty check lists, skipped test suites (
vitest/node --test/jestskipped counts), or missing commits return exit code2(INCOMPLETE), never0. - Non-Self-Certified, Diff-Bound Review: Enforces distinct implementer vs. reviewer identities, explicit raw-diff attestation (
--diff-sha <sha>fromdiffpact diffor--inspected-raw-diff), optional orchestrator HMAC signing (DIFFPACT_REVIEWER_SECRET, automatically stripped from worker subprocesses), and automatic invalidation (exit 3) ifHEADmoves. - Worktree Lifecycle & Durable Evidence Archiving:
diffpact worktree create --share-node-moduleshandles standard repos, npm/pnpm monorepo workspace overlays, and subdirectory apps (site/node_modules).diffpact worktree removeautomatically archives.diffpact/evidence (contract.json,receipt.json,reviews/,report.md,report.json) to<main>/.diffpact/archive/before removing the worktree. - Post-Merge Integration Gate (
diffpact merge-verify): After joining 2+ parallel branches ontomain, runs the deduplicated union of all participating contracts' checks and path boundaries on the merged tree and writes a signedmerge-receipt.json. - Cross-Harness Support: Ready out of the box forClaude Code ,OpenAI Codex CLI ,Crush ,Google Gemini CLI / Antigravity (
agy&agy-worker) , and**@vercel/board** .
In a typical single-agent workflow, the moment npm run typecheck and npm test exit 0, the branch looks ready to merge. Here is an actual generalized trajectory from a 7-package TypeScript monorepo running diffpact v0.4.x with two separate models (Author Agent A and Independent Reviewer Agent B):
worktree create --share-node-modules (7 local workspace packages linked, ~10s)
└─▶ Author Agent A implements feature + tests ──▶ diffpact verify: PASS (exit 0)
└─▶ diffpact status --require-review ──▶ HOLD (exit 2: review missing)
└─▶ Reviewer Agent B runs `diffpact diff` (~90s raw-diff audit)
└─▶ REQUEST_CHANGES: 6 real bugs caught before merge!
1. Async cancellation race (queue cleared, active fetch unguarded)
2. Missing DOM data-attribute breaking replay buttons on one variant
3. Background audio volume left un-ducked during modal transition
4. Test file silently swallowing a ReferenceError inside try/catch
5. Missing profile metadata in peer-to-peer rendering path
6. Automated system notices unintentionally triggering TTS playback
└─▶ Orchestrator runs `diffpact amend --add-allow packages/core/src/index.ts`
(hash-chained scope expansion required for bug #5; old receipt invalidated)
└─▶ Author fixes all 6 bugs ──▶ diffpact verify: PASS (exit 0)
└─▶ Reviewer B signs `diffpact review --diff-sha <sha> --verdict approve` (mode=diff-sha-bound)
└─▶ diffpact status --require-review ──▶ PASS (exit 0, review: approved 1/1)
└─▶ diffpact worktree remove --require-verified --delete-branch
(archived contract, receipt, amendment chain, reviews & reports to .diffpact/archive/)
Measured overhead: ~25 seconds for worktree setup, contract pinning, and archiving + ~90 seconds for independent raw-diff review — 6 subtle production bugs stopped before a single line touched main, including a broken test that had exited 0.
diffpact doctor
diffpact worktree create /var/tmp/wt-normalizer --branch feat/normalizer --share-node-modules
cd /var/tmp/wt-normalizer
diffpact init \
--task-id "feat-normalizer-01" \
--mission "Implement normalizer slice without touching migrations" \
--allow "src/normalizer/**" \
--allow "test/normalizer/**" \
--read-only "src/common/**" \
--forbid "migrations/**" \
--forbid "package.json" \
--check "typecheck=npm run typecheck" \
--check "unit=npm test" \
--check-timeout "unit=60" \
--advisory-check "baseline=npm run test:baseline" \
--implementer "codex-worker:sess-01:codex"
diffpact run --harness codex --model gpt-6-astra --prompt "Implement .diffpact/contract.json" --heartbeat-sec 30
diffpact status
diffpact diff
diffpact review \
--reviewer "claude-rev:sess-99:claude-code" \
--verdict approve \
--diff-sha <raw_diff_sha256_prefix> \
--summary "Verified raw diff and edge cases"
diffpact status --require-review
diffpact report --format markdown
cd /path/to/main-repo
git merge --squash feat/normalizer && git commit -m "feat: normalizer"
diffpact worktree remove /var/tmp/wt-normalizer --require-verified --delete-branch
diffpact merge-verify \
--from .diffpact/archive/<bundle-branch-a> \
--from .diffpact/archive/<bundle-branch-b>
diffpact merge-verify \
--from .diffpact/archive/<bundle-branch-a> \
--from .diffpact/archive/<bundle-branch-b> \
--allow-integration "src/index.ts" \
--reason "Wire exported routes from both merged slices"
Run diffpact <command> --help for full flags and examples on any command.
| Command | Purpose |
|---|---|
diffpact doctor |
Probe Node, Git, .git/info/exclude , installed agent CLIs (claude ,codex ,crush ,agy ,gemini ,vercel ), and root/sandbox warnings |
diffpact worktree create |
Create linked Git worktree with .diffpact/ pre-excluded + workspace/subdir-aware--share-node-modules |
diffpact worktree remove |
Auto-archive .diffpact/ evidence + reports to<main>/.diffpact/archive/ , gate via--require-verified , and delete merged/squashed branch |
diffpact init |
Create .diffpact/contract.json pinned tostarting_sha , path boundaries, checks, timeouts, and advisory checks |
diffpact amend |
Record hash-chained scope or starting_sha amendment in.diffpact/amendments.jsonl |
diffpact run |
Harness-aware launcher ( claude ,codex ,crush ,agy ,gemini ) with linked-worktree Codex--add-dir , root-safe Claude flags, isolated Crush--data-dir , heartbeats, and hostverify |
diffpact exec (wrap ) |
Wrap any worker command with pre-flight boundary check ( --resume for in-scope dirty trees), tamper guard, and post-flightverify |
diffpact verify |
Recompute Git diff boundaries, version pins, lockfiles, and run required + advisory checks ( receipt.json ) |
diffpact merge-verify |
Post-merge gate across 2+ merged contracts/archives: verifies combined path boundaries and runs the union of all checks ( merge-receipt.json ) |
diffpact diff |
Print primary raw Git diff ( starting_sha..HEAD ) and canonicalraw_diff_sha256 token for independent review |
diffpact review |
Record non-self-certified review attestation ( --diff-sha or--inspected-raw-diff ; optionalDIFFPACT_REVIEWER_SECRET HMAC) |
diffpact status |
Fast read-only gate check against live Git HEAD (shows explicitreview: missing/approved/stale even without--require-review ) |
diffpact report |
Emit Markdown PR card, canonical JSON bundle, or SARIF 2.1.0 report |
diffpact delegate |
Create monotonically narrowed child subcontract conserving parent max_budget_usd |
diffpact install-hooks |
Idempotently merge diffpact hooks intoclaude-code ,codex ,gemini , oragy configs |
diffpact print-config |
Print drop-in hook JSON config for claude-code ,codex ,gemini , oragy |
diffpact board |
@vercel/board adapter (post-contract /complete gate) |
diffpact agy-verify-patch |
Verify unattended agy-worker --diff unified patch beforegit apply |
Because a local CLI has no central identity server, a plain --reviewer flag is self-declared unless bound by your orchestrator. diffpact supports three escalating levels of review assurance:
- Diff-SHA Binding (
--diff-sha <sha>): Reviewer runsdiffpact diffand passes the exactraw_diff_sha256prefix (>= 12hex chars), proving the review targets the exact inspected diff bytes. - Orchestrator HMAC Signing (
DIFFPACT_REVIEWER_SECRET): ExportDIFFPACT_REVIEWER_SECRETin your orchestrator shell.diffpact execanddiffpact runautomaticallystripDIFFPACT_REVIEWER_SECRETfrom worker subprocesses, so a worker agent cannot forge a validdiffpact reviewattestation—only processes holding the orchestrator's secret passdiffpact status --require-review. - Wrapped Read-Only Reviewer (
--adapter codex -- <cmd...>): Spawns an independent read-only Codex session, extracts its realthread_id, and rejects any mutation of the working tree.
| Exit Code | Status | Meaning |
|---|---|---|
0 |
PASS |
Boundaries, version pins, checks, and (when required) independent reviews verified against HEAD |
1 |
VIOLATION |
Path/symlink/shell boundary breached, self-certification or forged HMAC, diff-SHA mismatch, budget exceeded, or check failed |
2 |
INCOMPLETE |
Missing contract/receipt/review, unattested raw-diff inspection, zero commits, or skipped tests ( No Silent Zero ) |
3 |
STALE |
Git HEAD orcontract.json moved after receipt or review was issued |
Built and maintained by InterfaceDelta: human-architected and developed with multi-model coding agents (Gemini, Claude Code, and OpenAI Codex) governed by diffpact itself with mandatory cross-model raw-diff review.