Light Dark

Functions

Identity alias

Alias of ::session/Identity

Message alias

Alias of ::ai::message/Message

Role alias

Alias of ::ai::message/Role

Session alias

Alias of ::session/Session

create-memory

fn (agent-name: Str, session: ::ai::session/Session, identity: ::ai::session/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.

ns alias

Alias of ::ai::memory/

Session-scoped agent memory with three storage levels: session (shared conversation history), user (per-user persistent data), and KB (shared domain knowledge).

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: ::ai::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, session: ::ai::session/Session, identity: ::ai::session/Identity, opts: Map?): Thread

Create or get a per-(session, user) thread store for multi-turn interactions. Options: max-turns (default 20).

The thread is scoped to (session, identity) so the same user in a different session has an independent thread. Pass the same session you used to build AgentMemory so memory and thread stay aligned.

thread-add

fn (t: Thread, role: ::ai::message/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: ::hot::store/Map,
    user-store: ::hot::store/Map,
    kb-store: ::hot::store/Map
}

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

Thread

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

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