SuperAPIAI Directory

agentcairn

github.com · AI agents

Local-first agent memory: a Markdown Obsidian vault as source of truth plus a rebuildable DuckDB index for hybrid BM25, vector and graph recall.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux

About this tool

Purpose

agentcairn provides long-term, cross-project memory capabilities for AI coding agents. It captures persistent context from the tools you use, saves it in an inspectable Markdown form with source information, and recalls only the most relevant snippets when another agent needs them. Its core philosophy is: your Markdown repository is the authoritative data source, DuckDB is merely a replaceable retrieval cache, and the memory belongs to you, not hidden in an admin console or hosted database.

Main capabilities

  • Inspectable memory: Memory is stored as Markdown files, and the companion program agentcairn-obsidian reads the same set of Markdown files, displaying source, timeliness, importance, supersession relationships, and related links.
  • Hybrid recall: BM25 and semantic vectors are fused via Reciprocal Rank Fusion, followed by optional reranking. When a model or provider fails, it explicitly falls back to BM25 and provides diagnostics, rather than returning incompatible vectors.
  • Capture and organization: Host hooks improve immediacy; cairn sweep serves as an out-of-band persistent fallback that reads supported session records. Before automatic writing, credential redaction, deduplication, importance filtering, and refinement are performed.
  • Remember operations: MCP tools atomically write Markdown notes and update the index under a single write lock; once the save succeeds, they can be recalled immediately.
  • Time-aware correction: valid_from, valid_until, and superseded_by keep old evidence visible while prioritizing current facts.
  • Deterministic graph: [[wikilinks]] and the optional cairn link neighbors create an Obsidian-native graph without requiring an LLM to invent entities.
  • Project-aware recall: The current project is boosted by default, and cross-project results remain available and labeled; automatic recall is scoped to the project by default unless all projects are explicitly selected.

How to use

The shortest path is to use the first-class plugin, which bundles the MCP server, memory skills, and host-specific environment hooks, with no separate installation of the agentcairn package required. The plugin is launched via uvx; if uvx --version is unavailable, install uv first.

  • Claude Code: Gets per-turn project-scoped recall, session/compaction capture, and the /agentcairn:recall, /agentcairn:remember, /agentcairn:memory, /agentcairn:savings, /agentcairn:ingest commands.
  • Codex: Gets bundled MCP tools and memory skills, live-validated SessionStart recall, and SessionEnd capture, with cairn sweep as an out-of-band fallback.

Agent-assisted installation can also be used: after installing the public setup assistant, have the agent execute Use $agentcairn-setup to preview, install, and verify AgentCairn for this coding agent.. This assistant only installs setup guidance, not runtimes, MCP servers, plugins, or hooks; it delegates to AgentCairn's preview-first native installer and verifies the integration result.

The default repository is ~/agentcairn, created on first use. A new empty repository has no useful content to recall yet, so the entire loop can be verified explicitly. remember writes both a Markdown note and an index entry, so immediate recallability is part of the contract. The first local run may download and warm up the configured embedding/reranking models.

agentcairn is also a standalone CLI and an on-demand MCP server; standalone installation requires Python 3.11+. Settings live in ~/.agentcairn/config.toml, with precedence CLI flags → environment variables → config file → defaults.

Migrating Claude Code memory: Claude Code's automatic memory can seed the shared repository without modifying its source files. By default the command only previews the current repository; adding --apply writes redacted notes and refreshes the index. The one-way import reads MEMORY.md and its topic Markdown files, and never reads CLAUDE.md or .claude/rules/. Imported notes retain Claude Code, project, and source-file provenance. When the source file changes, the old version remains inspectable but is superseded; when the source file disappears, its imported version becomes stale. A small .agentcairn/native-memory/ registry preserves this lifecycle without duplicating the indexed source content. Use --source <dir> to specify a custom, managed, or session-override Claude memory directory, or --no-reindex to batch-import.

When to use

  • Developers who need to share persistent memory across multiple AI coding agents.
  • Users who want memory stored as inspectable, version-controllable Markdown rather than in a black-box database.
  • Users who manage a knowledge base with Obsidian and want agents to reuse that knowledge base.
  • Teams or individuals who need to recall context across projects while keeping project scope isolated.

Limitations

  • Plaintext storage: The repository is plaintext by design, not encrypted storage. AgentCairn redacts known credential patterns before automatically writing body/title/tags, but unknown patterns and manual edits are the user's responsibility. Repository files are accessible only to the owner (0600/0700), since plaintext and redaction are best-effort, file mode is effectively the only access control. The shared GID scenario (such as two Docker containers in the same group with different UIDs) requires group access; you can optionally use vault_group_writable = true to relax new repository notes and directories to 0660/0770; this switch is intentionally optional because on macOS every local user's primary group is staff, and group-readable by default would expose memory to other accounts on the machine. This switch never relaxes anything outside the repository—the index, ledger, lock files, and ~/.agentcairn/config.toml remain private.
  • Cloud features are explicit outbound: by default everything stays local. Choosing a cloud embedder or LLM judge will send the remaining redacted text to that provider. After enabling a cloud provider, the remaining redacted note fragments and queries leave the local machine; changing the embedding model re-embeds the entire repository, which may incur real latency or API costs.
  • The project is in beta: standalone use requires Python 3.11+, and the first local model load may take time. The published retrieval evidence is strongest for conversational memory and is not a general-purpose code search claim.
  • Environment behavior varies by host: Cursor and Antigravity rely on sweep capture; generic MCP hosts may only expose tools without lifecycle hooks.
  • Automation varies by platform: managed scheduling targets macOS launchd and Linux user crontab; other platforms need to bring their own scheduler.
  • Benchmark notes: the repository ships a fixed-revision, reproducible LongMemEval-S + LoCoMo test harness, using local nomic-embed-text-v1.5 plus a cross-encoder reranker by default. Retrieval recall is not the same as question-answering accuracy; token counting uses a heuristic of about four characters per token; graph augmentation is ineffective on these chat corpora because they contain no native [[wikilink]] graph; the optional QA judge uses Anthropic rather than the paper's GPT-4o setup, so the results are suitable for relative ablations rather than leaderboard comparisons. Full metrics, embedding sweeps, latency measurements, licenses, commands, and caveats are in benchmarks/README.md.

License

Apache License 2.0, with an explicit patent grant. Copyright © 2026 Charles C. Figueiredo。

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools