Skip to main content
Glama

Cairn

Cairn 是一个仅追加的类型化事实存储。智能体在一个会话中断言一个事实,并在下一个会话开始时以新鲜度判定召回它。

事实持久化在 SQLite 中。Desk 是可选的。工作通过 JSON 和 MCP 进行。

安装

npx cairn init --project
npx cairn dev

init --project 创建 .cairn/cairn.db,接入 Cursor(.cursor/mcp.json),并接入 Pi(.mcp.json)。

无项目文件时的全局安装:

npx cairn init

Related MCP server: identity-storage-mcp

命令

命令

用途

cairn init --project

当前仓库中的数据库 + Cursor + Pi MCP 配置

cairn dev

Desk 和 API,端口 4721

cairn start

npm run build 之后的生产服务器

cairn mcp

供智能体使用的 Stdio MCP 服务器

cairn recall

以 JSON 形式打印实时信念

智能体契约

POST /api/cairn 发送 JSON,或调用 MCP 工具 cairn_recallcairn_request

每次写入都携带一个 idempotencyKey。崩溃后重放相同的键和请求体,Cairn 会返回原始结果,而不会写入两次。

Recall 会在每条信念上返回 freshnessassurance。根据 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_HOMECAIRN_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 值。

语义搜索。

就地编辑事实。

在请求进行中等待人类。

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    C
    maintenance
    An 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.
    1
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Local-first, auditable memory for AI agents. Provides durable context for MCP hosts with SQLite storage, CLI, and MCP tools for memory management.
    2
    Apache 2.0

View all related MCP servers

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.

View all MCP Connectors

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/QuarkOS/Cairn'

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