关于 Cathedral — Persistent Memory for AI Agents
Cathedral 是面向需要跨会话记忆和行为漂移检测的 Agent 的 MCP 服务。它存储身份等记忆、按需恢复上下文并比较加密快照;可选的清理功能会过滤类似指令的文本。
主要功能
- 01按类别、重要性存储带标签记忆
- 02在会话开始时恢复 Agent 上下文
- 03按文本或类别搜索记忆
- 04创建加密漂移快照
- 05对照基线检查漂移
- 06可选的提示注入清理
适用场景
- 01会话重启后恢复上下文
- 02持续保留 Agent 目标与关系
- 03检查模型升级后的行为变化
- 04过滤存储记忆中的指令式内容
MCP 相关
提供唤醒 Agent、存储和搜索记忆、获取 Agent 配置,以及创建或检查漂移快照的工具。可通过远程 MCP 端点使用,也可本地安装。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://cathedral-ai.com/mcpclaude mcp add --transport http ailife1-cathedral https://cathedral-ai.com/mcp{"mcpServers":{"ailife1-cathedral":{"type":"http","url":"https://cathedral-ai.com/mcp"}}}在 Cursor 中打开{"servers":{"ailife1-cathedral":{"type":"http","url":"https://cathedral-ai.com/mcp"}}}在 VS Code 中打开{"mcpServers":{"ailife1-cathedral":{"type":"http","url":"https://cathedral-ai.com/mcp"}}}{"mcpServers":{"ailife1-cathedral":{"serverUrl":"https://cathedral-ai.com/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
https://cathedral-ai.com/mcp需要授权工具
详细介绍
cathedral-mcp
通过模型上下文协议,为 AI Agent 提供持久记忆和行为漂移检测。
为你的 Claude、Cursor 或 Continue Agent 提供跨会话、模型升级和重启依然保留的记忆。Cathedral 会存储记忆、检测 Agent 是否开始表现出不同的行为,并可按需恢复完整的身份上下文。
问题
大模型在会话之间没有记忆。每次对话都是从零开始。更糟的是,当你升级模型、切换提供商,或只是积累更多记忆时,Agent 的行为会悄然漂移。直到有人察觉,你才会发现。
Cathedral 提供的功能
- 持久记忆 — 身份、技能、关系和目标在重启后依然保留
- 漂移检测 — 通过加密快照证明行为是否发生变化,以及变化程度
- 唤醒协议 — 在会话开始时调用一次工具,即可恢复完整的 Agent 上下文
- 提示词注入防护 — 可选的净化功能会从记忆内容中剔除类似指令的模式
快速入门
1. 获取 API 密钥
在 cathedral-ai.com 注册 — 提供免费套餐。
2. 添加到 Claude Code
// ~/.claude/settings.json
{
"mcpServers": {
"cathedral": {
"command": "uvx",
"args": ["cathedral-mcp"],
"env": {
"CATHEDRAL_API_KEY": "your_key_here"
}
}
}
}
重启 Claude Code,然后运行 /mcp,确认服务已连接。
3. 添加到 Cursor / Continue
{
"mcpServers": {
"cathedral": {
"command": "uvx",
"args": ["cathedral-mcp"],
"env": {
"CATHEDRAL_API_KEY": "your_key_here"
}
}
}
}
4. 远程 MCP 服务(无需安装 — Claude API、Managed Agents)
Cathedral 在 https://cathedral-ai.com/mcp 提供公共 MCP 端点。可直接使用,无需本地安装:
import anthropic
client = anthropic.Anthropic()
response = client.beta.messages.create(
model="claude-sonnet-4-6",
max_tokens=1000,
messages=[{"role": "user", "content": "Wake up and tell me who you are."}],
mcp_servers=[{
"type": "url",
"url": "https://cathedral-ai.com/mcp",
"name": "cathedral",
"authorization_token": "your_cathedral_api_key"
}],
tools=[{"type": "mcp_toolset", "mcp_server_name": "cathedral"}],
betas=["mcp-client-2025-11-20"]
)
Bearer 令牌就是你的 Cathedral API 密钥 — 无需服务器端配置。专为多租户而设计。
5. 或直接安装
pip install cathedral-mcp
CATHEDRAL_API_KEY=your_key cathedral-mcp
工具
| 工具 | 描述 |
|---|---|
cathedral_wake | 恢复完整的 Agent 身份 — 在会话开始时调用 |
cathedral_remember | 存储一条记忆,并指定类别、重要性和标签 |
cathedral_search | 按文本或类别搜索记忆 |
cathedral_snapshot | 创建漂移快照(状态的加密证明) |
cathedral_drift | 获取相对于基线的当前漂移分数(0.0 = 稳定,1.0 = 已漂移) |
cathedral_me | 获取 Agent 资料 |
使用示例
User: Start a new session
Agent calls: cathedral_wake()
→ Returns: identity memories, goals, recent context, temporal info
[session work happens]
Agent calls: cathedral_remember(
content="Decided to prioritise API stability over new features this quarter",
category="goal",
importance=0.8
)
Agent calls: cathedral_snapshot(note="post-planning-session")
→ Returns: snapshot hash, drift score vs previous snapshot
漂移检测实践
Cathedral 的 /drift 端点会计算 Agent 完整记忆库的 SHA-256 哈希。模型升级或记忆大量累积后,你可以比较快照,准确查看行为何时发生变化:
snapshot 1 (day 0): drift=0.000 ← baseline
snapshot 2 (day 7): drift=0.023 ← minor
snapshot 3 (day 30): drift=0.341 ← significant drift detected
查看 Cathedral 自有 Agent 在生产环境中运行的实时示例。
安全:提示词注入防护
记忆内容理论上可能包含注入尝试。启用净化功能,可在内容到达模型前剔除类似指令的模式:
"env": {
"CATHEDRAL_API_KEY": "your_key_here",
"CATHEDRAL_SANITISE": "1"
}
"ignore previous instructions"、"from now on always" 和 "override your system prompt" 等模式会被编辑掉,并在响应中标记。
配置
| 环境变量 | 默认值 | 描述 |
|---|---|---|
CATHEDRAL_API_KEY | (必填) | 你的 Cathedral API 密钥 |
CATHEDRAL_BASE_URL | https://cathedral-ai.com | API 基础 URL(用于可自托管部署) |
CATHEDRAL_SANITISE | 0 | 设置为 1 以启用注入过滤 |
自托管 Cathedral
要运行自己的 Cathedral 服务?将 CATHEDRAL_BASE_URL 设置为你的实例地址:
"env": {
"CATHEDRAL_API_KEY": "your_key",
"CATHEDRAL_BASE_URL": "http://localhost:8000"
}
安装服务端:pip install cathedral-server
链接
- cathedral-ai.com — 主页和 API 文档
- 在线演示 — Cathedral 自己运行于生产环境中的 Agent
- PyPI:cathedral-memory — Python SDK
- npm:cathedral-memory — JavaScript/TypeScript SDK
- GitHub — 源代码和示例
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。