0G-Memory-Hooks

Fixing the "inbox deletion" bug. Auto-persist agent memory to 0G Storage. Never lose context again.

0G-Memory-Hooks

Created At

Open Agents

Project Description

OpenClaw agents lose all memory when context compaction occurs - the same bug that caused Meta's AI director to lose her entire inbox. 0G-Memory-Hooks solves this by auto-saving agent checkpoints to 0G decentralized storage BEFORE compaction, and restoring them seamlessly after restart. The plugin hooks into OpenClaw's lifecycle events, captures agent state (conversation, memory files, workspace), uploads to 0G Storage, and registers pointers on 0G Chain. When the agent restarts, it automatically locates and restores the most recent checkpoint. Result: Zero context loss. Zero repeat work. The agent remembers EVERYTHING.

How it's Made

Built as a TypeScript plugin for OpenClaw using @0gfoundation/0g-ts-sdk for decentralized storage and 0G Chain (EVM-compatible, chainId 16602) for on-chain pointers. Smart contract deployed with Hardhat using --evm-version cancun. Plugin hooks intercept before_compact, after_restart, and heartbeat events. Checkpoints are compressed with archiver, uploaded to 0G Storage (turbo indexer for 200MBPS speeds), and registered via ethers.js. Integrated KeeperHub for reliable execution with retry logic and gas optimization. Gensyn AXL for P2P mesh broadcast (multi-agent sync). DeepSeek API for inference. Sandbox tested with actual OpenClaw agent conversations. Key hack: pre-compaction checkpoint trigger before OpenClaw's native compact runs.

background image mobile

Join the mailing list

Get the latest news and updates