Skip to main content

紫府 · 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)

Tool What it does
zifu_write Append a memory (passes the fail-closed gate: credentials / OTPs / phone / ID numbers are rejected) and return a source pointer
zifu_search Keyword lookup (entity-level digest)
zifu_semantic Semantic search (pluggable embedder; zero-dependency char-bigram core by default)
zifu_hybrid Keyword + semantic merged search
zifu_events Time-window event stream reader
zifu_state Current state
zifu_replay Rebuild state at any timestamp (verifiable)
zifu_export Pack a cold backup
zifu_retention Tiered retention report (7d fine / 90d hourly / older: ledger + fingerprints)
zifu_assert Contract 1+2: register a fact with a source pointer; duplicate IDs are deterministic errors
zifu_replace Contract 2: revise a fact, history preserved
zifu_retire Retire a fact (mark only, never delete)
zifu_facts List the fact ledger
zifu_inject Contract 3: deterministic context packing under a hard budget
zifu_view Contract 5: consistent view (state + active facts at a timestamp)
zifu_handoff End-of-session handoff summary (session-boundary free)
zifu_resume New-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

Apache-2.0

Metadata

Release files for zifu-memory 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zifu-memory 0.1.0
File Size Uploaded Provenance Actions
zifu_memory-0.1.0.tar.gz 21.7 kB Without provenance Details for zifu_memory-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zifu-memory 0.1.0
File Interpreter ABI Platform Actions
zifu_memory-0.1.0-py3-none-any.whl Python 3 none any Details for zifu_memory-0.1.0-py3-none-any.whl

Total release size: 45.2 kB

Release files / zifu_memory-0.1.0.tar.gz

Download URL zifu_memory-0.1.0.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8d64172385ca385c0aea0186bf80537fb7d2c3e341b354f56e3a1349c0b6f984
BLAKE2b-256 checksum
How to use checksums
cff284eb875843633564883c8c145f772f8dcca43b4fad8c7cb0258de2f9bcd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / zifu_memory-0.1.0-py3-none-any.whl

Download URL zifu_memory-0.1.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22d18ba16aaba3eed39ecea6156e70d549457bdeb42ed5bbc6dc697abf2c4b43
BLAKE2b-256 checksum
How to use checksums
63013cce2a40cea61ea1975c0687f91f703a6b2a5ed1ae417a68c7b521d3512b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for zifu-memory 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page