Giving AI coding assistants a memory that actually persists. Watch In Memoria in action: learning a codebase, providing instant context, and routing features to files. 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. T
Add this skill
npx mdskills install pi22by7/in-memoriaWell-documented MCP server providing persistent codebase intelligence with multi-mode search and pattern learning
1# In Memoria23[](https://www.npmjs.com/package/in-memoria)4[](https://www.npmjs.com/package/in-memoria)5[](https://opensource.org/licenses/MIT)6[](https://discord.gg/6mGsM4qkYm)78**Giving AI coding assistants a memory that actually persists.**910## Quick Demo1112[](https://asciinema.org/a/ZyD2bAZs1cURnqoFc3VHXemJx)1314_Watch In Memoria in action: learning a codebase, providing instant context, and routing features to files._1516---1718## The Problem: Session Amnesia1920You 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.2122Then you close the window.2324Next 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.2526**Every AI coding session starts from scratch.**2728This 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.2930## The Solution: Persistent Intelligence3132In 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.3334Think of it as giving your AI pair programmer a notepad that doesn't get wiped clean every time you restart the session.3536**Current version: 0.6.0** - [See what's changed](CHANGELOG.md)3738### What It Does3940- **Learns your patterns** - Analyzes your code to understand naming conventions, architectural choices, and structural preferences41- **Instant project context** - Provides tech stack, entry points, and architecture in <200 tokens (no re-analysis needed)42- **Smart file routing** - Routes vague requests like "add password reset" directly to relevant files43- **Semantic search** - Finds code by meaning, not just keywords44- **Work memory** - Tracks current tasks and architectural decisions across sessions45- **Pattern prediction** - Suggests how you'd solve similar problems based on your history4647### Example Workflow4849```bash50# First time: Learn your codebase51npx in-memoria learn ./my-project5253# Start the MCP server54npx in-memoria server5556# Now in Claude/Copilot:57You: "Add password reset functionality"58AI: *queries In Memoria*59 "Based on your auth patterns in src/auth/login.ts, I'll use your60 established JWT middleware pattern and follow your Result<T>61 error handling convention..."6263# Next session (days later):64You: "Where did we put the password reset code?"65AI: *queries In Memoria*66 "In src/auth/password-reset.ts, following the pattern we67 established in our last session..."68```6970No re-explaining. No generic suggestions. Just continuous, context-aware assistance.7172## Quick Start7374### Installation7576```bash77# Install globally78npm install -g in-memoria7980# Or use directly with npx81npx in-memoria --help82```8384### Connect to Your AI Tool8586**Claude Desktop** - Add to your config (`~/Library/Application Support/Claude/claude_desktop_config.json`):8788```json89{90 "mcpServers": {91 "in-memoria": {92 "command": "npx",93 "args": ["in-memoria", "server"]94 }95 }96}97```9899**Claude Code CLI**:100101```bash102claude mcp add in-memoria -- npx in-memoria server103```104105**GitHub Copilot** - See [Copilot Integration](#github-copilot-integration) section below106107### Learn Your Codebase108109```bash110# Analyze and learn from your project111npx in-memoria learn ./my-project112113# Or let AI agents trigger learning automatically114# (Just start the server and let auto_learn_if_needed handle it)115npx in-memoria server116```117118## How It Works119120In Memoria is built on Rust + TypeScript, using the Model Context Protocol to connect AI tools to persistent codebase intelligence.121122### Architecture123124```125┌─────────────────────┐ MCP ┌──────────────────────┐ napi-rs ┌─────────────────────┐126│ AI Tool (Claude) │◄──────────►│ TypeScript Server │◄─────────────►│ Rust Core │127└─────────────────────┘ └──────────┬───────────┘ │ • AST Parser │128 │ │ • Pattern Learner │129 │ │ • Semantic Engine │130 ▼ │ • Blueprint System │131 ┌──────────────────────┐ └─────────────────────┘132 │ SQLite (persistent) │133 │ SurrealDB (in-mem) │134 └──────────────────────┘135```136137### The Core Components138139**Rust Layer** - Fast, native processing:140141- Tree-sitter AST parsing for 12 languages (TypeScript, JavaScript, Python, PHP, Rust, Go, Java, C/C++, C#, Svelte, SQL)142- Blueprint analyzer (detects project structure, entry points, architecture patterns)143- Pattern learner (statistical analysis of your coding style)144- Semantic engine (understands code relationships and concepts)145146**TypeScript Layer** - MCP server and orchestration:147148- 13 specialized tools for AI assistants (organized into 4 categories)149- SQLite for structured data, SurrealDB with SurrealKV for persistent vector embeddings150- File watching for incremental updates151- Smart routing that maps features to files152153**Storage** - Local-first:154155- Everything stays on your machine156- SQLite for patterns and metadata157- SurrealDB with SurrealKV backend for persistent vector embeddings158- Local transformers.js for embeddings (Xenova/all-MiniLM-L6-v2)159160### What Makes It Different161162This isn't just another RAG system or static rules engine:163164- **Learns from actual code** - Not manually-defined rules, but statistical patterns from your real codebase165- **Predicts your approach** - Based on how you've solved similar problems before166- **Token efficient** - Responses optimized to minimize LLM context usage (<200 tokens for project context)167- **Routes to files** - "Add login" → automatically suggests `src/auth/login.ts`168- **Remembers context** - Tracks work sessions, tasks, and architectural decisions169- **Multi-mode search** - Semantic (meaning), text (keywords), or pattern-based170171## What's New in v0.5.x172173We recently completed Phases 1-4 of the implementation roadmap:174175### 🗺️ Project Blueprints (Phase 1)176177Instant project context without full learning. Ask about a codebase and get tech stack, entry points, key directories, and architecture all in under 200 tokens.178179### 💼 Work Context System (Phase 2)180181AI agents can now track work sessions, maintain task lists, and record architectural decisions. Resume work exactly where you left off.182183### 🧭 Smart File Routing (Phase 3)184185Feature-to-file mapping across 10 categories (auth, API, database, UI, etc.). Vague requests like "add password reset" get routed to specific files automatically.186187### ⚡ Smooth Progress Tracking (v0.5.3)188189No more janky console spam. Progress bars update in-place with consistent 500ms refresh rates.190191## MCP Tools for AI Assistants192193In 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):194195### 🎯 Core Analysis (2 tools)196197- `analyze_codebase` - Analyze files/directories with concepts, patterns, complexity (Phase 4: now handles both files and directories)198- `search_codebase` - Multi-mode search (semantic/text/pattern)199200### 🧠 Intelligence (7 tools)201202- `learn_codebase_intelligence` - Deep learning to extract patterns and architecture203- `get_project_blueprint` - Instant project context with tech stack and entry points ⭐ (Phase 4: includes learning status)204- `get_semantic_insights` - Query learned concepts and relationships205- `get_pattern_recommendations` - Get patterns with related files for consistency206- `predict_coding_approach` - Implementation guidance with file routing ⭐207- `get_developer_profile` - Access coding style and work context208- `contribute_insights` - Record architectural decisions209210### 🤖 Automation (1 tool)211212- `auto_learn_if_needed` - Smart auto-learning with staleness detection ⭐ (Phase 4: includes quick setup functionality)213214### 📊 Monitoring (3 tools)215216- `get_system_status` - Health check217- `get_intelligence_metrics` - Analytics on learned patterns218- `get_performance_status` - Performance diagnostics219220**Phase 4 Consolidation**: Three tools were merged into existing tools for better AX (agent experience haha):221222- ~~get_file_content~~ → merged into `analyze_codebase`223- ~~get_learning_status~~ → merged into `get_project_blueprint`224- ~~quick_setup~~ → merged into `auto_learn_if_needed`225226> **For AI agents**: See [`AGENT.md`](AGENT.md) for complete tool reference with usage patterns and decision trees.227228## GitHub Copilot Integration229230In Memoria works with GitHub Copilot through custom instructions and chat modes.231232### Setup233234This repository includes:235236- `.github/copilot-instructions.md` - Automatic guidance for Copilot237- `.github/chatmodes/` - Three specialized chat modes:238 - 🔍 **inmemoria-explorer** - Intelligent codebase navigation239 - 🚀 **inmemoria-feature** - Feature implementation with patterns240 - 🔎 **inmemoria-review** - Code review with consistency checking241242## GitHub Copilot Integration (VS Code)243244In Memoria integrates with **GitHub Copilot Chat** using **MCP + Custom Agents** (formerly called *Chat Modes*).245These agents allow Copilot to query In Memoria’s persistent intelligence when working in **Agent mode**.246247> ⚠️ **Important**: Copilot will only call MCP tools when the chat is in **Agent** mode (not Ask or Edit).248249### Requirements250251* **VS Code 1.106+**252* **GitHub Copilot Chat** enabled253* In Memoria MCP server configured and running254255---256257### MCP Server Setup (Required)258259Create or edit the following file in your workspace:260261**`.vscode/mcp.json`**262263```json264{265 "servers": {266 "in-memoria": {267 "command": "npx",268 "args": ["in-memoria", "server"]269 }270 }271}272```273274Open this file in VS Code and click **Start** when prompted, or start it manually.275276---277278### Copilot Instructions (Automatic)279280This repository includes:281282* **`.github/copilot-instructions.md`**283284VS Code automatically loads this file and applies guidance to Copilot Chat.285No additional setup is required.286287---288289### Custom Agents (formerly “Chat Modes”)290291This repository provides **three Custom Agents** for Copilot:292293| Agent | Purpose |294| ------------------------- | --------------------------------------------- |295| 🔍 **inmemoria-explorer** | Intelligent codebase navigation |296| 🚀 **inmemoria-feature** | Feature implementation using learned patterns |297| 🔎 **inmemoria-review** | Consistency & pattern-based code review |298299#### Agent File Location300301> ⚠️ VS Code has renamed *Chat Modes* → **Custom Agents**302303To ensure compatibility with current VS Code versions:3043051. Create the folder:306307 ```308 .github/agents/309 ```3102. Move or copy files from:311312 ```313 .github/chatmodes/314 ```315316 into:317318 ```319 .github/agents/320 ```3213. Rename each file:322323 ```324 *.chatmode.md → *.agent.md325 ```326327Example:328329```330inmemoria-feature.chatmode.md → inmemoria-feature.agent.md331```332333---334335### Using Agents in VS Code3363371. Open **Copilot Chat**3382. Select the custom agent (e.g., inmemoria-featurename) directly from the dropdown.339340If agents do not appear:341342* Reload the window343* Ensure files are in `.github/agents/`344345---346347### Example Usage348349```text350Where is the authentication logic?351```352353→ Copilot queries In Memoria’s semantic index354355```text356Add password reset functionality357```358359→ Copilot retrieves:360361* file routing362* architectural patterns363* prior auth decisions364365```text366Review this code for consistency367```368369→ Copilot compares against learned conventions370371---372373### Common Pitfalls374375* ❌ Using **Ask/Edit mode** → MCP tools are ignored376* ❌ MCP server not running377* ❌ Agent files left in `.github/chatmodes/` only378* ❌ VS Code version < 1.106379380---381382### Notes on VS Code Terminology383384| Old Name | Current Name |385| ----------------------------- | ------------------------------- |386| Chat Modes | Custom Agents |387| `Chat: Configure Chat Modes…` | `Chat: Configure Custom Agents` |388| `.github/chatmodes/` | `.github/agents/` |389390VS Code still recognizes legacy files, but **`.github/agents/*.agent.md` is the recommended format going forward**.391392## Language Support393394Native AST parsing via tree-sitter for:395396- TypeScript & JavaScript (including JSX/TSX)397- Python398- PHP399- Rust400- Go401- Java402- C & C++403- C#404- Svelte405- SQL406407Build artifacts (`node_modules/`, `dist/`, `.next/`, etc.) are automatically filtered out.408409## Status: Work in Progress410411**Let's be honest**: In Memoria is early-stage software. It works, but it's not perfect.412413### What Works Well414415- ✅ Pattern learning from real codebases416- ✅ Semantic search across concepts417- ✅ Project blueprint generation418- ✅ MCP integration with Claude Desktop/Code419- ✅ Cross-platform support (Linux, macOS, Windows)420- ✅ Token-efficient responses421422### Known Limitations423424- ⚠️ Large codebases (100k+ files) can be slow on first analysis425- ⚠️ Pattern accuracy improves with codebase consistency426- ⚠️ Some languages have better tree-sitter support than others427- ⚠️ Documentation could be more comprehensive428429### We Need Your Help430431This is open-source infrastructure for AI-assisted development. Currently a solo project by [@pi22by7](https://github.com/pi22by7), but contributions are not just welcome, they're essential.432433**Before contributing code**, please:434435- Check the [GitHub Projects board](https://github.com/pi22by7/in-memoria/projects) to see what's planned436- Join [Discord](https://discord.gg/6mGsM4qkYm) to discuss your ideas (@pi_22by7)437- [Open an issue](https://github.com/pi22by7/in-memoria/issues) to discuss the feature/fix438- Email me at [talk@pi22by7.me](mailto:talk@pi22by7.me) for larger contributions439440**Ways to contribute**:441442- 🐛 **Report bugs** - Found something broken? [Open an issue](https://github.com/pi22by7/in-memoria/issues)443- 💡 **Suggest features** - Have ideas? Discuss on [Discord](https://discord.gg/6mGsM4qkYm) or [GitHub Discussions](https://github.com/pi22by7/in-memoria/discussions)444- 🔧 **Submit PRs** - Code contributions are always appreciated (discuss first!)445- 📖 **Improve docs** - Help make this easier to understand446- 🧪 **Test on your codebase** - Try it out and tell us what breaks447- 💬 **Join the community** - [Discord](https://discord.gg/6mGsM4qkYm) for real-time discussions448449See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.450451## Technical Comparison452453**vs GitHub Copilot's memory**:454455- Copilot: Basic fact storage, no pattern learning456- In Memoria: Semantic analysis + pattern learning + architectural intelligence + work context457458**vs Cursor's rules**:459460- Cursor: Static rules, manually defined461- In Memoria: Dynamic learning from actual code + smart file routing + project blueprints462463**vs Custom RAG**:464465- RAG: Retrieves relevant code snippets466- In Memoria: Understands patterns + predicts approaches + routes to files + tracks work context467468## Team Usage469470In Memoria works for both individual developers and teams:471472**Individual**:473474- Learns your personal coding style475- Remembers architectural decisions you've made476- Provides context-aware suggestions477478**Team**:479480- Share `.in-memoria.db` files to distribute learned patterns481- Onboard new developers with pre-learned codebase intelligence482- Ensure consistent AI suggestions across the team483484## Build from Source485486```bash487git clone https://github.com/pi22by7/in-memoria488cd in-memoria489npm install490npm run build491```492493**Requirements**:494495- Node.js 18+496- Rust 1.70+ (for building from source)497- 2GB RAM minimum498499**Development**:500501```bash502npm run dev # Start in development mode503npm test # Run test suite (98.3% pass rate)504npm run build:rust # Build Rust components505```506507**Quality metrics**:508509- 118/120 unit tests passing (98.3%)510- 23/23 MCP integration tests passing (100%)511- Zero clippy warnings in Rust code512- Zero memory leaks verified513514## FAQ515516**Q: Does this replace my AI coding assistant?**517A: No, it enhances them. In Memoria provides the memory and context that tools like Claude, Copilot, and Cursor can use to give better suggestions.518519**Q: What data is collected?**520A: Everything stays local. No telemetry, no phone-home. Your code never leaves your machine. All embeddings are generated locally using transformers.js models.521522**Q: How accurate is pattern learning?**523A: 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.524525**Q: What's the performance impact?**526A: 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.527528**Q: What if analysis fails or produces weird results?**529A: [Open an issue](https://github.com/pi22by7/in-memoria/issues) 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.530531**Q: Can I use this in production?**532A: 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.533534**Q: Why Rust + TypeScript?**535A: Rust for performance-critical AST parsing and pattern analysis. TypeScript for MCP server and orchestration. Best of both worlds: fast core, flexible integration layer.536537**Q: What about other AI tools (not Claude/Copilot)?**538A: 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.539540## Roadmap541542We're following a phased approach:543544- ✅ **Phase 1**: Project Blueprint System (v0.5.0)545- ✅ **Phase 2**: Work Context & Session Memory (v0.5.0)546- ✅ **Phase 3**: Smart File Routing (v0.5.0)547- ✅ **Phase 4**: Tool Consolidation (v0.5.0)548- 🚧 **Phase 5**: Enhanced Vector Search & Embeddings549- 📋 **Phase 6**: Multi-project Intelligence550- 📋 **Phase 7**: Collaboration Features551552See [GitHub Projects](https://github.com/pi22by7/in-memoria/projects) for detailed tracking.553554## Community & Support555556**Project maintained by**: [@pi22by7](https://github.com/pi22by7)557558- 💬 **Discord**: [discord.gg/6mGsM4qkYm](https://discord.gg/6mGsM4qkYm) - Join the community, ask questions, discuss improvements (ping @pi_22by7)559- 📧 **Email**: [talk@pi22by7.me](mailto:talk@pi22by7.me) - For private inquiries or larger contribution discussions560- 🐛 **Issues**: [GitHub Issues](https://github.com/pi22by7/in-memoria/issues) - Report bugs and request features561- 💡 **Discussions**: [GitHub Discussions](https://github.com/pi22by7/in-memoria/discussions) - General discussions and Q&A562- 📖 **Documentation**: See [AGENT.md](AGENT.md) for AI agent instructions563- 🤝 **Contributing**: Check [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines564565**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.566567## License568569MIT - see [LICENSE](LICENSE)570571Built with ❤️ by [@pi22by7](https://github.com/pi22by7) for the AI-assisted development community.572573---574575**Try it**: `npx in-memoria server`576577**Latest release**: [v0.6.0](CHANGELOG.md) - Smooth progress tracking and Phase 1-4 complete578579_In memoria: in memory. Because your AI assistant should remember._580581**Questions? Ideas?** Join us on [Discord](https://discord.gg/6mGsM4qkYm) or reach out at [talk@pi22by7.me](mailto:talk@pi22by7.me)582
Full transparency — inspect the skill content before installing.