Dense-Mem Quick Start: Give Claude Code and Codex the Same Memory
A beginner-friendly tutorial for spinning up a local Dense-Mem server, creating your first memory key, and connecting Claude Code and Codex to one shared AI memory brain.
AI-powered · Limited to 20 requests per hour

Quick Answer
In 2026, the simplest Dense-Mem setup is a local Docker Compose stack with 3 services behind one MCP endpoint: Dense-Mem, Postgres, and Neo4j.
The quick path:
- Start Dense-Mem with the local compose file.
- Create one memory key with
provision-team. - Connect Claude Code, Codex, or both to
localhost:8080/mcp.
Most AI chats feel smart for one session, then forget the next morning.
Dense-Mem fixes that by giving your AI tools one shared memory server. Claude Code, Codex, and other MCP clients can all connect to the same place. Instead of repeating your preferences, project rules, family plans, or team decisions in every new chat, you give your tools one durable memory brain.
The goal is simple:
Many AI sessions -> one Dense-Mem server -> the same useful memoryThis tutorial gets the local version running first. It is the safest first step because everything stays on your computer.
What Dense-Mem Gives You
Dense-Mem is not another chatbot. It is the memory layer behind your chat tools.

Read the picture left to right.
Without Dense-Mem, every assistant starts cold. Claude Code may know one thing, Codex may know another, and tomorrow's chat may know neither.
With Dense-Mem, those tools point at one memory service. Preferences, project decisions, corrections, and team context can survive beyond a single chat window.
Dense-Mem stores evidence first, then turns safe memories into facts. If a new memory conflicts with an old one, it should ask for clarification instead of silently overwriting the old memory.
That matters because memory is only useful when you can trust it later.
The Problems It Addresses

Dense-Mem is useful when:
- you keep repeating the same preferences
- project decisions disappear into old chats
- different AI clients cannot share context
- team or family knowledge is scattered across sessions
- corrections should replace old memory instead of creating confusion
What You Need
You need four things:
- Docker, so the server and databases can run without manual installation.
- A terminal, where you paste the commands.
- An OpenAI-compatible embedding endpoint and API key, used for memory recall and checks.
- Claude Code, Codex, or another MCP client that will use the memory.
If this is your first time, use the published Dense-Mem manual as the source of truth: Dense-Mem Quick Start.
Step 1: Download The Local Compose File

Create a folder:
mkdir dense-mem-local
cd dense-mem-localDownload the beginner local setup:
curl -fsSLo docker-compose.yml \
https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.base.ymlCreate the .env file:
cat > .env <<'EOF'
POSTGRES_PASSWORD=choose-a-strong-postgres-password
NEO4J_PASSWORD=choose-a-strong-neo4j-password
CONTROL_PORTAL_TOKEN=choose-a-long-control-portal-token
AI_API_URL=https://api.openai.com/v1
AI_API_KEY=your-ai-provider-api-key
AI_API_EMBEDDING_MODEL=text-embedding-3-large
AI_API_EMBEDDING_DIMENSIONS=3072
EOFOpen .env and replace every placeholder with your real value.
Keep this file private. It contains passwords and API keys.
Dense-Mem talks to an OpenAI-compatible embedding API. The example above uses OpenAI's text-embedding-3-large, so the dimension must be 3072. If you use text-embedding-3-small, use 1536 instead. If you use another OpenAI-compatible provider, change AI_API_URL, AI_API_EMBEDDING_MODEL, and AI_API_EMBEDDING_DIMENSIONS together before storing important memory.
Step 2: Start Dense-Mem
Start the stack:
docker compose up -dCheck that it is running:
docker compose psYour local Dense-Mem URLs are:
http://127.0.0.1:8080/mcpfor Claude Code, Codex, and other MCP clientshttp://127.0.0.1:8080/uifor the user-facing UIhttp://127.0.0.1:8090/for the control portal that manages teams, profiles, and keys
The important part: these are local addresses. They are not public internet addresses.
Step 3: Create Your First Memory Key
Run:
docker compose exec server /app/provision-team --name "primary-memory"Dense-Mem prints an API key once. Save it somewhere private.
It will look like this:
{
"team_name": "primary-memory",
"profile_name": "default profile",
"scopes": ["read", "write"],
"api_key": "dm_default-prof_..."
}The API key is how your AI client proves it can use your memory.
Step 4: Connect Claude Code

Set the API key in your terminal:
export DENSE_MEM_API_KEY="dm_default-prof_..."Then add Dense-Mem to Claude Code:
claude mcp add --transport http dense-mem http://localhost:8080/mcp \
--header "Authorization: Bearer $DENSE_MEM_API_KEY"Now Claude Code can call Dense-Mem when you ask it to remember or recall something.
Step 5: Connect Codex
Set the same environment variable:
export DENSE_MEM_API_KEY="dm_default-prof_..."Add this to ~/.codex/config.toml:
[mcp_servers.dense_mem]
url = "http://localhost:8080/mcp"
bearer_token_env_var = "DENSE_MEM_API_KEY"
tool_timeout_sec = 60
enabled = trueRestart Codex after changing the config.
Now Claude Code and Codex can use the same Dense-Mem server. Same memory, different client.
Step 6: Try Your First Memory
Ask your AI client:
Remember that I prefer concise explanations with concrete examples.Then start a new session and ask:
What do you remember about my explanation preferences?If everything is connected, the assistant should call Dense-Mem and answer from stored memory.
Use One Brain For More Than One Person

Dense-Mem supports teams and profiles.
Use one team when memory should be shared. Use separate teams when memory should not mix.
- One person using many AI tools can start with one team and one profile.
- A family can use one family team with separate profiles.
- A work group can use one team per project or group.
- Automation that should only search should get a read-only profile key.
This is the real power: the memory is not trapped inside one chat client.
Your Claude Code session can remember a project rule. Later, Codex can recall it. A family planning assistant can remember preferences for a trip. A work team can keep project decisions in one shared memory boundary.
What Not To Store
Dense-Mem is memory, not a password manager.
Do not store:
- passwords
- seed phrases
- private keys
- payment card numbers
- anything you would not want your configured AI provider to process
By default, Dense-Mem sends memory text and recall queries to the configured embedding provider. If that is not acceptable, use a self-hosted provider before storing sensitive memory.
Stop Or Restart
Stop:
docker compose downStart again:
docker compose up -dYour memory stays in Docker volumes unless you intentionally delete those volumes.
Next Step
Local Dense-Mem is the best first win. Once it works, you can put it on a secure public server so your AI tools can reach the same memory from more than one machine.
That is the next tutorial: Secure Dense-Mem on Vultr with Traefik.
If Dense-Mem helps you, star the project and share it with someone who uses more than one AI tool: github.com/markhuangai/dense-mem.
License
Article text © 2026 Mark Huang. Licensed under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) unless otherwise noted. Article text is licensed for non-commercial sharing with attribution to the original article URL. Commercial use requires prior written permission and must clearly cite the original source.
Code snippets, screenshots, third-party assets, and site source code may have separate terms.
Suggested attribution: Based on "Dense-Mem Quick Start: Give Claude Code and Codex the Same Memory" by Mark Huang, originally published at https://markhuang.ai/blog/dense-mem-personal-server-claude-code-codex.
Related Articles

Try Dense-Mem in 5 Minutes With the Hosted Demo
A quick tutorial for using the hosted Dense-Mem test instance, connecting Claude Code and Codex to the same temporary memory, and seeing how shared context helps AI work smarter.
Read article
Secure Dense-Mem on Vultr with Traefik
A nontechnical walkthrough for launching Dense-Mem on a Vultr cloud server with Traefik, HTTPS, private control-portal access, and shared memory for personal, family, or work AI tools.
Read article
Stop Teaching Every AI From Scratch
A personal Dense-Mem reflection on the problems that pushed me beyond static skills and stale files toward dynamic shared memory, read-only automation context, import/export, and governed knowledge graphs.
Read article