Step journals: replay recorded decisions without rerunning the outside world
Define immutable event records, artifact references, deterministic control replay, and recovery for unresolved tool intents.
On this page
The question for today
What you’ll understand
- Reconstruct a run from accepted ordered events.
- Record nondeterministic model and tool results as replay inputs.
- Distinguish journal integrity from external-effect completion and artifact availability.
A durable journal turns recovery into an explicit reconstruction problem. It records what the runtime decided, what it requested, and what it actually learned about the result. Replay should consume recorded outcomes rather than ask a model or external service to recreate the past. The difficult boundary is an intent whose external effect may have happened before its completion was recorded.
Journal events describe facts at precise boundaries
A proposed journal can append intent, dispatch, result-observed, effect-confirmed, approval, budget, and terminal events with stable identities. Define which transitions share a storage transaction and which merely follow one another. Append corrections or reconciliation findings instead of silently rewriting an old success into a failure. Include logical step, attempt, incarnation, expected revision, contract version, and references to the relevant inputs and outputs. An application log line is not automatically a durable accepted event.
Store large artifacts through immutable versioned references with integrity metadata and an availability policy. A digest can detect a changed payload when compared against a trusted record, but it cannot recover a missing payload. Retention and access controls must cover the artifacts required for recovery. A redacted diagnostic trace and a complete execution record can serve different purposes. State what information is replay-critical and how its deletion or expiration changes the supported recovery window.
Determinism concerns the recorded command history
A model response is a nondeterministic external result for replay purposes. Preserve the actual response and its artifact identity, along with model, prompt, tool-schema, and decoding configuration. A fixed seed or zero temperature does not guarantee a future provider invocation returns identical bytes under changed infrastructure or model revisions. Likewise, wall-clock reads, random values, network lookups, and scheduler order need recorded inputs or workflow-safe APIs when they affect control decisions. Do not turn a replay into a new planning run silently.
Temporal's documented replay compares generated commands with its Event History under deterministic constraints. That is a concrete platform mechanism, not a promise that arbitrary application code can replay safely. Code changes need the platform's supported compatibility or versioning strategy. In the proposed journal design, define equivalent rules for reducer and schema evolution. A hash chain can assist integrity checking, but an untrusted actor able to replace the whole chain and its root is not defeated by hashes alone; use a trusted anchor and access policy.
An unresolved intent requires effect-aware recovery
If the journal contains a tool intent but no confirmed outcome, determine whether dispatch occurred and whether the provider can resolve the logical operation. Use a stable idempotency key, provider receipt lookup, conditional resource state, or another implemented reconciliation path. Replaying a recorded completion should not repeat its external write. Retrying an unresolved intent with a new identity can create a duplicate. Test crashes before dispatch, after provider commit, and before journal append rather than assuming the same handler exception covers every window.
The cache lab models only the performance of retaining a small working set. Reset, set C=3 and s=4, predict zero initial hits in sixteen requests, then Play or Step. Separately Reset, set C=4 and s=4, predict twelve, then Play or Step. A workflow state cache can reduce reconstruction work, but this toy LRU stream has no journal or durable storage. Evicting a cache entry is different from losing its authoritative history; validate replay from the durable record even after every in-memory entry is gone.
Work it through
Reconstruct two completions and one unresolved intent
A proposed journal records intent and completion for step A, intent and completion for B, then intent for C. It has five ordered events. The worker crashes after C may have reached its provider.
Replay folds all five accepted events and reconstructs two confirmed step results, A and B.
Neither recorded completion is a reason to call its external tool again. C remains one unresolved intent rather than a third confirmed result.
Reconcile C using its stable effect identity and provider evidence. If a completion is confirmed, append the next accepted event at sequence six under the store's concurrency rule; do not invent that result from the missing journal entry.
Five events establish two known completions and one unresolved effect boundary, not permission to rerun every step.
The living notebook
Explore the model
Interactive lab · cache
A fast state cache is not the durable journal
Reset, set C=3 and s=4, predict zero initial hits in 16 requests, then Play or Step. Separately Reset, set C=4 and s=4, predict 12 initial hits, then Play or Step. The modulo-16 LRU model has no event history, replay engine, integrity hashes, or remote effects.
- Hits / requests
- 0 / 16
- Hit rate
- 0%
- Address-stream period
- 16 addresses
A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forRecovery must work from authoritative history even when an in-memory cache is empty.
Pause & reason
Check your understanding
Your turn
Try it yourself
Ten sequential steps each have one intent and one completion event, except the last has no completion. Count journal events, confirmed steps, and unresolved intents.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Count nine complete pairs plus the final intent.
Compare with the solution
There are 9×2+1=19 events, nine confirmed steps, and one unresolved intent. The missing completion does not prove the tenth external effect was absent. Recovery needs the declared provider and journal protocol, not a new uncorrelated retry.
Keep the idea
Take it with you
- Replay needs recorded nondeterministic results and compatible reducers.
- Journal integrity, artifact availability, and effect truth are separate properties.
- Unresolved intents require reconciliation across the external boundary.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.