Expand description
Context template models.
Provides data structures for user-defined context templates that format memories and statistics for hooks and MCP tool responses.
§Variable Types
Context templates support two types of variables:
-
Auto-variables: Automatically populated from memory context
{{memories}}- List of memories for iteration{{memory.id}},{{memory.content}}, etc. - Individual memory fields (in iteration){{statistics}}- Memory statistics object{{total_count}},{{namespace_counts}}- Statistics fields
-
User-variables: Custom variables provided at render time
- Any
{{variable}}not in the auto-variable list
- Any
§Iteration Syntax
Templates support iteration over collections using {{#each}}...{{/each}}:
{{#each memories}}
- **{{memory.namespace}}**: {{memory.content}}
{{/each}}Structs§
- Context
Template - A user-defined context template.
- Template
Variable - A variable in a context template.
- Template
Version - Version metadata for a context template.
Enums§
- Output
Format - Output format for rendered templates.
- Variable
Type - Type of template variable.
Constants§
- AUTO_
VARIABLES - Auto-variable names recognized by the system.
- AUTO_
VARIABLE_ PREFIXES - Auto-variable prefixes for iteration context.
Functions§
- default_
required 🔒 - Default value for
requiredfield (true for user variables, false for auto). - default_
version 🔒 - Default version number.
- is_
auto_ variable - Checks if a variable name is an auto-variable.