Introduction
RetainDB gives AI agents memory, a company brain, and clean agent access through MCP or HTTP.
Build a Company Brain
Connect docs, repos, URLs, files, and team tools so agents can answer with citations.
Start with sources ->Connect agents
Give Claude, Cursor, Codex, backend jobs, and custom agents clean access through MCP or HTTP.
Wire agent access ->Add user memory
Store durable preferences and facts, then retrieve only what the next model call needs.
Use memory ->Ship agent workflows
Record task events, preserve decisions, and hand work across planner, builder, and reviewer agents.
Add task memory ->Install
Agent-readable docs
Give coding agents the docs index at /llms.txt so they can find the right page before editing code.
RetainDB helps AI agents stop starting from zero.
Use it to give your product three things:
- Company Brain: connected sources such as docs, repos, files, web pages, and team tools that agents can query with citations.
- Memory: durable user, session, and agent facts that survive across conversations and runs.
- Agent Access: MCP and HTTP surfaces so Claude, Cursor, Codex, backends, jobs, and custom agents can read and update the right context.
Pick The Right Start
| I want to | Start here | Best surface |
|---|---|---|
| Connect company knowledge for agents | Build a Company Brain | Dashboard, MCP, /v1/context |
| Let Claude/Cursor/Codex read RetainDB | Connect Agents | MCP first, HTTP when needed |
| Add user memory to an AI app | 5 Minute Quickstart | SDK v5 |
| Use RetainDB from any runtime | Raw HTTP Quickstart | REST API |
| Share state across planner/builder/reviewer agents | Agent task API | SDK or Agent Memory API |
| Add RetainDB to a Next.js app | Next.js integration | server route |
Mental Model
RetainDB separates knowledge by what it is for.
| Layer | What it stores | Read it with |
|---|---|---|
| Company Brain | documents, repos, URLs, files, source-derived memories, citations | POST /v1/context, MCP context, agent filesystem |
| User memory | preferences, facts, goals, support history | SDK db.user(...).getContext(), /v1/memory/search |
| Session memory | current conversation or workflow state | SDK session helpers, /v1/memory/search |
| Agent memory | decisions, tool results, failures, handoffs | SDK agent helpers, MCP agent tools, Agent Memory API |
Do not put every piece of data into every layer. Good RetainDB integrations keep company knowledge, user memory, and agent task state separate, then retrieve only what the current model call needs.
The First Five Minutes
For most teams, the best first run is:
- Create or choose a project.
- Connect one trustworthy source.
- Ask the company brain a question in the dashboard.
- Connect one agent through MCP.
- Verify the answer includes the right source context.
That path proves the product loop before you spend time on billing, advanced connectors, SDK abstractions, or custom orchestration.
What Production-Ready Feels Like
A good RetainDB setup has these properties:
- agents can answer from connected company knowledge without pasted transcripts
- user memory is scoped to the authenticated user, not guessed from prompts
- source sync state is visible before agents rely on it
- answers expose citations, source names, or trace IDs
- API keys stay server-side
- failed syncs and empty searches produce clear next actions
Core URLs
| Surface | URL or route |
|---|---|
| API base URL | https://api.retaindb.com |
| Ask Company Brain | POST /v1/context |
| Read agent filesystem | GET /v1/context/files |
| Manage sources | GET /v1/sources, POST /v1/sources, PATCH /v1/sources/:id, DELETE /v1/sources/:id |
| Memory search | POST /v1/memory/search |
| Agent events | POST /v1/agent/memory/events |
Next
Start with Build a Company Brain, or jump to Connect Agents if your sources already exist.
Was this page useful?
Your feedback helps us make the product easier to ship with.