One memory for every AI agent in your company, in your own AWS account

My coding assistant forgets everything I told it the moment a session ends, and the ChatGPT tab next to it never knew any of it. Fixing that for myself costs about $52 a month on AWS in eu-west-1 for the server and database, plus model usage.
You've probably seen the company version of this. Half the engineers use Claude and the rest prefer ChatGPT. Six weeks into the rollout every team is rebuilding the same context by hand. Somebody pastes the runbook into a prompt again, and somebody else explains, for the fourth time, why the billing service still talks to that one ancient queue. Whatever the agents picked up sits in personal chat histories on other companies' servers, and when a person leaves, their half of it goes too.
Platform and AI-enablement leads get the awkward questions first. Where does this memory live, and who can read it? Can we switch one person off on a Friday afternoon without breaking anyone else, and what happens to the bill when an agent loops at 3 a.m.?
I built Memrain to answer those for myself, then rebuilt the parts that only made sense for one person. Here's the plain version, unfinished bits included.
Same memory, whichever vendor
Memrain is long-term memory for the AI agents your engineers already use. It's open source under the MIT licence and it runs in your own AWS account.
It's an MCP server with 96 tools, and each credential only sees the ones its scope allows. Claude Code, Codex CLI, claude.ai on Pro and Max, Claude Team and Enterprise, and ChatGPT all have setup guides. They all talk to the same /mcp address. Put a shared team source in each person's read set and someone in ChatGPT searches the same runbooks and code as the colleague in Claude Code. You can switch vendors next quarter, or mix them, and the memory stays in your Postgres.
Notes and code from different agents end up in one store.
Old history doesn't have to be thrown away. ChatGPT and Claude.ai exports, Codex rollouts and Claude Code session logs can be imported, and they're redacted on the way in.
I think memory is the part of an AI rollout a company actually gets to keep. Models get swapped, while the notes about your systems keep piling up. Inside one vendor's product they follow that vendor's permissions and retention, and moving means starting over. In an AWS account your security team already reviews, the IAM policies and review habits are already in place.
How it works
Where requests and data go. The same diagram is on memrain.com/security.
The Terraform stack is deliberately dull: one EC2 instance, RDS Postgres 16 with pgvector, EFS and Secrets Manager. Requests come in through a Cloudflare Tunnel by default. If you'd rather keep Cloudflare out of the path, Caddy mode terminates TLS on the instance.
When an agent writes a note, Memrain embeds it with Amazon Titan v2 on Bedrock in your account. Search runs by meaning and by exact words at once and merges the two lists with Reciprocal Rank Fusion. Code gets a graph for TypeScript, Python and Go, so an agent can ask who calls a function and what breaks if it changes. Facts, timelines and links between pages sit alongside.
Each search result comes back with a pointer to the page it came from, and your agent writes the answer. I have to own something here. My README overpromised on this for a while and implied the answers themselves arrived cited. I only caught it while checking every claim for this article, and the wording is fixed as of v1.7.0. Memrain hands over passages and pointers, and you check the agent's work against the pointer. The one exception is an opt-in tool called think that writes a cited answer itself.
Stored data stays in your account. The passages your agent retrieves travel to that agent's model, because that's how it reads them, and in Tunnel mode requests pass through Cloudflare. A few optional features call Claude on Bedrock. Those use EU cross-region inference profiles by default, and IAM denies Claude invocation outside the regions you allow.
Every page keeps its version history and can be reverted. A write can carry the version it expects, so two agents don't quietly flatten each other's edits, and a retried request with the same id is safe.
What a team gets
A credential per person. CLI users get a personal access token. People in Claude or ChatGPT redeem a one-time enrollment code through one connector your organisation sets up. Revoking one person doesn't touch anyone else, which covers the Friday-afternoon question.
Daily spend caps. You set a daily USD cap per connector, per token or per person, plus an optional one across the whole memory. They apply to priced model calls and some of the underlying costs are approximations, so treat them as a guard rail with a known wobble.
Secret redaction on the way in. People paste things into agents they shouldn't. Credential-shaped text (vendor keys, JWTs, PEM private keys, passwords inside URLs, Basic and Bearer credentials, high-entropy KEY= or TOKEN= assignments) gets redacted before it's stored. Retrieval output to non-operator callers is scanned too, and memrain secrets audit rescans what's already there. No pattern set catches everything, and the docs say so.
An admin panel with its own sign-in. The Overview charts 7, 30 or 90 days, and next to it sit a brain explorer, credentials and members, spend and a request log. It's served with a strict Content-Security-Policy and loads no third-party fonts.
The admin Overview, running on demo data.
Credential changes are recorded, down to who issued, revoked or replaced an enrollment and who changed a grant. There are no vendor analytics and no third-party telemetry. Memrain keeps its own usage counters and request and spend logs, plus CloudWatch application logs with 14-day retention, all inside your account.
What it doesn't do
Better you read this now than find it in week three.
There's no single sign-on. Memrain has a built-in OAuth 2.1 authorization server for the connectors, but logins don't federate over SAML or OIDC, and there's no SCIM. If SSO on day one is a hard requirement, Memrain isn't for you yet.
You run it yourself. There's no hosted version, and no SLA or paid support either.
It's one EC2 instance, and high availability is not offered. RDS runs in a single AZ with 7-day automated backups, encrypted storage and deletion protection. Nobody has documented a restore drill, an RTO or an RPO yet.
Private spaces per person are pilot-grade. They need MEMRAIN_TENANT_FAIL_CLOSED=1 and Dynamic Client Registration switched off, and the known limits are written down in the team setup docs. If you need legally required separation between teams, run one stack per team.
Nobody outside has audited it and it holds no compliance attestation, though the code is open for your own review. memrain export writes pages as markdown with frontmatter; facts, versions, links and embeddings stay in your Postgres and aren't part of it.
A one-week pilot
I'd run it in a sandbox account with five to ten volunteers.
Monday. Request Bedrock model access and apply the Terraform. Budget roughly $52 a month for the server and database, plus model usage, and re-price it if you're not in eu-west-1. Pick the ingress. With the Tunnel the instance opens no inbound ports and you get in through SSM Session Manager. Caddy mode opens HTTPS on the instance.
Tuesday. Create one connector for the organisation and hand out enrollment codes. Turn on fail-closed before anyone redeems one.
Wednesday. Set a daily cap per person, and a lower one on the connector than feels comfortable. Load the runbooks, a handful of ADRs and one repository your volunteers actually work in. Put at least one volunteer on ChatGPT and one on Claude Code, so you see the shared memory across vendors.
Thursday. Let people work. Watch spend and the request log in the panel. The request log is opt-in and has no retention limit yet, so switch it on for the pilot and keep an eye on it.
Friday. Break things on purpose. Revoke one volunteer and confirm nobody else notices. Restore the database from an RDS backup into a scratch instance and time it, since that's the drill nobody has written down. Run an export and look at what came out.
By Friday evening you'll have a real bill and a list of what annoyed your volunteers.
Try it, or pilot it with me
The code and the Terraform are on GitHub under MIT: github.com/timurgaleev/memrain.
If you're evaluating it for a company, memrain.com/companies has the pilot path and memrain.com/security goes deeper on the data flow and the security model.
If you want help with a pilot, e-mail me at timur@tgaleev.com with [Memrain pilot] and your company name in the subject. There's no contract behind that, it's me answering. GitHub issues work for everything else.





