Functions
ask
fn (mem: AgentMemory, question: Str, chat-opts: ChatOptions, opts: Map?): Map
Search memory for relevant context, then generate an AI answer. Returns {answer, sources}.
ask-with-thread
fn (mem: AgentMemory, t: Thread, question: Str, chat-opts: ChatOptions, opts: Map?): Map
Like ask, but includes thread history for multi-turn context. Appends question and answer to the thread automatically.
build-context
fn (mem: AgentMemory, query: Str, opts: Map?): Str
Search session memory and KB, format as a context string for AI prompts. Options: limit (default 10), min-score (default 0.5).
build-rag-prompt
fn (history-text: Str, context: Str, question: Str): Str
Compose a RAG prompt from optional history, optional context, and a question.
format-kb-results
fn (results: Vec): Vec
Format a Vec of KB search results as [KB] content lines.
format-session-results
fn (results: Vec): Vec
Format a Vec of store search results (with v.sender-name, v.content) as [name]: content lines.
format-thread-lines
fn (history: Vec): Str
Format a Vec of ChatMessages as role: content lines.
summarize
fn (mem: AgentMemory, chat-opts: ChatOptions, opts: Map?): Str
Summarize recent messages from session memory using AI. Options: hours, limit, instruction.