Anamnesis

io.github.oscardvs由 GitHub 帳號 oscardvs 發布v0.1.3更新於 Oct 24, 2026

Cross-machine, file-first memory for Claude Code: markdown + SQLite FTS5, synced with git

概覽

AI 產生的概覽

為 Claude Code 設計的本地優先記憶層:以 markdown 保存專案筆記,用 SQLite FTS5 建立本機索引,並透過 git 在你自己的多台機器間同步。

可以做什麼
搜尋、列出記憶筆記並查看記憶庫狀態(唯讀工具)。寫入新筆記並觸發 markdown 記憶庫同步。透過 SessionStart、SessionEnd 與 PreCompact 鉤子自動擷取工作階段摘要。可選地用相容 OpenAI 的模型把工作階段筆記濃縮為長期筆記,並在評測集把關下合併近似重複項。在獨立的本機網頁介面中瀏覽、編輯與檢視筆記歷史。
適用情境
當你在多台機器上使用 Claude Code,希望專案慣例、架構決策與過往工作階段筆記能跟著同步,又不想依賴雲端帳號時使用。適合偏好受版本控制的純 markdown 檔案、而非託管記憶服務的人。
執行需求
需用 uv 從 PyPI 套件 anamnesis-memory 安裝本機程序,並具備 Claude Code 與 git。跨機器同步需要一個你掌控的 git 遠端儲存庫(例如經 Tailscale 網路);僅本機模式不需遠端。可選反思功能需在設定中指定相容 OpenAI 的模型。網頁介面需要 Node 20 或更新版本。
安裝前請注意
init 指令會在 Claude Code 設定中註冊 MCP 伺服器並安裝鉤子,事先備份 settings.json。SessionEnd 與 PreCompact 鉤子會把工作階段紀錄寫入筆記,因此工作階段內容會存到磁碟並推送到你的 git 遠端儲存庫。memory_write 與 memory_sync 會修改資料。可選反思會把筆記傳送給你設定的相容 OpenAI 模型。各版本之間 API 仍可能變動。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Anamnesis,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Anamnesis

Cross-machine memory for Claude Code

[PyPI] [CI] [Python] [License: Apache 2.0]

Website · Docs · Benchmark · Dashboard

bash
uv tool install anamnesis-memory && anamnesis init

ἀνάμνησις (anamnesis): Greek for recollection, the act of calling knowledge back to mind.

Anamnesis is a local-first, file-based memory layer for Claude Code that syncs across your own machines. What Claude learns about your projects (conventions, architecture decisions, fixes that worked, what you did yesterday) is stored as plain markdown, indexed locally for search, and kept in sync over your private network.

Claude Code's own memory stays on the machine where it was written. Copying a SQLite index through a cloud folder such as Dropbox or iCloud corrupts it. Anamnesis syncs the markdown with git instead and rebuilds the index on each machine, so a note written on your desktop is searchable from your laptop.

No cloud account is required. The memory stays on your machines, version-controlled and human-readable.

How it works

  ┌─────────────┐        git over your private mesh        ┌─────────────┐  │  desktop    │  ◄────────────  (Tailscale)  ────────►   │  laptop     │  │             │                                          │             │  │  Claude Code│                                          │  Claude Code│  │     ▼       │                                          │     ▼       │  │  MCP server │   markdown (source of truth)             │  MCP server │  │     ▼       │   + SQLite FTS index (rebuilt locally)   │     ▼       │  │ ~/.anamnesis│                                          │ ~/.anamnesis│  └─────────────┘                                          └─────────────┘
  • Files first. Each note is a markdown file under ~/.anamnesis/memory/, readable and git diff-able. The markdown is the source of truth; everything else is derived from it.
  • A local index. A SQLite FTS5 index gives keyword (BM25) recall. It is rebuilt locally and is not synced. On the project's eval set, keyword search reaches about 94% recall, so there is no vector store until measurements call for one.
  • Sync over git. The markdown is a git repo synced over your private Tailscale mesh, or any git remote you control. Only the markdown travels; each machine rebuilds its own index, so the database file is not copied between machines. If two machines edit the same note, sync reports a git conflict instead of dropping either side.
  • Claude Code integration. An MCP server exposes read-only query tools, and session hooks do the rest: SessionStart injects the relevant notes, and SessionEnd captures a summary of the session and syncs it.
  • Reflection and merge. An optional reflection pass (any OpenAI-compatible model, set in config) distills session notes into durable notes, and anamnesis merge consolidates near-duplicates. Generated notes carry provenance and confidence in their front-matter. merge --apply is gated on your eval set so it does not lower recall, and anamnesis eval measures reflection before and after on a sandbox copy.
  • A dashboard. A web GUI to browse, search, edit, and read the history of your memory across every machine.

Quickstart

Prereqs: Claude Code, uv, and git.

bash
uv tool install anamnesis-memory && anamnesis init

anamnesis init registers the MCP server with Claude Code at user scope, installs the SessionStart, SessionEnd, and PreCompact hooks, configures the store at ~/.anamnesis, and runs a first sync. It is idempotent: it backs up settings.json and does not duplicate hooks. --print shows the full plan without writing anything, and --local-only skips the remote until you want one.

Claude Code gets five tools: memory_search, memory_list, and memory_status (read-only, safe to auto-approve), plus memory_write and memory_sync. Full reference: CLI · MCP tools · configuration.

Developing from source instead
bash
git clone https://github.com/oscardvs/anamnesis && cd anamnesis/serveruv venv --python 3.12uv pip install -e ".[mcp,dev]"uv run anamnesis init --print

The repo also ships a project-scoped .mcp.json. Claude Code launches MCP servers with a filtered environment, so ANAMNESIS_HOME / ANAMNESIS_MACHINE_ID / ANAMNESIS_GIT_REMOTE belong in its "env" block, not your shell. Server internals: server/README.md.

Cross-machine sync

Memory is a git repo (~/.anamnesis/memory/) synced over your private Tailscale mesh, or any git remote you control. Set it up once:

  1. Put every machine on the same tailnet (install Tailscale, tailscale up). Pick one always-on machine to host the shared repo; tailscale status prints its MagicDNS name (for example host.your-tailnet.ts.net).

  2. Create one shared bare repo on the host:

    bash
    git init --bare -b main ~/anamnesis-memory.git
  3. Point each machine at it:

    bash
    anamnesis init --remote '[email protected]:anamnesis-memory.git'

    The host itself uses the local path: --remote "$HOME/anamnesis-memory.git".

Sync runs commit -> pull --rebase -> push and rebuilds the local index after pulling, so a note written on one machine is searchable on the others within a sync cycle. If you started with --local-only, re-run init --remote ... later; the store attaches to the remote and pushes its history.

Hooks

anamnesis init installs three Claude Code hooks:

  • SessionStart injects the most relevant notes for the current project (your global preferences, the project's durable notes, and a couple of recent session summaries) and starts a background sync.
  • SessionEnd captures an episodic note from the session transcript and syncs it, so it is on your other machines by the next session. PreCompact captures the same kind of note before context compaction.

Two more commands build on them:

  • Reflection (optional). Point anamnesis config set reflection.provider ... at an OpenAI-compatible model and anamnesis reflect distills accumulated session notes into durable conventions. With reflection.auto set, it runs at session end once a project has enough unreflected notes. anamnesis merge consolidates near-duplicates and only applies if recall on your eval set holds.
  • Import. anamnesis import copies Claude Code's own per-project memory into the store, so notes you already wrote for it are included.

To set the hooks up by hand instead of with init, copy examples/hooks.settings.json into ~/.claude/settings.json and point it at your install.

Benchmark

bench/cross-machine-tokens/ runs one scripted task on a fresh machine twice: once without Anamnesis, where the agent explores the project to learn its conventions, and once with the real SessionStart memory block injected. It drives the Claude Code CLI headlessly on a synthetic project, so a Pro/Max subscription is enough and no API key is needed.

The committed result.json (3 runs per arm on claude-opus-4-8) shows about 8% fewer total input tokens with memory, 366k versus 336k on average, with output tokens and turn count about the same. The conventions were known from the first turn instead of being rediscovered. An earlier version of the scenario used a 5-file project and showed no difference; that null result is documented in the same README.

Dashboard

A web GUI for the memory store: browse and full-text search every note, edit markdown with per-note history, see every machine (which one wrote what and when it last synced), and run reflection from the browser. Provenance badges show where each note came from: you, a session capture, reflection, or import.

[The Anamnesis dashboard showing a synced cross-machine memory store]

bash
npx anamnesis-dashboard      # http://localhost:3000

or, from the CLI you already have:

bash
anamnesis dashboard

Needs Node 20 or newer. From a repo clone, cd dashboard && npm run dev works for development.

It is a thin read/write client over the same local store the MCP server uses: it reads the SQLite index directly and shells out to the anamnesis CLI for writes and sync. Use --port, --store, and --no-open to adjust how it serves. See dashboard/README.md for configuration and design notes.

Status

September 2026: v0.1.3 is on PyPI. The local-first core is done and has been used across a real multi-machine setup: the store, the MCP server, the hooks, git sync, the one-command install, the reflection and merge passes with their eval harness, and the dashboard. APIs may still change between releases.

Next: a hosted relay for people without their own mesh (the server already ships anamnesis relay commands behind a [relay] extra, but they are not documented yet) and team memory.

Repository layout

PathWhat
server/The MCP memory server and CLI (Python, FastMCP).
dashboard/The memory GUI (Next.js).
site/The public website and docs (live).
bench/The cross-machine token benchmark and the demo recording pipeline.
examples/A hand-written hooks.settings.json for manual hook setup.

Contributing

Issues and discussion are welcome. If the install is rough on your machine, open an issue with the exact command you ran and its output.

License

Apache License 2.0. See NOTICE.

來源:README.md,提交 65efe41

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分