The General Engine is the default. It works for most AI products — chatbots, coding agents, productivity copilots, SaaS personalization, internal knowledge tools — anything that needs persistent user memory without an industry-specific schema.
Memory categories
| Category | Example |
|---|
preference | User prefers concise answers with Python examples. |
fact | User works in a B2B SaaS support team. |
goal | User is preparing to launch an AI product. |
procedure | User wants weekly summaries every Friday. |
relationship | User reports to the Head of Product. |
expertise | User is comfortable with FastAPI and PostgreSQL. |
Write
add() authenticates the tenant, resolves external_user_id, runs the quality gate, queues extraction, resolves conflicts, stores memories, and indexes vectors — then returns a job result. Extraction is async.
result = mem.add(
messages=[
{
"role": "user",
"content": "Remember that I prefer concise technical explanations with Python examples.",
}
],
external_user_id="user_123",
)
Possible outcomes:
| Status | What to do |
|---|
queued | Continue normally |
passthrough | Skip memory context, still call the LLM |
L1 | Per-user rate limit — retry later |
L2 | Low-quality input — don’t retry the same message |
L3 | Near-duplicate — avoid repeated writes |
L4 | Budget block — wait for reset or upgrade |
Blocking add() should not affect LLM calls.
Retrieve
Call get() before the model call. MemoryOS ranks memories by semantic relevance, importance, recency, and hot-tier signals, then returns system_prompt_addition ready to prepend.
memories = mem.get(
query="answer this user's integration question",
external_user_id="user_123",
limit=5,
context_max_tokens=500,
)
system_prompt = "You are a helpful assistant."
if memories.has_context:
system_prompt = f"{system_prompt}\n\n{memories.system_prompt_addition}"
Use a query that describes the current task. "answer this user's question" retrieves better than "preferences" or "memory".
When to switch to a domain schema
The General Engine is the right default. Move to a domain schema when your product needs structured domain memory:
- EdTech — student profiles, weak topics, exams, forgetting stages
- Support — customer issue history, support type, sentiment, escalation risk
Related pages