Liking cljdoc? Tell your friends :D
Clojure only.

vaelii.impl.llm.prompt

The system prompt, generated from the live KB.

A hand-written copy of the ontology in a prompt string rots the moment someone drops a new <Context>.txt into resources/kb/. So every section here is read back out of the KB it is about: the context topology from contexts / context-up, the type hierarchy from types / genls, the predicate documentation from the (comment <term> "…") sentexes the vocabulary documents itself with (vaelii.impl.core-context/comment-of), the argument types from the stored argIsa sentexes, the disjointness from disjoint / disjointMetatype, and the algebraic metadata from props. The naming invariants are the one static section, because they are mechanical rules rather than content.

The result is a large stable prefix: byte-identical across turns for an unchanged KB (every section is sorted, nothing carries a clock or an id), which is what prompt caching needs. The volatile part — the user's request — lives in the message turn after the cache breakpoint, never in here.

The system prompt, **generated from the live KB**.

A hand-written copy of the ontology in a prompt string rots the moment someone
drops a new `<Context>.txt` into `resources/kb/`.  So every section here is read
back out of the KB it is about: the context topology from `contexts` /
`context-up`, the type hierarchy from `types` / `genls`, the predicate
documentation from the `(comment <term> "…")` sentexes the vocabulary documents
itself with (`vaelii.impl.core-context/comment-of`), the argument types from the stored
`argIsa` sentexes, the disjointness from `disjoint` / `disjointMetatype`, and the
algebraic metadata from `props`.  The naming invariants are the one static section,
because they are mechanical rules rather than content.

The result is a **large stable prefix**: byte-identical across turns for an
unchanged KB (every section is sorted, nothing carries a clock or an id), which is
what prompt caching needs.  The volatile part — the user's request — lives in the
message turn after the cache breakpoint, never in here.
raw docstring

system-promptclj

(system-prompt kb)
(system-prompt kb opts)

The generated system prompt for kb, as one string.

opts bounds the enumerated sections so a large KB does not push the whole vocabulary into every request: :max-contexts (40), :max-types (80), :max-predicates (60). :preamble prepends application-specific instruction ahead of everything else.

Deterministic for a given KB and opts — sorted throughout, no clock, no handles — so it is a stable cache prefix.

The generated system prompt for `kb`, as one string.

`opts` bounds the enumerated sections so a large KB does not push the whole
vocabulary into every request: `:max-contexts` (40), `:max-types` (80),
`:max-predicates` (60).  `:preamble` prepends application-specific instruction ahead
of everything else.

Deterministic for a given KB and opts — sorted throughout, no clock, no handles — so
it is a stable cache prefix.
raw 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