Design¶
promptlibretto is built around a small set of concepts:
- A
Registryis the prompt blueprint. - A
Sectionowns authored items. RegistryState/SectionStateown runtime choices.assembly_orderowns render order.Groupowns reusable prompt snippets.Scaleowns slider-driven prompt text.
Only schema version: 2 is supported.
Registry and Sections¶
Sections are blueprint containers:
Runtime data is separate:
Canonical sections:
base_contextpersonassentimentstatic_injectionsruntime_injectionsoutput_prompt_directionsgroupsprompt_endings
Tokens¶
assembly_order supports:
section— selected item's primary fieldsection.field— named field on the selected itemsection.scale— selected item's Scalesection.groups— all groups attached to the selected itemsection.groups[group_id]— one attached groupgroups[group_id]— top-level reusable groupsection[item_id]— one specific item by ID regardless of selectionsection[item_id].field— one field of a specific item by IDinjections— active runtime injections
Same-section blocks join with one newline. Different sections join with two newlines.
Groups¶
Groups are reusable snippet lists:
Attach with:
Render with personas.groups or personas.groups[brief_examples].
Dynamic Items¶
Dynamic items can define template_vars, template_defaults, and fragments.
Fragments use condition:
The fragment renders only when that section's ticket_id value is present.
Scale¶
section.scale renders the selected item's Scale. The value comes from SectionState.slider, randomization, or default_value.
Injections¶
runtime_injections render through injections. If injections are selected but the token is not present, they append to the end.
include_sections is item metadata in v2; it does not filter the assembled prompt.
Routes¶
Routes are optional named overrides:
Route(
assembly_order=[...],
generation={"max_tokens": 64},
output_policy={"max_length": 240},
default_state=RegistryState(...),
)
With no route active, the top-level registry assembly order and config are used.