inmemoria
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIn Memoria: Persistent Codebase Intelligence
In Memoria: 持久化代码库智能
In Memoria is an MCP server that learns your codebase patterns once, then exposes that intelligence to AI agents persistently. Instead of re-analyzing code on every interaction, it maintains a semantic understanding of your architecture, conventions, and decisions.
In Memoria 是一款MCP服务器,只需学习一次你的代码库模式,就能持续为AI Agent提供这种智能能力。无需在每次交互时重新分析代码,它会持续维护对你的架构、约定和决策的语义理解。
Core Concept
核心概念
Setup → Learn → Verify → Serve. After that, AI agents query persistent intelligence without repeated parsing.
设置 → 学习 → 验证 → 提供服务。完成后,AI Agent即可查询持久化智能,无需重复解析代码。
Quick Start (5 minutes)
快速开始(5分钟)
bash
undefinedbash
undefined1. Configure for your project
1. 为你的项目进行配置
npx in-memoria setup --interactive
npx in-memoria setup --interactive
2. Build intelligence database
2. 构建智能数据库
npx in-memoria learn ./src
npx in-memoria learn ./src
3. Verify it worked
3. 验证是否成功
npx in-memoria check ./src --verbose
npx in-memoria check ./src --verbose
4. Keep it fresh (optional but recommended)
4. 保持智能更新(可选但推荐)
npx in-memoria watch ./src
npx in-memoria watch ./src
5. Expose to agents via MCP
5. 通过MCP向Agent提供服务
npx in-memoria server
undefinednpx in-memoria server
undefinedWhen to Use
适用场景
✅ Use In Memoria:
- Building long-lived AI agent partnerships (Claude, Copilot, etc.)
- Projects where consistency across sessions matters
- Teams wanting shared codebase intelligence
❌ Skip it:
- One-off analysis (use directly)
npx in-memoria analyze [path] - Simple projects agents can read directly
✅ 推荐使用In Memoria:
- 构建长期运行的AI Agent协作(Claude、Copilot等)
- 跨会话一致性至关重要的项目
- 需要共享代码库智能的团队
❌ 不建议使用:
- 一次性分析场景(直接使用 )
npx in-memoria analyze [path] - Agent可直接读取的简单项目
The 5 Core Commands
5个核心命令
| Command | Purpose | When |
|---|---|---|
| Configure exclusions, paths, preferences | First time only |
| Build/rebuild intelligence database | After setup, major refactors |
| Validate intelligence layer | After learn, before server |
| Auto-update intelligence on code changes | During development (optional) |
| Start MCP server for agent queries | After check passes |
Key difference: builds persistent knowledge. is one-time reporting only.
learnanalyze| 命令 | 用途 | 使用时机 |
|---|---|---|
| 配置排除项、路径和偏好设置 | 仅首次使用 |
| 构建/重建智能数据库 | 完成设置后、重大重构后 |
| 验证智能层 | 执行learn后、启动server前 |
| 代码变更时自动更新智能 | 开发期间(可选) |
| 启动MCP服务器供Agent查询 | 检查通过后 |
关键区别: 用于构建持久化知识, 仅用于一次性报告。
learnanalyzeWhat Agents See
Agent可查询内容
When connected, agents can query:
- Project structure - Tech stack, entry points, architecture
- Code patterns - Your naming conventions, error handling, patterns used
- Smart routing - "Add password reset" → suggests
src/auth/password-reset.ts - Semantic search - Find code by meaning, not keywords
- Work context - Track decisions, tasks, approach consistency
连接后,Agent可查询以下信息:
- 项目结构 - 技术栈、入口点、架构
- 代码模式 - 命名约定、错误处理、所用模式
- 智能路由 - 例如“添加密码重置功能”→ 推荐
src/auth/password-reset.ts - 语义搜索 - 按含义而非关键词查找代码
- 工作上下文 - 追踪决策、任务、方法一致性
Troubleshooting
故障排查
| Issue | Fix |
|---|---|
| Learn fails | Verify path is correct; check file permissions |
| Check reports missing intelligence | Run |
| Agent doesn't see new code | Is |
| Server won't start | Run |
| Multiple projects conflict | Use |
| 问题 | 解决方法 |
|---|---|
| Learn执行失败 | 验证路径是否正确;检查文件权限 |
| Check报告缺少智能 | 重新运行 |
| Agent无法看到新代码 | 是否运行了 |
| Server无法启动 | 先运行 |
| 多项目冲突 | 使用 |
Performance Notes
性能说明
- Small projects (<1K files): 5-15s to learn
- Medium (1K-10K files): 30-60s
- Large (10K+ files): 2-5min
If learning stalls (>10min), verify you're not indexing , , or build artifacts—use setup's exclusion patterns.
node_modules/dist/- 小型项目(<1000个文件):5-15秒完成学习
- 中型项目(1000-10000个文件):30-60秒
- 大型项目(10000+个文件):2-5分钟
如果学习过程停滞(超过10分钟),请确认未索引、或构建产物——可使用设置中的排除规则。
node_modules/dist/Key Principles
核心原则
- Local-first - Everything stays on your machine; no telemetry
- Persistent - One learning pass; intelligence updates incrementally with
watch - Agent-native - Designed for MCP; works with Claude, Copilot, and any MCP-compatible tool
- Pattern-based - Learns from your actual code, not rules you define
- 本地优先 - 所有数据均保存在你的设备上;无遥测数据
- 持久化 - 仅需一次学习;通过实现智能增量更新
watch - 原生支持Agent - 为MCP设计;可与Claude、Copilot及任何兼容MCP的工具配合使用
- 基于模式 - 从你的实际代码中学习,而非你定义的规则
Deployment Pattern (3 terminals)
部署模式(3个终端)
bash
undefinedbash
undefinedTerminal 1: One-time setup
终端1:一次性设置
npx in-memoria setup --interactive
npx in-memoria learn ./src
npx in-memoria check ./src --verbose
npx in-memoria setup --interactive
npx in-memoria learn ./src
npx in-memoria check ./src --verbose
Terminal 2: Keep intelligence fresh
终端2:保持智能更新
npx in-memoria watch ./src
npx in-memoria watch ./src
Terminal 3: Expose to agents
终端3:向Agent提供服务
npx in-memoria server
npx in-memoria server
Now agents (Claude, Copilot, etc.) have persistent codebase context
现在Agent(Claude、Copilot等)即可获取持久化代码库上下文
See [GitHub](https://github.com/pi22by7/In-Memoria) for full API docs and agent integration examples.
完整API文档及Agent集成示例请查看[GitHub](https://github.com/pi22by7/In-Memoria)。