cd /news/ai-agents/show-hn-diffpact-local-git-task-cont… · home › topics › ai-agents › article
[ARTICLE · art-179490] src=github.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Show HN: Diffpact – Local Git task contracts and review gates for AI agents

InterfaceDelta released Diffpact, an MIT-licensed, zero-runtime-dependency Node >= 22.6 tool that enforces SHA-pinned Git task contracts and review gates for multi-agent coding workflows, installable via `npm install -g diffpact`. Diffpact blocks edits to `.git/`, symlinks, submodules and destructive shell or inline interpreter commands before and after execution, returns exit code 2 (INCOMPLETE) instead of 0 when check lists are empty or test suites are skipped, and requires distinct implementer and reviewer identities with raw-diff attestation. The tool ships drop-in configs for Claude Code, OpenAI Codex CLI, Crush, Google Gemini CLI/Antigravity and @vercel/board, and adds a `diffpact merge-verify` gate that runs the union of participating contracts' checks on merged trees and writes a signed merge-receipt.json.

key takeaway

Diffpact pins each agent task to a SHA-bound contract and returns exit code 2 (INCOMPLETE) rather than 0 when check lists are empty or test suites are skipped, and invalidates reviews with exit 3 if HEAD moves.

read9 min views19 publishedDec 1, 2026
Show HN: Diffpact – Local Git task contracts and review gates for AI agents
Image: Michielbdejong (auto-discovered)

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 (.git deny > 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 /jest skipped 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 diff or--inspected-raw-diff ), optional orchestrator HMAC signing (DIFFPACT_REVIEWER_SECRET , automatically stripped from worker subprocesses), and automatic invalidation (exit 3 ) ifHEAD moves.
  • Worktree Lifecycle & Durable Evidence Archiving:diffpact worktree create --share-node-modules handles standard repos, npm/pnpm monorepo workspace overlays, and subdirectory apps (site/node_modules ).diffpact worktree remove automatically 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 onto main , 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:

  1. Diff-SHA Binding (--diff-sha <sha>): Reviewer runs diffpact diff and passes the exactraw_diff_sha256 prefix (>= 12 hex chars), proving the review targets the exact inspected diff bytes.
  2. Orchestrator HMAC Signing (DIFFPACT_REVIEWER_SECRET): Export DIFFPACT_REVIEWER_SECRET in your orchestrator shell.diffpact exec anddiffpact run automaticallystripDIFFPACT_REVIEWER_SECRET from worker subprocesses, so a worker agent cannot forge a validdiffpact review attestation—only processes holding the orchestrator's secret passdiffpact status --require-review .
  3. 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.

── more in #ai-agents 4 stories · sorted by recency
── more on @interfacedelta 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/show-hn-diffpact-loc…] indexed:0 read:9min 2026-12-01 · —