MemexAI Docs
Inspectable memory infrastructure for multi-tenant agents, backed by Postgres.
MemexAI is drop-in, inspectable memory infrastructure for multi-tenant agents. Run the service beside Postgres, give agents scoped memory tools, and use the admin console to inspect the memory record that changes future behavior.
Start with the service
Fastest: Coding agent setup
Paste one public setup instruction into your coding agent and let it wire the service, tools, prompt block, and two-turn proof.
Recommended: Containerized service
Run MemexAI as a separate service, then connect over the TypeScript SDK, Python SDK, or MCP.
Admin Console
Inspect memory files, revisions, access logs, observability, tool calls, and background dreaming.
Advanced: Direct Postgres runtime
Skip the service only when your app intentionally owns database credentials.
Product mental model
MemexAI is not transcript RAG. Raw conversations can stay in your app, warehouse, or audit store. MemexAI owns the smaller working set your agent should carry forward: preferences, constraints, corrections, project notes, decisions, shared policies, and source-backed updates.
The default production flow is:
agent / SDK / MCP -> MemexAI service -> PostgresFrom there:
- Architecture: the service owns database access, while SDKs, adapters, REST, and MCP all route through the same tool engine.
- Memory model: agents write structured files; search is BM25-first, with optional pgvector hybrid search inside Postgres.
- Scopes:
user/is private peruserId;shared/is global guidance, read-only by default, and writable only when explicitly enabled. - Operations: revisions, access logs, time travel, observability, and hot/cold files make memory inspectable.
- Optimization: teams can update memory schema over time, and dreaming can compact and clean user memory after activity goes quiet.
How the two paths work
1. Recommended: containerized service
Run the MemexAI service alongside Postgres. Your app never gets database credentials; it connects to the service over HTTP with the TypeScript or Python SDK, or through MCP over SSE/stdio.
Use this when you want a deployable memory service with API key auth and the admin UI built in.
If you want your coding agent to perform the integration, start with Coding Agent Onboarding. It uses the same service path, then asks the agent to prove memory with a two-turn test.
2. Advanced: direct Postgres runtime
Skip the MemexAI service container only when your JavaScript or Python app should own the Postgres connection directly. Your app imports the MemexAI runtime, passes a Postgres URL, runs migrations, and executes memory tools in-process.
Use this for embedded deployments, local experiments, or environments where sharing database credentials with the app is an intentional tradeoff.
Two integration paths
Agentic tools
Use this for most assistants. The model gets two tools, and your system prompt gets the MemexAI prompt block.
const system = await memory.getSystemPrompt('You are a helpful assistant with durable user memory.')
const tools = memory.createAgenticToolset()
// memory_memorize, memory_searchPass both system and tools into your model call. Tools store and retrieve memory; the prompt block is what makes stored memory available to the next answer.
Raw tools
Use this when your agent or application should manage memory files directly.
const tools = memory.createRawToolset()
// memory_list, memory_read, memory_write, memory_patch, memory_smart_readFramework adapters
Drop Memex into the framework you already use.
Vercel AI SDK
Use memory tools with generateText and streamText in TypeScript.
Anthropic SDK
Integrate with claude-opus-4-7 and other Claude models via @memexai/core.
LangChain
Add memory tools to LangChain agents in TypeScript or Python.
OpenAI SDK
Wire memory tool definitions into OpenAI chat completions calls.
LlamaIndex
Use FunctionTool memory tools with LlamaIndex agents in Python.
CrewAI
Add memory tools to CrewAI agents and crews in Python.
Shared memory can guide behavior
User memory stores per-user facts, preferences, and project state. Shared memory stores global guidance that every agent can read, such as tool rules, product policies, escalation criteria, and evaluation rubrics.
How MemexAI works
Understand the loop from model tool call to memory files, prompt injection, revisions, and later recall.
Memory tools
Choose between two agentic tools and the raw file-level tool set.
Prompt block
Make stored memory part of the system prompt so the next response can change.
Memory scopes
Understand user/private memory, shared/global memory, and opt-in shared writable mode.
Shared memory as behavior guide
Use shared files as durable guidance, and optionally let trusted agents grow shared canon, policies, and workflows.
Operate and evaluate memory
Benchmarks are useful, but production memory also needs inspectability. Evaluate whether important facts were written, retrieved, cited, and answerable; then check whether an operator can explain failures from revisions, access logs, and time-travel snapshots.
Admin Console
Inspect files, revisions, access logs, observability, tool calls, hot files, hygiene signals, and dreaming.
Background Dreaming
Compact, merge, and clean user memory after sessions go quiet.
Why memory evals matter
Evaluate memory state, retrieval, and writes, not only prompt text.
What MemexAI stores
Memory lives in Postgres tables:
| Table | Purpose |
|---|---|
mx_file | Current memory file contents |
mx_revision | Full write snapshots for auditability |
mx_access_log | Lightweight read/write activity |
mx_migration | Applied schema migrations |
Agents use virtual paths like user/profile.md and shared/policy.md. MemexAI translates those paths to physical database paths and enforces user isolation.
Community / Support
Got a question, found a bug, or want to share how you're using MemexAI? Join us on Slack →