ZeroMem

Encrypted Git-style agent memory on 0G Storage: versioned commits, recall, branching, grants.

ZeroMem

Created At

Open Agents

Project Description

What it is ZeroMem is a TypeScript stack that gives AI agents persistent, encrypted, versioned memory on 0G—framed as “Git for agent memory.” Every meaningful write becomes a signed ZeroCommit on an append-only DAG of blobs on 0G Storage; HEAD, index shards, grants metadata, tombstones, and skills manifests are kept in 0G KV (or can be supplemented / swapped for speed with Postgres + pgvector via POSTGRES_URL). Agents embed, encrypt (ECIES), upload payloads, upload commit blobs, then update indices so recall() does cosine similarity over stored vectors and pulls only the winning blobs back from Storage.

What you can do with it Beyond remember / recall / search / ask, the surface includes branch, merge, diff, snapshot, checkout, replay, blame, log; forget / forgetBulk / gc; reflect (compaction); plan and task completion; signed skills blobs; prove for attestation-style evidence; and restore to rebuild KV/Postgres from the chain after data loss given a tip commit. Multi-agent grant / revoke ties on-chain GrantRegistry on 0G EVM to MemoryCapsule key wrapping so a peer can decrypt scoped memories without sharing long-term secrets.

How it fits real products The design is framework-agnostic at the core: @zeromem/sdk is the engine. OpenClaw is integrated via @zeromem/openclaw-gateway (hooks + tools + manifest). Vercel AI SDK users get @zeromem/openclaw (withZeroMem / middleware). Web2 or polyglot teams use the self-hosted relayer and @zeromem/client so agents talk plain HTTP without holding keys—while blobs remain on 0G Storage and indices can progress from Postgres-only → + KV without changing client code.

How it's Made

Monorepo & language The repo is an npm workspace monorepo, almost entirely TypeScript. The core is packages/sdk (ZeroMem in client.ts), with focused modules for commits (commit.ts), 0G I/O (storage.ts → @0gfoundation/0g-ts-sdk: Indexer, MemData, Uploader, KvClient, Batcher, flow contracts), KV layout (kv-views.ts), vector search (vector.ts + optional pg-index.ts behind memory-index.ts), inference (inference.ts — 0G Compute via @0glabs/0g-serving-broker when configured, plus OpenRouter for chat/embed paths and optional @xenova/transformers fallback for embeddings), grants & ACL (grant.ts, acl.ts), Git-like DAG ops (git.ts), and skills (skills.ts).

Partner / external tech

0G: Storage + KV + EVM are the backbone: immutable encrypted blobs, fast HEAD/index materialization, and on-chain grant records. OpenClaw: openclaw-gateway implements before_prompt_build (inject <zeromem-memories> + namespace hints) and agent_end (filtered auto-capture), plus memory_search / memory_store tools with basic injection guards. OpenRouter (optional): configured through the same inference layer for LLM and practical dev velocity on chat/embed. Hardhat: compiles and deploys GrantRegistry.sol. Relayer: Express app that caches ZeroMem per agentId+branch, exposes REST for remember/recall/ask/branch/merge/grant/restore/etc., and keeps private keys server-side. Notable “hacky but real” bits

Production integration required defensive work around 0G + ethers: e.g. explicit gas limits and balance preflight so failed estimates don’t look like random “insufficient funds”; a custom waitForLogEntry that polls every storage node so sharded uploads don’t stall when the first node has no shard; KV unreachable modes with process-level shared fallback so demos and cross-agent flows degrade gracefully; and embedding falling back when testnet models don’t expose a clean embed API.

background image mobile

Join the mailing list

Get the latest news and updates

ZeroMem | ETHGlobal