As AI-assisted software development grows in popularity, a key challenge has emerged: how to enable AI coding assistants to have the same cross-session "memory" as a human developer, remembering and applying a project's coding specifications, preferences, particular processes, and even requirements details. Currently, the popular AI integrated development environments (IDEs) Cursor
A perfect memory solution has not yet been provided.
A recent study utilizing the open-source temporal mapping framework Graphiti
as well as MCP
(Model Context Protocol) The server is Cursor IDE
The attempt to add persistent memory capabilities opens up new possibilities to address this pain point. This integration allows Cursor
The AI assistant inside can efficiently store, manage and recall information, promising to handle more complex development tasks.
Why are lasting memories critical?
The lack of memory capabilities across sessions means that AI programming assistants may need to re-acquire contextual information for each interaction or new development session. This not only reduces efficiency, but also limits its ability to handle complex projects and long-term tasks. Persistent memory allows AI to:
- Maintaining consistency: Ensure that the same coding standards and developer preferences are followed throughout the project cycle.
- context: Better understanding of long-term project requirements and evolving technical specifications.
- Handling complex tasks: Perform more complex, multi-step development tasks based on historical interactions and project knowledge.
Empowering AI programming assistants with reliable memory is a key step in their evolution from simple code-completion tools to truly intelligent development partners.
Demystifying MCP and Graphiti
MCP
, or Model Context Protocol, is a protocol designed to facilitate AI applications (MCP
client) with external resources (MCP
(servers) an open standard for structured interactions between AI models. It allows AI models to access external data or tools, breaking through the limitations of static training data. In this integration, theGraphiti
play the role of MCP
server, and the Cursor IDE
failing agreement MCP
Client.
Graphiti
is a framework for constructing and querying temporal-aware knowledge graphs, especially for AI intelligences operating in dynamic environments. Unlike traditional retrieval-augmented generation (RAG) approaches that rely heavily on static or batch-updated vector databases, theGraphiti
Continuously integrate user interactions, structured and unstructured enterprise data, and external information into a coherent, queryable graph. The framework supports incremental data updates, efficient retrieval, and accurate historical state queries without the need to completely recompute the entire graph, making it ideal for developing interactive, context-aware AI applications.
Graphiti
The team released an experimental MCP
servers, exposing their framework capabilities as tools to AI intelligences (such as the Cursor
Agent) is called directly. Given that the Cursor
popularity in the development community as well as the team's own experience with it, choose the Cursor
to demonstrate MCP
Integration is a natural choice.
Customize Graphiti to fit Cursor
Graphiti
One feature is to allow the use of rich, domain-specific data structures by customizing entity definitions, replacing generic graph nodes with concrete models. For example, in the case with Cursor IDE
Integration scenarios can define a Requirement
(demand) entities:
from pydantic import BaseModel, Field
class Requirement(BaseModel):
"""需求代表了产品或服务必须满足的特定需要、特性或功能。
始终确保在需求和其所属项目之间创建一条边,并在边上明确指出该需求是一个 requirement。
识别和提取需求的说明:
1. 寻找明确的需求或必要性陈述(“我们需要X”,“X是必需的”,“X必须有Y”)。
2. 识别描述系统应做什么的功能规范。
3. 注意非功能性需求,如性能、安全或可用性。
4. 提取必须遵守的约束或限制。
5. 关注清晰、具体、可衡量的需求,而不是模糊的愿望。
6. 如果提到优先级或重要性(“关键”、“高优先级”等),则捕获它们。
7. 包括需求之间的明确依赖关系。
8. 保留原始意图和范围。
9. 根据领域或功能进行适当分类。
"""
project_name: str = Field(
...,
description='需求所属项目的名称。',
)
description: str = Field(
...,
description='需求的描述。仅使用上下文中提到的信息来编写此描述。',
)
This structured approach allows Cursor
Ability to accurately store project requirements in Graphiti
in the knowledge graph and retrieve it when needed.
Integration Implementation Steps
commander-in-chief (military) Graphiti
(used form a nominal expression) MCP
Server integration into Cursor IDE
to provide a memory function, which is mainly realized by the following steps:
- configure: Will
Cursor IDE
Configured to connect to theGraphiti MCP
server-basedMCP
client to establish a direct interaction channel. Detailed configuration can be found in theGraphiti MCP
ReadMe documents. - Customized entity definitions: in
Graphiti
Define custom entities that represent project specifications, coding standards, etc. in theRequirement
(Demand),Preference
(Preference),Procedure
(process), etc. - Real-time data updates: Instructions
Cursor
The assistant is inGraphiti
Adding and updating entities in the Knowledge Graph. For example, when a developer changes the UI framework preferences from theChakra UI
change toShadCN
When the change is made, this change is immediately reflected in the atlas, accompanied by time-series metadata that records the time of the change. - Pre-action search: Instructions
Cursor
The assistant queries before performing the operationGraphiti
, to retrieve stored preferences, needs, and processes. This information can be kept persistent across sessions and even across projects.
A related project provides a demo video that shows the Cursor
How does Agent utilize Graphiti MCP
server to manage and recall project requirements and developer preferences.
Potential impacts and next steps
this work Cursor
together with Graphiti MCP
integration, demonstrating an effective way to endow AI coding assistants with persistent, structured memories. While Graphiti
(used form a nominal expression) MCP
The server is still in the experimental stage, but it foreshadows the possible future direction of AI-assisted development tools - AI not only understands the current instructions, but also provides smarter, more personalized assistance based on accumulated knowledge and context. This is expected to significantly improve development efficiency and enable AI to participate in longer-term, more complex software engineering tasks.
right Graphiti
Framework or MCP
Developers interested in integration can further explore the following resources:
Graphiti
GitHub Repositories: https://github.com/getzep/graphitiMCP
Server Documentation: https://github.com/getzep/graphiti/blob/main/mcp_server/README.mdZep
related research papers (arXiv): Zep: A Temporal Knowledge Graph Architecture for Agent Memory