Runtime And Layout
This page is the short runtime model for contributors who need to reason about replay, run state, or journal repair.
Deterministic Replay Loop
The core orchestration flow spans the SDK runtime and storage layers:
- Acquire
run.lock. - Build the replay engine from
run.json, the journal, and the derived state cache. - Import the process entrypoint.
- Run the process inside
withProcessContext(...). - When the process requests an unresolved effect, the runtime throws an effect-pending exception instead of executing side effects inline.
- External orchestration resolves effects and posts results through
babysitter task:post. - The next iteration replays resolved effects and advances deterministically.
Relevant source roots:
Run Directory Layout
Default layout under the active runs root:
<runsRoot>/<runId>/
├── run.json
├── inputs.json
├── run.lock
├── journal/
├── tasks/<effectId>/
├── state/state.json
├── blobs/
└── process/
Use the active runs root from Command Surfaces: global ~/.a5c/runs by default, repo-local only when configured or when probing legacy runs.
Journal Event Model
The event stream is append-only and centers on:
RUN_CREATEDEFFECT_REQUESTEDEFFECT_RESOLVEDRUN_COMPLETEDRUN_FAILED
The state cache is derived data. If it drifts from the journal, repair with run:rebuild-state. If journal entries are malformed or partially written, use run:repair-journal carefully after inspecting the affected run.
Effects
Processes request work through ProcessContext intrinsics such as:
ctx.task()ctx.breakpoint()ctx.sleepUntil()ctx.orchestratorTask()ctx.hook()ctx.parallel.all()andctx.parallel.map()
Those APIs are part of the SDK runtime contract, not ad hoc process behavior. Changes here need replay, serialization, and state-cache discipline.