Skip to main content
Glama

Cursor10x 记忆系统

使用模型上下文协议 (MCP) 的 Cursor 综合内存系统。

🚀宣布推出 CURSOR10X 系统🚀

利用人工智能驱动的自主系统转变您的开发流程

🔥 Cursor10x 记忆系统现在是完整 Cursor10x 平台的一部分! 🔥

GitHub上探索完整的自主开发生态系统,其特点包括:

📋 任务管理系统- 通过分步任务引导实施🔄 自主记忆- 可记住整个项目的上下文感知 AI📊项目蓝图- 根据您的规范创建的完整技术架构📁 文件/文件夹架构- 使用最佳实践优化的项目结构📘 实施指南- 所有文件和组件的综合文档📝 详细任务- 从项目启动到完成的完整工作流程🔍 基于向量的搜索- 跨代码库和对话进行语义搜索🧩 代码索引- 自动检测和索引代码结构🔎 语义代码检索- 按含义而不是精确匹配查找相关代码🤖 自动代码分析- 使用上下文提取函数、类和变量

生成完整的项目蓝图,包括文件架构、实施指南和完整的任务序列以及已实施的整个 Cursor10x 系统!


概述

Cursor10x 记忆系统为人工智能助手(特别是 Claude)创建了一个持久记忆层,使它们能够保留和回忆:

  • 最近的消息和对话历史记录

  • 当前正在处理的活动文件

  • 重要的项目里程碑和决策

  • 技术要求和规范

  • 按时间顺序排列的动作和事件(情节)

  • 代码库中的代码片段和结构

  • 基于向量嵌入的语义相似内容

  • 通过语义相似性来关联代码片段

  • 具有函数和变量关系的文件结构

该记忆系统弥合了无状态人工智能交互和持续开发工作流程之间的差距,从而提供了更高效、更具情境感知的帮助。

Related MCP server: Knowledge Graph Memory Server

系统架构

记忆系统建立在四个核心组件之上:

  1. MCP 服务器:实现模型上下文协议来注册工具和处理请求

  2. 内存数据库:使用 Turso 数据库进行跨会话的持久存储

  3. 内存子系统:将内存组织成具有不同用途的专用系统

  4. 向量嵌入:将文本和代码转换为用于语义搜索的数字表示

内存类型

该系统实现了四种互补的内存类型:

  1. 短期记忆(STM)

    • 存储最新消息和活动文件

    • 为当前交互提供即时背景

    • 根据新近度和重要性自动确定优先级

  2. 长期记忆(LTM)

    • 存储永久项目信息,如里程碑和决策

    • 保持建筑和设计背景

    • 无限期地保存重要信息

  3. 情景记忆

    • 按时间顺序记录事件

    • 维持动作之间的因果关系

    • 提供项目历史的时间背景

  4. 语义记忆

    • 存储消息、文件和代码片段的向量嵌入

    • 支持基于语义相似性的内容检索

    • 自动索引代码结构以进行上下文检索

    • 跟踪代码组件之间的关系

    • 提供基于相似度的代码库搜索

特征

  • 持久上下文:在多个会话中维护对话和项目上下文

  • 基于重要性的存储:根据可配置的重要性级别对信息进行优先排序

  • 多维记忆:结合短期、长期、情景和语义记忆系统

  • 综合检索:提供来自所有内存子系统的统一上下文

  • 健康监测:包括内置诊断和状态报告

  • 横幅生成:创建用于对话开始的信息上下文横幅

  • 数据库持久性:将所有内存数据存储在 Turso 数据库中,并自动创建模式

  • 向量嵌入:创建文本和代码的数值表示,用于相似性搜索

  • 高级矢量存储:利用 Turso 的 F32_BLOB 和矢量函数实现高效的嵌入存储

  • ANN 搜索:支持近似最近邻搜索,实现快速相似性匹配

  • 代码索引:自动检测和索引代码结构(函数、类、变量)

  • 语义搜索:根据含义而不是精确的文本匹配来查找相关内容

  • 相关性评分:根据与当前查询的相关性对上下文项进行排名

  • 代码结构检测:识别并提取跨多种语言的代码组件

  • 自动嵌入生成:自动为索引内容创建向量嵌入

  • 交叉引用检索:查找不同文件和组件之间的相关代码

安装

先决条件

  • Node.js 18 或更高版本

  • npm 或 yarn 包管理器

  • Turso 数据库帐户

设置步骤

  1. 配置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并注册,然后创建数据库并获取相应的凭证。免费计划足以满足您的项目内存需求。

  1. 配置光标 MCP:

使用数据库 URL 和 turso 身份验证令牌更新项目目录中的.cursor/mcp.json

{
  "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 (字符串,可选):重要性级别(“低”,“中”,“高”,“关键”),默认为“低”

  • 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 (字符串,可选):重要性级别(“低”,“中”,“高”,“关键”),默认为“中”

  • 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 (字符串,可选):重要性级别(“低”,“中”,“高”,“关键”),默认为“低”

  • 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 (字符串,可选):重要性级别(“低”,“中”,“高”,“关键”),默认为“低”

  • 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 (数字,可选):要检索的最大消息数,默认为 10

  • importance (字符串,可选):按重要性级别过滤

返回:

  • 具有状态和消息数组的对象

例子:

// 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 (字符串,可选):重要性级别,默认为“低”

  • 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 (数字,可选):要检索的最大剧集数量,默认为 10

  • context (字符串,可选):按上下文过滤

返回:

  • 具有状态和剧集数组的对象

例子:

// 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

用于管理向量嵌入的统一工具,具有存储、搜索、更新和删除操作。

参数:

  • operation (字符串,必需):要执行的操作(“存储”,“搜索”,“更新”,“删除”)

  • contentId (数字,可选):此向量代表的内容的 ID(用于存储、更新、删除)

  • contentType (字符串,可选):内容类型(“消息”,“文件”,“片段”等)

  • vector (数组,可选):作为数字数组的向量数据(用于存储、更新)或查询向量(用于搜索)

  • vectorId (数字,可选):要更新或删除的矢量的ID

  • limit (数字,可选):搜索操作的最大结果数,默认为 10

  • threshold (数字,可选):搜索操作的相似度阈值,默认为 0.7

  • metadata (对象,可选):关于向量的附加信息

返回:

  • 具有状态和操作结果的对象

例子:

// 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 :引用内容的 ID

    • content_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"
});

故障排除

常见问题

  1. 数据库连接问题

    • 验证您的 Turso 数据库 URL 和身份验证令牌是否正确

    • 检查 Turso 服务的网络连接

    • 验证防火墙设置是否允许连接

  2. 缺失数据

    • 检查数据是否按适当的重要性级别存储

    • 验证检索查询参数(限制、过滤器)

    • 使用mcp_cursor10x_checkHealth()检查数据库健康状况

  3. 性能问题

    • 使用mcp_cursor10x_getMemoryStats()监控内存统计信息

    • 如果数据库变得太大,请考虑归档旧数据

    • 使用更具体的过滤器优化检索

诊断步骤

  1. 检查系统健康状况:

    const health = await mcp_cursor10x_checkHealth({});
    console.log("System Health:", health);
  2. 验证内存统计信息:

    const stats = await mcp_cursor10x_getMemoryStats({});
    console.log("Memory Stats:", stats);
  3. 生成状态横幅:

    const banner = await mcp_cursor10x_generateBanner({});
    console.log("Memory Banner:", banner);

重要性级别

在内存中存储项目时,请使用适当的重要性级别:

  • :一般信息、日常操作、日常对话

  • 中等:有用的上下文、标准工作项目、常规功能

  • :关键决策、主要特征、重要架构元素

  • 关键:核心架构、安全问题、数据完整性问题

执照

麻省理工学院

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aiurda/cursor10x-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server