Memory infra for AI agents

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.

Read Quickstart

Paste the prompt into Cursor, Claude, or Antigravity to automate setup.

user/profile.mdRev 1 · 0s ago
The problem

Two ways agent memory fails in production

Stateless agents lose users

Without persistent memory, your agent starts fresh every session. Users repeat their preferences, re-explain their goals, and eventually stop coming back. The AI feels like it has amnesia.

“I already told you I moved to London.”

Vector stores hide the wrong facts

Dumping conversations into a vector database retrieves similar-looking fragments — including outdated or conflicting ones. When the agent says something wrong, you can't see why. You can't fix it.

??? ??? ???

The solution

Memory as Markdown files in your Postgres

MemexAI stores what your agent knows about each user as structured Markdown files — not opaque embeddings. Files live in your own Postgres database. Agents read and write them with simple tools. You read them with your eyes.

Memory Files
user/
shared/
user/profile.md Private
name: Alex Chen
location: London
prefers: dark mode, concise replies
timezone: GMT
last_topic: apartment search in Shoreditch
Private · Writable · 3 revisions
user/**Private per tenant

Each user gets their own memory directory. Agents read and write freely. Other users can't see it.

shared/**Global read-only

Project-wide policies, style guides, and workflows. Agents read but can't write by default.


Global Knowledge

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.


Maintenance

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.

Compaction & Deduplication

Merges repeated preferences, removes outdated or corrected facts, and consolidates fragmented notes into a stable record without blocking the main user request.

Zero Audit Noise

Dream runs that find nothing to change complete silently. When they do make updates, they create normal revisions authored by the dream-agent.


Debuggability

When the AI gets a fact wrong, open the file and fix it.

No re-indexing. No opaque embedding adjustments. Edit the Markdown line, and the next prompt block updates instantly. Revisions track every write. Access logs track every read. You can trace exactly which tool call wrote the wrong fact.

user/profile.mdRev 4 (current)
name: Alex Chen location: New York moved_from: null prefers: dark mode, concise replies
Access Log
14:22:01READuser/profile.mdtool_call_id: tc_a83f
14:22:03WRITEuser/profile.mdreason: "user corrected location"

Get started

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.

# Start Postgres + MemexAI service
docker compose up -d

# In your agent code:
const memex = MemexAI({
url: 'http://localhost:8080',
apiKey: 'dev-agent-key'
})
const memory = memex.memory('user-123')
const tools = memory.createAgenticToolset()
Or copy this into your coding agent:
Setup MemexAI by following https://memexai.space/setup.md

Compare

How MemexAI compares

MemexAI
Mem0
Zep
DIY
Storage
Your Postgres
Their cloud
Their cloud
Varies
Memory format
Markdown files
JSON blobs
Knowledge graph
Custom
Human-readable
✓ Open the file
✗ API-only
✗ API-only
Depends
Fix a wrong fact
Edit one line
Re-extract
Re-process
Write migration
Revision history
✓ Built-in
Build it yourself
Self-hosted
✓ Docker
Paid cloud
Paid cloud
See full comparison
Build the record

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.