Demonstrates typed-product handoff: a downstream DAG node builds on an upstream node's patch, with every byte provenance-sealed and verifiable.
- Dependent edit via
needs: node B (apply-patch) declaresneeds: { patch: { from: 'edit-a', select: { kind: 'patch' } } }— no hand-writtendepends_on. The orchestrator auto-unions theneedsbinding intodepends_onat submit-normalization, so B fires only after A reachesdone. - Content-addressed handoff: A's
result_ref(a content-addressed patch artifact) is resolved at fire time and passed to B asinputs.inputRefs.patch. B'spangolin-setup.shinitialises the repo (git init -q) and then runsgit apply inputs/patchso the downstream worker literally builds on the upstream edit. - Provenance closure: after both items complete,
verifyBundleproves the chain — everyinputRefsvalue in every dispatch manifest must be a sealedresultRef(oroutputRef) of a completed item in the same run. A run with a tampered or fabricated ref failschecks.handoff.ok.
The guarantee tier is tamper-detecting (LocalAnchor stores the Merkle root in SQLite).
Swap LocalAnchor for S3ObjectLockAnchor for external-immutable / tamper-evident.
# From repo root — reads ../../.env for ANTHROPIC_API_KEY (or CLAUDE_CODE_OAUTH_TOKEN)
pnpm --filter handoff-dag-example start:envOr set a credential in your shell:
export ANTHROPIC_API_KEY=sk-ant-...
# …or bill a Claude Pro/Max subscription instead (no API credits; mint with
# `claude setup-token`): export CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-...
pnpm --filter handoff-dag-example startThe demo:
- Registers a
code-editsubagent that renamesGREETING → SALUTATIONinsrc/main.tsand anapply-patchsubagent whosepangolin-setup.shfirst initialises the repo (git init -q) then applies the patch (git apply inputs/patch). Setup runs after the inputs/ overlay (soinputs/patchis already present) but before the adapter, which is why the repo must be initialised inside the script. - Submits
plan.json(2 items,apply-patchwired vianeedsonly). - The
servedriver ticks the PangolinOrchestrator until both items are terminal. - Prints each item's
resultRef. - Assembles the audit bundle and calls
verifyBundlefor the provenance-closure proof. - Exits non-zero if any item failed,
report.intact === false, orreport.checks.handoff.ok !== true.
- Docker reachable (local Docker Desktop, or
DOCKER_HOSTpointing at a remote daemon). - Worker image pullable:
ghcr.io/quarrysystems/pangolin-worker:latest. - A Claude credential set (Claude runs inside the worker container):
ANTHROPIC_API_KEYfor API credits, orCLAUDE_CODE_OAUTH_TOKENfor a Claude Pro/Max subscription.
pnpm --filter handoff-dag-example testRuns test/handoff.test.ts with vitest. Uses a fake executor (no containers, no LLM).
Verifies:
plan.jsonhas exactly 2 items;apply-patchdeclaresneeds.patchbindingedit-awithselect: { kind: 'patch' }and has no hand-writtendepends_on.- A real
PangolinOrchestratorwith the fake executor drives the plan to completion — both items reachdone. - The fake executor builds REAL
buildManifest-produced manifests (withinputRefspopulated fromitem.inputs.inputRefs), stores them in an in-memory blob map, and reconcilesedit-awith aresultRef. verifyBundlereportsintact: trueandchecks.handoff.ok === true— theinputRefsinapply-patch's manifest resolve toedit-a'sresultRef.