Cursor10x忆系统
Cursor10x内存系统为AI助手(特别是Claude)创建了一个持久化内存层,使它们能够自主地保留和回忆短期、长期和情景记忆。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"cursor10x-mcp": {
"args": [
"cursor10x-mcp"
],
"command": "npx",
"enabled": true,
"env": {
"TURSO_AUTH_TOKEN": "your-turso-auth-token",
"TURSO_DATABASE_URL": "your-turso-database-url"
}
}
}
}
该服务需要配置环境变量:MCP_LOG_LEVEL、MCP_PORT、TURSO_AUTH_TOKEN、TURSO_DATABASE_URL
服务介绍
Cursor10x Memory System
Cursor 使用 Model Context Protocol (MCP) 的全面记忆系统。
🚀 宣布 CURSOR10X 系统 🚀
用 AI 驱动的自主系统改变您的开发流程
🔥 Cursor10x 记忆系统现在已成为完整的 Cursor10x 平台的一部分! 🔥
在 GitHub 上发现完整的自主开发生态系统,特色包括:
📋 任务管理系统 - 通过分步任务进行指导性实现
🔄 自主记忆 - 能记住您整个项目的上下文感知 AI
📊 项目蓝图 - 根据您的规范创建完整的技术架构
📁 文件/文件夹结构 - 采用最佳实践优化的项目结构
📘 实现指南 - 所有文件和组件的综合文档
📝 详细任务 - 从项目启动到完成的完整工作流程
🔍 基于向量的搜索 - 在您的代码库和对话中进行语义搜索
🧩 代码索引 - 自动检测和索引代码结构
🔎 语义代码检索 - 根据含义而不是精确匹配查找相关代码
🤖 自动代码分析 - 提取带有上下文的函数、类和变量
生成包含文件结构、实现指南以及完整任务序列的完整项目蓝图,并且整个 Cursor10x 系统已经实现!
概览
Cursor10x 记忆系统为 AI 助手(特别是 Claude)创建了一个持久的记忆层,使它们能够保留和回忆:
- 最近的消息和对话历史
- 当前正在处理的活动文件
- 重要的项目里程碑和决策
- 技术要求和规格
- 按时间顺序排列的动作和事件序列(片段)
- 来自您的代码库的代码片段和结构
- 基于向量嵌入的语义相似内容
- 通过语义相似性相关的代码片段
- 包含函数和变量关系的文件结构
这种内存系统弥合了无状态AI交互与持续开发工作流之间的差距,允许提供更高效且上下文感知的辅助。
系统架构
该内存系统建立在四个核心组件之上:
- MCP 服务器:实现模型上下文协议以注册工具和处理请求
- 内存数据库:使用 Turso 数据库进行会话间的持久化存储
- 内存子系统:将内存组织成具有不同用途的专业系统
- 向量嵌入:将文本和代码转换为数值表示,以便进行语义搜索
内存类型
该系统实现了四种互补的内存类型:
-
短期记忆 (STM)
- 存储最近的消息和活动文件
- 为当前交互提供即时上下文
- 根据时间和重要性自动优先排序
-
长期记忆 (LTM)
- 存储永久性的项目信息,如里程碑和决策
- 维护架构和设计上下文
- 永久保存高重要性信息
-
情景记忆
- 记录事件的时间序列
- 维护动作之间的因果关系
- 为项目历史提供时间上的上下文
-
语义记忆
- 存储消息、文件和代码片段的向量嵌入
- 基于语义相似性启用内容检索
- 自动索引代码结构以进行上下文检索
- 跟踪代码组件之间的关系
- 提供整个代码库中的基于相似性的搜索
功能
- 持久化上下文: 在多个会话中保持对话和项目上下文
- 基于重要性的存储: 根据可配置的重要性级别优先处理信息
- 多维度记忆: 结合短期、长期、情景和语义记忆系统
- 全面检索: 从所有记忆子系统提供统一的上下文
- 健康监控: 包括内置诊断和状态报告
- 横幅生成: 为对话开始创建信息性上下文横幅
- 数据库持久化: 将所有记忆数据存储在 Turso 数据库中,并自动创建模式
- 向量嵌入: 为文本和代码创建数值表示,以便进行相似性搜索
- 高级向量存储: 利用 Turso 的 F32_BLOB 和向量函数高效存储嵌入
- 近似最近邻搜索: 支持快速相似性匹配的近似最近邻搜索
- 代码索引: 自动检测并索引代码结构(函数、类、变量)
- 语义搜索: 基于意义而不是精确文本匹配查找相关内容
- 相关性评分: 根据与当前查询的相关性对上下文项进行排名
- 代码结构检测: 跨多种语言识别并提取代码组件
- 自动嵌入生成: 为已索引的内容自动生成向量嵌入
- 交叉引用检索: 查找不同文件和组件中的相关代码
安装
先决条件
- Node.js 18 或更高版本
- npm 或 yarn 包管理器
- Turso 数据库账号
设置步骤
- 配置 Turso 数据库:
# Install Turso CLI
curl -sSfL https://get.turso.tech/install.sh | bash
# Login to Turso
turso auth login
# Create a database
turso db create cursor10x-mcp
# Get database URL and token
turso db show cursor10x-mcp --url
turso db tokens create cursor10x-mcp
或者你可以访问 Turso 并注册然后继续创建数据库并获取正确的凭据。免费计划将足以覆盖你的项目内存需求。
- 配置 Cursor MCP:
在你的项目目录中更新 .cursor/mcp.json 文件,填入数据库 URL 和 Turso 认证令牌:
{
"mcpServers": {
"cursor10x-mcp": {
"command": "npx",
"args": ["cursor10x-mcp"],
"enabled": true,
"env": {
"TURSO_DATABASE_URL": "your-turso-database-url",
"TURSO_AUTH_TOKEN": "your-turso-auth-token"
}
}
}
}
工具文档
系统工具
mcp_cursor10x_initConversation
通过在一个操作中存储用户消息、生成横幅并检索上下文来初始化对话。这个统一的工具取代了每次对话开始时分别调用 generateBanner, getComprehensiveContext, 和 storeUserMessage 的需要。
参数:
content(字符串, 必需): 用户消息的内容importance(字符串, 可选): 重要性级别 ("low", "medium", "high", "critical"),默认为 "low"metadata(对象, 可选): 消息的额外元数据
返回:
- 包含两个部分的对象:
display: 包含要显示给用户的横幅internal: 包含供代理使用的全面上下文
示例:
// Initialize a conversation
const result = await mcp_cursor10x_initConversation({
content: "I need to implement a login system for my app",
importance: "medium"
});
// Result: {
// "status": "ok",
// "display": {
// "banner": {
// "status": "ok",
// "memory_system": "active",
// "mode": "turso",
// "message_count": 42,
// "active_files_count": 3,
// "last_accessed": "4/15/2023, 2:30:45 PM"
// }
// },
// "internal": {
// "context": { ... comprehensive context data ... },
// "messageStored": true,
// "timestamp": 1681567845123
// }
// }
mcp_cursor10x_endConversation
通过一次调用结合多个操作来结束对话:存储助手的最后一条消息、记录所完成事项的里程碑、并在情景记忆中记录一个片段。这个统一的工具取代了在每次对话结束时分别调用 storeAssistantMessage、storeMilestone 和 recordEpisode 的需要。
参数:
content(字符串, 必需): 助手最后一条消息的内容milestone_title(字符串, 必需): 要记录的里程碑标题milestone_description(字符串, 必需): 所完成事项的描述importance(字符串, 可选): 重要性级别 ("low", "medium", "high", "critical"),默认为 "medium"metadata(对象, 可选): 所有记录的额外元数据
返回:
- 包含每个操作的状态和结果的对象
示例:
// End a conversation with finalization steps
const result = await mcp_cursor10x_endConversation({
content: "I've implemented the authentication system with JWT tokens as requested",
milestone_title: "Authentication Implementation",
milestone_description: "Implemented secure JWT-based authentication with refresh tokens",
importance: "high"
});
// Result: {
// "status": "ok",
// "results": {
// "assistantMessage": {
// "stored": true,
// "timestamp": 1681568500123
// },
// "milestone": {
// "title": "Authentication Implementation",
// "stored": true,
// "timestamp": 1681568500123
// },
// "episode": {
// "action": "completion",
// "stored": true,
// "timestamp": 1681568500123
// }
// }
// }
mcp_cursor10x_checkHealth
检查记忆系统及其数据库连接的健康状况。
参数:
- 不需要任何参数
返回:
- 包含健康状态和诊断信息的对象
示例:
// Check memory system health
const health = await mcp_cursor10x_checkHealth({});
// Result: {
// "status": "ok",
// "mode": "turso",
// "message_count": 42,
// "active_files_count": 3,
// "current_directory": "/users/project",
// "timestamp": "2023-04-15T14:30:45.123Z"
// }
mcp_cursor10x_getMemoryStats
检索关于记忆系统的详细统计信息。
参数:
- 不需要任何参数
返回:
- 包含全面记忆统计信息的对象
示例:
// Get memory statistics
const stats = await mcp_cursor10x_getMemoryStats({});
// Result: {
// "status": "ok",
// "stats": {
// "message_count": 42,
// "active_file_count": 3,
// "milestone_count": 7,
// "decision_count": 12,
// "requirement_count": 15,
// "episode_count": 87,
// "oldest_memory": "2023-03-10T09:15:30.284Z",
// "newest_memory": "2023-04-15T14:30:45.123Z"
// }
// }
mcp_cursor10x_getComprehensiveContext
从所有记忆子系统中检索统一的情景,包括短期记忆、长期记忆和情景记忆。
参数:
- 不需要任何参数
返回:
- 来自所有记忆系统的合并上下文对象
示例:
// Get comprehensive context
const context = await mcp_cursor10x_getComprehensiveContext({});
// Result: {
// "status": "ok",
// "context": {
// "shortTerm": {
// "recentMessages": [...],
// "activeFiles": [...]
// },
// "longTerm": {
// "milestones": [...],
// "decisions": [...],
// "requirements": [...]
// },
// "episodic": {
// "recentEpisodes": [...]
// },
// "system": {
// "healthy": true,
// "timestamp": "2023-04-15T14:30:45.123Z"
// }
// }
// }
短期记忆工具
mcp_cursor10x_storeUserMessage
在短期记忆系统中存储用户消息。
参数:
content(字符串, 必需): 消息内容importance(字符串, 可选): 重要性级别 ("low", "medium", "high", "critical"),默认为 "low"metadata(对象, 可选): 消息的额外元数据
返回:
- 包含状态和时间戳的对象
示例:
// Store a user message
const result = await mcp_cursor10x_storeUserMessage({
content: "We need to implement authentication for our API",
importance: "high",
metadata: {
topic: "authentication",
priority: 1
}
});
// Result: {
// "status": "ok",
// "timestamp": 1681567845123
// }
mcp_cursor10x_storeAssistantMessage
在短期记忆系统中存储助手消息。
参数:
content(字符串, 必需): 消息内容importance(字符串, 可选): 重要性级别 ("low", "medium", "high", "critical"),默认为 "low"metadata(对象, 可选): 消息的额外元数据
返回:
- 包含状态和时间戳的对象
示例:
// Store an assistant message
const result = await mcp_cursor10x_storeAssistantMessage({
content: "I recommend implementing JWT authentication with refresh tokens",
importance: "medium",
metadata: {
topic: "authentication",
contains_recommendation: true
}
});
// Result: {
// "status": "ok",
// "timestamp": 1681567870456
// }
mcp_cursor10x_trackActiveFile
跟踪用户正在访问或修改的活动文件。
参数:
filename(字符串, 必需): 正在跟踪的文件路径action(字符串, 必需): 对文件执行的操作 (打开、编辑、关闭等)metadata(对象, 可选): 跟踪事件的额外元数据
返回:
- 包含状态、文件名、操作和时间戳的对象
示例:
// Track an active file
const result = await mcp_cursor10x_trackActiveFile({
filename: "src/auth/jwt.js",
action: "edit",
metadata: {
changes: "Added refresh token functionality"
}
});
// Result: {
// "status": "ok",
// "filename": "src/auth/jwt.js",
// "action": "edit",
// "timestamp": 1681567900789
// }
mcp_cursor10x_getRecentMessages
从短期记忆中检索最近的消息。
参数:
limit(数字, 可选): 要检索的消息的最大数量,默认为 10importance(字符串, 可选): 按重要性级别筛选
返回:
- 包含状态和消息数组的对象
示例:
// Get recent high importance messages
const messages = await mcp_cursor10x_getRecentMessages({
limit: 5,
importance: "high"
});
// Result: {
// "status": "ok",
// "messages": [
// {
// "id": 42,
// "role": "user",
// "content": "We need to implement authentication for our API",
// "created_at": "2023-04-15T14:30:45.123Z",
// "importance": "high",
// "metadata": {"topic": "authentication", "priority": 1}
// },
// ...
// ]
// }
mcp_cursor10x_getActiveFiles
从短期记忆中检索活动文件。
参数:
limit(数字, 可选): 要检索的文件的最大数量,默认为 10
返回:
- 包含状态和活动文件数组的对象
示例:
// Get recent active files
const files = await mcp_cursor10x_getActiveFiles({
limit: 3
});
// Result: {
// "status": "ok",
// "files": [
// {
// "id": 15,
// "filename": "src/auth/jwt.js",
// "last_accessed": "2023-04-15T14:30:45.123Z",
// "metadata": {"changes": "Added refresh token functionality"}
// },
// ...
// ]
// }
长期记忆工具
mcp_cursor10x_storeMilestone
在长期记忆中存储项目里程碑。
参数:
title(字符串, 必需): 里程碑的标题description(字符串, 必需): 里程碑的描述importance(字符串, 可选): 重要性级别,默认为 "medium"metadata(对象, 可选): 里程碑的附加元数据
返回:
- 包含状态、标题和时间戳的对象
示例:
// Store a project milestone
const result = await mcp_cursor10x_storeMilestone({
title: "Authentication System Implementation",
description: "Implemented JWT authentication with refresh tokens and proper error handling",
importance: "high",
metadata: {
version: "1.0.0",
files_affected: ["src/auth/jwt.js", "src/middleware/auth.js"]
}
});
// Result: {
// "status": "ok",
// "title": "Authentication System Implementation",
// "timestamp": 1681568000123
// }
mcp_cursor10x_storeDecision
在长期记忆中存储项目决策。
参数:
title(字符串, 必需): 决策的标题content(字符串, 必需): 决策的内容reasoning(字符串, 可选): 决策背后的理由importance(字符串, 可选): 重要性级别,默认为 "medium"metadata(对象, 可选): 决策的附加元数据
返回:
- 包含状态、标题和时间戳的对象
示例:
// Store a project decision
const result = await mcp_cursor10x_storeDecision({
title: "JWT for Authentication",
content: "Use JWT tokens for API authentication with refresh token rotation",
reasoning: "JWTs provide stateless authentication with good security and performance characteristics",
importance: "high",
metadata: {
alternatives_considered: ["Session-based auth", "OAuth2"],
decision_date: "2023-04-15"
}
});
// Result: {
// "status": "ok",
// "title": "JWT for Authentication",
// "timestamp": 1681568100456
// }
mcp_cursor10x_storeRequirement
在长期记忆中存储项目需求。
参数:
title(字符串, 必需): 需求的标题content(字符串, 必需): 需求的内容importance(字符串, 可选): 重要性级别,默认为 "medium"metadata(对象, 可选): 需求的附加元数据
返回:
- 包含状态、标题和时间戳的对象
示例:
// Store a project requirement
const result = await mcp_cursor10x_storeRequirement({
title: "Secure Authentication",
content: "System must implement secure authentication with password hashing, rate limiting, and token rotation",
importance: "critical",
metadata: {
source: "security audit",
compliance: ["OWASP Top 10", "GDPR"]
}
});
// Result: {
// "status": "ok",
// "title": "Secure Authentication",
// "timestamp": 1681568200789
// }
情景记忆工具
mcp_cursor10x_recordEpisode
在情景记忆中记录一个事件(动作)。
参数:
actor(字符串, 必需): 执行动作的行为者(用户、助手、系统)action(字符串, 必需): 执行的动作类型content(字符串, 必需): 动作的内容或细节importance(字符串, 可选): 重要性级别,默认为 "low"context(字符串, 可选): 事件的情境
返回:
- 包含状态、行为者、动作和时间戳的对象
示例:
// Record an episode
const result = await mcp_cursor10x_recordEpisode({
actor: "assistant",
action: "implementation",
content: "Created JWT authentication middleware with token verification",
importance: "medium",
context: "authentication"
});
// Result: {
// "status": "ok",
// "actor": "assistant",
// "action": "implementation",
// "timestamp": 1681568300123
// }
mcp_cursor10x_getRecentEpisodes
从情景记忆中检索最近的事件。
参数:
limit(数字, 可选): 要检索的事件的最大数量,默认为 10context(字符串, 可选): 按情境筛选
返回:
- 包含状态和事件数组的对象
示例:
// Get recent episodes in the authentication context
const episodes = await mcp_cursor10x_getRecentEpisodes({
limit: 5,
context: "authentication"
});
// Result: {
// "status": "ok",
// "episodes": [
// {
// "id": 87,
// "actor": "assistant",
// "action": "implementation",
// "content": "Created JWT authentication middleware with token verification",
// "timestamp": "2023-04-15T14:45:00.123Z",
// "importance": "medium",
// "context": "authentication"
// },
// ...
// ]
// }
基于向量的记忆工具
mcp_cursor10x_manageVector
注意到原文档中的最后一部分没有提供完整信息,因此翻译也保留了这部分未完成的状态。如果有更多关于mcp_cursor10x_manageVector的信息,请提供以便继续翻译。
统一的工具用于管理向量嵌入,支持存储、搜索、更新和删除操作。
参数:
operation(字符串, 必填): 要执行的操作 ("store", "search", "update", "delete")contentId(数字, 可选): 该向量所代表的内容ID (用于存储、更新、删除)contentType(字符串, 可选): 内容类型 ("message", "file", "snippet" 等)vector(数组, 可选): 作为数字数组的向量数据 (用于存储、更新) 或查询向量 (用于搜索)vectorId(数字, 可选): 要更新或删除的向量IDlimit(数字, 可选): 搜索操作的最大结果数,默认为10threshold(数字, 可选): 搜索操作的相似度阈值,默认为0.7metadata(对象, 可选): 关于向量的额外信息
返回:
- 包含状态和操作结果的对象
示例:
// Store a vector embedding
const result = await mcp_cursor10x_manageVector({
operation: "store",
contentId: 42,
contentType: "message",
vector: [0.1, 0.2, 0.3, ...], // 128-dimensional vector
metadata: {
topic: "authentication",
language: "en"
}
});
// Result: {
// "status": "ok",
// "operation": "store",
// "vectorId": 15,
// "timestamp": 1681570000123
// }
// Search for similar vectors
const searchResult = await mcp_cursor10x_manageVector({
operation: "search",
vector: [0.1, 0.2, 0.3, ...], // query vector
contentType: "snippet", // optional filter
limit: 5,
threshold: 0.8
});
// Result: {
// "status": "ok",
// "operation": "search",
// "results": [
// {
// "vectorId": 10,
// "contentId": 30,
// "contentType": "snippet",
// "similarity": 0.92,
// "metadata": { ... }
// },
// ...
// ]
// }
数据库模式
记忆系统会自动创建并维护以下数据库表:
-
messages: 存储用户和助手的消息id: 唯一标识符timestamp: 创建时间戳role: 消息角色(用户/助手)content: 消息内容importance: 重要性级别archived: 消息是否已归档
-
active_files: 跟踪文件活动id: 唯一标识符filename: 文件路径action: 最后执行的操作last_accessed: 上次访问的时间戳
-
milestones: 记录项目里程碑id: 唯一标识符title: 里程碑标题description: 详细描述timestamp: 创建时间戳importance: 重要性级别
-
decisions: 存储项目决策id: 唯一标识符title: 决策标题content: 决策内容reasoning: 决策理由timestamp: 创建时间戳importance: 重要性级别
-
requirements: 维护项目需求id: 唯一标识符title: 需求标题content: 需求内容timestamp: 创建时间戳importance: 重要性级别
-
episodes: 记录动作和事件id: 唯一标识符timestamp: 创建时间戳actor: 执行动作的参与者action: 动作类型content: 动作详情importance: 重要性级别context: 动作上下文
-
vectors: 存储用于语义搜索的向量嵌入id: 唯一标识符content_id: 引用内容的IDcontent_type: 内容类型(消息、文件、代码片段)vector: 嵌入向量的二进制表示metadata: 向量的附加元数据
-
code_files: 跟踪索引的代码文件id: 唯一标识符file_path: 文件路径language: 编程语言last_indexed: 上次索引的时间戳metadata: 文件的附加元数据
-
code_snippets: 存储提取的代码结构id: 唯一标识符file_id: 父文件的引用start_line: 开始行号end_line: 结束行号symbol_type: 代码结构类型(函数、类、变量)content: 代码片段内容
示例工作流程
优化对话启动
// Initialize conversation with a single tool call
// This replaces the need for three separate calls at the start of the conversation
const result = await mcp_cursor10x_initConversation({
content: "I need help implementing authentication in my React app",
importance: "high"
});
// Display the banner to the user
console.log("Memory System Status:", result.display.banner);
// Use the context internally (do not show to user)
const context = result.internal.context;
// Use context for more informed assistance
开启新会话(替代方法)
// Generate a memory banner at the start
mcp_cursor10x_generateBanner({})
// Get comprehensive context
mcp_cursor10x_getComprehensiveContext({})
// Store the user message
mcp_cursor10x_storeUserMessage({
content: "I need help with authentication",
importance: "high"
})
跟踪用户活动
// Track an active file
await mcp_cursor10x_trackActiveFile({
filename: "src/auth/jwt.js",
action: "edit"
});
故障排除
常见问题
-
数据库连接问题
- 确认您的 Turso 数据库 URL 和认证令牌是否正确
- 检查到 Turso 服务的网络连接
- 确认防火墙设置允许该连接
-
数据缺失
- 检查数据是否以适当的优先级存储
- 验证检索查询参数(如限制、过滤器)
- 使用
mcp_cursor10x_checkHealth()检查数据库健康状况
-
性能问题
- 使用
mcp_cursor10x_getMemoryStats()监控内存统计信息 - 如果数据库变得太大,考虑归档旧数据
- 通过使用更具体的过滤器来优化检索
- 使用
诊断步骤
-
检查系统健康状态:
const health = await mcp_cursor10x_checkHealth({}); console.log("System Health:", health); -
验证内存统计信息:
const stats = await mcp_cursor10x_getMemoryStats({}); console.log("Memory Stats:", stats); -
生成状态横幅:
const banner = await mcp_cursor10x_generateBanner({}); console.log("Memory Banner:", banner);
重要性级别
在内存中存储项目时,请使用适当的重要性级别:
- low:一般信息、常规操作、日常对话
- medium:有用的上下文、标准工作项、常规功能
- high:关键决策、主要功能、重要的架构元素
- critical:核心架构、安全问题、数据完整性问题
许可证
MIT