The retry reads the ledger first.

A plain function that dies between the capture and the order charges the card twice. A Durable run writes a step's intent to its row before the call and the answer after it, so the retry finds the capture and creates the order once. Every claim on this page is a row in your database or a line in your tree.

npx durable-sdk init my-appdurable-sdk deploy

The night it prevents

One checkout, one crash between the capture and the order, one retry. The left column is a function and a retry; the right is the same intent as a Durable run.

A plain function

await capture(); await createOrder(); and a retry on failure.

  1. 22:14:03POST /checkout chk_4f21
  2. 22:14:03payments.capture($42.00)
  3. 22:14:04← pay_7f3a charged
  4. 22:14:04orders.create(chk_4f21) …
  5. 22:14:04the process died (SIGKILL)
  6. 22:14:09retry POST /checkout chk_4f21
  7. 22:14:09payments.capture($42.00) again
  8. 22:14:10← pay_8c02 charged
  9. 22:14:10orders.create ok
  10. morningtwo charges on one card; pay_7f3a refunded by hand
charges2

The same intent under Durable

key: [checkoutId, requestId]; payment.capture with its undo; order.create ledgered.

  1. 22:14:03execute checkout.complete key chk_4f21:q7c1
  2. 22:14:03payment.capture intent on the row, then the call
  3. 22:14:04← pay_7f3a after image landed seq 41
  4. 22:14:04order.create(chk_4f21) …
  5. 22:14:04the process died (SIGKILL)
  6. 22:14:09retry same input, same key: the one run
  7. 22:14:09payment.capture seq 41 found: pay_7f3a, no second call
  8. 22:14:10order.create ok seq 42
  9. 22:14:10order.placed emitted once
  10. morningone charge; one row that says so
charges1

The till

A cash register keeps a tape, not a number. The left column stores the total and overwrites it on every sale; the right prints a line and sums the tape. Press the controls; the crash is the night above.

A stored total

total = total + sale; total = total − refund

$65.25unknown

read back as it stands; nothing says what happened

historynone to read back

A tape

append(line); total = sum(lines)

  1. 1sale+$42.00a654
  2. 2sale+$18.50292e
  3. 3refund−$42.000d15
  4. 4sale+$25.008881
  5. 5sale+$9.009840
total, rebuilt from the tape$52.50
Z report: 5 lines, chain ok
  • Every step's before and after image is a line on the tape: appended, hashed on the line before, never edited.
  • A run's result and the console's views are the total: derived from the lines when read, never stored a second time; the eleventh rule.
  • An undo is a reversing line, and verify is the Z report: every hash recomputed from the first line, the first that does not hold named.

What you can check

Not claims. Rows in your database and lines your terminal prints.

A ledger row

The image the step found and the image it left, its hash chained on the row before. No update and no delete, by interface and by trigger.

durable-sdk ledger export --out ledger.json

One ledger row
seqstepresourceoperationbeforeafterprevHashhash
41payment.capture a1payment/pay_7f3acreatenull{ paymentId: "pay_7f3a", amount: 4200 }8c1f…e0a4e41b…9c02

An undo row

A compensation is a row too: what it found, what it restored, and the row it reverses. The undo is a record, not a hope.

durable-sdk undo --scope chk_4f21 --since 2026-10-28T22:14:00Z --api <url>

seq 43 payment.capture.undo reversesId 41 0a77…d4e1

found
{ paymentId: "pay_7f3a", status: "captured" }
restored
{ status: "refunded" }

A doctor finding

Every rule over the tree, offline, before a deploy. A failed rule is one line with its fix and the ADR that states it.

durable-sdk doctor --host

error  workflow-identity/key-reads-no-clock  app/workflows/checkout.ts:9  the key reads the clock: Date.now() in key()  → put the moment in the input as requestId and key on the field list  (ADR-0041)not ok: 1 finding (39 guard files, 39 in the manifest, 1 checks failed, 4222 passed, 0 skipped)

A refusal, explained

Every refusal a door throws has an id; the same command answers an error code and a run id. Offline, with no app running.

durable-sdk explain step.undo.effect

step.undo.effect · the refusals registry
door
ctx.step, ctx.poll, ctx.batch, defineStep, defineExternalStep
throws
TypeError
says
<step>: a step with an undo declares what it changed; say effect: "provider" (a call whose answer the ledger keeps), "ledgered" or "external"
trap
A step with an undo and no effect is read: it lands no ledger row, no reversesId, nothing for undo.run, so the console cannot show what it changed and the undo has no image to restore.
remedy
Declare the effect beside the undo: "provider" for a call whose answer the ledger keeps, "ledgered" for rows the body appends, "external" for a recorded write.
adr
ADR-0060 decision 2

What the agent sees

The same checkout, asked instead of read.

An agent that reads a tree file by file guesses at the end. One that asks the graph gets lines: what the door admits, what each step calls and whether it can undo, what the run emits and who listens. The chain from the door to the payment’s capture is in the accent: three hops, three lines.

path door:api:checkout/complete → provider:payments.capture · 3 hops
The walk from door:api:checkout/complete, three hops, the chain to the payment's capture litwalk door:api:checkout/complete · out · depth 3 · 11 edges · 12 nodes. One row an edge under its verb, the depth as the indent, the start solid first.door checkout/completeworkflow checkout.completefact order.placedlistener send-receiptstep cart.readprovider cart.readstep stock.reserveprovider stock.reservestep payment.captureprovider payments.capturestep order.createprovider orders.create

The solid pill is where the walk starts. A pill drawn twice is a step with an undo. A dashed stub leaves a pill the walk reached and did not expand: the next question starts there. Press a pill to walk from it. Press Path, then two pills, for the first chain between them: durable-sdk graph path <from> <to>.

durable-sdk graph path door:api:checkout/complete provider:payments.capturepath door:api:checkout/complete → provider:payments.capture · 3 hopsdoor:api:checkout/complete admits workflow:checkout.complete · body checkoutId @ api/checkout/complete.ts:17workflow:checkout.complete declares step:checkout.complete:payment.capture · ctx.step · provider · undo @ src/workflows/checkout-complete.ts:23step:checkout.complete:payment.capture calls provider:payments.capture · via effects @ src/workflows/checkout-complete.ts:25drawbacks: admits, ctx.step, calls
admitsA door judges from the rows as read and answers a refusal as a value before any run exists, and the step keeps the same guard as the race's backstop: two posts a moment apart both pass the door's reading and the step's compare-and-set refuses the second from the row as it stands, so the door's judgement is a courtesy to the phone, never the fence; the run the door admits is keyed by the input and a second post under the key answers the first run (reused).
ctx.stepOne step row per call, started before the body and finished after it, the ledger rows the body appends under its effect; a crash between the body and the row's finish re-invokes the body on the next attempt (a provider call is replayed from its ledger row, a read is run again), and a redrive replays every finished row and re-runs the step that failed. A read step declared completion: "behind" (FP-011 as landed, opt-in) lands its COMPLETED row on the next boundary's statement or the finish instead of its own, one statement a step where there were two, at the price that a crash between its body's return and that statement leaves the row STARTED and the next attempt reads again; the default ("now") keeps the answer on its row before the body goes on, replayed after any crash (ADR-0063 B22).
callsA provider call is reached through a connector by capability, never a provider's name (business code branches on the connector's capabilities, the connector modules alone import a client), takes a token from its account's bucket first and carries the step's stop so a cancel or a deadline aborts it in flight; it is never retried by the client when non-idempotent, and the call has no row of its own: once the step's row landed the call is replayed from it, and a crash between the call and the row's finish re-invokes the step on the next attempt and sends it again (the ctx.step row), so a call that must not be sent twice is read for first or made under a recordedWrite or an external step, whose row is written before it; a call the walk reads outside any step is a provider reached with no row to replay from, said as the body's.

What the agent reads: one line per edge under its depth, the file and line to open next on every line that names a thing, the drawbacks folded, one sentence per primitive met, the registry’s own.

Vibe coding with the graph walks four questions through the verbs.

Beside the other shapes

Each shape by what its own documentation says it does. Three columns differ.

Six shapes: where the state lives, the undo, the audit
ShapeWhere the state livesUndoThe audit
Durableyour Postgres, the durable schemaa compensation per step, each a ledger rowan append-only, hash-chained ledger; verify walks it
A workflow cluster you runthe server's event historythe saga pattern, by handthe history, kept for a period
Hosted event functionsthe vendor's storeby handthe run's steps, in the dashboard
A platform's durable functionsthe platform's persistenceby handthe run's trace, in the dashboard
A queue with retriesthe brokernonelogs
A job tableyour tablenonelogs

One record; every view derived from it. Every product by name, with its sources, in the whole table.

Against each product

Eleven products, one walk each: what it gives by its own documentation, what that leaves you to write, and the same work under Durable. The queue here, the rest on their own pages.

A queue: SQS

A standard queue hands you delivery. Everything after the receive is yours.

12 / 12

What SQS gives, as its documentation describes

  1. 1

    At-least-once delivery

    it gives
    A standard queue delivers each message at least once; a copy can arrive more than once.
    you write
    An idempotency check in the consumer, keyed on a field you choose and stored somewhere you keep.
  2. 2

    A visibility timeout

    it gives
    A received message is hidden from other consumers for the timeout; the consumer deletes it when the work is done.
    you write
    A deadline on your own work, extended by hand when a step runs long.
  3. 3

    Redelivery

    it gives
    A message not deleted before the timeout ends becomes visible again and is received again.
    you write
    A status column, so the second receive can tell what the first one already did.
  4. 4

    A dead-letter queue

    it gives
    After a set number of receives the message moves to a dead-letter queue you name.
    you write
    The compensation when the third step of four fails: by hand, before the message moves, with no record of the first two.
  5. 5

    Ordering

    it gives
    A standard queue orders at best effort; a FIFO queue keeps the order inside a message group.
    you write
    The order of your own steps across receives, when a later receive overtakes an earlier one.
  6. 6

    FIFO deduplication

    it gives
    A FIFO queue accepts a second message with the same deduplication id inside a deduplication interval and does not deliver it.
    you write
    The same guard once the interval has passed, and the record of what each receive changed.
things you write6

The same work under Durable

  1. 7

    The delivery id is the intent key

    it does
    key: ["messageId"]. A redelivery joins the one run, and a step already done is served from its row, never called again.
  2. 8

    Each step a row, then the undos in reverse

    it does
    The image it found and the image it left, hash-chained, append-only: the record of what each receive changed, written by the engine. The completed steps' undos run in reverse, each its own row, and the run waits in limbo with its rows for a person, no dead-letter queue to read back.
  3. 9

    What the queue leaves to the consumer is an option here

    it does
    The key dedupes for the row's life, not for an interval; a delay has no short cap; the retry ladder is declared on the listener; debounce, throttle, priority and fair share are options on a per-row listener; the outbox archives and replays; one failed run waits in limbo, never in a second queue.
  4. 10

    One bad row parks alone

    it does
    A per-row listener registered beside a batch listener parks the row it failed on alone, with its run named, while the rows whose reactions completed are delivered in the one statement.
  5. 11

    The agent asks the graph

    it does
    durable-sdk explain <workflow> prints what the door admits, every step with its undo and its writes, the facts and who listens; durable-sdk graph walk <subject> prints the closure from any node; durable-sdk graph impact --changed prints what a change reaches before it is made. Offline, over a committed index: an AI coding agent asks before it edits, never guesses.
  6. 12

    Nothing to write but the steps

    it does
    No status column, no idempotency check, no compensation by hand, no record kept by hand.
    you write
    The steps and their undos.
things you write1

When SQS wins: fire-and-forget fan-out at very large volume, with one idempotent handler that changes nothing worth imaging. The walk in prose, with its sources.

The whole table, with every source, in Compared.

Measured, not estimated

Read off the newest develop bench and written into the bench's targets from its artifact with the run and the machine; the floors under the figures only tighten, and a pull request that loosens one says why.

runs a minute
4,024
a ten-step workflow; eight starters in one process on a ten-connection pool; a two-vCPU CI runner, the database on the same machine.
a ledger append, p95
4.3 ms
uncontended, 300 sequential appends; p50 3.7 ms; a two-vCPU CI runner, the database on the same machine.
lost, doubled, in limbo
0
facts, writes and runs after a restart under load; a laptop, the database on loopback.

The runs and the append are develop's bench run 40945075490 of 2026-10-29; the restart zeros are exact on every machine measured. The whole table and what bounds it, in Why Durable.

When to pick another

Three cases where another shape wins today.

Workers in several languages
A cluster's SDKs cover Go, Java, Python and more. Durable is TypeScript, and a second language is a later plan, not a promise.
Millions of concurrent timers
A sleeping run is four rows, about 1.7 kB with its indexes, and the read that finds the due ones is one index probe at a million; but a timer fires at minute precision through the sweeper, and a backlog of due timers drains at about fifty a minute. A cluster is built for that volume.
Fire-and-forget work
A job that is one call, can run again and changes nothing worth imaging wants a queue, not a ledger row.

One charge, and a row that says so.

Two commands to an app with a ledger, and one that asks the graph what happens before you edit.