Expand description
Markdown rendering of Engine result types.
Shared by memstead-mcp (wraps output in MCP CallToolResult) and
memstead-cli (prints directly to stdout).
Structs§
- List
Result Envelope - Envelope for a full
ListResult. The engine-meta counters carry the same_-prefixed wire keys asSearchResultEnvelope(and as both surfaces’ markdown form) so an agent moving betweenmemstead list --jsonandmemstead search --jsonparses one envelope-meta convention. The_prefix reads as “engine-meta, not entity content”. - Search
HitEnvelope - Envelope wrapping a
SearchHitwith precomputed summary fields. - Search
Result Envelope - Envelope for a full
SearchResult:_-prefixedengine-emitted counters at the top level,facetsas a structured object (not a markdown blob), and the full per-hit shape (score, score_breakdown, matched_terms, expansion) inherited verbatim fromSearchHitso the structured envelope is the branching surface — agents readingstructured_contentdon’t have to parse the text channel’s rendered prose to recover scores or score components. CLI--jsonand MCPstructured_contentshare this shape. - Unknown
Schema Types - Unknown type names in a
typesselection passed tobuild_schema_payload_scoped— the caller raises a typed refusal naming the valid types (recovery-payload posture, never a silent empty section).
Enums§
- Origin
Class - Trust origin of a schema (or the mem that pins it), decided at adopt/write time and reported — never re-derived — on the read path.
- Schema
Verbosity - Verbosity selector for
build_schema_payload.
Constants§
- DEFAULT_
SCHEMA_ FULL_ BUDGET - Default budget for the UNSCOPED full-verbosity schema reply, in
estimated (bytes/4) tokens — ~60 KB of JSON. Calibrated against the
primary client’s ~25k real-token response cap: dense JSON tokenizes
well above bytes/4, so 15k estimated sits at the cap’s edge. The
two measured packages land on the intended sides:
default@1.3.0(~52 KB) keeps serving in full — today’s behaviour on today’s reply sizes — whilesoftware@0.4.0(60.2 KB, the observed harness spill, 2026-08-18 WOENENN ingest) degrades visibly to the per-type steer instead of overflowing the pipe.
Functions§
- build_
entity_ envelope - Build the structured
memstead_entityenvelope. Identity fields (_hash,id,mem,type,title,_stub_kind) come from the parsedEntityand live at the top level. Every schema-declared frontmatter key surfaces under a nestedmetadata: {...}map — its single home. Read a metadata value asenvelope.metadata.<key>; generic consumers iterate the map without per-type branching. The prior shape additionally hoistedlevel/stability/created_date/last_modifiedto the top level, serialising those fields twice; that hoist is gone. The read-only identity triple (mem/id/type) is excluded from the nested map — it appears only top-level — and underscore-prefixed internal keys (_hash,_tokens*,_mem_schema,_stub_*) live in dedicated top-level slots and never appear inside the nested map.sectionsandrelationshipsround-trip the engine’s internal IndexMap / Vec shapes verbatim._tokensis computed from the rendered body (filter and opt-in inserts applied) so agents can pre-size before a follow-uptoken_budget-bounded read._mem_schemarides when the workspace pinned a schema for the mem. - build_
list_ envelope - Build a
ListResultEnvelopeborrowing fromresult. - build_
schema_ payload - build_
schema_ payload_ scoped build_schema_payloadwith the serving-shape controls (backlog-sweep plan 06a):type_selectionscopes the heavy per-type prose to the named types — the reply carries the full package-level context, the selected types in full, and atypes_omittedroster naming what was not served (visible scope, never silent truncation). An unknown name refuses withUnknownSchemaTypes. UnderSchemaVerbosity::Litethe selection filters the skeleton the same way (coherent, though the full tier is the use case).- build_
search_ envelope - Build a
SearchResultEnvelopeborrowing fromresult. - manual_
authoring_ str - Stable wire string for the
manual_authoringposture. - per_
edge_ description_ str - Render a
PerEdgeDescriptionto its wire literal — bit-identical to what the schema YAML accepts so consumers can echo the value back without case fiddling.forbidden(the default) is emitted explicitly rather than omitted so a schema without an explicit declaration still surfaces the resolved posture on the wire. - render_
community_ context_ section - Render a
## Community Contextsection — cluster id + neighbor list — appended tomemstead_entityoutput wheninclude_context: true. No frontmatter; the entity body owns that. - render_
context_ markdown - Render context (community cluster) as markdown.
- render_
entity_ markdown - Render a single entity as markdown with frontmatter metadata.
- render_
entity_ markdown_ with_ signals - Serving-surface variant of
render_entity_markdown: when the entity’s type declares signals, the headline (name,value,levelper signal) rides in the frontmatter block — the one pre-body slot the format has — and the contributors in a## Signalssection appended after the body, in the style of## Relations. When the mem’s schema declares labelling, the grounded label rides as_labelin the frontmatter and the evidence in a## Labellingsection.None/Nonerenders byte-identically to the canonical form. - render_
list_ markdown - Render list results as markdown.
- render_
overview_ markdown - Render overview (all clusters) as markdown.
storeprovides entity titles for the on-the-fly auto-summary (title-join) — there is no stored summary. - render_
relations_ json - Render outgoing/incoming relations as a JSON envelope. Consumed by
memstead-cli relations --json; no MCP path uses it. - render_
relations_ markdown - Render a
## Relationssection as markdown — typed edges grouped by direction. Appended tomemstead_entityoutput wheninclude_relations: true. A JSON-shaped version is available viarender_relations_jsonfor thememstead-cli relations --jsonconsumer. - render_
search_ markdown - Render search results as markdown.
- render_
type_ catalog_ markdown - Render the full schema catalog as markdown — built-in default types.
- render_
type_ catalog_ markdown_ for - Render the type catalog for an arbitrary loaded
Schema. Same shape asrender_type_catalog_markdown; iterates the schema’s own types in name order so multi-mem workspaces can describe the schema pinned by the writable mem, not the engine’s hard-coded built-in. - render_
type_ info_ markdown - Render a single type’s definition as agent-friendly markdown.
- rendered_
body_ tokens - Token estimate for an entity’s rendered body (title + sections +
relationships, filter applied) — the exact number
render_entity_markdownembeds as its frontmatter_tokens. Use this when building a structured envelope so the envelope’s_tokensand the markdown channel’s frontmatter_tokensdescribe the same thing for a given_hash: the rendered body, not the full markdown document (which would additionally count frontmatter).