
Cairn
io.github.jasondostal由 GitHub 帳號 jasondostal 發布v0.21.2更新於 Oct 27, 2026
Persistent memory for AI agents and humans. Store, search, and discover patterns.
發布方自己的服務:Cairn.ink Memory
概覽
自架的持久記憶伺服器,讓助理跨工作階段、跨專案儲存、搜尋與回想決策、事實與模式。
- 可以做什麼
- 儲存、搜尋與回想記憶,融合向量、關鍵字、時效與標籤排序,並支援時間篩選
- 以規則、近期活動、信念與未完成工作開啟工作階段,並管理信念與工作記憶
- 建立、認領與完成工作項目,管理專案文件
- 執行程式碼結構查詢(相依者、呼叫者、影響範圍、死程式碼、複雜度)並檢查架構規則
- 修改、整併與匯入記憶,並記錄結構化的思考序列
- 適用情境
- 適合需要助理在工作階段之間、跨專案記住決策與事實的情況,或想採用自架記憶層(可選知識圖譜與程式碼智慧)而非託管服務時。
- 執行需求
- 以本機程序(容器映像)執行,需要搭配 pgvector 的 PostgreSQL,知識圖譜可選用 Neo4j;README 描述的是四容器 Docker Compose 部署。需要 CAIRN_DB_HOST 與密鑰 CAIRN_DB_PASS;CAIRN_LLM_BACKEND 選擇 ollama 或 bedrock 用於增強,屬選用項目。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Cairn,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[Cairn — persistent memory for agents and humans]
[Release] [License] [MCP] [PostgreSQL]
[!IMPORTANT] Cairn is retired, and this repository is archived (read-only). Its successor is rill — a faster, leaner, MCP-native memory server written in Go that learned from everything Cairn got right (and the things it got wrong). Cairn was the first; rill is where the work continues. This repo stays up as a read-only archive — explore it, fork it, but new development lives in rill.
A self-hosted persistent memory platform for AI agents and humans. Store something once, find it later, across sessions, across projects. Four containers. docker compose up. Done.
Cairn is the memory brain. Your agent runtime handles execution — Cairn handles knowing. What decisions were made, what facts are known, what patterns emerge across projects.
It's built for the systems person. The curious. The t-shaped. The ones who need a memory that works the way they do, across everything, all at once.
Quick Start
1. Pull and run
Four containers start:
- cairn on port 8000 (MCP server + REST API)
- cairn-ui on port 3000 (web dashboard)
- cairn-db (PostgreSQL 16 + pgvector)
- cairn-graph (Neo4j 5, knowledge graph)
Migrations run on first boot. Ready in about a minute.
2. Connect your IDE
Add this to your MCP config:
Where that goes:
Or run the setup wizard — it walks you through everything: LLM backend, database, embeddings, auth, and IDE configuration:
Pick a tier (local dev, recommended, enterprise, or custom) and the wizard collects only what that tier needs. Supports --dry-run and --non-interactive for CI.
3. Use it
Tell your agent to remember something:
"Remember that we chose PostgreSQL for storage because it handles hybrid search without a separate vector DB."
Search for it later:
"What did we decide about the storage layer?"
That's it. 11 tools available. The ones you'll use most:
The rest: modify, insights, think, status, consolidate, ingest.
What's in the box
Memory that persists across sessions. Your agent makes a decision at 2am. Next morning, different session, it finds that decision. That's the core. Bi-temporal tracking separates when something happened (event_at) from when you learned it (created_at). Memories that go unaccessed decay naturally; important ones are protected. Related memories get consolidated into higher-order insights automatically.
Beliefs. Durable epistemic state — knowledge held with confidence. Crystallize hypotheses into beliefs, challenge them with counter-evidence, retract them when wrong. Beliefs surface in session boot alongside rules and memories, giving agents a clear picture of what the organization knows and how confident it is.
Search that fuses signals. Vector similarity, recency, access frequency, keyword matching, and tag overlap blended via Reciprocal Rank Fusion. Filter by project, type, or time range. Temporal queries: "what did we know as of Tuesday?" via as_of, "what happened last week?" via event_after/event_before.
Knowledge graph. Entities and facts get extracted into a Neo4j graph that connects memories through shared people, places, projects, and concepts. Optional, but powerful when you're working across domains.
Thinking sequences. Structured deliberation — start with a goal, add thoughts (observations, hypotheses, analysis, alternatives), conclude. Both humans and agents contribute. The exploration itself becomes searchable memory.
Work management. Hierarchical work items with dependency tracking, gates that pause for human decisions, and activity logging. Experimental — evolving as we learn what works.
Web dashboard. Browse memories with OKLCH-colored toggle filters, score gradient bars, and shareable URL state. Explore the knowledge graph and entity relationships. View analytics, manage work items. Port 3000.
[Cairn dashboard with memory growth and token usage]
Memory growth by type, token usage tracking, and the full nav.
Code intelligence. A standalone worker indexes codebases with tree-sitter (30 languages) and builds a code graph in Neo4j. The server queries the graph without ever touching source files. Ask structural questions — "what depends on this file?", "who calls this function?", "what's the blast radius?" — and get answers from the code graph. Call graph extraction, cyclomatic complexity, dead code detection. Enforce architecture boundaries with YAML rules. Works across projects.
Supported languages (30)
Multi-user authentication and RBAC. Off by default, zero to enterprise in one command. ./scripts/setup.sh includes auth configuration, or run ./scripts/setup-auth.sh standalone. Auth mode selection (none / local JWT / OIDC SSO), JWT secret generation, OIDC provider validation. Personal Access Tokens for machine clients, stdio identity for MCP. Three roles, project-level scoping, first-user-becomes-admin. Groups with OIDC sync. See the Authentication Guide.
Disaster recovery. Cron-friendly scripts for PostgreSQL dump and Neo4j graph export with configurable retention. Tested restore procedures with migration safety checks. See the Backup Guide.
Do I need an LLM?
No. Store, search, recall, and rules work without one. You lose auto-enrichment (summaries, tags, importance scoring), knowledge extraction, and thinking.
If you want enrichment:
Configuration
All via environment variables. The ones that matter:
Full reference is in docker-compose.yml. Every variable has a sensible default.
Authentication
Off by default. The fastest way to enable it is through the setup wizard:
Three modes — no auth, local JWT, or OIDC/SSO. Generates secrets, validates
your identity provider's discovery endpoint, writes .env. Provider-specific
URL hints for Authentik, Keycloak, Auth0, Okta, and Azure AD. Both scripts
support --dry-run and --non-interactive for CI.
First user to register becomes admin. Role-based access control enforces permissions across REST API, MCP HTTP, and the web UI. Personal Access Tokens for machine clients, groups with OIDC sync.
See the Authentication Guide for the full reference covering all auth modes, OIDC provider configuration, and MCP client examples.
Security note: Cairn's auth system is functional and production-tested but has not been independently audited. For network-exposed deployments, add TLS termination and network-level access controls.
Remote MCP Access (Claude.ai, Mobile)
Connect Cairn to Claude.ai, the Claude mobile app, or any OAuth2-capable MCP client. Cairn acts as an OAuth2 Authorization Server, delegating user authentication to your existing OIDC identity provider.
Prerequisites: Auth enabled (CAIRN_AUTH_ENABLED=true), OIDC configured (CAIRN_OIDC_ENABLED=true), and a public URL set (CAIRN_PUBLIC_URL).
Enable it:
Connect from Claude.ai:
- Go to Claude.ai Settings > Integrations > Add custom MCP
- Enter your Cairn URL:
https://your-cairn-domain.com/mcp - Claude.ai discovers the OAuth2 endpoints automatically
- You'll be redirected to your identity provider to log in
- After login, Claude.ai has full access to your Cairn MCP tools
The OAuth2 flow uses Authorization Code + PKCE with Dynamic Client Registration (RFC 7591). If your identity provider supports SSO sessions, the auth redirect is invisible after the first login.
See the Remote MCP Guide for reverse proxy configuration, security hardening, and troubleshooting.
Code Intelligence
Code intelligence runs as a standalone worker that indexes source code and writes to Neo4j. The cairn server queries the graph but never touches source files directly. This separation means indexing doesn't block the event loop and the worker can run on the machine where code lives.
Requirements: Neo4j (the cairn-graph service in docker-compose) must be running.
Quick start
Environment variables
Docker / remote codebases
Mount source code into the cairn container and set CAIRN_CODE_DIR:
Or run the worker on the code host and point it at your cairn + Neo4j instances:
What gets indexed
- Symbols: functions, classes, methods, interfaces, enums, React components/hooks
- Relationships:
IMPORTS(file-level),CALLS(function-level),CONTAINS(parent-child) - Metadata: signatures, docstrings, cyclomatic complexity, line numbers, content hashes
- Languages: Python, TypeScript/TSX, and 28 more (C, Rust, Go, Java, Ruby, etc.)
Query examples (via code_query MCP tool)
Architecture
Benchmark
Tested against LoCoMo, a long-conversation memory benchmark with 1,986 questions across five categories.
Test configuration: Titan V2 embeddings (Bedrock, 1024-dim), episodic ingestion (raw turns + two-pass fact extraction), Search V2 with graph-primary retrieval, type routing, cross-encoder reranking, LLM-as-judge evaluation. Full results and methodology in eval/.
Development
Status
Cairn is under active development. It's a real system used daily in production, and it's evolving as I learn what actually works for agent memory. Migrations handle schema changes. If something breaks, open an issue.
License
來源:README.md,提交 40be32a
工具
0版本歷史
1- v0.21.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Cairn 整合

Cairn.ink Memory
ink.cairn官方發布者
Cairn.ink Memory 是託管的 MCP 端點,讓助理儲存、回想、檢視、更正與遺忘跨工作階段的記憶,每筆記憶都附有來源憑證。

Cairn Commons (read-only)
由 GitHub 帳號 cairncommons 發布
唯讀的遠端 MCP 伺服器,讓程式設計助理依錯誤文字、套件名稱與版本查詢經核實、鎖定版本的相依性缺陷紀錄。

Cairn Remembers
由 GitHub 帳號 CairnRemembers 發布
為 AI 代理設計的本地優先情境記憶:把決策、筆記與更正存進單一 SQLite 記憶庫,任何支援 MCP 的助理都能檢索與寫入。

Cairn
由 GitHub 帳號 luckyjackluo 發布
Cairn 為 AI 助理提供本機工具,用來列出、讀取、搜尋、加上標籤、編輯、移動並語意檢索指定資料夾中的檔案。

Cairn
由 GitHub 帳號 cybort360 發布
把 Claude Code 的工作工作階段、檔案編輯與任務記錄到 Cairn 帳號,讓助理能登記活動與專案筆記。