Skip to content

Core Concepts

A useful mental model is:

MemAgent = model + memory provider + runtime policies + optional capabilities

The model reasons, the provider persists, and the runtime decides what may be retrieved, exposed, executed, cached, compacted, or learned.

Pass scope on every request in multi-user applications.

Identifier Meaning Example
agent_id Persisted agent definition support-agent-v2
memory_id Application or memory namespace acme-support
user_id Tenant/end-user isolation boundary user-42
thread_id One conversation or workstream ticket-918

A turn reads and writes exactly one memory: the memory_id you pass. It takes a single ID. A list is refused with an error that names also_recall_from.

sam.run(question, memory_id="support-desk")

An agent’s memory_ids is the list of memories it has worked in, with the first as its default. It is not a set of memories every turn reads. A turn with no memory_id stays in the memory the agent last ran in, so pass memory_id on every call when an agent works in more than one.

To work in one memory and read another, name the other:

sam.run(question, memory_id="support-desk", also_recall_from=["fern-ember"])
memory_id also_recall_from
Conversations read and written recalled, marked from memory fern-ember
Entity records read and written read, under From memory fern-ember:; a write to one is refused
The turn itself recorded here never recorded there
Recall statistics updated left as they were

agent.with_also_recall_from([...]) (and the builder’s method of the same name) sets it for every turn and is saved with the agent; also_recall_from=[] on a call reads no other memory that turn. A knowledge base is attached to the agent, not filed under a memory, so it follows the agent into every memory without this.

Three limits. A thread-scoped or sealed retrieval policy reads no other memory, and neither does a delegate’s task. entity_scope other than memory reads no other memory’s records. An agent with a learning control plane lists its other conversations but does not recall from other memories.

None is an anonymous/legacy user scope, not a wildcard. Provider APIs that support an omitted-filter sentinel distinguish “do not filter by user” from “only rows whose user_id is null.” See Multi-Tenant Applications.

Memory types describe semantics. Providers implement persistence and query behavior.

Family Units capture Common runtime use
Episodic Messages, conversations, summaries Continuity and historical recall
Semantic Knowledge, entities, personas Facts and structured profiles
Procedural Tools, workflows, skills Reusable actions and learned procedures
Short-term Working records and semantic-cache entries Current-turn efficiency
Shared Workflow-scoped coordination state Multi-agent hand-offs
Operational Tool logs, traces, agent definitions Audit, expansion, and lifecycle

All providers should preserve canonical identifiers, timestamps, metadata, and scope. Semantic retrieval must apply tenant/agent/toolbox filters before vector top-k selection—not after it.

For portable copies, export and import memories as a .memorizz.json file. The MemoRizz Memory Archive v1 format groups all 13 stores by this taxonomy and preserves explicit relationships between records.

Persisting a record does not mean sending it to the model. On each turn the runtime retrieves candidates, applies scope and policy, deduplicates them, selects a bounded set, and assembles a stable prompt prefix. Large tool results can be replaced with an auditable pointer; summaries compact old history while retaining links to their source messages.

This separation lets an application keep rich durable history without paying to place every record in every prompt.

Memories are never silently deleted. Retrieval scores every candidate the way Generative Agents do: recency since the memory was last used (exponential decay, 0.995 per hour by default), its stored importance (rated when it was written) and relevance to the query, each normalised and equally weighted. Selecting a memory into a prompt counts as a recall, so useful memories stay fresh and unused ones sink. A separate, governed tier lets an operator plan a dry run over low-retention records, approve it, and hide them from retrieval with a reversible retention_state; pinned, verified and cited records are protected. Defaults live on the Settings page; each agent can override the scoring and the planner thresholds. See the forgetting mechanism.

host request and scope
→ semantic-cache admission / lookup
→ scoped memory and skill retrieval
→ bounded context assembly
→ model call and governed tool loop
→ response and operational evidence
→ memory, cache, summary, trace, and learning writes

Side-effecting tools bypass semantic-cache admission. Cache keys and matches incorporate ownership, model/prompt/tool/data fingerprints, domains, TTL, and freshness policy; vector similarity alone does not establish freshness.

assistant, workflow, and deep_research choose default memory families. They do not change the provider security boundary or automatically enable external capabilities. Explicit memory_types can override mode defaults.

  • The host owns credentials, tenant scope, approval decisions, tool registration, and policy configuration.
  • The model may propose actions but cannot approve its own mutations.
  • MCP, browser, internet, and sandbox providers are separate authority and execution boundaries; enable only the least privilege required.
  • Continual learning consumes host-verified evidence and promotes workflows through explicit lifecycle policy. A repeated model claim is not verified success.
  • Observability may contain sensitive operational metadata. Use content redaction, authentication, audit logging, and scoped access.

Next, build an agent in the SDK quickstart, then add tools and approval or review context efficiency.