Pure renderer for the standing agent-facing session snapshot.
render-ctx-static projects the session view with project-ctx-static and
prints it via the same Python pretty-printer path used to bind the live
sandbox session dict, emitting a fenced Python session = {…} block — so the
visible embed and the runtime value share one canonical shape, and
render-ctx-delta mutates that same session with session[...] = … lines.
Pure renderer for the standing agent-facing `session` snapshot.
`render-ctx-static` projects the session view with `project-ctx-static` and
prints it via the same Python pretty-printer path used to bind the live
sandbox `session` dict, emitting a fenced Python `session = {…}` block — so the
visible embed and the runtime value share one canonical shape, and
`render-ctx-delta` mutates that same `session` with `session[...] = …` lines.(ctx-delta-map {:keys [ctx warnings]})Per-iteration CURRENT map for the structural ctx delta: ctx-static-map
PLUS :utilization. The frozen system block stays utilization-free (cache
stability); live token usage instead rides as a cheap appended
session["utilization"] = … delta against the frozen baseline.
Per-iteration CURRENT map for the structural ctx delta: `ctx-static-map` PLUS `:utilization`. The frozen system block stays utilization-free (cache stability); live token usage instead rides as a cheap appended `session["utilization"] = …` delta against the frozen baseline.
(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_run" 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_run"
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 map
— the SINGLE source of truth for both the rendered <context> text AND the live
session dict bound in the sandbox (loop/execute-code binds this same shape
via env/bind-ctx!). array-map fixes canonical key order; empty subtrees are
omitted.
Takes a session-view map (from eng/session-view). _opts is ignored.
THE canonical projection of a `session-view` into the agent-facing ordered map — the SINGLE source of truth for both the rendered `<context>` text AND the live `session` dict bound in the sandbox (loop/execute-code binds this same shape via `env/bind-ctx!`). array-map fixes canonical key order; empty subtrees are omitted. Takes a `session-view` map (from `eng/session-view`). `_opts` is ignored.
(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-static {:keys [ctx warnings]})Render the standing session context (workspace / env / routing / resources /
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 / env / routing / resources / 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. File reads return :anchors
as an ordered {"ln:hash" text} map — the key IS the patch from_anchor
— 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. File reads return `:anchors`
as an ordered `{"ln:hash" text}` map — the key IS the `patch from_anchor`
— so editing resolves straight off this structured data.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 |