Cairn
Cairn
Cairn 是一个仅追加的类型化事实存储。智能体在一个会话中断言一个事实,并在下一个会话开始时以新鲜度判定召回它。
事实持久化在 SQLite 中。Desk 是可选的。工作通过 JSON 和 MCP 进行。
安装
npx cairn init --project
npx cairn devinit --project 创建 .cairn/cairn.db,接入 Cursor(.cursor/mcp.json),并接入 Pi(.mcp.json)。
无项目文件时的全局安装:
npx cairn initRelated MCP server: identity-storage-mcp
命令
命令 | 用途 |
| 当前仓库中的数据库 + Cursor + Pi MCP 配置 |
| Desk 和 API,端口 4721 |
|
|
| 供智能体使用的 Stdio MCP 服务器 |
| 以 JSON 形式打印实时信念 |
智能体契约
向 POST /api/cairn 发送 JSON,或调用 MCP 工具 cairn_recall 和 cairn_request。
每次写入都携带一个 idempotencyKey。崩溃后重放相同的键和请求体,Cairn 会返回原始结果,而不会写入两次。
Recall 会在每条信念上返回 freshness 和 assurance。根据 response.kind 进行分支。拒绝信息包含 error.remedy.kind。
示例断言
curl -s http://127.0.0.1:4721/api/cairn \
-H 'content-type: application/json' \
-d '{
"kind": "assert",
"idempotencyKey": "s-021-deploy",
"onConflict": "supersede",
"draft": {
"entity": "repo:acme/checkout",
"attribute": "deploy.command",
"value": { "kind": "text", "text": "bin/ship --env staging" },
"provenance": {
"kind": "observed",
"command": "cat Makefile && bin/ship --help",
"session": "s-021"
},
"validity": { "kind": "until-superseded" }
}
}'Harness 插件
Cursor。 在 cairn init --project 之后,.cursor/mcp.json 会包含一个 cairn 服务器,它运行 npx cairn mcp。
Pi。 同样的 init 会为 Pi 和其他 MCP 客户端写入 .mcp.json。Pi 会读取 .mcp.json 以及诸如 cursor 的宿主导入。
Desk 和 Canvas
打开 Desk(/)可查看信念表和智能体 API 控制台。打开 Canvas(/canvas)可将每个智能体或会话视为一个可拖拽容器,其中包含它们贡献的事实。
智能体按 provenance.by 分组以显示被告知的事实,按 provenance.session 分组以显示观察或推断的事实。拖拽 pod 来排列画板;布局会持久化在 .cairn/canvas.json 中。
从 npm 发布和安装
npm publish
npx cairn init --project
npx cairn dev发布的 tarball 包含完整的 Desk、Canvas、API、CLI 和 MCP 服务器。需要 Node 20+。
开发
npm install
npm test
npm run dev当该目录存在时,数据库路径解析为 ./.cairn/cairn.db,否则为 ~/.cairn/cairn.db。可使用 CAIRN_HOME 或 CAIRN_DB_PATH 覆盖。
发布预告片(Remotion)
一个约 30 秒的 X 产品预告片位于 cairn-trailer/。在该文件夹内使用 npm run dev 预览,或渲染:
cd cairn-trailer
npx remotion render CairnTrailer out/cairn-v0.4-trailer.mp4建议的帖子文案见 cairn-trailer/x-post-draft.md。
Cairn 拒绝什么
自由格式的 JSON 值。
语义搜索。
就地编辑事实。
在请求进行中等待人类。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides a memory layer for personal agents, enabling MCP-compatible agents to store and query profile, factual, episodic, and procedural memory.MIT
- AlicenseAqualityBmaintenanceProvides persistent, inspectable memory storage for AI agents using SQLite. Agents can store, recall, and search memories across sessions via three MCP tools.3MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that gives agents persistent memory with namespaced facts, tags, full-text search, and TTL expiry, all running locally on SQLite with zero external dependencies.1MIT
- AlicenseNot gradedqualityFmaintenanceLocal-first, auditable memory for AI agents. Provides durable context for MCP hosts with SQLite storage, CLI, and MCP tools for memory management.2Apache 2.0
Related MCP Connectors
Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
Cross-vendor AI memory over MCP. One semantic store, readable and writeable from every MCP client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/QuarkOS/Cairn'
If you have feedback or need assistance with the MCP directory API, please join our Discord server