memhippo

memhippo

Provides persistent, shared memory for AI agents by capturing conversations verbatim, distilling facts and summaries, and enabling retrieval through search, timeline, details, and explicit remember tools.

Category
访问服务器

README

memhippo

The hippocampus for your AI agents.

memhippo gives every AI agent on your machine a shared, persistent memory. It captures every conversation verbatim into a permanent archive you own, distills those conversations into durable facts and session summaries with an LLM, and feeds that knowledge back to your agents — automatically at session start, mid-session when relevant, and on demand through search tools.

AI assistants forget. Every session starts from zero, and memory is siloed per tool: something you told one assistant is unknown to every other. memhippo fixes both:

  1. Ambient continuity — sessions start already oriented and receive relevant memory as the conversation calls for it.
  2. A cross-agent shared brain — one memory shared by Claude Code, OpenClaw, and any MCP-speaking agent.

Underneath both sits one principle: a verbatim raw archive you own forever. Summaries and indexes are opinions; the raw record is truth, and everything else can be re-derived from it.

Status

Early. Single-user, macOS-tested (the daemon and CLI are plain Node and should run elsewhere; the launchd safety net and install flow are macOS-specific). APIs and schemas may still change. Distillation currently calls the Claude API via the Claude Agent SDK; everything else is fully local.

Architecture

Claude Code hooks ─┐
OpenClaw watcher ──┼─▶ POST /events ─▶ RAW: append-only JSONL file tree (permanent)
backfill ──────────┘        │
                            ▼  session end
                     distiller (LLM) ─▶ DISTILLED: summaries + reconciled facts
                            ▼
                     INDEX: SQLite FTS5 + local embeddings (fully rebuildable)
                            ▼
        card (SessionStart) · top-ups (per prompt) · MCP tools · CLI

Layer 1 — raw. Plain JSONL files under ~/.memhippo/raw/YYYY/MM/DD/HH/ (UTC), one file per source+session per hour. Append-only: nothing ever rewrites or deletes them. Any tool ever written can grep this tree.

Layer 2 — distilled. Per-session five-field summaries (request / investigated / learned / completed / next steps) and durable facts with provenance links back to their source sessions. Facts are reconciled semantically and never destructively: a new fact that supersedes an old one flips a status flag and leaves a pointer — old text is never rewritten or deleted, and the full supersession history stays queryable.

Layer 3 — index. SQLite (WAL) holding full-text indexes over both layers, fact embeddings (local MiniLM — no cloud), session bookkeeping, and the job queue. The entire database is derived state: memhippo reindex rebuilds it from the file tree.

The components:

  • memhippod — a single daemon on 127.0.0.1:7337, the sole writer of both the raw tree and the database. Everything else talks to it over HTTP.
  • Hooks — six tiny bundled scripts wired into Claude Code's hook events, POSTing events to the daemon. Governing rule: a hook may never hurt a session — short timeouts, every error swallowed, always exit 0, a hard watchdog.
  • OpenClaw watcher — a poller inside the daemon that tails OpenClaw's session files, using idle-gap windowing to close synthetic sessions for distillation.
  • MCP server — exactly four tools exposing memory to any MCP-speaking agent.
  • memhippo CLI — ops verbs plus human query commands over both layers.

Quickstart

Requires Node >= 20. Distillation requires the Claude Code / Claude Agent SDK credentials already on your machine.

git clone https://github.com/memhippo/memhippo && cd memhippo
npm install
npm run build
npm link          # puts `memhippo` and `memhippod` on your PATH

# Wire the six hooks into ~/.claude/settings.json, install the hourly rsync
# safety net (launchd), and start the daemon. --dry-run first to see the plan:
memhippo install --dry-run
memhippo install

# Verify
memhippo status

Then run a Claude Code session anywhere and check it was captured:

memhippo sessions
memhippo search "something you said"

To ingest your existing Claude Code history:

memhippo backfill --dry-run   # see what would be ingested
memhippo backfill

To register the MCP server with a client, point it at memhippo mcp (stdio transport).

The three retrieval tiers

Tier 1: the orientation card. At SessionStart, the hook fetches a precomputed card (~2,000 characters): top global facts, the current project's facts and last session's next-steps, recent session one-liners, and a pointer to the search tools. A cache read — no LLM, sub-100ms — rebuilt lazily after each distillation.

Tier 2: threshold-gated top-ups. On each user prompt, the daemon scores the prompt against facts and summaries using a hybrid of BM25 rank and embedding cosine similarity. Only matches clearing a threshold (0.55) inject, capped at 500 characters, deduplicated per session, at most four per session. Deliberately silent-leaning: a missed top-up is recoverable via the tools; a noisy one erodes trust.

Tier 3: pull. Four MCP tools teaching agents a search-then-fetch protocol:

Tool Purpose
search_memory Query with optional filters; returns a compact index (IDs, titles, scores — never full content)
timeline Chronological context around a hit
get_details Full content for chosen IDs, including raw-archive receipts as file:line pointers
remember Explicit writes routed through the fact store

Every ambient claim is traceable: facts carry provenance to session IDs, and raw hits carry file:line receipts into the archive.

Trust properties

  • Local only. The daemon binds 127.0.0.1. Nothing leaves the machine except distillation calls to the Claude API.
  • Raw is sacred. Append-only, verbatim. No code path rewrites or deletes raw files.
  • Never-destructive facts. Supersession is a status flip plus a pointer; fact text is never updated or deleted.
  • Everything else is disposable. The database is rebuildable from the file tree; losing it loses nothing permanent.
  • Single writer. Only the daemon writes; the CLI's offline fallback is provably read-only.
  • Self-observation is fenced. The distiller's own LLM sessions are triple-guarded (SDK persistence off, working-directory isolation, prompt-signature exclusion in backfill) so the system never captures its own distillation prompts as memories.

CLI tour

memhippo status                 daemon health, pid, event/session counts
memhippo start / stop / logs    daemon lifecycle
memhippo search <query>         FTS across raw + distilled layers
memhippo sessions               list captured sessions
memhippo show <session-db-id>   replay a session's raw events
memhippo projects               distinct projects with session/fact counts and last activity
memhippo conversations          human list of conversations, newest first
memhippo read <n|id-prefix>     render a conversation as dialogue (paged)
memhippo summary <n|id-prefix>  the distilled 5-field summary
memhippo last                   shorthand for 'read 1'
memhippo facts                  active facts, or one fact's supersession history
memhippo card                   print the ambient orientation card
memhippo distill <id>           enqueue a manual distill job
memhippo grep <pattern>         regex straight over the raw file tree
memhippo import <jsonl>         POST each line as an event
memhippo backfill               ingest historical Claude Code transcripts
memhippo reindex                rebuild the search index from the raw tree
memhippo install / uninstall    wire/remove Claude Code hooks
memhippo mcp                    run the MCP server over stdio

Add --json to any query command for machine-readable output. Query commands prefer the daemon but fall back to a direct read-only view of the local database when it's down.

Environment reference

Variable Default Purpose
MEMHIPPO_HOME ~/.memhippo Data dir (raw tree, db, logs)
MEMHIPPO_PORT 7337 Daemon port (localhost only)
MEMHIPPO_DISTILL_MODEL sonnet Model for session distillation
MEMHIPPO_RECONCILE_MODEL haiku Model for fact-reconcile verdicts
MEMHIPPO_DISTILL_CONCURRENCY 3 Max distill LLM calls in flight
MEMHIPPO_DISTILL_GRACE_MS 3600000 Idle grace before a session is considered ended
MEMHIPPO_SWEEP_INTERVAL_MS 600000 Stale-session sweep interval
MEMHIPPO_MAX_FACTS_PER_SESSION 60 Per-session fact budget
MEMHIPPO_MAX_RECONCILE_CALLS_PER_SESSION 40 Per-session reconcile-LLM budget
MEMHIPPO_DEDUP_WINDOW_MS 120000 Ingest content-hash dedup window
MEMHIPPO_TOPUP_THRESHOLD 0.55 Min hybrid score for a mid-session top-up
MEMHIPPO_OPENCLAW_DIR ~/.openclaw/agents OpenClaw session dir to watch
MEMHIPPO_OPENCLAW_IDLE_MS 1800000 Idle gap that closes an OpenClaw window
MEMHIPPO_OPENCLAW_POLL_MS 60000 OpenClaw poll interval
MEMHIPPO_PAGER / MEMHIPPO_NO_PAGER less -R / unset Pager for read/last
MEMHIPPO_HOOK_DEBUG unset Hooks flush buffered debug output to stderr
MEMHIPPO_SKIP_MODEL unset Tests: skip the local embedding-model download
MEMHIPPO_REAL_LLM unset Tests: enable gated real-LLM smoke tests

Development

npm run build       # tsc + esbuild hook bundles (tests exercise dist/)
npm run typecheck
MEMHIPPO_SKIP_MODEL=1 npm test

Tests run against temp data dirs and ephemeral ports; they never touch ~/.memhippo or a running daemon. MEMHIPPO_SKIP_MODEL=1 skips the one test that downloads the local embedding model; MEMHIPPO_REAL_LLM=1 enables the (off-by-default) tests that make real LLM calls.

See docs/design.md for the design notes and docs/roadmap.md for what's next.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选