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 stepsDecision
// 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.
| Layer | Store | Reference engine |
|---|---|---|
Durable.memory | In process, gone at exit. A real engine, not a mock | FlowEngine.layerMemory |
Durable.sqlite({ filename, workspace?, owner? }) | One SQLite file | NodeRuntime.layerHost in the reference engine's Node platform package, BunRuntime.layerHost in its Bun platform package |
Durable.postgres({ url, owner? }) | PostgreSQL | The same runtimes over @effect/sql-pg |
Runs.
| Call | Meaning | Reference engine |
|---|---|---|
Durable.run(W, id) | A Run<A, E> handle for a stored run | W.poll, W.execute, W.interrupt, W.resume behind it |
Durable.runs({ status?, workflow? }) | A stream of run rows | RunStore |
Durable.plan(W, ...args) | The plan W would run for these arguments: nodes, edges, keys, a digest | Graph.build(flow, payload, { callbackIdentity: "stable" }), Graph.drafts, Plan.compile |
Durable.diff(planA, planB) | Added, removed and re-keyed nodes | PlanDiff |
History and time travel. A position is { run, seq }: a run and a sequence number in its journal.
| Call | Meaning | Reference 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 cache | ReadOnlyTimeTravel.replay |
Durable.fork(at) | A new run that reuses every step before at | TimeTravel.fork |
Durable.rewind(at) | Truncate the run to at, undoing compensable steps | TimeTravel.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
- 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.
- 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.
- 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. - A step's event and its state commit together, in one transaction, so history has no holes.
- Reuse across runs is opt-in. It needs an
idempotencyKey, animplementationVersionand a hard file boundary. A memoized model answer is never promoted to the shared cache. - 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. - Credentials never reach the journal. Payloads are scrubbed before they are encoded (
flows/journal/README.md). - Identity and representation follow VIP-44: canonical JSON and SHA-256 for identity, an injected
RpcSerializationfor stored bytes.
What must change in the reference engine
- VIP-44's identity rows landed at
main@originbcf8076a4ff4on 2026-11-09. Its storage rows have not: stored results still use a fixedSchema.toCodecJson, notRpcSerialization.codecFor. - The reference engine's published 1.0.0-rc.16 packages require
effect4.0.5, and Vibe 0.0.13 pins 4.1.1. The reference engine'smainis on 4.1.1. This module needs the reference engine's next release.
Host needs
| Need | Why |
|---|---|
| A SQL client | SQLite or PostgreSQL. Browser hosts use SQLite on OPFS in a worker; Cloudflare uses one Durable Object per run. |
Effect's Crypto digest | Keys and plan digests |
jj 0.39.0 or later on PATH | 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. |
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.layerHostin the reference engine's Node platform package,BunRuntime.layerHostin 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: ARun<A, E>handle for a stored run; Reference engine:W.poll,W.execute,W.interrupt,W.resumebehind 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 planWwould 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 toat. 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 beforeat; Reference engine:TimeTravel.fork. Design · Review. - Call
Durable.rewind(at): Meaning: Truncate the run toat, undoing compensable steps; Reference engine:TimeTravel.rewind. Design · Review. forkandrewindfail withDurable.TimeTravelError, whosecodeis 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 isAction.withCache. Design · Review. scopeis"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, animplementationVersionand 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
RpcSerializationfor stored bytes. Design · Review. - VIP-44's identity rows landed at
main@originbcf8076a4ff4on 2026-11-09. Design · Review. - Its storage rows have not: stored results still use a fixed
Schema.toCodecJson, notRpcSerialization.codecFor. Design · Review. - The reference engine's published 1.0.0-rc.16 packages require
effect4.0.5, and Vibe 0.0.13 pins 4.1.1. Design · Review. - The reference engine's
mainis 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
Cryptodigest: Why: Keys and plan digests. Design · Review. - Need
jj0.39.0 or later onPATH: 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 withnot_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.Xnames 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.startare the two ways to create a second run. Review decision. - The
jjrequirement applies only to fork and compensable tasks, including a rewind that restores a compensable task's workspace. Replay, sealed and irreversible tasks need nojj. 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 }
})| Program | Tokens (o200k_base) | Lines |
|---|---|---|
| Vibe, proposed | 62 | 5 |
| Reference engine 1.x | 153 | 15 |
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.
forkreruns 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.Encodedstays: everything that decides behavior sits above it. - Factory-first. The factory's runs are
Durableruns, and their journals are the public record.
What this changes
Experimental.Durableis new.- A Vibe program depends on the reference engine's flows package when it uses
Durable,taskorworkflow. VIP-44 already made that dependency. - Effect's
WorkflowEnginestays in scope and is unrelated.
Alternatives
- Effect's
WorkflowEngineandClusterWorkflowEngine. 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,CacheStoreandTimeTravelare 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/rewindcommand exists and stays. A program that repairs its own runs needs the calls.
Follow-up questions
jjas a requirement. Decided for v1: only fork and compensable tasks requirejj, including rewinds that restore those tasks' workspace.replay, sealed and irreversible tasks do not.- How much of the journal is public?
Durable.historyreturns 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. - 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
- VIP-44, accepted.
- capabilities: the guarded host an engine runs steps on.