MemexAI Docs

Memory that changes your agent's next response, backed by Postgres.

MemexAI gives agents durable memory that can actually influence the next response. It stores memory as scoped Markdown-like files in Postgres, injects the right context through a prompt block, and gives teams revisions, access logs, search, and an admin UI.

Start with the service

How the two paths work

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.

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_search

Pass 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_read

Framework adapters

Drop Memex into the framework you already use.

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.

What MemexAI stores

Memory lives in Postgres tables:

TablePurpose
mx_fileCurrent memory file contents
mx_revisionFull write snapshots for auditability
mx_access_logLightweight read/write activity
mx_migrationApplied 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 →

On this page