偏好记忆服务

一个自动学习并记住用户偏好的零配置本地化服务,适用于Claude AI助手。

  • by airmcp-com
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 airmcp-com/mcp-standards

使用说明

MCP标准-克劳德个人记忆

⚠️ 存档项目:此存储库已存档,仅供参考。该项目是实验性的,是使用AgentDB向量记忆进行自动偏好学习的概念验证。看 存档.md 了解完整细节。

让克劳德自动记住你的偏好。零配置,零手动步骤。


🎯 这有什么作用

别再跟克劳德重复了。此MCP服务器会自动学习您的偏好:

You: "Install pytest"
Claude: pip install pytest

You: "Actually, use uv not pip"
Claude: ✓ Remembered

Next session:
You: "Install requests"
Claude: uv pip install requests  [automatic]

一个更正。永远铭记。


⚡ 快速入门(5分钟)

1.安装

git clone https://github.com/airmcp-com/mcp-standards.git
cd mcp-standards

# Install dependencies
npm install

# Setup AgentDB
npm run setup

2.配置克劳德桌面

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-standards": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/ABSOLUTE/PATH/TO/mcp-standards",
        "python",
        "-m",
        "mcp_standards.server_simple"
      ]
    }
  }
}

⚠️ 替换 /ABSOLUTE/PATH/TO/ 与你的实际路径!

3.重新启动克劳德桌面

退出并重新启动Claude Desktop。

4.测试一下!

You: "Remember: use uv not pip"
Claude: ✓ Remembered: 'use uv not pip' (python)

You: "What do you remember?"
Claude: I remember you prefer:
- Use uv not pip for Python projects

就是这样!你完了。 🎉


🧠 运作原理

自动学习

只要自然地纠正克劳德——它会自动学习:

Session 1:
You: "Use uv not pip"
→ Auto-detected and stored in AgentDB

Session 2+:
You: "Install anything"
→ Claude uses uv automatically

什么会被记住

✅ 工具首选项:“使用uv而不是pip”,“更喜欢yarn而不是npm” ✅ 工作流模式:“提交前运行测试” ✅ 代码风格:“对新文件使用TypeScript” ✅ 项目惯例:“遵循政治公众人物8”

类别(自动检测)

  • python -Python/pip/uv首选项
  • javascript -npm/yarn/pnpm首选项
  • git -Git工作流首选项
  • docker -Docker/容器首选项
  • testing -测试框架首选项
  • general -其他一切

📊 特性

功能 状态
自动检测 ✅ 自动检测“使用X而不是Y”
语义搜索 ✅ <使用AgentDB时为1ms(比SQLite快150倍)
交叉会议 ✅ 偏好永远存在
零配置 ✅ 开箱即用
100%本地 ✅ 无云,全部私有
简单 ✅ 5分钟设置

📖 文档


🛠️ MCP工具可用

个人记忆(简单版)

// Store preference
remember({
    content: "use uv not pip",
    category: "python"
})

// Search preferences
recall({
    query: "package manager",
    top_k: 5
})

// List all categories
list_categories()

// Get statistics
memory_stats()

配置标准(奖金)

// Generate minimal CLAUDE.md from project config files
generate_ai_standards({
    project_path: ".",
    formats: ["claude"]
})

🚀 建筑

简单快捷

User corrects Claude
   ↓
Auto-detection hook triggers
   ↓
Stores in AgentDB (semantic vector memory)
   ↓
Next session: Claude queries AgentDB automatically
   ↓
Uses remembered preference

技术

  • AgentDB -超高速矢量存储器(<1ms搜索)
  • python -MCP服务器(异步)
  • SQLite -后备存储
  • MCP协议 -Claude桌面集成
  • 100%本地 -无云依赖

📁 项目结构

mcp-standards/
├── src/mcp_standards/
│   ├── agentdb_client.py        # AgentDB wrapper
│   ├── hooks/auto_memory.py     # Auto-detection
│   └── server_simple.py         # Simple MCP server
├── tests/
│   └── test_simple_setup.py     # Validation tests
├── docs/
│   ├── QUICKSTART_SIMPLE.md     # Setup guide
│   ├── VALIDATION_CHECKLIST.md  # Testing guide
│   └── SIMPLE_V2_PLAN.md        # Technical details
├── scripts/
│   └── setup-agentdb.js         # Setup script
├── .claude/skills/
│   └── remember-preferences.md  # Claude skill
└── README.md                     # This file

干净。简单。作品。


🧪 测试

运行自动验证:

python3 tests/test_simple_setup.py

预期输出:

✓ PASS: Directory Structure
✓ PASS: Required Files
✓ PASS: Module Imports
✓ PASS: AgentDB Client Init
✓ PASS: Auto Memory Patterns

Results: 5/5 tests passed
Status: Ready for dev testing 🚀

🐛 故障排除

安装失败

# Check Node.js version
node --version  # Need v18+

# Install AgentDB manually
npm install -g agentdb
npx agentdb --version

Claude Desktop未连接

# Check logs
tail -f ~/Library/Logs/Claude/mcp*.log

# Look for initialization messages
# Should see: "MCP Standards (Simple) initialized"

首选项未被记住

检查:

  1. 服务器正在运行(检查Claude Desktop MCP状态)
  2. 更正使用清晰的短语(“使用X而不是Y”)
  3. AgentDB路径存在: ~/.mcp-standards/agentdb

更多帮助:参见 验证检查表


🎯 演出

度量 值
设置时间 <5分钟
服务器启动 <2秒
搜索速度 <1ms(代理DB HNSW)
检测 实时(异步)
存储 <10ms
内存使用 ~50MB(嵌入式模型)

比SQLite快150倍。零滞后。


🔒 隐私

  • ✅ 100%本地 -所有存储在 ~/.mcp-standards/
  • ✅ 没有云 -没有外部API调用
  • ✅ 无遥测 -无数据收集
  • ✅ 您的数据 -你掌控一切

📝 改变了什么(v2简单)

我们消除了所有的复杂性:

v1(旧) v2简单(新)
手动MCP呼叫(4-5步) ✅ 自动(零步)
SQLite关键字搜索(50ms+) ✅ AgentDB矢量搜索(<1ms)
没有语义匹配 ✅ 语义理解
复杂的设置 ✅ 5分钟设置
6000+位置 ✅ ~950 LOC

结果:代码减少80%,用户体验提高100倍


🤝 贡献

这是一个个人副业。如果你想做出贡献:

  1. 先自己试试
  2. 打开一个问题,描述您要添加的内容
  3. 编写代码前等待反馈

请不要:先提交大型PR,不进行讨论。


📜 许可证

MIT许可证-请参阅 许可证 文件


🙏 鸣谢

灵感来自:


💬 问题?

Q: 为什么不用v1? A: v1每次校正需要4-5次手动MCP调用。v2是零接触。

Q: 我需要AgentDB吗? A: 是的,但它是通过自动安装的 npm run setup.

Q: 我的数据是私有的吗? A: 100%本地。所有存储在 ~/.mcp-standards/。没有云。

Q: 如果我想要旧版本怎么办? A: 使用 src/mcp_standards/server.py 而不是 server_simple.py.


🚀 后续步骤

# Try it now
git clone https://github.com/airmcp-com/mcp-standards.git
cd mcp-standards
npm run setup

# See: docs/QUICKSTART_SIMPLE.md

别再重复了。开始自动记忆。 🎯


📦 存档状态

此项目已存档。 看 存档.md 用于:

  • 完整的项目状态和成就
  • 安全审计结果
  • 完整文档索引
  • 经验教训和技术见解
  • 如何将此存储库用作参考

由...制作❤️ 保持简单