Skip to content

VIP-60: Experimental.Durable, the durable runtime: journal, replay, run state, step cache and time travel

Status: accepted by Will, 2026-11-23 — standard library only (no compiler or language changes). Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". Implemented in the runtime as Experimental.Durable.

Will's words

Vibelang is meant to have most of the features of durable execution agents etc. built into it. What is that status? Are the VIP open or are VIP missing for things like adding llm calls or jev calls to language sandboxing durable execution etc?

Ok so give me a list of [the reference engine's] features. We need to figure out what the VIP should look like. Some of the features outside of durable execution likely should simply be in the standard library I'm guessing but we should enumerate all of them

Summary

One sentence. Experimental.Durable is the standard-library module that runs what task and workflow declare: it journals each step, replays a run after a crash, caches results, and reads, forks or rewinds a run's past.

One paragraph. The language VIPs emit declarations for the reference engine (an existing Effect durable-execution framework these built-ins are modelled on). This module is the engine under them: the reference engine itself, ported behind one namespace. A program picks a store with one layer: Durable.memory for tests, Durable.sqlite or Durable.postgres for a server. Everything else is a function over a run id. The module wraps eight of the reference engine's packages (engine, engine-store, journal, run-store, step-cache, time-travel, keys, canonical) and adds no behavior of its own. Three things stay separate throughout: a run's progress, its committed history, and the cache of reusable results.

 workflow Triage ──► Durable ──► journal      append-only events, one order per run
                        │   ──► run store    one row per run: status, owner, heartbeat
                        │   ──► step cache   results by content key, shared across runs
                        ▼
                  time travel:   replay(at)  read the past       changes nothing
                                 fork(at)    branch a new run    reuses steps before `at`
                                 rewind(at)  truncate the run    undoes compensable steps

Decision

// proposed
export effect function main() {
  provide Layer.provideMerge(Triage.layer, Experimental.Durable.sqlite({ filename: ".vibe/runs.db" })) {
    return try Triage("smithersai/vibelang")     // kill the process mid-run; the next start resumes the same run
  }
}
// proposed
export effect function forkAt(run: string, seq: number) {
  const events = try Stream.runCollect(Stream.map(Experimental.Durable.history(run), (entry) => entry.eventType))
  const copy = try Experimental.Durable.fork({ run, seq })
  return { events, copy }
}

Module

Experimental.Durable, in scope with no import, as VIP-33 rules. Its code is vibelang-runtime/experimental/Durable. The timers and signals of durable-waits live in the same module.

Engines. Each is a layer that provides the runtime a workflow's layer needs. None is a default: a workflow with no engine has a missing requirement, and the compiler says so.

LayerStoreReference engine
Durable.memoryIn process, gone at exit. A real engine, not a mockFlowEngine.layerMemory
Durable.sqlite({ filename, workspace?, owner? })One SQLite fileNodeRuntime.layerHost in the reference engine's Node platform package, BunRuntime.layerHost in its Bun platform package
Durable.postgres({ url, owner? })PostgreSQLThe same runtimes over @effect/sql-pg

Runs.

CallMeaningReference engine
Durable.run(W, id)A Run<A, E> handle for a stored runW.poll, W.execute, W.interrupt, W.resume behind it
Durable.runs({ status?, workflow? })A stream of run rowsRunStore
Durable.plan(W, ...args)The plan W would run for these arguments: nodes, edges, keys, a digestGraph.build(flow, payload, { callbackIdentity: "stable" }), Graph.drafts, Plan.compile
Durable.diff(planA, planB)Added, removed and re-keyed nodesPlanDiff

History and time travel. A position is { run, seq }: a run and a sequence number in its journal.

CallMeaningReference engine
Durable.history(run)The run's journal, as a stream of { seq, eventType, payload }Journal.entries, paged
Durable.replay(at, { initial, reduce })Fold the journal up to at. Runs nothing, and needs only the journal and the cacheReadOnlyTimeTravel.replay
Durable.fork(at)A new run that reuses every step before atTimeTravel.fork
Durable.rewind(at)Truncate the run to at, undoing compensable stepsTimeTravel.rewind

fork and rewind fail with Durable.TimeTravelError, whose code is the reference engine's closed list of twelve: busy, live_parent, live_child, not_found, invalid, already_crossed, rate_limited, compensation_failed, irreversible, fence_lost, limit_exceeded, unknown. A rewind refuses to cross an irreversible step: no engine can unsend an email.

Cache. A task opts in with static readonly cache = { ttlMs?, scope? }, which is Action.withCache. scope is "run", "flow" or "shared". Durable.remoteCache({ url }) adds a shared tier that speaks the action-cache half of Bazel's remote cache protocol (RemoteCacheStore). A cache entry may expire or be evicted; a run's committed result never depends on one.

Retention. Durable.sweep({ olderThan }) deletes old run history and unreferenced artifacts. Nothing is deleted on a schedule the program did not set.

Guarantees the port keeps

  1. A finished step never runs twice in one run. A step opens a row before its body and settles it after. A restart reads the record.
  2. A step that did not finish can run again. A crash after an outside effect and before the record repeats the handler. Delivery is at-least-once, so an irreversible task carries an idempotency key and the destination deduplicates it.
  3. One owner per run. Every durable write is fenced against the owner that claimed the run. A process that came back from the dead fails with fence_lost.
  4. A step's event and its state commit together, in one transaction, so history has no holes.
  5. Reuse across runs is opt-in. It needs an idempotencyKey, an implementationVersion and a hard file boundary. A memoized model answer is never promoted to the shared cache.
  6. A changed plan is refused, not rerun. A resume that rebuilds a different plan than the run recorded fails with plan_changed. Nothing repairs a divergence by running under a new key.
  7. Credentials never reach the journal. Payloads are scrubbed before they are encoded (flows/journal/README.md).
  8. Identity and representation follow VIP-44: canonical JSON and SHA-256 for identity, an injected RpcSerialization for stored bytes.

What must change in the reference engine

  • VIP-44's identity rows landed at main@origin bcf8076a4ff4 on 2026-11-09. Its storage rows have not: stored results still use a fixed Schema.toCodecJson, not RpcSerialization.codecFor.
  • The reference engine's published 1.0.0-rc.16 packages require effect 4.0.5, and Vibe 0.0.13 pins 4.1.1. The reference engine's main is on 4.1.1. This module needs the reference engine's next release.

Host needs

NeedWhy
A SQL clientSQLite or PostgreSQL. Browser hosts use SQLite on OPFS in a worker; Cloudflare uses one Durable Object per run.
Effect's Crypto digestKeys and plan digests
jj 0.39.0 or later on PATHOnly for a compensable task, a fork, and a rewind that crosses a compensable step. A host builds without it, and the first jj operation fails with not_installed.

Which host supplies them is VIP-54's question.

Maintainers' decisions

This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.

  • Experimental.Durable, in scope with no import, as VIP-33 rules. Design · Review.
  • Its code is vibelang-runtime/experimental/Durable. Design · Review.
  • The timers and signals of durable-waits live in the same module. Design · Review.
  • Engines. Each is a layer that provides the runtime a workflow's layer needs. Design · Review.
  • None is a default: a workflow with no engine has a missing requirement, and the compiler says so. Design · Review.
  • Layer Durable.memory: Store: In process, gone at exit. A real engine, not a mock; Reference engine: FlowEngine.layerMemory. Design · Review.
  • A real engine, not a mock | FlowEngine.layerMemory | Design · Review.
  • Layer Durable.sqlite({ filename, workspace?, owner? }): Store: One SQLite file; Reference engine: NodeRuntime.layerHost in the reference engine's Node platform package, BunRuntime.layerHost in its Bun platform package. Design · Review.
  • Layer Durable.postgres({ url, owner? }): Store: PostgreSQL; Reference engine: The same runtimes over @effect/sql-pg. Design · Review.
  • Runs. Design · Review.
  • Call Durable.run(W, id): Meaning: A Run<A, E> handle for a stored run; Reference engine: W.poll, W.execute, W.interrupt, W.resume behind it. Design · Review.
  • Call Durable.runs({ status?, workflow? }): Meaning: A stream of run rows; Reference engine: RunStore. Design · Review.
  • Call Durable.plan(W, ...args): Meaning: The plan W would run for these arguments: nodes, edges, keys, a digest; Reference engine: Graph.build(flow, payload, { callbackIdentity: "stable" }), Graph.drafts, Plan.compile. Design · Review.
  • Call Durable.diff(planA, planB): Meaning: Added, removed and re-keyed nodes; Reference engine: PlanDiff. Design · Review.
  • History and time travel. A position is { run, seq }: a run and a sequence number in its journal. Design · Review.
  • Call Durable.history(run): Meaning: The run's journal, as a stream of { seq, eventType, payload }; Reference engine: Journal.entries, paged. Design · Review.
  • Call Durable.replay(at, { initial, reduce }): Meaning: Fold the journal up to at. Runs nothing, and needs only the journal and the cache; Reference engine: ReadOnlyTimeTravel.replay. Design · Review.
  • Runs nothing, and needs only the journal and the cache | ReadOnlyTimeTravel.replay | Design · Review.
  • Call Durable.fork(at): Meaning: A new run that reuses every step before at; Reference engine: TimeTravel.fork. Design · Review.
  • Call Durable.rewind(at): Meaning: Truncate the run to at, undoing compensable steps; Reference engine: TimeTravel.rewind. Design · Review.
  • fork and rewind fail with Durable.TimeTravelError, whose code is the reference engine's closed list of twelve: busy, live_parent, live_child, not_found, invalid, already_crossed, rate_limited, compensation_failed, irreversible, fence_lost, limit_exceeded, unknown. Design · Review.
  • A rewind refuses to cross an irreversible step: no engine can unsend an email. Design · Review.
  • Cache. A task opts in with static readonly cache = { ttlMs?, scope? }, which is Action.withCache. Design · Review.
  • scope is "run", "flow" or "shared". Design · Review.
  • Durable.remoteCache({ url }) adds a shared tier that speaks the action-cache half of Bazel's remote cache protocol (RemoteCacheStore). Design · Review.
  • A cache entry may expire or be evicted; a run's committed result never depends on one. Design · Review.
  • Retention. Durable.sweep({ olderThan }) deletes old run history and unreferenced artifacts. Design · Review.
  • Nothing is deleted on a schedule the program did not set. Design · Review.
  • A finished step never runs twice in one run. A step opens a row before its body and settles it after. Design · Review.
  • A restart reads the record. Design · Review.
  • A step that did not finish can run again. A crash after an outside effect and before the record repeats the handler. Design · Review.
  • Delivery is at-least-once, so an irreversible task carries an idempotency key and the destination deduplicates it. Design · Review.
  • One owner per run. Every durable write is fenced against the owner that claimed the run. Design · Review.
  • A process that came back from the dead fails with fence_lost. Design · Review.
  • A step's event and its state commit together, in one transaction, so history has no holes. Design · Review.
  • Reuse across runs is opt-in. It needs an idempotencyKey, an implementationVersion and a hard file boundary. Design · Review.
  • A memoized model answer is never promoted to the shared cache. Design · Review.
  • A changed plan is refused, not rerun. A resume that rebuilds a different plan than the run recorded fails with plan_changed. Design · Review.
  • Nothing repairs a divergence by running under a new key. Design · Review.
  • Credentials never reach the journal. Payloads are scrubbed before they are encoded (flows/journal/README.md). Design · Review.
  • Identity and representation follow VIP-44: canonical JSON and SHA-256 for identity, an injected RpcSerialization for stored bytes. Design · Review.
  • VIP-44's identity rows landed at main@origin bcf8076a4ff4 on 2026-11-09. Design · Review.
  • Its storage rows have not: stored results still use a fixed Schema.toCodecJson, not RpcSerialization.codecFor. Design · Review.
  • The reference engine's published 1.0.0-rc.16 packages require effect 4.0.5, and Vibe 0.0.13 pins 4.1.1. Design · Review.
  • The reference engine's main is on 4.1.1. Design · Review.
  • This module needs the reference engine's next release. Design · Review.
  • Need A SQL client: Why: SQLite or PostgreSQL. Browser hosts use SQLite on OPFS in a worker; Cloudflare uses one Durable Object per run. Design · Review.
  • Browser hosts use SQLite on OPFS in a worker; Cloudflare uses one Durable Object per run. Design · Review.
  • Need Effect's Crypto digest: Why: Keys and plan digests. Design · Review.
  • Need jj 0.39.0 or later on PATH: Why: Only for a compensable task, a fork, and a rewind that crosses a compensable step. A host builds without it, and the first jj operation fails with not_installed. Design · Review.
  • A host builds without it, and the first jj operation fails with not_installed. Design · Review.
  • Which host supplies them is VIP-54's question. Design · Review.

Adopted review answers

  • Keep Experimental.X names under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.
  • Repeat calls with the same input join the first run, per VIP-44. Triggers and W.start are the two ways to create a second run. Review decision.
  • The jj requirement applies only to fork and compensable tasks, including a rewind that restores a compensable task's workspace. Replay, sealed and irreversible tasks need no jj. Review decision.

Compared

The second example for the reference engine 1.x. It type-checks against the reference engine's time-travel and flows packages at 1.0.0-rc.16.

import { Engine } from "@smthrs/flows"
import { TimeTravel } from "@smthrs/time-travel"
import { Effect } from "effect"
 
export const forkAt = (runId: string, seq: number) =>
  Effect.gen(function*() {
    const timeTravel = yield* TimeTravel
    const position = { runId, frame: { lineageId: Engine.FlowEngine.Lineage.root(runId), seq } }
    const events = yield* timeTravel.inspect<ReadonlyArray<string>>(position, {
      initial: [],
      reduce: (seen, entry) => [...seen, entry.eventType]
    })
    const fork = yield* timeTravel.fork(position)
    return { events, fork }
  })
ProgramTokens (o200k_base)Lines
Vibe, proposed625
Reference engine 1.x15315

Checked. The forkAt example uses only existing syntax and compiles under vibelang 0.0.13 against a declaration of the proposed module. The first example uses workflow, which is new. The reference-engine program type-checks as shown. One trap found while checking: const fork = … is EK1702 in Effect code, because fork is reserved.

Principles

  • TypeScript-first. A namespace of functions. No syntax.
  • Effect-second. Bends, as durable-tasks-workflows says: Effect ships WorkflowEngine, and this module is the reference engine instead. Every surface is still an Effect, a Layer or a Stream.
  • Optimized for agentic programs. A crashed agent resumes without paying for a finished model call. fork reruns a run from the step that went wrong.
  • Highly forkable. A fork swaps the store by providing another layer. The seam the reference engine calls FlowEngine.Encoded stays: everything that decides behavior sits above it.
  • Factory-first. The factory's runs are Durable runs, and their journals are the public record.

What this changes

  • Experimental.Durable is new.
  • A Vibe program depends on the reference engine's flows package when it uses Durable, task or workflow. VIP-44 already made that dependency.
  • Effect's WorkflowEngine stays in scope and is unrelated.

Alternatives

  • Effect's WorkflowEngine and ClusterWorkflowEngine. In scope today. No static plan, no step cache, no time travel, and a different identity pipeline from the one VIP-44 accepted.
  • Expose the eight packages under their own names. Journal, RunStore, CacheStore and TimeTravel are engine parts. A program asks about runs, so the module is organized by run.
  • A memory engine when nothing is provided. A durable program would then lose its runs silently. A missing engine is a compile error.
  • Put time travel in a product. The reference engine's runs replay/fork/rewind command exists and stays. A program that repairs its own runs needs the calls.

Follow-up questions

  1. jj as a requirement. Decided for v1: only fork and compensable tasks require jj, including rewinds that restore those tasks' workspace. replay, sealed and irreversible tasks do not.
  2. How much of the journal is public? Durable.history returns raw entries, whose event types are the reference engine's internal vocabulary. Recommendation: publish entries as they are, versioned, and document only the step and wait events.
  3. Schema changes under a parked run. A run recorded with one schema and resumed with another is refused today (payload_changed). Which changes, such as an added optional field, may resume? Recommendation: refuse all in the first release.

Depends on