In Memoria

In Memoria

Persistent memory and instant context for AI coding assistants, integrated via MCP.

94
Stars
17
Forks
94
Watchers
4
Issues
In Memoria is an MCP server that enables AI coding assistants such as Claude or Copilot to retain, recall, and provide context about codebases across sessions. It learns patterns, architecture, and conventions from user code, offering persistent intelligence that eliminates repetitive explanations and generic suggestions. Through the Model Context Protocol, it allows AI tools to perform semantic search, smart file routing, and track project-specific decisions efficiently.

Key Features

Persistent cross-session memory of codebase context
Learns and identifies code patterns and conventions
Instant delivery of project architecture and entry points
Semantic search across code by meaning
Smart file routing for ambiguous feature requests
Maintains work memory and architectural decisions
Pattern prediction for future tasks
Integrates with AI coding assistants via MCP
CLI for codebase learning and server management
Supports integration with tools like Claude and Copilot

Use Cases

Providing AI assistants with project-specific coding context across sessions
Eliminating the need to re-explain codebase patterns and conventions
Automating intelligent task routing to relevant project files
Delivering concise architectural and tech stack summaries to AI assistants
Enabling semantic code search by meaning rather than keyword
Tracking and recalling architectural decisions through project evolution
Supporting onboarding of new developers by surfacing project history
Facilitating context-aware code assistance in large codebases
Improving relevance of AI-generated code suggestions
Enabling seamless integration of persistent project memory into coding workflows

README

In Memoria

npm version npm downloads License: MIT Discord

Giving AI coding assistants a memory that actually persists.

Quick Demo

asciicast

Watch In Memoria in action: learning a codebase, providing instant context, and routing features to files.


The Problem: Session Amnesia

You know the drill. You fire up Claude, Copilot, or Cursor to help with your codebase. You explain your architecture. You describe your patterns. You outline your conventions. The AI gets it, helps you out, and everything's great.

Then you close the window.

Next session? Complete amnesia. You're explaining the same architectural decisions again. The same naming conventions. The same "no, we don't use classes here, we use functional composition" for the fifteenth time.

Every AI coding session starts from scratch.

This isn't just annoying, it's inefficient. These tools re-analyze your codebase on every interaction, burning tokens and time. They give generic suggestions that don't match your style. They have no memory of what worked last time, what you rejected, or why.

The Solution: Persistent Intelligence

In Memoria is an MCP server that learns from your actual codebase and remembers across sessions. It builds persistent intelligence about your code (patterns, architecture, conventions, decisions) that AI assistants can query through the Model Context Protocol.

Think of it as giving your AI pair programmer a notepad that doesn't get wiped clean every time you restart the session.

Current version: 0.5.8 - See what's changed

What It Does

  • Learns your patterns - Analyzes your code to understand naming conventions, architectural choices, and structural preferences
  • Instant project context - Provides tech stack, entry points, and architecture in <200 tokens (no re-analysis needed)
  • Smart file routing - Routes vague requests like "add password reset" directly to relevant files
  • Semantic search - Finds code by meaning, not just keywords
  • Work memory - Tracks current tasks and architectural decisions across sessions
  • Pattern prediction - Suggests how you'd solve similar problems based on your history

Example Workflow

bash
# First time: Learn your codebase
npx in-memoria learn ./my-project

# Start the MCP server
npx in-memoria server

# Now in Claude/Copilot:
You: "Add password reset functionality"
AI: *queries In Memoria*
    "Based on your auth patterns in src/auth/login.ts, I'll use your
     established JWT middleware pattern and follow your Result<T>
     error handling convention..."

# Next session (days later):
You: "Where did we put the password reset code?"
AI: *queries In Memoria*
    "In src/auth/password-reset.ts, following the pattern we
     established in our last session..."

No re-explaining. No generic suggestions. Just continuous, context-aware assistance.

Quick Start

Installation

bash
# Install globally
npm install -g in-memoria

# Or use directly with npx
npx in-memoria --help

Connect to Your AI Tool

Claude Desktop - Add to your config (~/Library/Application Support/Claude/claude_desktop_config.json):

json
{
  "mcpServers": {
    "in-memoria": {
      "command": "npx",
      "args": ["in-memoria", "server"]
    }
  }
}

Claude Code CLI:

bash
claude mcp add in-memoria -- npx in-memoria server

GitHub Copilot - See Copilot Integration section below

Learn Your Codebase

bash
# Analyze and learn from your project
npx in-memoria learn ./my-project

# Or let AI agents trigger learning automatically
# (Just start the server and let auto_learn_if_needed handle it)
npx in-memoria server

How It Works

In Memoria is built on Rust + TypeScript, using the Model Context Protocol to connect AI tools to persistent codebase intelligence.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    MCP     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    napi-rs    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  AI Tool (Claude)   โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚  TypeScript Server   โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚   Rust Core         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ”‚  โ€ข AST Parser       โ”‚
                                              โ”‚                           โ”‚  โ€ข Pattern Learner  โ”‚
                                              โ”‚                           โ”‚  โ€ข Semantic Engine  โ”‚
                                              โ–ผ                           โ”‚  โ€ข Blueprint System โ”‚
                                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚ SQLite (persistent)  โ”‚
                                   โ”‚ SurrealDB (in-mem)   โ”‚
                                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The Core Components

Rust Layer - Fast, native processing:

  • Tree-sitter AST parsing for 12 languages (TypeScript, JavaScript, Python, PHP, Rust, Go, Java, C/C++, C#, Svelte, SQL)
  • Blueprint analyzer (detects project structure, entry points, architecture patterns)
  • Pattern learner (statistical analysis of your coding style)
  • Semantic engine (understands code relationships and concepts)

TypeScript Layer - MCP server and orchestration:

  • 13 specialized tools for AI assistants (organized into 4 categories)
  • SQLite for structured data, SurrealDB (in-memory) for vector search
  • File watching for incremental updates
  • Smart routing that maps features to files

Storage - Local-first:

  • Everything stays on your machine
  • SQLite for patterns and metadata
  • SurrealDB in-memory mode for vector embeddings and semantic search
  • Optional OpenAI API or local transformers.js for embeddings (Xenova/all-MiniLM-L6-v2)

What Makes It Different

This isn't just another RAG system or static rules engine:

  • Learns from actual code - Not manually-defined rules, but statistical patterns from your real codebase
  • Predicts your approach - Based on how you've solved similar problems before
  • Token efficient - Responses optimized to minimize LLM context usage (<200 tokens for project context)
  • Routes to files - "Add login" โ†’ automatically suggests src/auth/login.ts
  • Remembers context - Tracks work sessions, tasks, and architectural decisions
  • Multi-mode search - Semantic (meaning), text (keywords), or pattern-based

What's New in v0.5.x

We recently completed Phases 1-4 of the implementation roadmap:

๐Ÿ—บ๏ธ Project Blueprints (Phase 1)

Instant project context without full learning. Ask about a codebase and get tech stack, entry points, key directories, and architecture all in under 200 tokens.

๐Ÿ’ผ Work Context System (Phase 2)

AI agents can now track work sessions, maintain task lists, and record architectural decisions. Resume work exactly where you left off.

๐Ÿงญ Smart File Routing (Phase 3)

Feature-to-file mapping across 10 categories (auth, API, database, UI, etc.). Vague requests like "add password reset" get routed to specific files automatically.

โšก Smooth Progress Tracking (v0.5.3)

No more janky console spam. Progress bars update in-place with consistent 500ms refresh rates.

MCP Tools for AI Assistants

In Memoria provides 13 specialized tools that AI assistants can call via MCP. They're organized into 4 categories (down from 16 after Phase 4 consolidation merged redundant tools):

๐ŸŽฏ Core Analysis (2 tools)

  • analyze_codebase - Analyze files/directories with concepts, patterns, complexity (Phase 4: now handles both files and directories)
  • search_codebase - Multi-mode search (semantic/text/pattern)

๐Ÿง  Intelligence (7 tools)

  • learn_codebase_intelligence - Deep learning to extract patterns and architecture
  • get_project_blueprint - Instant project context with tech stack and entry points โญ (Phase 4: includes learning status)
  • get_semantic_insights - Query learned concepts and relationships
  • get_pattern_recommendations - Get patterns with related files for consistency
  • predict_coding_approach - Implementation guidance with file routing โญ
  • get_developer_profile - Access coding style and work context
  • contribute_insights - Record architectural decisions

๐Ÿค– Automation (1 tool)

  • auto_learn_if_needed - Smart auto-learning with staleness detection โญ (Phase 4: includes quick setup functionality)

๐Ÿ“Š Monitoring (3 tools)

  • get_system_status - Health check
  • get_intelligence_metrics - Analytics on learned patterns
  • get_performance_status - Performance diagnostics

Phase 4 Consolidation: Three tools were merged into existing tools for better AX (agent experience haha):

  • get_file_content โ†’ merged into analyze_codebase
  • get_learning_status โ†’ merged into get_project_blueprint
  • quick_setup โ†’ merged into auto_learn_if_needed

For AI agents: See AGENT.md for complete tool reference with usage patterns and decision trees.

GitHub Copilot Integration

In Memoria works with GitHub Copilot through custom instructions and chat modes.

Setup

This repository includes:

  • .github/copilot-instructions.md - Automatic guidance for Copilot
  • .github/chatmodes/ - Three specialized chat modes:
    • ๐Ÿ” inmemoria-explorer - Intelligent codebase navigation
    • ๐Ÿš€ inmemoria-feature - Feature implementation with patterns
    • ๐Ÿ”Ž inmemoria-review - Code review with consistency checking

To use in VS Code:

  1. Command Palette โ†’ "Chat: Configure Chat Modes..."
  2. Select a mode from .github/chatmodes/

Example

typescript
// In Copilot chat:
@workspace "Where is the authentication logic?"
// โ†’ Copilot uses In Memoria's semantic search

"Add password reset functionality"
// โ†’ Copilot gets approach + file routing + patterns

"Review this code for consistency"
// โ†’ Copilot checks against project patterns

Language Support

Native AST parsing via tree-sitter for:

  • TypeScript & JavaScript (including JSX/TSX)
  • Python
  • PHP
  • Rust
  • Go
  • Java
  • C & C++
  • C#
  • Svelte
  • SQL

Build artifacts (node_modules/, dist/, .next/, etc.) are automatically filtered out.

Status: Work in Progress

Let's be honest: In Memoria is early-stage software. It works, but it's not perfect.

What Works Well

  • โœ… Pattern learning from real codebases
  • โœ… Semantic search across concepts
  • โœ… Project blueprint generation
  • โœ… MCP integration with Claude Desktop/Code
  • โœ… Cross-platform support (Linux, macOS, Windows)
  • โœ… Token-efficient responses

Known Limitations

  • โš ๏ธ Semantic search works best with OpenAI embeddings (requires API key) but falls back to local transformers.js
  • โš ๏ธ Large codebases (100k+ files) can be slow on first analysis
  • โš ๏ธ Pattern accuracy improves with codebase consistency
  • โš ๏ธ Some languages have better tree-sitter support than others
  • โš ๏ธ Documentation could be more comprehensive
  • โš ๏ธ SurrealDB runs in-memory mode (data persists in SQLite, vectors rebuilt on restart)

We Need Your Help

This is open-source infrastructure for AI-assisted development. Currently a solo project by @pi22by7, but contributions are not just welcome, they're essential.

Before contributing code, please:

Ways to contribute:

  • ๐Ÿ› Report bugs - Found something broken? Open an issue
  • ๐Ÿ’ก Suggest features - Have ideas? Discuss on Discord or GitHub Discussions
  • ๐Ÿ”ง Submit PRs - Code contributions are always appreciated (discuss first!)
  • ๐Ÿ“– Improve docs - Help make this easier to understand
  • ๐Ÿงช Test on your codebase - Try it out and tell us what breaks
  • ๐Ÿ’ฌ Join the community - Discord for real-time discussions

See CONTRIBUTING.md for development setup and guidelines.

Technical Comparison

vs GitHub Copilot's memory:

  • Copilot: Basic fact storage, no pattern learning
  • In Memoria: Semantic analysis + pattern learning + architectural intelligence + work context

vs Cursor's rules:

  • Cursor: Static rules, manually defined
  • In Memoria: Dynamic learning from actual code + smart file routing + project blueprints

vs Custom RAG:

  • RAG: Retrieves relevant code snippets
  • In Memoria: Understands patterns + predicts approaches + routes to files + tracks work context

Team Usage

In Memoria works for both individual developers and teams:

Individual:

  • Learns your personal coding style
  • Remembers architectural decisions you've made
  • Provides context-aware suggestions

Team:

  • Share .in-memoria.db files to distribute learned patterns
  • Onboard new developers with pre-learned codebase intelligence
  • Ensure consistent AI suggestions across the team

Build from Source

bash
git clone https://github.com/pi22by7/in-memoria
cd in-memoria
npm install
npm run build

Requirements:

  • Node.js 18+
  • Rust 1.70+ (for building from source)
  • 2GB RAM minimum

Development:

bash
npm run dev          # Start in development mode
npm test            # Run test suite (98.3% pass rate)
npm run build:rust  # Build Rust components

Quality metrics:

  • 118/120 unit tests passing (98.3%)
  • 23/23 MCP integration tests passing (100%)
  • Zero clippy warnings in Rust code
  • Zero memory leaks verified

FAQ

Q: Does this replace my AI coding assistant? A: No, it enhances them. In Memoria provides the memory and context that tools like Claude, Copilot, and Cursor can use to give better suggestions.

Q: What data is collected? A: Everything stays local. No telemetry, no phone-home. Your code never leaves your machine. The only optional external call is to OpenAI API for embeddings (if you provide an API key), otherwise it uses local transformers.js models.

Q: How accurate is pattern learning? A: It improves with codebase size and consistency. Projects with established patterns see better results than small or inconsistent codebases. The system learns from frequency and repetition.

Q: What's the performance impact? A: Minimal. Initial learning takes time (proportional to codebase size), but subsequent queries are fast. File watching enables incremental updates. Smart filtering skips build artifacts automatically.

Q: What if analysis fails or produces weird results? A: Open an issue with details. Built-in timeouts and circuit breakers handle most edge cases, but real-world codebases are messy and we need your feedback to improve.

Q: Can I use this in production? A: You can, but remember this is v0.5.x. Expect rough edges. Test thoroughly. Report issues. We're working toward stability but aren't there yet.

Q: Why Rust + TypeScript? A: Rust for performance-critical AST parsing and pattern analysis. TypeScript for MCP server and orchestration. Best of both worlds: fast core, flexible integration layer.

Q: What about other AI tools (not Claude/Copilot)? A: Any tool supporting MCP can use In Memoria. We've tested with Claude Desktop, Claude Code, and GitHub Copilot. Others should work but may need configuration.

Roadmap

We're following a phased approach:

  • โœ… Phase 1: Project Blueprint System (v0.5.0)
  • โœ… Phase 2: Work Context & Session Memory (v0.5.0)
  • โœ… Phase 3: Smart File Routing (v0.5.0)
  • โœ… Phase 4: Tool Consolidation (v0.5.0)
  • ๐Ÿšง Phase 5: Enhanced Vector Search & Embeddings
  • ๐Ÿ“‹ Phase 6: Multi-project Intelligence
  • ๐Ÿ“‹ Phase 7: Collaboration Features

See GitHub Projects for detailed tracking.

Community & Support

Project maintained by: @pi22by7

  • ๐Ÿ’ฌ Discord: discord.gg/6mGsM4qkYm - Join the community, ask questions, discuss improvements (ping @pi_22by7)
  • ๐Ÿ“ง Email: talk@pi22by7.me - For private inquiries or larger contribution discussions
  • ๐Ÿ› Issues: GitHub Issues - Report bugs and request features
  • ๐Ÿ’ก Discussions: GitHub Discussions - General discussions and Q&A
  • ๐Ÿ“– Documentation: See AGENT.md for AI agent instructions
  • ๐Ÿค Contributing: Check CONTRIBUTING.md for development guidelines

Before contributing: Please discuss your ideas on Discord, via email, or in an issue before starting work on significant features. This helps ensure alignment with project direction and avoids duplicate efforts.

License

MIT - see LICENSE

Built with โค๏ธ by @pi22by7 for the AI-assisted development community.


Try it: npx in-memoria server

Latest release: v0.5.8 - Smooth progress tracking and Phase 1-4 complete

In memoria: in memory. Because your AI assistant should remember.

Questions? Ideas? Join us on Discord or reach out at talk@pi22by7.me

Star History

Star History Chart

Repository Owner

pi22by7
pi22by7

User

Repository Details

Language Rust
Default Branch main
Size 1,267 KB
Contributors 2
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Rust
44.91%
TypeScript
41.11%
JavaScript
13.57%
PHP
0.28%
Shell
0.1%
Dockerfile
0.03%

Tags

Topics

ai-agents ai-tools codebase-intelligence developer-tools local-first mcp-server persistent-memory

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Exa MCP Server

    Exa MCP Server

    Fast, efficient web and code context for AI coding assistants.

    Exa MCP Server provides a Model Context Protocol (MCP) server interface that connects AI assistants to Exa AIโ€™s powerful search capabilities, including code, documentation, and web search. It enables coding agents to retrieve precise, token-efficient context from billions of sources such as GitHub, StackOverflow, and documentation sites, reducing hallucinations in coding agents. The platform supports integration with popular tools like Cursor, Claude, and VS Code through standardized MCP configuration, offering configurable access to various research and code-related tools via HTTP.

    • โญ 3,224
    • MCP
    • exa-labs/exa-mcp-server
  • Memory MCP

    Memory MCP

    A Model Context Protocol server for managing LLM conversation memories with intelligent context window caching.

    Memory MCP provides a Model Context Protocol (MCP) server for logging, retrieving, and managing memories from large language model (LLM) conversations. It offers features such as context window caching, relevance scoring, and tag-based context retrieval, leveraging MongoDB for persistent storage. The system is designed to efficiently archive, score, and summarize conversational context, supporting external orchestration and advanced memory management tools. This enables seamless handling of conversation history and dynamic context for enhanced LLM applications.

    • โญ 10
    • MCP
    • JamesANZ/memory-mcp
  • Membase-MCP Server

    Membase-MCP Server

    Decentralized memory layer server for AI agents using the Model Context Protocol.

    Membase-MCP Server provides decentralized and persistent storage of conversation history and agent knowledge for AI agents using Unibase and the Model Context Protocol. It supports secure, traceable storage and retrieval of messages to ensure agent continuity and personalization within interactions. The server offers integration with Claude, Windsurf, Cursor, and Cline, allowing dynamic context management such as switching conversations and saving or retrieving messages. The server leverages the Unibase DA network for verifiable storage and agent data interoperability.

    • โญ 15
    • MCP
    • unibaseio/membase-mcp
  • Agentic Long-Term Memory with Notion Integration

    Agentic Long-Term Memory with Notion Integration

    Production-ready agentic long-term memory and Notion integration with Model Context Protocol support.

    Agentic Long-Term Memory with Notion Integration enables AI agents to incorporate advanced long-term memory capabilities using both vector and graph databases. It offers comprehensive Notion workspace integration along with a production-ready Model Context Protocol (MCP) server supporting HTTP and stdio transports. The tool facilitates context management, tool discovery, and advanced function chaining for complex agentic workflows.

    • โญ 4
    • MCP
    • ankitmalik84/Agentic_Longterm_Memory
  • Lucidity MCP

    Lucidity MCP

    Intelligent prompt-based code quality analysis for AI coding assistants.

    Lucidity MCP is a Model Context Protocol (MCP) server that empowers AI coding assistants to deliver high-quality code through intelligent, prompt-driven analysis. It offers comprehensive detection of code issues across multiple quality dimensions, providing structured and actionable feedback. With language-agnostic capabilities, extensible framework, and flexible transport options, Lucidity MCP seamlessly integrates into developer workflows and AI systems.

    • โญ 72
    • MCP
    • hyperb1iss/lucidity-mcp
  • Context7 MCP

    Context7 MCP

    Up-to-date code docs for every AI prompt.

    Context7 MCP delivers current, version-specific documentation and code examples directly into large language model prompts. By integrating with model workflows, it ensures responses are accurate and based on the latest source material, reducing outdated and hallucinated code. Users can fetch relevant API documentation and examples by simply adding a directive to their prompts. This allows for more reliable, context-rich answers tailored to real-world programming scenarios.

    • โญ 36,881
    • MCP
    • upstash/context7
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results