Pure renderer for the standing agent-facing session snapshot.
render-ctx-static projects the session view and serializes it as a Python
literal with pure JVM code. The live sandbox session dict is built from the
same boundary projection, and render-ctx-delta emits executable updates.
Pure renderer for the standing agent-facing `session` snapshot. `render-ctx-static` projects the session view and serializes it as a Python literal with pure JVM code. The live sandbox `session` dict is built from the same boundary projection, and `render-ctx-delta` emits executable updates.
(ctx-delta-map {:keys [ctx warnings]})Per-iteration CURRENT map for the structural ctx delta: ctx-static-map
PLUS the live goal, the app notes and utilization. They change during a run,
so they ride after the cached prefix rather than being frozen in the system
message.
Per-iteration CURRENT map for the structural ctx delta: `ctx-static-map` PLUS the live goal, the app notes and utilization. They change during a run, so they ride after the cached prefix rather than being frozen in the system message.
(ctx-static-map {:keys [ctx warnings]})The standing ctx as a MAP (project-ctx-static) — the data behind
render-ctx-static's FROZEN <context> block, and the delta BASELINE seed.
Utilization-free so the cached system prefix never churns.
The standing ctx as a MAP (`project-ctx-static`) — the data behind `render-ctx-static`'s FROZEN `<context>` block, and the delta BASELINE seed. Utilization-free so the cached system prefix never churns.
(fold-op-index index)Fold an op-keyword index map ({:shell/run v, …} — e.g. the tag
registry) to the sandbox call names the model writes ({"shell" v, …}), with the SAME fold the globals bind under
(env/sym->py-name). Memoized on snapshot identity — the ONE fold
site for head-keyed lookups (classify-form-tag's tag resolver in
loop).
Fold an op-keyword index map (`{:shell/run v, …}` — e.g. the tag
registry) to the sandbox call names the model writes (`{"shell"
v, …}`), with the SAME fold the globals bind under
(`env/sym->py-name`). Memoized on snapshot identity — the ONE fold
site for head-keyed lookups (`classify-form-tag`'s tag resolver in
loop).(project-ctx view)(project-ctx view _opts)THE canonical projection of a session-view into the agent-facing ordered
string-keyed map used by both rendered context and the live Python dict.
THE canonical projection of a `session-view` into the agent-facing ordered string-keyed map used by both rendered context and the live Python dict.
(project-ctx-static view)project-ctx limited to static-context-keys, canonical order preserved.
The host clock ([:env :host :clock]) is stripped: it ticks every render,
so leaving it in would make the per-iteration change-diff fire every time.
`project-ctx` limited to `static-context-keys`, canonical order preserved. The host clock (`[:env :host :clock]`) is stripped: it ticks every render, so leaving it in would make the per-iteration change-diff fire every time.
(render-ctx-delta prev cur)Structural Python delta of the standing ctx between the previously-sent map
prev and the current cur (both ctx-static-map shape). RECURSIVE: emits
the minimal session["a"]["b"] = <repr> / del session["a"]["b"] ops for exactly
the keys that moved, at any depth — never the whole session. nil when
nothing changed. Append-only + cache-safe.
Structural Python delta of the standing ctx between the previously-sent map `prev` and the current `cur` (both `ctx-static-map` shape). RECURSIVE: emits the minimal `session["a"]["b"] = <repr>` / `del session["a"]["b"]` ops for exactly the keys that moved, at any depth — never the whole session. nil when nothing changed. Append-only + cache-safe.
(render-ctx-map m)Render an already-materialized model-facing session map as the fenced Python baseline block. Used when a large fold deliberately rebases cached context.
Render an already-materialized model-facing session map as the fenced Python baseline block. Used when a large fold deliberately rebases cached context.
(render-ctx-static {:keys [ctx warnings]})Render the standing session context (workspace / access / env / routing /
symbols) as a FENCED PYTHON block that binds session to its initial value —
embedded once in the system prompt. The same session dict is live in the
sandbox; mid-session changes arrive as session[...] = … / del session[...] delta
lines (render-ctx-delta), so the embed and the deltas are one coherent
Python story. Returns nil when there is nothing to show.
Render the standing session context (workspace / access / env / routing / symbols) as a FENCED PYTHON block that binds `session` to its initial value — embedded once in the system prompt. The same `session` dict is live in the sandbox; mid-session changes arrive as `session[...] = …` / `del session[...]` delta lines (`render-ctx-delta`), so the embed and the deltas are one coherent Python story. Returns nil when there is nothing to show.
(render-form-value _src v)THE model-facing string for one tool/form VALUE: the canonical STRUCTURED serialization of the result, and nothing else. Tools return maps or vectors and the model reads them as DATA — there is NO per-tool rendering, no hash-gutter file views, no rg grouping.
:op (the call head) is stripped from maps since the call is already
visible in the assistant replay; src is accepted for call-site
compatibility but no longer affects the output. Structural results carry
plain 1-based line/end_line numbers, so editing resolves straight off
this structured data.
THE model-facing string for one tool/form VALUE: the canonical STRUCTURED serialization of the result, and nothing else. Tools return maps or vectors and the model reads them as DATA — there is NO per-tool rendering, no hash-gutter file views, no rg grouping. `:op` (the call head) is stripped from maps since the call is already visible in the assistant replay; `src` is accepted for call-site compatibility but no longer affects the output. Structural results carry plain 1-based `line`/`end_line` numbers, so editing resolves straight off this structured data.
(session-context-text? s)True when s is a rendered session context block.
True when `s` is a rendered session context block.
Opening line of every rendered session context block. The block names one session and workspace, so prompt-cache placement keeps it after the shared anchor.
Opening line of every rendered session context block. The block names one session and workspace, so prompt-cache placement keeps it after the shared anchor.
(turn-boundary {:keys [ctx warnings]} baseline)The append-only turn boundary placed on every current user message, as
:text, and the delta :baseline after it. It always states the current turn
and includes utilization when available, so iteration 1 never relies on a
stale frozen system snapshot.
The goal rides here for the same reason: /goal persists AFTER the frozen
standing block was rendered, so without this line the very turn that sets a
goal shows the model a session without one.
The app notes ride here too: the newest note of each app and HTML page reaches
the model with every user message. When the notes are gone and baseline
still holds them, the boundary removes them. The new baseline holds the notes
of the same snapshot, so iteration 1 does not repeat them as a delta.
The append-only turn boundary placed on every current user message, as `:text`, and the delta `:baseline` after it. It always states the current turn and includes utilization when available, so iteration 1 never relies on a stale frozen system snapshot. The goal rides here for the same reason: `/goal` persists AFTER the frozen standing block was rendered, so without this line the very turn that sets a goal shows the model a session without one. The app notes ride here too: the newest note of each app and HTML page reaches the model with every user message. When the notes are gone and `baseline` still holds them, the boundary removes them. The new baseline holds the notes of the same snapshot, so iteration 1 does not repeat them as a delta.
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 |