fractal-engine is built for work that unfolds across turns, branches, restarts, and operator steering. The important unit is not a single prompt. It is durable working state that can be refined, branched, resumed, attached, checked, and eventually returned as a value.
This document describes how to design that kind of run without turning the engine into a scoring harness, a domain-specific analyzer, or a general workflow app.
A session is a persistent working state. A turn appends new work to that state until
FINAL returns a value for the turn. After FINAL, the session remains alive for
future turns, and its current head becomes the authoritative continuation point.
flowchart LR
T1["Turn 1 FINAL"] --> H1["Head 1"]
H1 --> T2["Turn 2 FINAL"]
T2 --> H2["Current head"]
H1 --> ATTACH["attach-rlm"]
ATTACH --> D1["Derived child head"]
T2 --> CHILD["rlm child"]
CHILD --> C1["Child head"]
H2 --> RESUME["resume-session!"]
RESUME --> T3["Later turn"]
Operators steer the root session over time. They can narrow scope, provide new evidence, reject a branch, ask for a different decomposition, or attach from a useful prior head. The engine should preserve enough state for those steering moves to be meaningful without pretending that every branch is equally current.
Children explore branches. Leaves answer bounded semantic questions. Clojure keeps the ledger, performs exact work, validates outputs, and builds final values.
Start by writing down the durable shape of the work:
FINALThen choose the execution shape:
| Need | Prefer |
|---|---|
| Exact computation or validation | Clojure in the current session |
| One bounded semantic judgment | lm |
| Many independent bounded judgments | map-lm |
| One uncertain lane that needs its own loop | rlm |
| Many independent uncertain lanes | map-rlm |
| Continue from useful prior cognitive state without mutating it | attach-rlm |
| Continue the same durable session from its current point | resume |
The root should keep enough structured state to explain what happened: inputs, normalization choices, branch assignments, returned values, failed lanes, assumptions, and final checks. Long-horizon work fails when this state collapses into prose memory.
Treat each turn as a settlement boundary:
FINAL with the compact value for this turn.Do not rush to FINAL from expectation. Build the final value from observed vars
and returned data. If a branch is incomplete, encode that incompleteness explicitly
instead of smoothing it away.
The current head is authoritative for resume. Resuming a durable session means continuing the same session from its current published state, not replaying old provider calls, old evals, or a loose transcript.
Branching preserves alternatives:
rlm creates a fresh child from the caller's assignment.map-rlm creates one fresh child per independent lane.attach-rlm creates a fresh derived child from a selected prior session/head.This makes long-horizon work operator-friendly. A human can keep the root on the main line, inspect branch outcomes, discard weak branches, and later derive new work from a head that proved useful.
Prefer structured values over narrative summaries:
:inputs or stable ids for the material under consideration:ledger with expected counts, partitions, and status per lane:results with normalized child or leaf outputs:failures with fan-out sentinels and missingness:evidence with quoted or referenced support where applicable:checks with deterministic validation outcomes:assumptions separated from verified facts:handles or returned envelopes for attach-worthy branchesThe root does not need to keep every raw byte in the final value. It does need to keep enough durable working state to resume reasoning honestly on a later turn.
A long-horizon run should degrade visibly:
The goal is not to make every branch succeed. The goal is to preserve enough truth about success, failure, uncertainty, and lineage that the next operator move is well informed.
Live dogfooding should prove the engine's semantics under realistic model behavior, not just that a happy-path call returns text.
A useful live run demonstrates:
map-lm and map-rlm preserve order and expose partial failures as sentinelsGood dogfooding should be runnable through the agent control plane when possible:
use CLI config profiles, explicit session ids, run / turn for writes, and
inspection commands such as report, events, heads, edges, tree,
turns, and payload for readback. The useful artifact is not a polished
transcript; it is a clear, public-safe account of what was run, what state
persisted, which branches were created, which heads were attached, which lanes
failed, which checks passed, and what remains uncertain.
A long-horizon run is healthy when an operator can answer these questions from the session state:
If those answers are available without replaying old work or trusting prose memory, the engine is doing its job.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |