Self-hosted on your own AWS. memex indexes your notes and code and lets any MCP agent (Claude Code, Cursor, Codex) search it and cite the source. No SaaS, no telemetry — your second brain stays yours.
You write a lot — notes, decisions, docs, code. Six months later you can't find any of it, and your AI assistant has no idea it exists.
memex is a personal knowledge brain you run in your own cloud. It reads your markdown notes and your code, turns them into a searchable index, and hands that search to your AI agent over the Model Context Protocol (MCP). Now your agent answers "what did I decide about X?" with your own words, cited back to the exact note — instead of guessing.
It's a second brain for you, and long-term memory for your AI.
memex returns the evidence, cited to the exact file. Your agent writes the answer. (The brain retrieves — it doesn't chat.)
- Your knowledge is private. Most "AI memory" tools upload everything to someone else's servers. memex runs entirely inside one AWS account you control — your notes never leave your cloud, and there's zero telemetry.
- One brain, every agent. It exposes a single MCP endpoint. Any MCP-compatible tool connects to it; you don't re-index your life per app.
- Search that actually finds things. It blends meaning (vector embeddings), exact words (keyword search), and relationships (an entity graph) — so the thing you only half-remember still surfaces.
- Understands your code too. It indexes your source (TypeScript, Python) and can answer "who calls this function / what does it call" from a real call graph — not just your prose.
- Surfaces notes before you ask. Hand it a conversation and it volunteers the pages most likely relevant — deterministic, no AI guessing.
- Small and boring on purpose. No orchestrator, no SaaS to depend on. It fits on one small EC2 box, and you can read the whole thing in an afternoon. One brain serves one person; every remote credential (OAuth client, PAT) is scoped to the sources it may read (opt-in fail-closed).
| memex | Hosted "AI memory" | A plain RAG script | |
|---|---|---|---|
| Your data stays in your cloud | ✅ | ❌ | ✅ |
| Any MCP agent, one shared index | ✅ | sometimes | ❌ |
| Vector + keyword + entity-graph | ✅ | varies | vector-only |
| Understands code (real call graph), not just notes | ✅ | ❌ | ❌ |
| Zero telemetry, no SaaS dependency | ✅ | ❌ | ✅ |
Who it's for: developers who live in Claude Code / Cursor / Codex, note-takers with a markdown vault, and anyone who refuses to put their second brain on someone else's servers.
memex indexes your content once, then answers searches on demand. When your agent asks a question, here's the round trip — note that memex hands back evidence, and the agent composes the answer:
sequenceDiagram
autonumber
actor You
participant Agent as Your AI agent
participant memex as memex (MCP)
participant DB as Postgres + pgvector
You->>Agent: "What did I decide about X?"
Agent->>memex: tools/call search { q }
memex->>DB: vector + keyword + graph query
DB-->>memex: top chunks, ranked (RRF)
memex-->>Agent: cited chunks (evidence, not an answer)
Agent-->>You: answer, grounded in your own notes
Under the hood: a small Bun + TypeScript service, Postgres
16 with pgvector, AWS Bedrock for embeddings, and a Cloudflare Tunnel for
HTTPS — so no EC2 port is ever exposed. The entire public surface is two
routes: GET /health and POST /mcp. That's the whole attack surface.
Full topology, every container, and the security model: ARCHITECTURE.md.
You'll need an AWS account, Terraform 1.6+, docker compose v2, and a domain you control (for the Cloudflare Tunnel).
git clone https://github.com/<your-org>/memex.git
cd memex
make init # interactive bootstrap: AWS account, domain, buckets -> .env + tfvars
make audit # PII / secrets gate (must pass on a clean clone)
make plan # preview the AWS resources
make apply # create themmake apply boots one EC2 host, pulls the repo, fetches secrets from AWS
Secrets Manager, and starts the two containers (memex + cloudflared). Your
brain is then live at https://brain.<your-domain>/mcp.
Connecting Claude Code (or any MCP client): deploy/memex/docs/CLAUDE-CODE.md.
| Piece | What it does |
|---|---|
| memex | The brain: hybrid search, entity + code call graph, code/markdown indexers, MCP server, a built-in advisor that ranks what to fix, push-context that volunteers relevant pages, an opt-in (off-by-default) step that distils notes into concepts/opinions in a separate store (your original notes are never touched) with a take-review lifecycle (list_takes / takes_search / set_take_status), and a self-maintaining background cycle. 63 MCP tools. |
| cloudflared | Public HTTPS ingress via Cloudflare Tunnel — no open EC2 ports. |
| Terraform | All AWS infra (VPC, EC2, RDS, EFS, Secrets Manager) as one module. |
| AWS Bedrock | Titan v2 embeddings + Claude Haiku for query intent and the optional, off-by-default note synthesis (Claude Sonnet for the paid opt-in deep-reasoning slices). Your agent still writes the answers. |
Learn more: How it works · ARCHITECTURE.md · Deployment · Configuration · API / MCP tools · Operations · Privacy · Changelog
If a private, self-hosted brain for your AI agent is something you want to exist, give it a ⭐ — it's the signal that keeps this maintained. Bugs and ideas welcome in issues.
memex is intentionally small — one box, multi-source tenant isolation, no SaaS — so open an issue before anything that adds infrastructure or changes the deploy story. Please read CLAUDE.md (the repo's working rules) first.
Found a vulnerability? Please don't open a public issue — see SECURITY.md for the private disclosure channel.
MIT. Fork it, redeploy it, modify it, ship it. Solo-maintained, no SLA — if you need guarantees, fork and pin.