Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.context.prompt

Prompt assembly.

Provider messages are explicit blocks in send order: core system rules, project instructions (AGENTS.md / CLAUDE.md when present), extension fragments, current user message. Per-iteration user-role context is the engine snapshot rendered as a Python dict (session) by the loop.

Prompt assembly.

Provider messages are explicit blocks in send order: core system rules,
project instructions (AGENTS.md / CLAUDE.md when present), extension
fragments, current user message. Per-iteration user-role context is the
engine snapshot rendered as a Python dict (`session`) by the loop.
raw docstring

active-extensionsclj

(active-extensions environment)

Returns the seq of registered extensions whose :ext/activation-fn returns truthy for environment, in registration order. Single source of truth for activation; call ONCE at the top of a turn.

Returns the seq of registered extensions whose `:ext/activation-fn` returns
truthy for `environment`, in registration order. Single source of truth for
activation; call ONCE at the top of a turn.
sourceraw docstring

assemble-initial-messagesclj

(assemble-initial-messages
  {:keys [stable-prompt-messages initial-user-content previous-turn-context
          turn-context user-images skipped-images vision? image-descriptions]
   :or {vision? true}})

Initial provider messages for one turn.

Prior RESUME entries are emitted as one stable user message per turn (or materialized fold checkpoint), so adding a turn appends a message instead of rewriting one monolithic conversation recap. :turn-context is the current append-only turn/utilization assignment block and rides immediately before the current user request.

:image-descriptions carries the vision fallback's {label {:text … :model …}} for images this turn's target cannot see. Pure input: deciding whether that report is worth paying for belongs to the caller, never to message assembly.

Initial provider messages for one turn.

Prior RESUME entries are emitted as one stable user message per turn (or
materialized fold checkpoint), so adding a turn appends a message instead of
rewriting one monolithic conversation recap. `:turn-context` is the current
append-only turn/utilization assignment block and rides immediately before
the current user request.

`:image-descriptions` carries the vision fallback's `{label {:text … :model …}}`
for images this turn's target cannot see. Pure input: deciding whether that
report is worth paying for belongs to the caller, never to message assembly.
sourceraw docstring

assemble-stable-prompt-messagesclj

(assemble-stable-prompt-messages
  environment
  {:keys [system-prompt active-extensions session-context] :as opts})

Assemble provider-prefix messages.

Send order is explicit and tested: SYSTEM-PROMPT - CORE_SYSTEM_PROMPT + caller addendum PROJECT-INSTRUCTIONS - AGENTS.md / CLAUDE.md contents (when present) TURN-SYSTEM-CONTEXT - turn-scoped runtime capability context. Today it contains extension prompt fragments; future message, never append a second extension context.

Extension fragments are separate from the core system prompt and are not repeated in per-iteration trailers.

Required opts: :active-extensions - vec from (active-extensions env). Drives environment, extension prompt, and hint collection.

Optional opts: :system-prompt - caller addendum appended to CORE. :session-context - rendered fenced-Python session = {…} block (standing session state: workspace / env / routing / tools). Embedded ONCE here as a cached system message; the loop re-emits only the session[...] = … structural delta in the conversation when it changes mid-turn.

Assemble provider-prefix messages.

Send order is explicit and tested:
  `SYSTEM-PROMPT`         - CORE_SYSTEM_PROMPT + caller addendum
  `PROJECT-INSTRUCTIONS`  - AGENTS.md / CLAUDE.md contents (when present)
  `TURN-SYSTEM-CONTEXT`   - turn-scoped runtime capability context. Today
                            it contains extension prompt fragments; future
                            message, never append a second extension
                            context.

Extension fragments are separate from the core system prompt and are not
repeated in per-iteration trailers.

Required opts:
  `:active-extensions` - vec from `(active-extensions env)`. Drives
     environment, extension prompt, and hint collection.

Optional opts:
  `:system-prompt`            - caller addendum appended to CORE.
  `:session-context`          - rendered fenced-Python `session = {…}` block
     (standing session state: workspace / env / routing / tools). Embedded
     ONCE here as a cached system message; the loop re-emits only the
     `session[...] = …` structural delta in the conversation when it changes
     mid-turn.
sourceraw docstring

build-system-promptclj

(build-system-prompt {:keys [system-prompt workspace-root]})

Core system prompt + optional caller addendum + config prompt + SYSTEM.md / APPEND_SYSTEM.md file overrides.

Assembled in send order (later blocks positionally reinforce earlier): base, then the caller's :system-prompt addendum, then the :system-prompt pulled from Vis config (~/.vis/config.yml / state.yml / <project>/vis.yml / .vis/config.yml, deep-merged), then ~/.vis/APPEND_SYSTEM.md, then <workspace>/.vis/APPEND_SYSTEM.md. The config + file hooks let a project append house rules without any caller having to pass them.

Full rewrite precedence for the base: <workspace>/.vis/SYSTEM.md > ~/.vis/SYSTEM.md > config :system-prompt map with :replace? true > CORE_SYSTEM_PROMPT. When a file/config replaces the base, addenda and append files are still appended after it. workspace-root scopes all project config and file lookups; an omitted root keeps the caller's workspace binding.

Core system prompt + optional caller addendum + config prompt +
SYSTEM.md / APPEND_SYSTEM.md file overrides.

Assembled in send order (later blocks positionally reinforce earlier):
base, then the caller's `:system-prompt` addendum, then the
`:system-prompt` pulled from Vis config (`~/.vis/config.yml` / `state.yml` /
`<project>/vis.yml` / `.vis/config.yml`, deep-merged), then `~/.vis/APPEND_SYSTEM.md`, then
`<workspace>/.vis/APPEND_SYSTEM.md`. The config + file hooks let a project
append house rules without any caller having to pass them.

Full rewrite precedence for the base: `<workspace>/.vis/SYSTEM.md` >
`~/.vis/SYSTEM.md` > config `:system-prompt` map with `:replace? true` >
`CORE_SYSTEM_PROMPT`. When a file/config replaces the base, addenda and
append files are still appended after it. `workspace-root` scopes all project
config and file lookups; an omitted root keeps the caller's workspace binding.
sourceraw docstring

cli-autonomous-rulesclj

Override injected ONLY for the non-interactive :cli channel (headless bin/vis-agent '<task>' one-shot runs). No human is in the loop, so the model must never wait for input — it makes reasonable assumptions and drives the work to a finished prose answer.

Override injected ONLY for the non-interactive `:cli` channel (headless
`bin/vis-agent '<task>'` one-shot runs). No human is in the loop, so the model
must never wait for input — it makes reasonable assumptions and drives the
work to a finished prose answer.
sourceraw docstring

extensions-snapshotclj

(extensions-snapshot active-extensions)

Build the active extension summary placed under (:extensions ctx) from a precomputed active-extensions vec.

Returns a vec of compact, fully-realized data maps - NO functions, NO atoms, NO opaque runtime objects. The model walks this with a comprehension / filter / any exactly like any other Python list of dicts; never has to reach into an extensions() call just to discover what's loaded.

Per element: :alias - short symbol the model calls under ('v, 'z, 'git, ...). nil when the extension didn't declare an :ext.engine/alias. :namespace - fully-qualified ns symbol of the extension. :doc - one-line LLM description from :ext/description (when set). :kind - categorical bucket (providers, channels, foundation, languages, persistance, ...) used as the section label both in this snapshot and in vis-agent extension list (when set). :registry-id - canonical manifest id, usually the alias symbol. :symbols - vec of bare symbol names the extension intern'd into the sandbox.

The vec is bound ONCE at turn start (see iteration-loop) and stays frozen for the rest of the turn - every iteration sees the same value.

Build the active extension summary placed under `(:extensions ctx)` from a
precomputed active-extensions vec.

Returns a vec of compact, fully-realized data maps - NO functions,
NO atoms, NO opaque runtime objects. The model walks this with a
comprehension / `filter` / `any` exactly like any other Python list of
dicts; never has to reach into an `extensions()` call just to discover
what's loaded.

Per element:
  :alias     - short symbol the model calls under (`'v`, `'z`,
               `'git`, ...). nil when the extension didn't declare
               an `:ext.engine/alias`.
  :namespace - fully-qualified ns symbol of the extension.
  :doc       - one-line LLM description from `:ext/description` (when set).
  :kind      - categorical bucket (providers, channels, foundation,
               languages, persistance, ...) used as the section
               label both in this snapshot and in `vis-agent extension
               list` (when set).
  :registry-id - canonical manifest id, usually the alias symbol.
  :symbols   - vec of bare symbol names the extension intern'd into
               the sandbox.

The vec is bound ONCE at turn start (see `iteration-loop`) and
stays frozen for the rest of the turn - every iteration sees the
same value.
sourceraw docstring

previous-turn-context-blockclj

(previous-turn-context-block turns)

Render prior-turn RESUME entries. Normal entries retain their stable turn number and Q/A/result index. Cancelled turns retain settled work plus an explicit model-visible cancellation boundary. A :checkpoint? entry is the sole materialized replacement for all complete turns covered by one broader fold.

Render prior-turn RESUME entries. Normal entries retain their stable turn
number and Q/A/result index. Cancelled turns retain settled work plus an
explicit model-visible cancellation boundary. A `:checkpoint?` entry is the
sole materialized replacement for all complete turns covered by one broader
fold.
sourceraw docstring

request-healthclj

(request-health environment messages tools & [model accounting])

Content-free provenance for one request. Prefer Svar's final :request-accounting over recounting canonical messages: Responses replay filtering, tool shaping and body overrides have already happened. Its components are not rescaled to usage. Wires without prepared accounting retain explicitly labelled logical estimates. Neither estimate replaces same-request provider usage for utilization. Root guidance is disk-only; logical metadata attributes guidance without rereading it.

Content-free provenance for one request. Prefer Svar's final :request-accounting
over recounting canonical messages: Responses replay filtering, tool shaping and
body overrides have already happened. Its components are not rescaled to usage.
Wires without prepared accounting retain explicitly labelled logical estimates.
Neither estimate replaces same-request provider usage for utilization. Root
guidance is disk-only; logical metadata attributes guidance without rereading it.
sourceraw docstring

stable-prompt-textclj

(stable-prompt-text messages)

Join stable prompt message contents for token budgeting and debug bindings only. Provider sends the original message vector; this is not a send path.

Join stable prompt message contents for token budgeting and debug bindings only.
Provider sends the original message vector; this is not a send path.
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