Skip to main content

Memory

Memory is what separates DAEMI agents from stateless chat interfaces. Every agent has two persistent memory layers, both managed by DAEMI's memory store.


Two Memory Layers

Short-Term Memory (STM)

STM is the agent's active working memory for the current session. Every message, tool result, and reasoning step is written here as the conversation unfolds. STM is:

  • Semantically indexed — DAEMI's semantic indexing lets the agent retrieve relevant context from earlier in a long session without blowing the context window
  • Session-scoped — starts fresh each session (though LTM primes it with relevant past context at session start)
  • Bounded — the stm_window setting caps how many messages stay in the active context; older messages are still stored and can be retrieved by semantic search

Long-Term Memory (LTM)

LTM is persistent memory that survives session boundaries. It accumulates over time and is the basis of the agent's "knowledge of you." LTM is:

  • Distilled from STM — at session end, DAEMI processes the session and writes significant items to LTM according to the agent's transfer_policy
  • Queried at session start — before the conversation begins, DAEMI searches LTM for context relevant to the user's first message and injects it
  • Grows indefinitely — there's no automatic pruning (you can manually clear it via the API)

How Memory Flows

Session Start


[LTM Query] ──── relevant past context ────► system prompt injection


[Conversation] ──── each turn ────► STM write


Session End


[STM → LTM distillation] per transfer_policy

Transfer Policies

PolicyWhat gets written to LTM
carry_allAll significant exchanges, decisions, and facts
facts_onlyOnly explicit facts and stated preferences
explicit_onlyOnly items the agent was directly told to remember
noneNothing — the session is fully ephemeral

Set the policy in the agent's profile:

memory:
transfer_policy: carry_all

Tuning Memory Behavior

memory:
transfer_policy: facts_only
ltm_max_results: 10 # max LTM records injected at session start
stm_window: 50 # max messages in active STM context

ltm_max_results — higher values give the agent more past context but increase prompt size. Default: 10.

stm_window — how many recent messages stay in the live context window. Older messages are still stored and can be retrieved via semantic search when relevant. Default: 50.


Querying Memory via API

You can write to an agent's long-term memory directly:

# Write a fact to LTM
POST /api/agents/{agent_id}/memory/ltm
{
"content": "User prefers async/await over Promise chains in Node.js",
"type": "fact"
}

Response shape:

{
"id": "mem_abc123",
"content": "User prefers async/await over Promise chains in Node.js",
"type": "fact",
"created_at": "2026-02-14T10:30:00Z"
}

Clearing Memory

# Clear all LTM (irreversible)
DELETE /api/agents/{agent_id}/memory/ltm
caution

Clearing LTM is permanent. There's no undo. The agent loses everything it has learned across all past sessions.


Go Deeper