myAI Memory Sync

by Jktfe
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Supports configuration through environment variables in .env files for customizing memory paths and platform settings

  • Uses structured markdown format to organize user preferences and information across platforms

  • Optional browser automation for Claude.ai web synchronization in headless mode

myAI 记忆同步

每次开始新聊天时都得跟 Claude 重复自己的话,是不是有点烦? myAI Memory Sync 是一款颠覆性的 MCP 工具,它可以无缝同步您所有 Claude 界面的偏好设置、个人信息和代码标准!只需更新一次,您的更改即可立即生效——从 Claude Desktop 到 Claude Code、Windsurf 和 Claude.ai 网页版。借助我们先进的缓存系统,内存相关查询速度最高可提升 2000 倍!告别重复指令的浪费,享受真正个性化的 AI 体验。

myAImemory-mcp 与其他记忆工具的比较

虽然 AI 系统已经存在几种出色的记忆工具,但 myAImemory-mcp 作为模型上下文协议 (MCP) 工具具有特定用途:

工具主要焦点隐私模型一体化独特力量
myAImemory-mcpClaude 界面上的用户偏好本地优先,不向外部服务器发送数据Claude特异的MCP具有高性能缓存的跨平台同步
石墨时间知识图谱数据库相关总代理框架知识表示中的时间意识
Letta/MemGPT状态代理框架基于服务器多模型支持完整的代理架构
内存0个性化的AI互动基于API多平台多级内存层次结构
记忆代理的类人记忆图形数据库以代理为中心人类记忆模拟
科尼适用于 AI 应用的可靠内存多种存储选项专注于数据管道广泛的数据源集成

myAImemory-mcp 的主要优势:

  • 隐私优先:所有数据保留在您的设备上,不会将任何个人信息发送到外部服务器
  • 性能:利用 Claude 的缓存功能显著提高速度
  • 简单:所有 Claude 界面均使用自然语言更新您的偏好
  • MCP 集成:专门构建为 Claude MCP,实现无缝集成

🚀 快速入门

# Clone repository git clone https://github.com/Jktfe/myaimemory-mcp.git cd myaimemory-mcp # Install dependencies npm install # Build TypeScript code npm run build # Start MCP server ./start-memory-sync.sh

🔄 直接同步方法(简单替代方法)

对于不需要运行 MCP 服务器的更简单方法,您可以使用独立同步脚本:

# One-time sync of all memory files node sync-memory.js

该脚本将:

  • 从您的“myAI Master.md”文件中读取
  • 更新项目中的所有 CLAUDE.md 文件
  • 更新您的 Windsurf 内存设置
  • 所有这些都无需在 git 存储库中存储敏感信息

🔒 隐私和安全

  • 包含您个人信息的“myAI Master.md”文件已从 git 跟踪中排除
  • 所有 CLAUDE.md 文件也被排除以保护您的隐私
  • 使用包含的.gitignore确保敏感文件保持私密

然后在 Claude 中,只需说:

You: Use myAI Memory to remember I prefer TypeScript over JavaScript Claude: ✅ Added to your Coding Preferences! I'll remember you prefer TypeScript over JavaScript.

📋 安装选项

选项 1:直接安装(推荐)

从 npm 安装:

npm install -g myai-memory-sync

启动服务器:

myai-memory-sync

选项 2:从源运行

从源代码克隆并构建:

git clone https://github.com/Jktfe/myaimemory-mcp.git cd myaimemory-mcp npm install npm run build npm start

选项 3:Docker

使用 Docker 构建并运行:

docker build -t myai-memory-sync . docker run -v myai-memory:/app/data -p 3000:3000 myai-memory-sync

🔌 MCP 配置

Claude桌面配置

将其添加到您的claude_desktop_config.json中:

{ "mcpServers": { "myai-memory-sync": { "command": "npx", "args": [ "-y", "myai-memory-sync" ], "env": { "TEMPLATE_PATH": "/path/to/custom/template.md", "ENABLE_ANTHROPIC": "true", "ANTHROPIC_API_KEY": "your-api-key-here" } } } }

Claude.ai 与 Smithery

  1. 访问Smithery.ai
  2. 添加 myAI Memory Sync MCP:
    @Jktfe/myaimemory-mcp
  3. 在 Smithery 设置中使用您的 API 密钥进行配置

风帆冲浪整合

在 Windsurf 中,添加到您的.codeium/config.json

{ "mcp": { "servers": { "myai-memory-sync": { "command": "npx", "args": [ "-y", "myai-memory-sync" ] } } } }

HTTP 服务器模式

对于 HTTP 传输而不是 stdio:

# Start HTTP server on port 3000 npm run start:http # Or specify a custom port PORT=8080 npm run start:http

环境变量

使用以下选项创建.env文件:

# Basic configuration DEBUG=true # Enable debug logging TEMPLATE_PATH=./data/template.md # Custom template location # Platform-specific paths WINDSURF_MEMORY_PATH=~/.codeium/windsurf/memories/global_rules.md CLAUDE_PROJECTS_PATH=~/CascadeProjects # Performance optimization ENABLE_ANTHROPIC=true # Enable Anthropic API integration ANTHROPIC_API_KEY=your-api-key # Your Anthropic API key ENABLE_PROMPT_CACHE=true # Enable prompt caching system CACHE_TTL=300000 # Cache TTL in milliseconds (5 minutes) # Claude web sync (optional) CLAUDE_WEB_SYNC_ENABLED=false # Enable Claude.ai web synchronization CLAUDE_WEB_EMAIL=you@email.com # Your Claude.ai email CLAUDE_WEB_HEADLESS=true # Run browser in headless mode

🧙‍♂️ 系统提示集成

为了获得最佳效果,请将其添加到您的 Claude 系统提示中:

Memory Integration Instructions: When you receive a command that starts with "use myAI Memory to", you should: 1. Process the rest of the instruction as a memory management command 2. Try to determine the appropriate section to update based on the content 3. Use the myAI Memory Sync MCP to update your memory 4. Confirm the update with a brief acknowledgment For example: "use myAI Memory to remember I prefer dark mode" → Update the preferences section with dark mode preference When asked questions about preferences or personal information, first check your memory via the myAI Memory Sync MCP. Always reference information from memory rather than making assumptions.

✨ 特点

  • 🔄跨平台同步:一次更新,同步到处
  • 闪电般快速的回忆:缓存系统性能提升高达 2000 倍
  • 🗣️自然语言界面:只需自然地交谈即可更新您的偏好
  • 🧩多个角色配置文件:轻松在不同的预设之间切换
  • 🔐安全至上:具有 .gitignore 保护的本地存储
  • 🛠️开发人员友好:完整的 TypeScript 实现和全面的 API

🧩 核心架构

myAI Memory Sync 采用模块化架构,包含以下关键组件:

  • 模板解析器:结构化内存对象与markdown之间的双向转换
  • 模板存储:具有内存和文件系统缓存的持久存储
  • 平台同步器:为每个目标平台实现PlatformSyncer接口
  • 自然语言处理器:从自然语言记忆命令中提取结构化数据
  • 内存缓存服务:通过多级缓存策略优化性能

🔍 详细功能

跨平台同步

  • ClaudeCodeSyncer :更新所有存储库中的 CLAUDE.md 文件
  • WindsurfSyncer :管理 Windsurf 环境中的 global_rules.md
  • ClaudeWebSyncer :可选的基于 Puppeteer 的与 Claude.ai Web 界面的同步

智能内存管理

  • 基于模式的提取:将自然语言转换为结构化的键值对
  • 部分检测算法:自动确定新记忆的适当部分
  • 记忆模板格式:基于 Markdown 的结构,包含章节、描述和键值项
  • 上下文保存:更新内存部分,同时保存其他模板内容

性能优化

  • 多级缓存:模板和部分级别的内存缓存
  • 基于TTL的缓存管理:可配置缓存内容的生存时间
  • 预热:模板更新后缓存预填充
  • 可选的 Anthropic API 集成:将内存相关查询速度提高 2000 倍

安全

  • 本地优先架构:所有数据保留在您的设备上
  • Gitignore 管理:自动将 CLAUDE.md 添加到所有存储库中的 .gitignore
  • 文件权限处理:修复权限问题以实现最大兼容性
  • 加密存储:兼容加密文件系统

📋 记忆模板格式

系统采用结构化的 markdown 格式来组织您的偏好设置:

# myAI Memory # User Information ## Use this information if you need to reference them directly -~- Name: Your Name -~- Location: Your Location -~- Likes: Reading, Hiking, Technology # General Response Style ## Use this in every response -~- Style: Friendly and concise -~- Use UK English Spellings: true -~- Include emojis when appropriate: true # Coding Preferences ## General Preference when responding to coding questions -~- I prefer TypeScript over JavaScript -~- Show step-by-step explanations

🛠️ 技术实现

MemoryTemplate 架构

interface MemoryTemplate { sections: TemplateSection[]; } interface TemplateSection { title: string; description: string; items: TemplateItem[]; } interface TemplateItem { key: string; value: string; }

平台同步接口

interface PlatformSyncer { sync(templateContent: string): Promise<SyncStatus>; } type PlatformType = 'claude-web' | 'claude-code' | 'windsurf' | 'master'; interface SyncStatus { platform: PlatformType; success: boolean; message: string; }

🔌 MCP 集成 API

myAI Memory Sync 工具实现了模型上下文协议 (MCP),具有以下功能:

功能描述参数
get_template检索完整内存模板没有任何
get_section检索特定部分sectionName: string
update_section更新特定部分sectionName: string, content: string
update_template替换整个模板content: string
list_presets列出可用的预设没有任何
load_preset加载特定预设presetName: string
create_preset创建新预设presetName: string
sync_platforms跨平台同步platform?: string
list_platforms列出可用的平台没有任何

自然语言界面

用户可以通过自然语言命令与系统交互:

You: Use myAI Memory to remember I prefer TypeScript over JavaScript Claude: ✅ Added to your Coding Preferences! I'll remember you prefer TypeScript over JavaScript. You: Use myAI Memory to load preset developer Claude: ✅ Loaded developer preset! I'll now use your developer preferences.

🧙‍♂️ 高级用法

记忆预设

轻松切换不同角色:

You: Use myAI Memory to list presets Claude: Available presets: personal, work, developer You: Use myAI Memory to load preset developer Claude: ✅ Loaded developer preset!

紧急同步

当您需要修复所有平台的同步问题时:

# Sync everything immediately ./emergency-sync.sh

命令行界面

# View all available commands node dist/cli.js --help # Process memory commands directly node dist/cli.js --remember "remember I prefer dark mode" # Start HTTP server for SSE transport npm run start:http # Start stdio server for MCP transport npm run start

开发工作流程

# Run in development mode with auto-reload npm run dev # Run in development mode with HTTP server npm run dev:http # Watch TypeScript compilation npm run build:watch # Run tests npm test # Run specific test npm test -- -t "platformSync" # Lint code npm run lint # Type check without emitting files npm run typecheck

⚡ 性能基准

我们的缓存系统提供了令人难以置信的性能改进:

手术无缓存带缓存改进
内存查询~2000毫秒~1毫秒2000倍
部分查找~1600毫秒~0.8毫秒2000倍
模板解析~120毫秒~0.1毫秒1200倍
平台同步~850毫秒~350毫秒2.4倍

🔒 安全与隐私

我们非常重视您的隐私:

  • 所有数据均保留在您的本地设备上
  • CLAUDE.md 文件自动添加到 .gitignore
  • 没有数据发送到外部服务器(除非使用可选的 Anthropic API 集成)
  • 与加密文件系统配合使用,实现最大程度的安全性

🛠️ 故障排除

常见问题

  1. CLAUDE.md 未更新
    • 使用ls -la CLAUDE.md检查文件权限
    • 尝试使用./emergency-sync.sh进行紧急同步
    • 验证.env文件中的平台路径
  2. MCP 连接失败
    • 使用ps aux | grep myai-memory确保 MCP 服务器正在运行
    • 检查 Claude Desktop 日志中是否存在 MCP 错误
    • 验证您的 Claude Desktop 配置文件
  3. 缓存问题
    • 使用node dist/cli.js --clear-cache清除缓存
    • 验证 Anthropic API 密钥是否设置正确
    • 使用node dist/cli.js --validate检查内存文件完整性

日志和调试

启用调试模式查看详细日志:

DEBUG=true npm run start

日志文件存储在:

  • Linux/macOS: ~/.local/share/myai-memory/logs/
  • Windows: %APPDATA%\myai-memory\logs\

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/amazing-feature
  3. 提交您的更改( git commit -m 'Add some amazing feature'
  4. 推送到分支( git push origin feature/amazing-feature
  5. 打开拉取请求

我们遵循标准的 Git 工作流程和 CI 流程:

  • 所有 PR 都需要通过测试和 linting
  • 新功能应该包括测试
  • 重大变更应更新文档
  • 遵循现有的代码风格和模式

📚 文档

有关更详细的文档,请参阅Wiki

API 文档位于/docs目录中:

# Generate API documentation npm run docs

📄 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

📬 联系方式

项目链接: https://github.com/Jktfe/myaimemory-mcp


ID: coxb0s9h7k