Cursor集成
你的人工智能不再遗忘。赋予 Cursor 持久记忆。
每个 Cursor 会话都是从头开始的——你的 AI 不会记得它昨天处理过的内容。Claude-mem 改变了这一点。你的代理会随着时间积累关于你的代码库、决策和模式的知识。
- Free to Start
Works with Gemini's free tier (1500 req/day) - no subscription required
- Automatic Capture
MCP tools, shell commands, and file edits logged without effort
- Smart Context
Relevant history injected into every chat session
- Works Everywhere
With or without Claude Code subscription
无需订阅 Claude Code。 使用 Gemini(免费版)或 OpenRouter 作为您的 AI 提供者。
运作方式
Claude-mem 通过本地钩子与 Cursor 集成:
- 会话钩子 捕捉工具使用、文件编辑和 shell 命令
- 人工智能提取 将观察结果压缩为语义摘要
- 上下文注入 将相关历史加载到每个新会话中
- 记忆查看器 在 http://localhost:37777 显示你的知识库
安装路径
选择适合您设置的安装方法:
路径 A:仅Cursor用户(无 Claude Code)
如果你在没有 Claude Code 订阅的情况下使用 Cursor:
# Clone and build
git clone https://github.com/thedotmack/claude-mem.git
cd claude-mem && bun install && bun run build
# Run interactive setup wizard
bun run cursor:setup安装向导将会:
- 检测到你尚未配置 Claude Code
- 帮助你选择和配置免费的 AI 提供商(推荐 Gemini)
- 自动安装钩子
- 启动 Worker 服务
详细指南:
- Gemini Setup - 推荐的免费选项(每天1500次请求)
- OpenRouter Setup - 100 个模型,包括免费选项
路径 B:Claude Code用户
如果你安装了Claude Code:
# Install the plugin (if not already)
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
# Install Cursor hooks
claude-mem cursor install该插件默认使用 Claude 的 SDK,但你可以随时切换到 Gemini 或 OpenRouter。
先决条件
- [Bun](https://bun.sh): `curl -fsSL https://bun.sh/install | bash`
- Cursor IDE
- jq and curl: `brew install jq curl`
- [Bun](https://bun.sh): `curl -fsSL https://bun.sh/install | bash`
- Cursor IDE
- jq and curl: `apt install jq curl` or `dnf install jq curl`
- [Bun](https://bun.sh): `powershell -c "irm bun.sh/install.ps1 | iex"`
- Cursor IDE
- PowerShell 5.1+ (included in Windows 10/11)
- Git for Windows
快速命令参考
安装后,这些命令可以从 claude-mem 目录使用:
| 命令 | 描述 |
|---|---|
bun run cursor:setup | 互动安装向导 |
bun run cursor:install | 安装 Cursor 钩子 |
bun run cursor:uninstall | 移除 Cursor 钩子 |
bun run cursor:status | 检查挂钩安装状态 |
bun run worker:start | 启动 Worker 服务 |
bun run worker:stop | 停止 Worker 服务 |
bun run worker:status | 检查 Worker 状态 |
验证安装
设置完成后,验证一切是否正常工作:
检查工作状态:
bashbun run worker:status检查挂钩安装:
bashbun run cursor:status打开内存查看器: 在浏览器中打开 http://localhost:37777
重启 Cursor 并开始编码会话 - 你应该能看到上下文被捕获
提供商比较
| 提供者 | 费用 | 速率限制 | 最适合 |
|---|---|---|---|
| Gemini | 免费套餐 | 每天1500次请求 | 个人使用,入门 |
| OpenRouter | 按使用付费的免费模型 | 根据模型不同 | 模型多样,高流量 |
| Claude SDK | 随 Claude Code 提供 | 无限 | Claude Code 订阅者 |
建议: 从 Gemini 的免费套餐开始。它能很好地应对常规的个人使用需求。如果你需要更高的使用限额,可以切换到 OpenRouter 或 Claude SDK。
故障排除
工作未启动
# Check if port is in use
lsof -i :37777
# Force restart
bun run worker:stop && bun run worker:start
# Check logs
bun run worker:logs钩子未触发
- 安装后重启 Cursor IDE
- 检查挂钩是否已安装:
bun run cursor:status - 验证 hooks.json 是否存在于
.cursor/目录中
没有出现任何上下文
- 确保Worker 进程正在运行:
bun run worker:status - 检查您是否有观察:访问 http://localhost:37777
- 请验证您的 API 密钥配置是否正确
下一步
- Gemini Setup Guide - 详细的免费层设置
- OpenRouter Setup Guide - 配置 OpenRouter
- Configuration Reference - 所有设置选项
- Troubleshooting - 常见问题及解决方法