Expand description
summary — the deterministic default-summary composer.
Used by dbmd fm init and dbmd write when the agent doesn’t supply a
summary. compose_default renders the type’s summary_template (from
the store’s DB.md ## Schemas) when one is declared, and otherwise falls
back to the body’s first non-heading paragraph. No type carries a built-in
template — the template, like the schema, is the store’s to declare.
Contract: deterministic (same (type, frontmatter, body) → same
string), single-line (newlines collapsed to spaces), and capped at 200
chars (the SPEC readability bound). The tool generates a deterministic
floor; the agent provides the ceiling via dbmd fm set <file> summary='…'.
Constants§
- MAX_
SUMMARY_ LEN - The SPEC’s
summarylength bound, in characters.
Functions§
- compose_
default - Compose a deterministic default
summaryfor a file from itstype, frontmatter, and body. If the store’s## Schemasdeclares asummary_templatefor the type, it is rendered with{field}interpolation; otherwise the default is the body’s first non-heading paragraph. The result is always single-line and ≤MAX_SUMMARY_LENchars. - compose_
from_ body - The body fallback: the file’s first non-heading paragraph, truncated to
MAX_SUMMARY_LENchars (the truncation is applied bynormalize). - normalize
- Normalize any candidate summary to the contract: collapse runs of
whitespace (including newlines) to single spaces, trim, and truncate to
MAX_SUMMARY_LENchars (never splitting a UTF-8 codepoint). Every composer runs its output through this.