Deterministic, bounded prompt-inventory renderer for a compiled prelude (Capability Prelude V1, plan §9).
The renderer is fed by the SAME %PtcRunner.Lisp.Prelude.Export{} records the
analyzer, evaluator, and discovery forms consult — there is no separate
prompt/discovery registry. It produces a compact, domain-blind-at-the-core
block that a deployment-specific prelude fills with its own namespace and
export names. The block is inserted into the SubAgent system prompt through
dynamic context assembly, NOT by editing static core prompt templates.
What it renders
- a per-namespace summary (namespace name + docstring) for namespaces that
have at least one
:prompt-visible export; - for each such namespace, up to
per_namespace_cap/0prompt-visible exports, each with its signature, short doc, and — only for an inferred:read/:writebacking — an effect hint (:unknownis omitted as noise, but stays available via(meta ...)/(ns-publics ...)); - a "more via
(ns-publics 'ns)" line when a namespace has more prompt-visible exports than the cap; - a discovery hint noting that additional
:discoverableexports (omitted from the inventory by design) can be found throughdoc/dir/apropos/ns-publics, and thatsourcerenders an export's defining form; - a compact existing-ledger summary (
Tool calls made/Tool call errors) when ledger data is supplied.
Determinism + bounds
Output is fully determined by the export records and the supplied ledger
counts: namespaces and exports are sorted, and per-namespace export rendering
is capped at per_namespace_cap/0. render/2 returns nil when there is no
prelude or no :prompt-visible export, so callers can filter the section out
of prompt assembly.
Summary
Types
Ledger summary input. Either a precomputed %{tool_calls: n, tool_errors: m}
map or the raw tool_calls list (records carrying an :error field that is
nil on success), from which counts are derived.
Functions
The per-namespace cap on rendered prompt-visible exports.
Renders the prompt inventory for prelude.
Types
@type ledger() :: %{tool_calls: non_neg_integer(), tool_errors: non_neg_integer()} | [map()]
Ledger summary input. Either a precomputed %{tool_calls: n, tool_errors: m}
map or the raw tool_calls list (records carrying an :error field that is
nil on success), from which counts are derived.
Functions
@spec per_namespace_cap() :: pos_integer()
The per-namespace cap on rendered prompt-visible exports.
@spec render( PtcRunner.Lisp.Prelude.t() | nil, keyword() ) :: String.t() | nil
Renders the prompt inventory for prelude.
Options
:ledger— a%{tool_calls: n, tool_errors: m}map or a rawtool_callslist; when present, a compact ledger summary is appended.
Returns the rendered block string, or nil when there is no prelude or no
:prompt-visible export to show.