Liking cljdoc? Tell your friends :D

fractal.engine.recursion

L4 · the RLM recursion layer (Phase 3). The four model-calling host fns injected into a session's SCI ctx when the harness is :rlm:

(lm input query [mode]) LEAF — ONE bounded provider call (no session, (map-lm inputs query [mode]) LEAF no loop, no lineage); the leaf prompt; mode :string/:edn. map-lm = the leaf fanned out over ≤50 inputs, order-kept. (rlm task) CHILD — a FRESH child session (its own SCI ctx (map-rlm tasks [shared]) CHILD + SessionStore session, inherit-and- clamped capability) running the WHOLE loop to FINAL; returns an ENVELOPE. (attach-rlm handle task [opts]) REUSE — a FRESH derived child restored from a selected immutable source head.

Recursion happens BETWEEN interpreters, in the HOST (03 recursion note): a child is a normal session in the SAME store. This ns NEVER requires session (that would cycle: session→recursion); instead session injects an env of spawn/run/stop closures (dependency inversion, mirroring the v1 reference).

Leaf ≠ child (architecture invariant): a leaf is one adapter call; a child is a full session. Partial fan-out NEVER throws — failed slots become {:fractal/failed true …} sentinels in the :fractal/ ns. Accounting stays honest: a child's usage/cost/cache rides its envelope's :rlm/meta; the root turn's :turn/usage/:turn/cost remain SELF-ONLY (06 §6).

Phase 4 adds the durable recursion data model here: invocation/derivation edges, cross-session lineage, immutable heads, and attach-rlm. The envelope's :rlm/head is the immutable current head plus legacy :vars-ref/session aliases.

L4 · the RLM recursion layer (Phase 3). The four model-calling host fns
injected into a session's SCI ctx when the harness is :rlm:

  (lm input query [mode])      LEAF  — ONE bounded provider call (no session,
  (map-lm inputs query [mode]) LEAF    no loop, no lineage); the leaf prompt;
                                       mode :string/:edn. map-lm = the leaf
                                       fanned out over ≤50 inputs, order-kept.
  (rlm task)                   CHILD — a FRESH child session (its own SCI ctx
  (map-rlm tasks [shared])     CHILD   + SessionStore session, inherit-and-
                                       clamped capability) running the WHOLE
                                       loop to FINAL; returns an ENVELOPE.
  (attach-rlm handle task [opts])
                               REUSE — a FRESH derived child restored from a
                                       selected immutable source head.

Recursion happens BETWEEN interpreters, in the HOST (03 recursion note): a
child is a normal session in the SAME store. This ns NEVER requires `session`
(that would cycle: session→recursion); instead session injects an `env` of
spawn/run/stop closures (dependency inversion, mirroring the v1 reference).

Leaf ≠ child (architecture invariant): a leaf is one adapter call; a child is
a full session. Partial fan-out NEVER throws — failed slots become
{:fractal/failed true …} sentinels in the :fractal/ ns. Accounting stays
honest: a child's usage/cost/cache rides its envelope's :rlm/meta; the root
turn's :turn/usage/:turn/cost remain SELF-ONLY (06 §6).

Phase 4 adds the durable recursion data model here: invocation/derivation
edges, cross-session lineage, immutable heads, and attach-rlm. The envelope's
:rlm/head is the immutable current head plus legacy :vars-ref/session aliases.
raw docstring

assemble-batch-resultsclj

(assemble-batch-results results)

Fold per-slot fan-out results (index-aligned, from concurrent/bounded-fanout) into one input-ordered vector: a success contributes its value; a failure contributes a {:fractal/failed true :index i :error …} sentinel in its slot.

Fold per-slot fan-out results (index-aligned, from concurrent/bounded-fanout)
into one input-ordered vector: a success contributes its value; a failure
contributes a {:fractal/failed true :index i :error …} sentinel in its slot.
sourceraw docstring

bounded-fanout-inputsclj

(bounded-fanout-inputs kind cfg inputs)

Enforce the ≤:max-fanout cap. Over the cap THROWS a recoverable :fractal/fanout-exceeded (the model chunks into 40-50 item batches and calls once per chunk — it does not raise the cap).

Enforce the ≤:max-fanout cap. Over the cap THROWS a recoverable
:fractal/fanout-exceeded (the model chunks into 40-50 item batches and calls
once per chunk — it does not raise the cap).
sourceraw docstring

engine-fnsclj

(engine-fns handle env)

Build the rlm host-fn impls closing over the (parent) session handle and the spawn/run/stop env injected by session (dependency inversion — recursion never requires session). Profile gating happens later in capability/sci-opts (the profile's :engine-fns selects which of these inject; :locked-down drops lm/rlm). The fns read cfg/adapter/store off the handle at CALL time.

Build the rlm host-fn impls closing over the (parent) session `handle` and the
spawn/run/stop `env` injected by `session` (dependency inversion — recursion
never requires session). Profile gating happens later in capability/sci-opts
(the profile's :engine-fns selects which of these inject; :locked-down drops
lm/rlm). The fns read cfg/adapter/store off the handle at CALL time.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close