zifu-memory MCP

검증 가능하고 재생 가능하며 범위를 인식하는 메모리 서버: 소스 포인터가 포함된 추가 전용 이벤트 원장, 교체 및 폐기 감사 추적 기능이 있는 사실 계약, 엄격한 예산 한도 내 컨텍스트 주입, 비트 단위 재생, 실패 시 차단되는 비밀 정보 검사.

문서

紫府 · Zifu Memory

Verifiable, replayable, scope-aware memory service for AI agents — via MCP.

Most agent memory systems are editable notebooks: an LLM pipeline rewrites memories (add / update / delete) and the previous state is gone. Zifu Memory is an auditable chronicle: an append-only event stream with fingerprinted snapshots, replay to any point in time, contract-governed facts, and scope-based access control.

Three pillars

  1. Persistent — append-only event stream as the source of truth; nothing is silently rewritten.
  2. Replayable — rebuild the full state at any timestamp from snapshots plus the event stream; every fact carries a source pointer and fingerprint.
  3. Cross-session, cross-node — scoped memory (session / user / agent / org) with session handoff and resume packs; sync-ready for federated nodes.

Install

pip install zifu-memory

Wire into your MCP client

{
  "mcpServers": {
    "zifu": { "command": "zifu-mcp", "args": [] }
  }
}

Data directory: set ZIFU_HOME (defaults to ~/.zifu).

Tools (17)

ToolWhat it does
zifu_writeAppend a memory (passes the fail-closed gate: credentials / OTPs / phone / ID numbers are rejected) and return a source pointer
zifu_searchKeyword lookup (entity-level digest)
zifu_semanticSemantic search (pluggable embedder; zero-dependency char-bigram core by default)
zifu_hybridKeyword + semantic merged search
zifu_eventsTime-window event stream reader
zifu_stateCurrent state
zifu_replayRebuild state at any timestamp (verifiable)
zifu_exportPack a cold backup
zifu_retentionTiered retention report (7d fine / 90d hourly / older: ledger + fingerprints)
zifu_assertContract 1+2: register a fact with a source pointer; duplicate IDs are deterministic errors
zifu_replaceContract 2: revise a fact, history preserved
zifu_retireRetire a fact (mark only, never delete)
zifu_factsList the fact ledger
zifu_injectContract 3: deterministic context packing under a hard budget
zifu_viewContract 5: consistent view (state + active facts at a timestamp)
zifu_handoffEnd-of-session handoff summary (session-boundary free)
zifu_resumeNew-session resume pack (handoffs first, then facts, then recent events)

The five contracts

  1. Source pointer first — every registered fact must point to a resolvable event (file + timestamp + fingerprint).
  2. Duplicate IDs are errors — revising goes through replace, history kept.
  3. Hard injection budget — context assembly is deterministic and reproducible.
  4. Idempotent replay — replaying the ledger any number of times yields the same state.
  5. Consistent views — fork a consistent snapshot of state + facts at any time.

Scope model (fail-closed)

session < user < agent < org

Writers tag memories with a scope; readers declare their identity. Without an identity you only see org-level memories. Legacy data defaults to org.

Design notes

  • Zero-dependency core (standard library only); the MCP shell needs mcp>=1.0,<2.
  • The semantic layer is a pluggable slot: the default char-bigram TF-IDF core works offline; swap in a real embedding model without changing the retrieval logic.
  • Forgetting is tiered, not deleted: fine-grained snapshots for 7 days, hourly snapshots for 90 days, event ledger + fingerprints forever.

License

Dual-licensed: AGPL-3.0 (default) or commercial — see DUAL-LICENSE.md