AI Memory Manager
English documentation is below the Chinese section.
"给你的 LLM 装上一个永远不会失忆、不写烂代码的本地大脑。"
AI Memory Manager 是一款 VSCode 扩展,通过对话式 AI
提取架构规则并"幽灵注入"到 .cursorrules,让 Cursor、Continue 等 AI
代码助手始终遵守你制定的工程规范。100% 本地存储,支持自带 API Key(BYOK)。
✨ 核心功能 (v1.1.6)
🔧 基础功能
- BYOK 多 Provider 支持:OpenAI / Anthropic / Google Gemini / Ollama / DeepSeek / 通义千问 / 豆包 / 自定义端点,一键切换
- AI 规则蒸馏:口语化描述 → LLM 提炼 → 专业架构规则,无需精准措辞
- 幽灵注入:规则自动写入
.cursorrules,AI 助手即时生效,零感知
🛡️ 商业级防御
- 机密扫描器:写入本地前强制扫描,
sk-xxx / password= / MongoDB URI 自动脱敏,防止密钥泄漏
- 外部变更监控:
chokidar 监听 .prisma / schema.sql,数据库被外部工具修改时立即告警
- 熔断限流器:单次对话 AI 工具调用上限 5 次,防止死循环耗尽 API 额度
- 决策日志:所有 AI 行为写入
decision_log.md,支持历史溯源 Debug
🔍 智能检索
- 语义模糊搜索(Fuse.js):跨
entities/ 目录模糊匹配,召回最相关知识
- 向量语义检索:基于 WebAssembly ONNX 运行时,跨平台本地向量嵌入
- Function Calling:LLM 可主动调用
search_memory 工具检索本地记忆库
- 双模式分流:自动区分"规则提取"和"知识查询"两种意图
📦 配置管理
- 一键导出:整个
.aimemory/ 目录打包为 .zip,便于迁移备份
- 一键导入:还原 zip 包,UI 自动刷新,跨机器同步配置
- 全局持久化:API Key / Model / Base URL 跨 session 保持
🌍 跨平台支持
- Windows / macOS / Linux 完整支持:向量检索引擎基于 WebAssembly,无平台原生二进制依赖
📁 数据存储结构
your-workspace/
├── .aimemory/
│ ├── config/
│ │ └── global_rules.json ← AI 提取的架构规则库
│ ├── entities/ ← 结构化数据字典(供语义搜索)
│ ├── apis/ ← 接口契约与签名
│ └── contexts/
│ └── decision_log.md ← 完整 AI 决策历史日志
└── .cursorrules ← 自动同步,Cursor/Continue 读取
🚀 快速开始
- 点击 Activity Bar 中的 AI Memory Manager 图标打开侧边栏
- 在 Provider Presets 选择你的服务商(如 OpenAI)
- 填入 Base URL、Model Name 和 API Key,点击 Sync Configuration
- 在 Ghost Workspace 输入框描述你的规则:
- 提取规则:"以后所有接口返回值必须用 Result<T, E> 包裹"
- 查询记忆:"我们的 User 实体有哪些字段?"
- 点击 🤖 Distill / Search,规则自动注入并显示在 Active Brain Atlas
🏗️ 版本历史
| 版本 |
状态 |
说明 |
| v0.1 MVP |
✅ 完成 |
基础聊天规则提取 + 幽灵注入 |
| v1.0 |
✅ 完成 |
四大防御 + 语义搜索 + 导入导出 + 多 Provider |
| v1.1.0 |
✅ 完成 |
分块质量修复 + JSONL 分片索引 + 目录契约 + Session 审计 |
| v1.1.1 |
✅ 完成 |
跨平台修复:WebAssembly ONNX 后端,移除 Windows 专属原生二进制依赖 |
| v1.1.2 |
✅ 当前版本 |
Webview CSP 修复:nonce 白名单内联脚本,解决插件安装后页面空白问题 |
详细进度记录请见 PROGRESS.md
📦 打包发布
# 安装打包工具
npm install -g @vscode/vsce
# 编译
npm run compile
# 打包为 .vsix
npx @vscode/vsce package
# 发布到 Marketplace
npx @vscode/vsce publish
AI Memory Manager (English)
"Equip your LLM with a local brain that never forgets and never writes bad
code."
AI Memory Manager is a VSCode extension that uses conversational AI to
extract architectural rules and "ghost-inject" them into .cursorrules. This
ensures AI coding assistants like Cursor or Continue consistently follow your
specific project standards. 100% local storage, supports Bring Your Own Key
(BYOK).
✨ Core Features (v1.1.2)
🔧 Basic Features
- BYOK Multi-Provider Support: OpenAI / Anthropic / Google Gemini / Ollama / DeepSeek / Qwen / Doubao / Custom endpoints with 1-click switching.
- AI Rule Distillation: Natural language → LLM extraction → Professional architecture rules (no prompt engineering required).
- Ghost Injection: Rules are auto-written to
.cursorrules. AI assistants instantly adopt them seamlessly.
🛡️ Enterprise Defense
- Secret Scanner: Mandatory scanning before local writes.
sk-xxx/password=/MongoDB URLs are redacted to prevent credential leaks.
- External Change Monitoring:
chokidar listens to .prisma/schema.sql. Immediate warnings if database schemas are modified externally.
- Circuit Breaker: AI tool calling is limited to 5 loops per session to prevent burning through your API quotas.
- Decision Logger: All AI reasoning is safely logged into
decision_log.md for historical debugging and trace-backs.
🔍 Smart Search
- Fuzzy Semantic Search (Fuse.js): Scopes across the
entities/ directory to recall the most contextually relevant knowledge.
- Vector Semantic Search: Local embedding via WebAssembly ONNX runtime — cross-platform, no native binaries required.
- Function Calling: LLM can natively invoke
search_memory to fetch from local storage.
- Dual Intent Routing: Intelligently differentiates between "Rule Extraction" and "Knowledge Query" intent.
📦 Config Management
- Export in 1-click: Pack the entire
.aimemory/ payload into a .zip for team synchronization or backups.
- Import in 1-click: Rehydrate from a zip package with instant UI refreshing.
- Global Persistence: Persist your API Keys/Models across VSCode sessions.
- Windows / macOS / Linux: Vector search engine runs on WebAssembly — no platform-specific native binary dependencies.
📁 Storage Architecture
your-workspace/
├── .aimemory/
│ ├── config/
│ │ └── global_rules.json ← AI extracted rules
│ ├── entities/ ← Structured Data Dictionary
│ ├── apis/ ← API Signatures / Contracts
│ └── contexts/
│ └── decision_log.md ← Action traces
└── .cursorrules ← Auto-synced payload context
🚀 Quick Start
- Click the AI Memory Manager icon in the Activity Bar to open the sidebar.
- Under Provider Presets, select your AI model provider (e.g. OpenAI).
- Fill in the Base URL, Model Name, and API Key, then click Sync
Configuration.
- Describe your rule in the Ghost Workspace:
- Extraction: "All API responses must be wrapped in Result<T, E>"
- Querying: "What fields does our User entity have?"
- Click 🤖 Distill / Search. The semantic rule instantly shows up on your
Active Brain Atlas.
Made with ❤️ for AI Engineers and Architects. 100% Local Storage · Zero
Data Collection · BYOK Pattern
Enjoying AI Memory Manager?
☕ Buy me a coffee to support further
development!