Skip to content
Back to search

In-Memoria

Persistent Intelligence Infrastructure for AI Agents

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/pi22by7--in-memoria/badge.svg)](/listings/pi22by7--in-memoria)

HTML

<a href="/listings/pi22by7--in-memoria"><img src="/api/listings/pi22by7--in-memoria/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Installation

# 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`):

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

**Claude Code CLI**:

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

**GitHub Copilot** - See [Copilot Integration](#github-copilot-integration) section below

Learn Your Codebase

# 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

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 581 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # In Memoria
  2. [![npm version](https://img.shields.io/npm/v/in-memoria.svg)](https://www.npmjs.com/package/in-memoria)
  3. [![npm downloads](https://img.shields.io/npm/dm/in-memoria.svg)](https://www.npmjs.com/package/in-memoria)
  4. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
  5. [![Discord](https://img.shields.io/discord/1431193342200516630?color=7289da&label=Discord&logo=discord&logoColor=white)](https://discord.gg/6mGsM4qkYm)
  6. **Giving AI coding assistants a memory that actually persists.**
  7. ## Quick Demo
  8. [![asciicast](https://asciinema.org/a/ZyD2bAZs1cURnqoFc3VHXemJx.svg)](https://asciinema.org/a/ZyD2bAZs1cURnqoFc3VHXemJx)
  9. _Watch In Memoria in action: learning a codebase, providing instant context, and routing features to files._
  10. ---
  11. ## The Problem: Session Amnesia
  12. 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.
  13. Then you close the window.
  14. 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.
  15. **Every AI coding session starts from scratch.**
  16. 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.
  17. ## The Solution: Persistent Intelligence
  18. 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.
  19. Think of it as giving your AI pair programmer a notepad that doesn't get wiped clean every time you restart the session.
  20. **Current version: 0.6.0** - [See what's changed](CHANGELOG.md)
  21. ### What It Does
  22. - **Learns your patterns** - Analyzes your code to understand naming conventions, architectural choices, and structural preferences
  23. - **Instant project context** - Provides tech stack, entry points, and architecture in <200 tokens (no re-analysis needed)
  24. - **Smart file routing** - Routes vague requests like "add password reset" directly to relevant files
  25. - **Semantic search** - Finds code by meaning, not just keywords
  26. - **Work memory** - Tracks current tasks and architectural decisions across sessions
  27. - **Pattern prediction** - Suggests how you'd solve similar problems based on your history
  28. ### Example Workflow
  29. ```bash
  30. # First time: Learn your codebase
  31. npx in-memoria learn ./my-project
  32. # Start the MCP server
  33. npx in-memoria server
  34. # Now in Claude/Copilot:
  35. You: "Add password reset functionality"
  36. AI: *queries In Memoria*
  37. "Based on your auth patterns in src/auth/login.ts, I'll use your
  38. established JWT middleware pattern and follow your Result<T>
  39. error handling convention..."
  40. # Next session (days later):
  41. You: "Where did we put the password reset code?"
  42. AI: *queries In Memoria*
  43. "In src/auth/password-reset.ts, following the pattern we
  44. established in our last session..."
  45. ```
  46. No re-explaining. No generic suggestions. Just continuous, context-aware assistance.
  47. ## Quick Start
  48. ### Installation
  49. ```bash
  50. # Install globally
  51. npm install -g in-memoria
  52. # Or use directly with npx
  53. npx in-memoria --help
  54. ```
  55. ### Connect to Your AI Tool
  56. **Claude Desktop** - Add to your config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
  57. ```json
  58. {
  59. "mcpServers": {
  60. "in-memoria": {
  61. "command": "npx",
  62. "args": ["in-memoria", "server"]
  63. }
  64. }
  65. }
  66. ```
  67. **Claude Code CLI**:
  68. ```bash
  69. claude mcp add in-memoria -- npx in-memoria server
  70. ```
  71. **GitHub Copilot** - See [Copilot Integration](#github-copilot-integration) section below
  72. ### Learn Your Codebase
  73. ```bash
  74. # Analyze and learn from your project
  75. npx in-memoria learn ./my-project
  76. # Or let AI agents trigger learning automatically
  77. # (Just start the server and let auto_learn_if_needed handle it)
  78. npx in-memoria server
  79. ```
  80. ## How It Works
  81. In Memoria is built on Rust + TypeScript, using the Model Context Protocol to connect AI tools to persistent codebase intelligence.
  82. ### Architecture
  83. ```
  84. ┌─────────────────────┐ MCP ┌──────────────────────┐ napi-rs ┌─────────────────────┐
  85. │ AI Tool (Claude) │◄──────────►│ TypeScript Server │◄─────────────►│ Rust Core │
  86. └─────────────────────┘ └──────────┬───────────┘ │ • AST Parser │
  87. │ │ • Pattern Learner │
  88. │ │ • Semantic Engine │
  89. ▼ │ • Blueprint System │
  90. ┌──────────────────────┐ └─────────────────────┘
  91. │ SQLite (persistent) │
  92. │ SurrealDB (in-mem) │
  93. └──────────────────────┘
  94. ```
  95. ### The Core Components
  96. **Rust Layer** - Fast, native processing:
  97. - Tree-sitter AST parsing for 12 languages (TypeScript, JavaScript, Python, PHP, Rust, Go, Java, C/C++, C#, Svelte, SQL)
  98. - Blueprint analyzer (detects project structure, entry points, architecture patterns)
  99. - Pattern learner (statistical analysis of your coding style)
  100. - Semantic engine (understands code relationships and concepts)
  101. **TypeScript Layer** - MCP server and orchestration:
  102. - 13 specialized tools for AI assistants (organized into 4 categories)
  103. - SQLite for structured data, SurrealDB with SurrealKV for persistent vector embeddings
  104. - File watching for incremental updates
  105. - Smart routing that maps features to files
  106. **Storage** - Local-first:
  107. - Everything stays on your machine
  108. - SQLite for patterns and metadata
  109. - SurrealDB with SurrealKV backend for persistent vector embeddings
  110. - Local transformers.js for embeddings (Xenova/all-MiniLM-L6-v2)
  111. ### What Makes It Different
  112. This isn't just another RAG system or static rules engine:
  113. - **Learns from actual code** - Not manually-defined rules, but statistical patterns from your real codebase
  114. - **Predicts your approach** - Based on how you've solved similar problems before
  115. - **Token efficient** - Responses optimized to minimize LLM context usage (<200 tokens for project context)
  116. - **Routes to files** - "Add login" → automatically suggests `src/auth/login.ts`
  117. - **Remembers context** - Tracks work sessions, tasks, and architectural decisions
  118. - **Multi-mode search** - Semantic (meaning), text (keywords), or pattern-based
  119. ## What's New in v0.5.x
  120. We recently completed Phases 1-4 of the implementation roadmap:
  121. ### 🗺️ Project Blueprints (Phase 1)
  122. 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.
  123. ### 💼 Work Context System (Phase 2)
  124. AI agents can now track work sessions, maintain task lists, and record architectural decisions. Resume work exactly where you left off.
  125. ### 🧭 Smart File Routing (Phase 3)
  126. Feature-to-file mapping across 10 categories (auth, API, database, UI, etc.). Vague requests like "add password reset" get routed to specific files automatically.
  127. ### ⚡ Smooth Progress Tracking (v0.5.3)
  128. No more janky console spam. Progress bars update in-place with consistent 500ms refresh rates.
  129. ## MCP Tools for AI Assistants
  130. 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):
  131. ### 🎯 Core Analysis (2 tools)
  132. - `analyze_codebase` - Analyze files/directories with concepts, patterns, complexity (Phase 4: now handles both files and directories)
  133. - `search_codebase` - Multi-mode search (semantic/text/pattern)
  134. ### 🧠 Intelligence (7 tools)
  135. - `learn_codebase_intelligence` - Deep learning to extract patterns and architecture
  136. - `get_project_blueprint` - Instant project context with tech stack and entry points ⭐ (Phase 4: includes learning status)
  137. - `get_semantic_insights` - Query learned concepts and relationships
  138. - `get_pattern_recommendations` - Get patterns with related files for consistency
  139. - `predict_coding_approach` - Implementation guidance with file routing ⭐
  140. - `get_developer_profile` - Access coding style and work context
  141. - `contribute_insights` - Record architectural decisions
  142. ### 🤖 Automation (1 tool)
  143. - `auto_learn_if_needed` - Smart auto-learning with staleness detection ⭐ (Phase 4: includes quick setup functionality)
  144. ### 📊 Monitoring (3 tools)
  145. - `get_system_status` - Health check
  146. - `get_intelligence_metrics` - Analytics on learned patterns
  147. - `get_performance_status` - Performance diagnostics
  148. **Phase 4 Consolidation**: Three tools were merged into existing tools for better AX (agent experience haha):
  149. - ~~get_file_content~~ → merged into `analyze_codebase`
  150. - ~~get_learning_status~~ → merged into `get_project_blueprint`
  151. - ~~quick_setup~~ → merged into `auto_learn_if_needed`
  152. > **For AI agents**: See [`AGENT.md`](AGENT.md) for complete tool reference with usage patterns and decision trees.
  153. ## GitHub Copilot Integration
  154. In Memoria works with GitHub Copilot through custom instructions and chat modes.
  155. ### Setup
  156. This repository includes:
  157. - `.github/copilot-instructions.md` - Automatic guidance for Copilot
  158. - `.github/chatmodes/` - Three specialized chat modes:
  159. - 🔍 **inmemoria-explorer** - Intelligent codebase navigation
  160. - 🚀 **inmemoria-feature** - Feature implementation with patterns
  161. - 🔎 **inmemoria-review** - Code review with consistency checking
  162. ## GitHub Copilot Integration (VS Code)
  163. In Memoria integrates with **GitHub Copilot Chat** using **MCP + Custom Agents** (formerly called *Chat Modes*).
  164. These agents allow Copilot to query In Memoria’s persistent intelligence when working in **Agent mode**.
  165. > ⚠️ **Important**: Copilot will only call MCP tools when the chat is in **Agent** mode (not Ask or Edit).
  166. ### Requirements
  167. * **VS Code 1.106+**
  168. * **GitHub Copilot Chat** enabled
  169. * In Memoria MCP server configured and running
  170. ---
  171. ### MCP Server Setup (Required)
  172. Create or edit the following file in your workspace:
  173. **`.vscode/mcp.json`**
  174. ```json
  175. {
  176. "servers": {
  177. "in-memoria": {
  178. "command": "npx",
  179. "args": ["in-memoria", "server"]
  180. }
  181. }
  182. }
  183. ```
  184. Open this file in VS Code and click **Start** when prompted, or start it manually.
  185. ---
  186. ### Copilot Instructions (Automatic)
  187. This repository includes:
  188. * **`.github/copilot-instructions.md`**
  189. VS Code automatically loads this file and applies guidance to Copilot Chat.
  190. No additional setup is required.
  191. ---
  192. ### Custom Agents (formerly “Chat Modes”)
  193. This repository provides **three Custom Agents** for Copilot:
  194. | Agent | Purpose |
  195. | ------------------------- | --------------------------------------------- |
  196. | 🔍 **inmemoria-explorer** | Intelligent codebase navigation |
  197. | 🚀 **inmemoria-feature** | Feature implementation using learned patterns |
  198. | 🔎 **inmemoria-review** | Consistency & pattern-based code review |
  199. #### Agent File Location
  200. > ⚠️ VS Code has renamed *Chat Modes* → **Custom Agents**
  201. To ensure compatibility with current VS Code versions:
  202. 1. Create the folder:
  203. ```
  204. .github/agents/
  205. ```
  206. 2. Move or copy files from:
  207. ```
  208. .github/chatmodes/
  209. ```
  210. into:
  211. ```
  212. .github/agents/
  213. ```
  214. 3. Rename each file:
  215. ```
  216. *.chatmode.md → *.agent.md
  217. ```
  218. Example:
  219. ```
  220. inmemoria-feature.chatmode.md → inmemoria-feature.agent.md
  221. ```
  222. ---
  223. ### Using Agents in VS Code
  224. 1. Open **Copilot Chat**
  225. 2. Select the custom agent (e.g., inmemoria-featurename) directly from the dropdown.
  226. If agents do not appear:
  227. * Reload the window
  228. * Ensure files are in `.github/agents/`
  229. ---
  230. ### Example Usage
  231. ```text
  232. Where is the authentication logic?
  233. ```
  234. → Copilot queries In Memoria’s semantic index
  235. ```text
  236. Add password reset functionality
  237. ```
  238. → Copilot retrieves:
  239. * file routing
  240. * architectural patterns
  241. * prior auth decisions
  242. ```text
  243. Review this code for consistency
  244. ```
  245. → Copilot compares against learned conventions
  246. ---
  247. ### Common Pitfalls
  248. * ❌ Using **Ask/Edit mode** → MCP tools are ignored
  249. * ❌ MCP server not running
  250. * ❌ Agent files left in `.github/chatmodes/` only
  251. * ❌ VS Code version < 1.106
  252. ---
  253. ### Notes on VS Code Terminology
  254. | Old Name | Current Name |
  255. | ----------------------------- | ------------------------------- |
  256. | Chat Modes | Custom Agents |
  257. | `Chat: Configure Chat Modes…` | `Chat: Configure Custom Agents` |
  258. | `.github/chatmodes/` | `.github/agents/` |
  259. VS Code still recognizes legacy files, but **`.github/agents/*.agent.md` is the recommended format going forward**.
  260. ## Language Support
  261. Native AST parsing via tree-sitter for:
  262. - TypeScript & JavaScript (including JSX/TSX)
  263. - Python
  264. - PHP
  265. - Rust
  266. - Go
  267. - Java
  268. - C & C++
  269. - C#
  270. - Svelte
  271. - SQL
  272. Build artifacts (`node_modules/`, `dist/`, `.next/`, etc.) are automatically filtered out.
  273. ## Status: Work in Progress
  274. **Let's be honest**: In Memoria is early-stage software. It works, but it's not perfect.
  275. ### What Works Well
  276. - ✅ Pattern learning from real codebases
  277. - ✅ Semantic search across concepts
  278. - ✅ Project blueprint generation
  279. - ✅ MCP integration with Claude Desktop/Code
  280. - ✅ Cross-platform support (Linux, macOS, Windows)
  281. - ✅ Token-efficient responses
  282. ### Known Limitations
  283. - ⚠️ Large codebases (100k+ files) can be slow on first analysis
  284. - ⚠️ Pattern accuracy improves with codebase consistency
  285. - ⚠️ Some languages have better tree-sitter support than others
  286. - ⚠️ Documentation could be more comprehensive
  287. ### We Need Your Help
  288. This 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.
  289. **Before contributing code**, please:
  290. - Check the [GitHub Projects board](https://github.com/pi22by7/in-memoria/projects) to see what's planned
  291. - Join [Discord](https://discord.gg/6mGsM4qkYm) to discuss your ideas (@pi_22by7)
  292. - [Open an issue](https://github.com/pi22by7/in-memoria/issues) to discuss the feature/fix
  293. - Email me at [talk@pi22by7.me](mailto:talk@pi22by7.me) for larger contributions
  294. **Ways to contribute**:
  295. - 🐛 **Report bugs** - Found something broken? [Open an issue](https://github.com/pi22by7/in-memoria/issues)
  296. - 💡 **Suggest features** - Have ideas? Discuss on [Discord](https://discord.gg/6mGsM4qkYm) or [GitHub Discussions](https://github.com/pi22by7/in-memoria/discussions)
  297. - 🔧 **Submit PRs** - Code contributions are always appreciated (discuss first!)
  298. - 📖 **Improve docs** - Help make this easier to understand
  299. - 🧪 **Test on your codebase** - Try it out and tell us what breaks
  300. - 💬 **Join the community** - [Discord](https://discord.gg/6mGsM4qkYm) for real-time discussions
  301. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
  302. ## Technical Comparison
  303. **vs GitHub Copilot's memory**:
  304. - Copilot: Basic fact storage, no pattern learning
  305. - In Memoria: Semantic analysis + pattern learning + architectural intelligence + work context
  306. **vs Cursor's rules**:
  307. - Cursor: Static rules, manually defined
  308. - In Memoria: Dynamic learning from actual code + smart file routing + project blueprints
  309. **vs Custom RAG**:
  310. - RAG: Retrieves relevant code snippets
  311. - In Memoria: Understands patterns + predicts approaches + routes to files + tracks work context
  312. ## Team Usage
  313. In Memoria works for both individual developers and teams:
  314. **Individual**:
  315. - Learns your personal coding style
  316. - Remembers architectural decisions you've made
  317. - Provides context-aware suggestions
  318. **Team**:
  319. - Share `.in-memoria.db` files to distribute learned patterns
  320. - Onboard new developers with pre-learned codebase intelligence
  321. - Ensure consistent AI suggestions across the team
  322. ## Build from Source
  323. ```bash
  324. git clone https://github.com/pi22by7/in-memoria
  325. cd in-memoria
  326. npm install
  327. npm run build
  328. ```
  329. **Requirements**:
  330. - Node.js 18+
  331. - Rust 1.70+ (for building from source)
  332. - 2GB RAM minimum
  333. **Development**:
  334. ```bash
  335. npm run dev # Start in development mode
  336. npm test # Run test suite (98.3% pass rate)
  337. npm run build:rust # Build Rust components
  338. ```
  339. **Quality metrics**:
  340. - 118/120 unit tests passing (98.3%)
  341. - 23/23 MCP integration tests passing (100%)
  342. - Zero clippy warnings in Rust code
  343. - Zero memory leaks verified
  344. ## FAQ
  345. **Q: Does this replace my AI coding assistant?**
  346. 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.
  347. **Q: What data is collected?**
  348. A: Everything stays local. No telemetry, no phone-home. Your code never leaves your machine. All embeddings are generated locally using transformers.js models.
  349. **Q: How accurate is pattern learning?**
  350. 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.
  351. **Q: What's the performance impact?**
  352. 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.
  353. **Q: What if analysis fails or produces weird results?**
  354. A: [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.
  355. **Q: Can I use this in production?**
  356. 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.
  357. **Q: Why Rust + TypeScript?**
  358. 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.
  359. **Q: What about other AI tools (not Claude/Copilot)?**
  360. 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.
  361. ## Roadmap
  362. We're following a phased approach:
  363. - ✅ **Phase 1**: Project Blueprint System (v0.5.0)
  364. - ✅ **Phase 2**: Work Context & Session Memory (v0.5.0)
  365. - ✅ **Phase 3**: Smart File Routing (v0.5.0)
  366. - ✅ **Phase 4**: Tool Consolidation (v0.5.0)
  367. - 🚧 **Phase 5**: Enhanced Vector Search & Embeddings
  368. - 📋 **Phase 6**: Multi-project Intelligence
  369. - 📋 **Phase 7**: Collaboration Features
  370. See [GitHub Projects](https://github.com/pi22by7/in-memoria/projects) for detailed tracking.
  371. ## Community & Support
  372. **Project maintained by**: [@pi22by7](https://github.com/pi22by7)
  373. - 💬 **Discord**: [discord.gg/6mGsM4qkYm](https://discord.gg/6mGsM4qkYm) - Join the community, ask questions, discuss improvements (ping @pi_22by7)
  374. - 📧 **Email**: [talk@pi22by7.me](mailto:talk@pi22by7.me) - For private inquiries or larger contribution discussions
  375. - 🐛 **Issues**: [GitHub Issues](https://github.com/pi22by7/in-memoria/issues) - Report bugs and request features
  376. - 💡 **Discussions**: [GitHub Discussions](https://github.com/pi22by7/in-memoria/discussions) - General discussions and Q&A
  377. - 📖 **Documentation**: See [AGENT.md](AGENT.md) for AI agent instructions
  378. - 🤝 **Contributing**: Check [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines
  379. **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.
  380. ## License
  381. MIT - see [LICENSE](LICENSE)
  382. Built with ❤️ by [@pi22by7](https://github.com/pi22by7) for the AI-assisted development community.
  383. ---
  384. **Try it**: `npx in-memoria server`
  385. **Latest release**: [v0.6.0](CHANGELOG.md) - Smooth progress tracking and Phase 1-4 complete
  386. _In memoria: in memory. Because your AI assistant should remember._
  387. **Questions? Ideas?** Join us on [Discord](https://discord.gg/6mGsM4qkYm) or reach out at [talk@pi22by7.me](mailto:talk@pi22by7.me)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.