Long-term memory for your AI agents.
Your notes, decisions and code, searchable from Claude, ChatGPT and Codex, with the source attached to every answer.
For developers and small teams who work with AI agents every day. Memrain is free and open source (MIT). It runs in your own AWS account, so you pay only your AWS bill: about $52 a month for the server and database, plus model usage if you turn on the paid features. To start, follow docs/QUICKSTART.md.
- Your agent forgets. Every new chat starts from zero, so you paste the same context again and again.
- Your knowledge is scattered. Decisions sit in notes, the reasons in old chats, the details in code.
- Answers without sources are guesses. You cannot check an answer that does not say where it came from.
Memrain reads all of it, stores it in one place, and lets every agent you use search it. Each result points to the exact page it came from.
It also keeps facts and timelines, imports your ChatGPT and Claude history, keeps a version history for every page, and redacts API keys, tokens, private keys and database passwords before anything is stored.
Memrain does the remembering, not the talking (the opt-in think tool is the
one exception). It returns ranked passages with
their sources, and your agent writes the answer from them. A search costs one
embedding call and no chat-model call by default. The full pipeline is in
docs/HOW-IT-WORKS.md.
Self-host (free software; you pay your AWS bill). You need an AWS account with Bedrock access, Terraform, the AWS CLI, an S3 bucket for Terraform state, and a domain on Cloudflare (or on Route53, with the Caddy option). Fork the repo to your GitHub account, then:
git clone https://github.com/<your-github-username>/memrain.git && cd memrain
make init # answers a few questions and writes your config
make plan && make applyThe full walkthrough, from the tunnel token to your first search, is in docs/QUICKSTART.md.
Try it on your laptop. No servers, one embedded database. You still need AWS credentials for the embeddings. See Try it locally.
Hosted. A hosted version, so you do not have to run AWS yourself, is planned. It is not available yet.
Every client uses the same https://<your-host>/mcp address.
| Client | Guide |
|---|---|
| Claude Code | docs/clients/CLAUDE_CODE.md |
| Codex CLI | docs/clients/CODEX.md |
| claude.ai (Pro, Max) | docs/clients/CLAUDE_AI.md |
| Claude Team, Enterprise | docs/clients/CLAUDE_TEAM.md |
| ChatGPT | docs/clients/CHATGPT.md |
- Your data stays in your AWS account. Notes, index and database live there. Only what an agent retrieves goes to that agent's model; with the default Cloudflare Tunnel, that traffic passes through Cloudflare. No telemetry.
- Secrets are stripped on the way in. Pasted AWS keys, API tokens, private keys and database passwords are redacted before they are stored or embedded.
- Every person has their own key. Personal tokens and OAuth sign-in, scoped per person, each with an optional daily cap. Details in docs/TEAM-SETUP.md.
To report a vulnerability, see SECURITY.md.
- You do not want to run anything in AWS. A hosted version is planned; it is not available yet.
- You want a chat app. Memrain is the memory behind your agent, not a chat window.
| Doc | What is in it |
|---|---|
| docs/QUICKSTART.md | Install, connect, credentials, day-to-day operation |
| docs/HOW-IT-WORKS.md | How search works, what it costs |
| docs/TEAM-SETUP.md | One connector for a team, a private space per person |
| docs/DEPLOYMENT.md | Every install and update step in detail |
| docs/CONFIGURATION.md | Every setting, quality tiers, budgets |
| ARCHITECTURE.md | What runs where, and the security model |
| UPGRADING.md · CHANGELOG.md | Upgrades and release history |
Issues and pull requests are welcome. Please open an issue before anything that adds infrastructure or changes how Memrain is deployed. The local checks and test commands are in CONTRIBUTING.md.


