Light Dark

Functions

create-memory

fn (agent-name: Str, session: Session, identity: Identity): AgentMemory

Build an AgentMemory with all three scoped stores.

forget-session

fn (mem: AgentMemory): Bool

Clear all entries in session memory.

get-user-data

fn (mem: AgentMemory, key: Str): Any

Read a value from the user's persistent store.

learn

fn (mem: AgentMemory, key: Str, content: Map): Any

Add an entry to the shared knowledge base. Auto-embedded for search.

recall

fn (mem: AgentMemory, query: Str, opts: Map?): Vec

Semantic search over session memory. Options: limit (default 10), min-score (default 0.5).

recent

fn (mem: AgentMemory, opts: Map?): Vec

Retrieve recent messages from session memory. Options: hours (default 24), limit (default 100).

remember

fn (mem: AgentMemory, message: Message): Any

Store a Message in session memory. Auto-generates a time-based key.

search-kb

fn (mem: AgentMemory, query: Str, opts: Map?): Vec

Semantic search over the shared knowledge base. Options: limit (default 5).

set-user-data

fn (mem: AgentMemory, key: Str, value: Any): Any

Write a value to the user's persistent store.

thread

fn (agent-name: Str, identity: Identity, opts: Map?): Thread

Create or get a per-user thread store. Options: max-turns (default 20).

thread-add

fn (t: Thread, role: Role, content: Str): Any

Append a message to a conversation thread.

thread-clear

fn (t: Thread): Bool

Reset a conversation thread.

thread-history

fn (t: Thread, opts: Map?): Vec

Get the recent thread history as ChatMessages. Options: limit (default all).

Types

AgentMemory

AgentMemory type {
    agent-name: Str,
    session-store: ::store/Map,
    user-store: ::store/Map,
    kb-store: ::store/Map
}

Bundles three scoped stores for an agent + session + identity combination.

Thread

Thread type {
    store: ::store/Map,
    turn-limit: Int
}

A per-user conversation thread for multi-turn interactions.