Your agent forgets users between sessions. That's the bug.
MemexAI gives your agent a persistent memory layer backed by Postgres. Memories are human-readable Markdown files with revision history, access logs, and scoped permissions. You can inspect every fact, fix mistakes, and trace what the agent remembered and why.
Paste the prompt into Cursor, Claude, or Antigravity to automate setup.
Where agent memory breaks in production.
Session 2 starts from scratch.
Your agent wrote what it learned last time. But nothing loaded that context into the new session. The model isn't broken — the memory injection layer is missing. Users re-explain themselves. The product feels stateless because it is.
context_files: [] // user/profile.md exists, never injected
Similarity retrieval serves the past, not the present.
Vector search returns what's similar, not what's current. A detailed old entry outranks a brief recent update. You can't fix one embedding — you'd have to re-extract the full conversation. The wrong fact keeps winning.
Rules, facts, and history share one unstructured blob.
Escalation policy, user preferences, and last week's conversation all arrive as one context string. The model can't distinguish what always applies from what happened once. Priority is undefined.
viewed ParkRegalia last week..."
// rules mixed with history, equal weight
Memory as Markdown files in your Postgres
MemexAI stores what your agent knows about each user as structured Markdown files — not embeddings as the source of truth. Files live in your own Postgres database. Optional pgvector ranking can improve recall, while the memory record stays readable and editable.
user/**Private per tenantEach user gets their own memory directory. Agents read and write freely. Other users can't see it.
shared/**Global read-onlyProject-wide policies, style guides, and workflows. Agents read but can't write by default.
Give all your agents a shared brain
The shared/ namespace holds global policies, product schemas, and behavioral rules. Update a schema or rule once, and it instantly propagates to every agent session. No code deployments required.
Behavioral Rules
Store shared/playbook.md to define how agents should handle specific situations (e.g., support escalations). The agent reads it before every session.
Memory Schemas
Define what a "good" user profile looks like. If you add a new required field to the schema, agents will automatically start asking users for it.
Auto-Injection
shared/index.mdis automatically injected into every prompt block. It acts as a routing catalog for your agent's collective knowledge.
Collective Memory
Optionally configure shared/ as read-write. Trusted agents can update project canon, backed by full audit trails and the ability to revert any change.
Background Dreaming keeps memory clean
Memory files can get messy over time with duplicate facts or scattered notes. MemexAI's Dreaming is a background optimization loop that runs when a user session goes quiet.
Merges repeated preferences, removes outdated or corrected facts, and consolidates fragmented notes into a stable record without blocking the main user request.
Dream runs that find nothing to change complete silently. When they do make updates, they create normal revisions authored by the dream-agent.
When the AI gets a fact wrong, open the file and fix it.
Edit the Markdown line, and the next prompt block updates instantly. Hybrid deployments refresh optional pgvector ranking on writes. Revisions track every write. Access logs track every read. You can trace exactly which tool call wrote the wrong fact.
Add memory to your agent in 4 lines
Start with Docker. Connect with the TypeScript SDK or MCP. Or paste a setup prompt into your coding agent and let it wire everything automatically.
memory subagentRecommended defaultGive the model memory_remember and memory_context; MemexAI decides what is durable, retrieves relevant context, and handles file bookkeeping.
raw file toolsExact file controlUse file-level tools when your app or agent owns the memory layout and needs exact path control over durable files.
Every team builds half of this. The other half shows up at scale.
These aren't design decisions — they're failure modes that appear as usage grows. Each one is a weekend of work that pulls engineers away from the product.
shared/ + user/ isolation, path-enforcedNo moat claims. These are failure modes that appear as usage scales, and the mechanisms that prevent them.
How MemexAI compares
Give your agent memory your team can trust.
Start with Docker, MCP, or the TypeScript SDK. Store memory, inject context, verify the next answer changes.