Skip to content
Jordan Hudgens
Macro architectural photograph of a brushed-brass ratchet wheel and locking pawl spanning a terracotta and basalt track beside dark slate negative space.AI-generated illustration
Guide 20AdvancedArchitecture and runtimesAgents and tool useOperations and observability

Long-Running Agents That Resume Without Repeating Harmful Work

Stop resumed multi-session agents from repeating external mutations after SIGKILL with a SQLite WAL outbox, lease-epoch fencing, and read-before-retry probes.

Reading
27 min
Workshop
150 min
Stack
TS, Node 22 Built-In SQLite WAL, Anthropic SDK
Version
1.0.0
Last verified
Nov 30, 2026

What you will build and be able to do

Each outcome has an observable criterion. The lab and the assessment check exactly these, nothing more and nothing less.

  1. OBJ-001

    Distinguish prompt memory from committed external side effects

    Explain what server-side compaction, memory files, Agent SDK file checkpoints, and Managed Agents events persist, and why Crash Window C2 fools text-only resume into repeating external mutations.

  2. OBJ-002

    Build a transactional SQLite WAL outbox with canonical step keys

    Write pre-mutation IN_FLIGHT intents inside BEGIN IMMEDIATE using a five-field SHA-256 idempotency tuple, monotonic lease_epoch fencing, and atomic step_journal rows. Checked by pnpm test:lab1.

  3. OBJ-003

    Reconcile crash windows and fence zombie workers before retry

    Classify IN_FLIGHT steps via GET probes across C1b, C2, and C3, post /reconcile-barrier to block delayed epoch-1 packets with HTTP 409, and halt non-idempotent webhooks in RECONCILIATION_REQUIRED. Checked by pnpm test:lab2.

  4. OBJ-004

    Pair compact-2026-09-04 summaries with authoritative outbox state

    Hand off multi-session Claude 5.5 work using completed-turn compaction blocks while letting SQLite outbox state override stale prose and knowing when to move off single-host SQLite WAL to PostgreSQL or Temporal. Checked by pnpm test:lab3.

Unpack durable-resume-labs.zip and run the offline fault suite ($0.00)

  • Node.js 22.23.5+ (built-in node:sqlite) and pnpm 12+ in a local terminal ($0.00 offline labs).Node.js downloads
  • Context compaction, memory files, and token-window hygiene for long-running shifts from Guide 08.Read Guide 08
  • Constraint-first runtime selection across Messages API loops, Agent SDK, and Managed Agents from Guide 16.Read Guide 16
  • Four-layer trace triage, retry containment, and incident-to-regression loops from Guide 18.Read Guide 18
  • Basic familiarity with SQLite transactions, HTTP idempotency headers, and POSIX process signals.
Terminalbash
unzip -q durable-resume-labs.zip -d durable-resume-workcd durable-resume-work/labs/starter && pnpm install --frozen-lockfilepnpm preflight && pnpm test# tests 9 | # pass 0 | # fail 9 (intentional starter bugs before Labs 1-3)
Offline SQLite WAL outbox, SIGKILL fault-injection, and compaction handoff labs (MIT, ZIP) · ZIP · tested at v1.0.0

The Four-Gate Durable Step Contract on Single-Host SQLite WAL

Synthetic workflow (Example Kiln and Calibration Desk, verified 2026-11-30): wrap every external mutation in Gate G1 outbox intent, Gate G2 monotonic lease_epoch fencing, Gate G3 read-before-retry probe, and Gate G4 atomic step_journal.
Diagram of Gates G1 through G4 above three SQLite Write-Ahead Log tables (workflow_runs, outbox_intents, step_journal) for synthetic workflow WF-KILN-401.
Extended description

Four gate cards run left to right: Gate G1 writes an IN_FLIGHT row and five-field SHA-256 key inside BEGIN IMMEDIATE before socket open; Gate G2 increments lease_epoch and posts /reconcile-barrier; Gate G3 probes GET /mutations/by-key across four outcomes; Gate G4 appends immutable audit rows.

Below the four gates, three SQLite WAL tables (workflow_runs, outbox_intents, step_journal) show verified synthetic rows for WF-KILN-401 and note 1:1 mapping to PostgreSQL or Temporal Activities off-host.

Why Remembered Text Repeats Harmful Work After SIGKILL

Context compaction, progress notes such as claude-progress.txt, and session transcripts are routinely treated as a complete multi-session recovery stack (Effective harnesses for long-running agents). They work when an agent only edits local Git-tracked files, yet fail inside Crash Window C2: the millisecond gap after a downstream HTTP POST commits an $1,840.00 credit (CRD-RMA-9041-01 on synthetic workflow WF-KILN-401) and before the local worker writes tool_result or updates disk notes.

Featured crash and restart timeline contrasting Track A Remembered Text against Track B Committed Durable State across Crash Windows C1b, C2, and C3.
Synthetic workflow WF-KILN-401 (RMA-9041, verified 2026-11-30): why SIGKILL in Crash Window C2 tricks compacted prose and transcripts into billing $3,680.00, while SQLite WAL + GET reconciliation bills $1,840.00 once.
Extended description

Four top cards trace Step 1 pre-crash intake, Window C1b pre-dispatch kill, Window C2 post-commit SIGKILL, and Window C3 post-receipt kill.

Track A shows stale compact-2026-09-04 summaries, claude-progress.txt, and .jsonl transcripts repeating the $1,840.00 credit (6/6 live trials); Track B shows SQLite outbox_intents + GET /mutations/by-key adopting CRD-RMA-9041-01 with 0 duplicates.

Persistence boundaries across built-in Claude surfaces (2026-11-30 primary documentation).
SurfaceWhat it persistsWhat it leaves to your runner
Compaction (compact-2026-09-04, compact-2026-01-12)Server-generated conversation summary blocksDoes not query or reconcile external API mutations
Memory tool & claude-progress.txtClient-side files written before crashStale if SIGKILL hits in C2 before file write
Agent SDK sessions & file checkpointing.jsonl transcripts and Write/Edit file backupsrewindFiles() never undoes Bash or HTTP mutations
Managed Agents (sesn_*, wrun_*)Server-side session events and phase transitionsidle does not mean workflow_run done; phase_ended does not prove external commit

Gates G1 and G4: SQLite WAL Outbox, Canonical Keys, and Atomic Journal

Gate G1 eliminates speculative retries by writing an IN_FLIGHT row into Node.js 22 node:sqlite (PRAGMA journal_mode = WAL; PRAGMA synchronous = FULL;) inside BEGIN IMMEDIATE before any network socket opens (SQLite Write-Ahead Logging). Rather than calling randomUUID() inside a retry wrapper, derive one deterministic key (ik_<40-hex>) from SHA-256 over (tenant_id, workflow_id, step_id, tool_name, canonical_args_sha256), reject parameter drift with INTENT_PAYLOAD_DRIFT, and append every transition to step_journal in the same transaction (Gate G4).

src/durable-ledger.ts (canonical 5-field key + BEGIN IMMEDIATE intent)ts
export function computeDeterministicIdempotencyKey(tuple: IdempotencyTuple): string {  const digest = sha256Hex(canonicalJson(tuple));  return `ik_${digest.slice(0, 40)}`;}

Gates G2 and G3: Read-Before-Retry Reconciliation and Zombie Barrier Fencing

Resuming safely requires separating observation from mutation (Gate G3) and fencing stalled workers that wake up after lease expiry (Gate G2). Inside reconcileWorkflowOnResume(), Worker B acquires lease_epoch = 2, immediately posts POST /reconcile-barrier so downstream rejects delayed epoch-1 packets with HTTP 409 STALE_EPOCH (F-ZOMBIE-BEFORE), and probes GET /mutations/by-key?key=... for every IN_FLIGHT step.

Four-way G3 external reconciliation table and four-step F-ZOMBIE-BEFORE /reconcile-barrier timeline.
Synthetic workflow WF-KILN-401 and legacy webhook WF-KILN-402 (2026-11-30): four-way GET classification plus immediate /reconcile-barrier fencing.
Extended description

Part A classifies IN_FLIGHT probes into COMMITTED_MATCH (adopt external_ref with 0 POSTs), COMMITTED_CONFLICT (halt on hash mismatch), NOT_FOUND_DISPATCHED (dispatch once on 404 within retention TTL under epoch 2), and UNKNOWN_HALTED (halt non-idempotent webhook WF-KILN-402).

Part B shows Worker A stalling at epoch 1, Worker B posting /reconcile-barrier at epoch 2, Worker A failing with HTTP 409 STALE_EPOCH, and Worker B committing once under X-Lease-Epoch: 2.

Synthetic workflow WF-KILN-401 (2026-11-30): adopting CRD-RMA-9041-01 ($1,840.00) after Crash Window C2 with zero duplicate POST requests. Silent loop, 6 seconds.
Extended description

Phase 1 commits IN_FLIGHT + ik_8f4c... in SQLite WAL; Phase 2 triggers SIGKILL after HTTP 200 commits CRD-RMA-9041-01.

Phase 3 bumps lease_epoch to 2 and probes GET /mutations/by-key; Phase 4 adopts CRD-RMA-9041-01 with 0 extra POSTs and advances to step_2_shipment.

Synthetic race F-ZOMBIE-BEFORE (2026-11-30): blocking a GC-stalled epoch-1 worker via /reconcile-barrier before Worker B dispatches. Silent loop, 6 seconds.
Extended description

Worker A pauses at lease_epoch 1 before its outbound packet arrives; Worker B acquires lease_epoch 2 and immediately posts /reconcile-barrier.

Delayed Worker A wakes up first and receives HTTP 409 STALE_EPOCH; Worker B then commits CRD-RMA-9041-01 cleanly under X-Lease-Epoch: 2.

Authoritative Compaction Handoffs and Live Claude 5.5 Verification

To carry diagnostic context across sessions without trusting stale prose, pair Anthropic's on-demand compaction beta (compact-2026-09-04 in @anthropic-ai/sdk 1.14.0) with a reconciled SQLite outbox ledger table. Across 55 frozen Stage 4 live requests ($0.154197 USD on Claude Sonnet 5.5 and Haiku 5.5 at published token rates), Arm A naive compaction resume double-billed 6/6 post-C2 runs ($11,040.00 overbilled), while Arm B durable outbox resume achieved 0/6 duplicates, 6/6 completions, 6/6 HTTP 409 zombie rejections, and 2/2 safe halts on WF-KILN-402.

Two-layer multi-session handoff specification pairing advisory compact-2026-09-04 context with authoritative SQLite outbox state and four verified wire rules.
Synthetic workflow WF-KILN-401 (2026-11-30): advisory compact-2026-09-04 context paired with authoritative SQLite outbox state and four live wire rules.
Extended description

Layer 1 marks compact-2026-09-04 summaries as advisory reasoning context only; Layer 2 marks reconciled SQLite outbox_intents rows as the authoritative step gate.

Four bottom cards document completed-turn boundaries, retaining betas: ['compact-2026-09-04'] on round-trips, omitting temperature on Claude 5.5, and verifying non-null compaction content.

Stage 4 frozen live verification chart comparing 6/6 Arm A naive duplicate credits against 0/6 Arm B durable duplicates across 55 live API calls.
Frozen Stage 4 live verification (55 billed calls incl. usage.iterations, $0.154197 USD reconciled with 0.0 drift on 2026-11-30, maxRetries: 0).
Extended description

Four summary cards highlight 6/6 Arm A naive duplicates ($11,040.00 overbilled), 0/6 Arm B durable duplicates, 6/6 completions and 409 zombie rejections, and 2/2 WF-KILN-402 safe halts.

Model breakdown rows list claude-sonnet-5-5 (27 requests, 39,861 in / 6,759 out, $0.147312) and claude-haiku-5-5 (28 requests, 38,370 in / 6,096 out, $0.006885).

Single-Host SQLite WAL Limits and Scaling Off-Host

When single-host SQLite WAL fits vs when to move off-host (2026-11-30).
TopologyState storeIdempotency & reconciliation rule
Single VM or local daemon (1 host)Node 22 node:sqlite (WAL + synchronous=FULL)Keep 5-field SHA-256 keys, BEGIN IMMEDIATE, and GET probes
Multi-host stateless containersPostgreSQL (SELECT ... FOR UPDATE)Same 3 tables (workflow_runs, outbox_intents, step_journal) + /reconcile-barrier
Long-horizon distributed fan-outTemporal Activities / Managed Agents + external DBPass deterministic workflow + activity IDs as downstream idempotency keys

Lab 1: SQLite WAL Outbox, Canonical Tuple Keys, and Monotonic Lease Epochs

Replace random UUID retries and unguarded lease overwrites with a single-host SQLite WAL outbox, a five-field SHA-256 idempotency key, and atomic step-journal rows.

Acceptance checks

  • Derives identical ik_ keys across reordered JSON keys while changing keys on different step IDs or amounts.
  • Increments lease_epoch from 1 to 2 on expired lease takeover while blocking foreign steals on active leases.
  • Writes IN_FLIGHT outbox rows and INTENT_RECORDED journal rows inside one BEGIN IMMEDIATE transaction and rejects parameter drift.
  1. Run the durable outbox and lease-epoch check

    $ pnpm lab1:ledger

    Initial: Initial (random UUIDs drift across retries and expired takeover leaves lease_epoch at 1)

    { "synthetic_tenant": "kiln-calibration.example-ops.test", "initial_epoch": 1, "foreign_steal_blocked": false, "takeover_epoch": 1, "idempotency_key_prefix": "ik_random_40", "final_intent_state": "COMMITTED", "journal_events": 0, "intents_recorded": 1 }

    Final: Final (canonical SHA-256 keys stay stable, takeover bumps lease_epoch to 2, and drift fails closed)

    { "synthetic_tenant": "kiln-calibration.example-ops.test", "initial_epoch": 1, "foreign_steal_blocked": true, "takeover_epoch": 2, "idempotency_key_prefix": "ik_b63374a46", "final_intent_state": "COMMITTED", "journal_events": 4, "intents_recorded": 1 }
  2. Run the Lab 1 tests

    $ pnpm test:lab1

    Initial: Initial (before you edit any file, 0 of 3 pass)

    TAP version 13 # Subtest: LAB-001.1: computeDeterministicIdempotencyKey is stable across retries and sensitive to canonical_args_sha256 not ok 1 - LAB-001.1: computeDeterministicIdempotencyKey is stable across retries and sensitive to canonical_args_sha256 --- duration_ms: <duration> type: 'test' location: '<workspace>/labs/starter/test/lab1.test.ts:18:1' failureType: 'testCodeFailure' error: |- Canonical key ordering must yield identical idempotency key across retries + actual - expected + 'ik_random_<non_deterministic_uuid>' - 'ik_random_<non_deterministic_uuid>' code: 'ERR_ASSERTION' name: 'AssertionError' expected: 'ik_random_<non_deterministic_uuid>' actual: 'ik_random_<non_deterministic_uuid>' operator: 'strictEqual' stack: |- TestContext.<anonymous> (file://<workspace>/labs/starter/test/lab1.test.ts:45:10) Test.runInAsyncScope (node:async_hooks:214:14) Test.run (node:internal/test_runner/test:1047:25) Test.start (node:internal/test_runner/test:944:17) startSubtestAfterBootstrap (node:internal/test_runner/harness:296:17) ... # Subtest: LAB-001.2: SQLite WAL lease fencing rejects unexpired foreign steals and bumps lease_epoch on expiry takeover not ok 2 - LAB-001.2: SQLite WAL lease fencing rejects unexpired foreign steals and bumps lease_epoch on expiry takeover --- duration_ms: <duration> type: 'test' location: '<workspace>/labs/starter/test/lab1.test.ts:50:1' failureType: 'testCodeFailure' error: |- Expected values to be strictly equal: 'delete' !== 'wal' code: 'ERR_ASSERTION' name: 'AssertionError' expected: 'wal' actual: 'delete' operator: 'strictEqual' stack: |- TestContext.<anonymous> (file://<workspace>/labs/starter/test/lab1.test.ts:55:12) Test.runInAsyncScope (node:async_hooks:214:14) Test.run (node:internal/test_runner/test:1047:25) Test.processPendingSubtests (node:internal/test_runner/test:744:18) Test.postRun (node:internal/test_runner/test:1173:19) Test.run (node:internal/test_runner/test:1101:12) async startSubtestAfterBootstrap (node:internal/test_runner/harness:296:3) ... # Subtest: LAB-001.3: recordOutboxIntent and commitOutboxReceipt atomically maintain outbox_intents and append-only step_journal not ok 3 - LAB-001.3: recordOutboxIntent and commitOutboxReceipt atomically maintain outbox_intents and append-only step_journal --- duration_ms: <duration> type: 'test' location: '<workspace>/labs/starter/test/lab1.test.ts:114:1' failureType: 'testCodeFailure' error: |- recordOutboxIntent must derive idempotency_key from the full tuple including canonical_args_sha256 + actual - expected + 'ik_random_<non_deterministic_uuid>' - 'ik_random_<non_deterministic_uuid>' code: 'ERR_ASSERTION' name: 'AssertionError' expected: 'ik_random_<non_deterministic_uuid>' actual: 'ik_random_<non_deterministic_uuid>' operator: 'strictEqual' stack: |- TestContext.<anonymous> (file://<workspace>/labs/starter/test/lab1.test.ts:135:12) Test.runInAsyncScope (node:async_hooks:214:14) Test.run (node:internal/test_runner/test:1047:25) Test.processPendingSubtests (node:internal/test_runner/test:744:18) Test.postRun (node:internal/test_runner/test:1173:19) Test.run (node:internal/test_runner/test:1101:12) async Test.processPendingSubtests (node:internal/test_runner/test:744:7) ... 1..3 # tests 3 # suites 0 # pass 0 # fail 3 # cancelled 0 # skipped 0 # todo 0 # duration_ms 178.071938

    Final: Final (after every Lab 1 check passes, 3 of 3)

    TAP version 13 # Subtest: LAB-001.1: computeDeterministicIdempotencyKey is stable across retries and sensitive to canonical_args_sha256 ok 1 - LAB-001.1: computeDeterministicIdempotencyKey is stable across retries and sensitive to canonical_args_sha256 --- duration_ms: <duration> type: 'test' ... # Subtest: LAB-001.2: SQLite WAL lease fencing rejects unexpired foreign steals and bumps lease_epoch on expiry takeover ok 2 - LAB-001.2: SQLite WAL lease fencing rejects unexpired foreign steals and bumps lease_epoch on expiry takeover --- duration_ms: <duration> type: 'test' ... # Subtest: LAB-001.3: recordOutboxIntent and commitOutboxReceipt atomically maintain outbox_intents and append-only step_journal ok 3 - LAB-001.3: recordOutboxIntent and commitOutboxReceipt atomically maintain outbox_intents and append-only step_journal --- duration_ms: <duration> type: 'test' ... 1..3 # tests 3 # suites 0 # pass 3 # fail 0 # cancelled 0 # skipped 0 # todo 0 # duration_ms 180.286294
  3. Show the solution discussion

    Canonicalize JSON arguments recursively by sorted object keys before computing payload_sha256 and the five-field idempotency tuple.

    Open BEGIN IMMEDIATE for lease acquisition and outbox intent writes so concurrent workers cannot interleave stale epochs.

    Reject any retry that reuses (workflow_id, step_id) with a different payload_sha256 by throwing INTENT_PAYLOAD_DRIFT.

More labs in this guide

  • Lab 2: Child-Process SIGKILL Fault Matrix, Read-Before-Retry, and Zombie Barrier

    Survive real OS SIGKILL faults across Crash Windows C1b, C2, and C3, fence delayed epoch-1 zombie workers via /reconcile-barrier, and halt non-idempotent legacy webhooks safely.

  • Lab 3: Authoritative Multi-Session Compaction Handoff

    Pair Anthropic's compact-2026-09-04 summary block with reconciled SQLite outbox state so resumed Claude 5.5 sessions skip committed mutations while preserving diagnostic context.

Eight ways this breaks, and how you will know

Seven of these reproduce in the lab; the other one was observed in this guide's recorded runs. Learn the symptom first; it is what you will actually see.

  • F-01pnpm lab1:ledgerReproducible

    Generating randomUUID() inside a tool retry wrapper

    Symptom
    Every crashed or timed-out retry creates a fresh idempotency header and bills the customer a second time.
    Diagnosis
    Deriving a new random UUID per HTTP attempt hides the fact that both calls represent the exact same logical workflow step.
    Fix
    Hash (tenant_id, workflow_id, step_id, tool_name, canonical_args_sha256) once and persist it in outbox_intents before socket open.
    Verify
    Run pnpm lab1:ledger and confirm reordered JSON keys produce identical ik_ tokens.
  • F-02pnpm test:lab1Reproducible

    Expired lease takeover without bumping lease_epoch

    Symptom
    Two workers both believe they own the workflow and interleave conflicting local and downstream writes.
    Diagnosis
    Overwriting lease_owner without incrementing lease_epoch leaves no monotonic fencing token to reject stale workers.
    Fix
    Increment lease_epoch atomically inside BEGIN IMMEDIATE on expired takeover and verify epoch equality on every write.
    Verify
    Run pnpm test:lab1 and confirm expired takeover bumps lease_epoch from 1 to 2 and blocks epoch-1 commits.
  • F-03pnpm lab2:crash-matrixReproducible

    Double-billing after SIGKILL in Crash Window C2

    Symptom
    Downstream commits CRD-RMA-9041-01 ($1,840.00), SIGKILL hits before local commit, and Session 2 bills a second $1,840.00.
    Diagnosis
    Compacted summaries, claude-progress.txt, and .jsonl transcripts never received the HTTP 200 receipt before process death.
    Fix
    Record IN_FLIGHT before dispatch and probe GET /mutations/by-key on resume to adopt CRD-RMA-9041-01 with 0 extra POSTs.
    Verify
    Run pnpm lab2:crash-matrix and confirm C2 finishes with committed_credits = 1 ($1,840.00).
  • F-04pnpm test:lab2Reproducible

    Delayed epoch-1 zombie commits before Worker B dispatches

    Symptom
    A GC-paused Worker A wakes up at t=16s and mutates downstream before Worker B sends its first step at t=17s.
    Diagnosis
    Downstream only learned about lease_epoch 2 lazily on mutation POSTs, leaving F-ZOMBIE-BEFORE open during reconciliation.
    Fix
    Post POST /reconcile-barrier with lease_epoch 2 as the first action inside reconcileWorkflowOnResume().
    Verify
    Run pnpm test:lab2 and confirm F-ZOMBIE-BEFORE records stale_epoch_rejections = 1 (HTTP 409).
  • F-05pnpm lab2:crash-matrixReproducible

    Blindly retrying a legacy webhook with no GET lookup

    Symptom
    Retrying an IN_FLIGHT carrier webhook after a crash dispatches duplicate freight pickups.
    Diagnosis
    Legacy endpoint legacy_notify_carrier (WF-KILN-402) has neither idempotency-key deduplication nor status lookup.
    Fix
    Classify unprovable IN_FLIGHT steps as UNKNOWN_HALTED and transition the workflow to RECONCILIATION_REQUIRED with 0 retries.
    Verify
    Run pnpm lab2:crash-matrix and confirm WF-KILN-402 halts cleanly with HALT_UNKNOWN_EFFECT.
  • F-06pnpm test:lab1Reproducible

    Silent parameter drift across resumed retries

    Symptom
    A resumed prompt retries step_1_credit with a different dollar amount under the same step_id.
    Diagnosis
    Reusing a step slot without comparing payload_sha256 either mutates the wrong amount or masks conflicting state.
    Fix
    Compare stored payload_sha256 in recordOutboxIntent() and GET reconciliation, halting on any mismatch.
    Verify
    Run pnpm test:lab1 and pnpm test:lab2 to verify INTENT_PAYLOAD_DRIFT and HALT_PAYLOAD_CONFLICT.
  • F-07pnpm test:lab3Reproducible

    Compacting an unresolved tool_use turn

    Symptom
    Calling on-demand compaction right after an interrupted assistant tool_use turn corrupts the turn boundary.
    Diagnosis
    Compaction requires a completed user/assistant turn boundary and cannot reconcile half-finished tool calls.
    Fix
    Enforce a completed-turn boundary check before calling compact-2026-09-04 and reconcile IN_FLIGHT steps in SQLite.
    Verify
    Run pnpm test:lab3 and confirm unresolved tool_use transcripts fail the boundary check before network calls.
  • F-08Observed

    HTTP 400 on Claude 5.5 compaction round-trips or temperature

    Symptom
    Session 2 fails with HTTP 400 when replaying a compaction block without the beta header or passing temperature: 0.
    Diagnosis
    Observed live on api.anthropic.com (2026-11-30): round-tripping a compaction block requires betas: ['compact-2026-09-04'], and Claude 5.5 models reject temperature.
    Fix
    Keep betas: ['compact-2026-09-04'] on every turn carrying a compaction block and omit temperature on Claude 5.5.
    Verify
    Run pnpm lab3:handoff and confirm Session 2 completes step_2_shipment and step_3_close cleanly.

Transfer task and rubric

Audit an unseen escrow recovery workflow, classify four post-crash reconciliation traces, fence a delayed zombie worker, and design a compacted multi-session handoff.

Analytic rubric: each criterion described at four performance levels, from Emerging to Exemplary
Criterion0 · Emerging1 · Developing2 · Proficient3 · Exemplary
C1 Built-in persistence boundariesConfuses compaction or rewindFiles() with external HTTP rollback.Names some built-in limits without isolating Crash Window C2.Accurately bounds compaction, memory, Agent SDK checkpoints, and Managed Agents.Maps every surface boundary and explains why C2 requires an outbox.
C2 Outbox and canonical tuple keysUses random UUIDs on retry or writes intents after HTTP dispatch.Persists intents before dispatch while omitting payload hash checks.Writes IN_FLIGHT inside BEGIN IMMEDIATE with a 5-field SHA-256 tuple.Enforces BEGIN IMMEDIATE, 5-field tuple, drift rejection, and atomic journal.
C3 Monotonic lease-epoch fencingOverwrites lease_owner without a monotonic fencing token.Increments lease_epoch locally without fencing downstream before retry.Increments lease_epoch and posts /reconcile-barrier before step dispatch.Proves both local SQLite epoch guards and HTTP 409 zombie rejection.
C4 Four-way crash reconciliationBlindly re-POSTs IN_FLIGHT mutations on resume.Handles 200 and 404 probes while ignoring payload hash mismatches.Classifies COMMITTED_MATCH, CONFLICT, NOT_FOUND, and UNKNOWN accurately.Pairs 4-way GET classification with exact step_journal audit events.
C5 Legacy non-idempotent containmentClaims unconditional exactly-once retries on legacy webhooks.Limits retry count while still risking duplicate webhook execution.Halts non-idempotent IN_FLIGHT crashes in RECONCILIATION_REQUIRED.Halts with 0 blind retries and defines operator reconciliation steps.
C6 Compaction handoff and scale limitsLets stale compacted prose override SQLite or mounts WAL on NFS.Pairs compaction with SQLite while missing Claude 5.5 wire rules.Enforces SQLite precedence, compact-2026-09-04 rules, and WAL host bounds.Documents all 4 live wire rules and 1:1 PostgreSQL or Temporal migration.

Proficiency standard: Proficient or higher on every criterion. Proposed local standard, not an official certification.

Self-check

The full brief

You receive an unfamiliar synthetic multi-step recovery workflow with an idempotent escrow release API, a downstream fulfillment API, and a legacy non-idempotent compliance webhook, plus four post-crash ledger traces and a zombie-worker race.

Submit a structured JSON solution (submission.json) specifying the canonical five-field idempotency tuple, transactional SQLite WAL outbox invariants, exact four-way reconciliation classifications (COMMITTED_MATCH, COMMITTED_CONFLICT, NOT_FOUND_DISPATCHED, UNKNOWN_HALTED), immediate /reconcile-barrier fencing, and compact-2026-09-04 handoff rules.

The assessment runs completely offline at $0.00. Passing requires at least 12 of 18 rubric points and zero critical failures across all seven automatic fail checks (CF-01 to CF-07). Completion confirms mastery within this course only and is not an external certification.

Teach it to a room

  • Timed facilitation plan

    A 150-minute workshop schedule (125 minutes through the three labs plus 25 minutes unseen assessment) with live SIGKILL demonstrations and crash-window checks.

  • 12-person and 100-person delivery plans

    Interactive fault-injection debugging clinics for 12-person rooms and autograded 10-mutant offline suites for 100-person cohorts.

  • Dry-run and observation rubric

    Anchored observation rubric verifying that instructors distinguish effectively-once APIs from non-idempotent legacy webhooks and state SQLite WAL host limits.

  • Pending instructor clearance record

    Unpopulated module-scoped clearance record that remains pending until two calibrated observers score a human teach-back.

  • Pass-rate report template

    Dual-denominator learner pass-rate template with Wilson intervals and small-cell suppression (n < 10).

  1. [1]Effective harnesses for long-running agents · anthropic.comchecked Nov 30, 2026
  2. [2]Compaction overview · platform.claude.comchecked Nov 30, 2026
  3. [3]Compaction on demand (compact-2026-09-04) · platform.claude.comchecked Nov 30, 2026
  4. [4]Compaction threshold (compact-2026-01-12) · platform.claude.comchecked Nov 30, 2026
  5. [5]Memory tool · platform.claude.comchecked Nov 30, 2026
  6. [6]Agent SDK session management · code.claude.comchecked Nov 30, 2026
  7. [7]Agent SDK file checkpointing · code.claude.comchecked Nov 30, 2026
  8. [8]Claude Managed Agents overview · platform.claude.comchecked Nov 30, 2026
  9. [9]Managed Agents session operations · platform.claude.comchecked Nov 30, 2026
  10. [10]Managed Agents events and streaming · platform.claude.comchecked Nov 30, 2026
  11. [11]Managed Agents workflow runs · platform.claude.comchecked Nov 30, 2026
  12. [12]Managed Agents budgets · platform.claude.comchecked Nov 30, 2026
  13. [13]Models overview · platform.claude.comchecked Nov 30, 2026
  14. [14]Claude pricing · platform.claude.comchecked Nov 30, 2026
  15. [15]Node.js v22 SQLite module documentation · nodejs.orgchecked Nov 30, 2026
  16. [16]Write-Ahead Logging in SQLite · sqlite.orgchecked Nov 30, 2026
  17. [17]Temporal Activities and idempotency · docs.temporal.iochecked Nov 30, 2026
  18. [18]@anthropic-ai/sdk 1.14.0 on npm · npmjs.comchecked Nov 30, 2026
  19. [19]Claude Agent SDK 0.3.332 on npm · npmjs.comchecked Nov 30, 2026

Independent work. Not affiliated with or endorsed by any vendor named in this guide.

Jordan Hudgens

Written by

Jordan Hudgens

Technical educator and AI engineering leader. 16 Udemy courses, 111K students, and curricula used by 250K+ learners.

Contact Jordan

Next in the path

All guides