codebase-memory
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codebase-memoryshow me known architecture decisions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codebase-memory
Your AI agent forgets everything between sessions. This MCP server fixes that.
You: "What architecture pattern does this project use?"
Without codebase-memory:
AI: "I'd need to look through the codebase to determine that."
With codebase-memory:
AI: "This project uses a hexagonal architecture with ports and adapters.
The decision was made in March 2026 to improve testability.
Related files: src/ports/, src/adapters/, src/domain/"The Problem
AI coding agents (Cursor, Claude, Copilot) lose all context between sessions:
Architecture decisions get forgotten and re-asked
Code patterns get violated because the AI doesn't know your conventions
Bug workarounds get re-introduced after being fixed
Every session starts from zero
codebase-memory gives your AI persistent memory through the Model Context Protocol (MCP).
Related MCP server: LogicMem MCP Server
Quick Start
# Install
npm install -g codebase-memory
# Add to Claude Desktop config (~/.config/claude/claude_desktop_config.json)
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory"]
}
}
}That's it. Your AI agent now has 5 memory tools:
Tool | Description |
| Store architecture decisions, patterns, conventions, bugs, context |
| Search memories by query, category, tags, or file path |
| Update existing memories when things change |
| Delete outdated or incorrect memories |
| Get overview of all memories (call at session start) |
Memory Categories
Category | Use For |
| System design decisions, service boundaries, data flow |
| Code patterns: repository, factory, observer, etc. |
| Why choices were made ("We chose Postgres over MongoDB because...") |
| Package choices, version constraints, compatibility notes |
| Naming rules, file structure, formatting standards |
| Known bugs, workarounds, things that look wrong but aren't |
| Domain knowledge, business rules, user requirements |
| Planned improvements, tech debt, future work |
| How files/modules connect, dependency graphs |
How It Works
AI stores knowledge — As your agent learns about the codebase, it calls
rememberto save important informationPersisted in SQLite — Memories are stored locally in
.codebase-memory/memory.dbRetrieved on demand — When the agent needs context, it calls
recallwith a search queryFull-text search — SQLite FTS5 enables fast, relevant search across all memories
Importance scoring — High-importance memories surface first
Example Workflow
Session 1 (you're setting up the project):
AI remembers:
- "architecture: Monorepo with turborepo, apps/ for services, packages/ for shared"
- "convention: All API routes use zod validation middleware"
- "decision: Chose Drizzle ORM over Prisma for edge runtime support"
- "bug: Don't use Date objects in API responses, use ISO strings (timezone issues)"
Session 2 (next day, different task):
AI calls project_summary -> instantly knows the project structure
AI calls recall({query: "API validation"}) -> knows to use zod middleware
AI calls recall({filePath: "src/api/"}) -> gets all API-related memories
-> Writes code that follows all your established patternsConfiguration
Claude Desktop
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory"]
}
}
}Cursor
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory"]
}
}
}Custom Database Location
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory", "--db", "/path/to/memory.db"]
}
}
}Programmatic API
import { MemoryDatabase } from 'codebase-memory';
const db = new MemoryDatabase({ path: './memory.db' });
// Store a memory
const entry = db.create({
category: 'architecture',
title: 'Event-driven messaging',
content: 'Services communicate via RabbitMQ. Orders service publishes OrderCreated events.',
tags: ['messaging', 'rabbitmq'],
filePaths: ['src/events/', 'src/services/orders/'],
importance: 9,
});
// Search memories
const results = db.query({
query: 'messaging',
category: 'architecture',
minImportance: 7,
});
// Get project overview
const summary = db.getSummary();
console.log(`Total memories: ${summary.totalMemories}`);
console.log(`Top tags: ${summary.topTags.map(t => t.tag).join(', ')}`);
db.close();Data Storage
Location:
.codebase-memory/memory.db(in your project root)Format: SQLite with FTS5 full-text search
Size: Typically under 1MB for thousands of memories
Backup: Just copy the
.dbfileGit: Add
.codebase-memory/to.gitignore(per-developer memories) or commit it (shared team knowledge)
CLI Options
codebase-memory [options]
--db <path> SQLite database path (default: .codebase-memory/memory.db)
--project <path> Project root directory (default: cwd)
--version Show version
--help Show helpLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Shared project memory that keeps teammates and AI agents aligned across sessions.
Project memory for coding agents: requirements, decisions, code graph and delivery telemetry.
Persistent memory layer that saves and recalls your project context and preferences.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides durable project context for coding agents, including project maps, session history, and explicit memories, all stored locally.43 npm7MIT

LogicMem MCP Serverofficial
AlicenseBqualityDmaintenanceProvides persistent memory, reasoning, agent-to-agent sharing, and immutable audit trail for AI agents via the Model Context Protocol.121MIT- AlicenseNot gradedqualityDmaintenanceGives AI agents durable project memory via the Model Context Protocol, allowing them to read tasks, record decisions, search context, and sync snapshots to the cloud.13 npmMIT
- AlicenseNot gradedqualityAmaintenanceProvides persistent, anchored memory for AI coding agents, binding every decision to specific lines of code and delivering relevant context just-in-time via the Model Context Protocol.1MIT