MemoryMergeLIVE VERIFIED
GitHubContract ↗
Built for 0G / Open Agents Hackathon · ETHGlobal 2026

Cryptographic knowledge provenance for
AI agent swarms

MemoryMerge is the only agent memory framework where you can cryptographically prove what an AI agent knew at any point in time. Pluggable adapters. OpenClaw-native. Powered by 0G Storage, 0G Compute, and 0G Chain.

Network
0G Galileo
Testnet
Contract
0x4dbF...4079
Anchors snapshots
Model
Qwen 2.5 7B
TeeML verified
Tracks
Track 1 + 2
Merkle verified · Pluggable
Preview state · refreshed 0s ago
What it does

Built different. Built to last.

MemoryMerge turns state into infrastructure. Agents write facts, tasks, and insights to 0G Storage; reflection compresses that memory; 0G Chain proves it forever.

Decentralized Memory
0G Storage KV for working memory and 0G Storage Log for permanent archives. The swarm never forgets.
Autonomous Reflection
Every N turns, the reflection engine compresses facts into ranked insights using 0G Compute with TeeML verification.
Swarm Coordination
Planner, Researcher, and Critic coordinate exclusively through shared memory state — no direct messaging required.
On-Chain Proof
Each snapshot root hash is anchored to the MemoryAnchor contract on 0G Chain for durable, auditable proof.
Drop-In SDK
Pluggable adapter interfaces for storage, compute, and anchoring. OpenClaw skill class with remember/recall/getContext hooks. Three lines to integrate.
Merkle Verification
Every snapshot builds a deterministic keccak256 Merkle tree. Any fact can be cryptographically proven or disproven by anyone. Anchored on 0G Chain forever.
How It Works

The full execution flow

From goal input to permanent archival, every step is transparent, auditable, and fully resumable.

01

Planner reads goal, creates tasks

Planner

Planner agent loads the swarm context from 0G Storage KV, reads the current goal, and writes 3 concrete subtasks back to 0G Storage.

02

Researcher executes tasks

Researcher

Researcher reads pending tasks, performs research using 0G Compute inference, writes discovered facts, and marks tasks pending_review.

03

Critic scores the findings

Critic

Critic evaluates each research result, assigns confidence scores, checks contradictions, and marks tasks complete.

04

Reflection engine fires

Reflection

Every N turns, the reflection engine pulls all facts from 0G Storage KV, compresses them through 0G Compute, writes insights, and archives a snapshot to 0G Storage Log.

05

Snapshot anchored on-chain

0G Chain

The Merkle root of each snapshot is anchored to the MemoryAnchor contract on 0G Chain, providing a permanent proof of memory integrity.

06

Swarm resumes from anywhere

Any Agent

Stop the process and restart with the same SWARM_ID. All memory is restored from 0G Storage automatically.

Loading swarm data from 0G Storage...
Documentation

Quick Start & SDK Reference

Get a MemoryMerge swarm running in under 10 minutes.

Installation
Environment Setup
0G Compute Setup
Run Example
SDK Reference
Contract

Installation

bash
git clone https://github.com/Techkeyy/memorymerge.git
cd memorymerge
npm install

Environment Setup

Copy the example env file and fill in your values. All 0G credentials come from the Galileo testnet.

bash
cp .env.example .env
env
# 0G Network - Galileo Testnet
ZG_EVM_RPC=https://evmrpc-testnet.0g.ai
ZG_INDEXER_RPC=https://indexer-storage-testnet-turbo.0g.ai
ZG_PRIVATE_KEY=your_testnet_wallet_private_key

# 0G Compute (from CLI setup below)
ZG_COMPUTE_PROVIDER=0xa48f01287233509FD694a22Bf840225062E67836
ZG_SERVICE_URL=your_service_url
ZG_API_SECRET=your_app_sk

# Contract - already deployed
MEMORY_ANCHOR_ADDRESS=0x4dbFC89D78Bc89578528a848B5bB5fC22b0C4079

# Swarm identity
SWARM_ID=memorymerge-swarm-001

0G Compute Setup

One-time setup. Funds your account and gets API credentials for the inference endpoint.

bash
npm install -g @0glabs/0g-serving-broker

0g-compute-cli setup-network          # Select: Testnet
0g-compute-cli login                   # Enter private key
0g-compute-cli deposit --amount 3     # Fund compute account

0g-compute-cli inference acknowledge-provider   --provider 0xa48f01287233509FD694a22Bf840225062E67836

# Get your credentials - copy to .env
0g-compute-cli inference get-secret   --provider 0xa48f01287233509FD694a22Bf840225062E67836

Run the Example Swarm

bash
# Default research goal
npm run example

# Custom goal
npm run example -- "Research decentralized AI infrastructure in 2026"

# Resume previous session (same SWARM_ID)
npm run example

Session continuity: Run the same command again with the same SWARM_ID — the swarm loads all memory from 0G Storage and continues where it left off.

SDK Reference

typescript
import { createMemoryManager, createReflectionEngine } from 'memorymerge';

const memory = createMemoryManager('my-agent');

// Facts — written to 0G Storage KV
await memory.writeFact('key', 'value', confidence);
await memory.readFact('key');
await memory.getAllFacts();
await memory.updateFactConfidence('key', 0.9, true);

// Tasks
await memory.writeTask('task-id', { status, assignedTo, description });
await memory.updateTaskStatus('task-id', 'complete', result);
await memory.getAllTasks();

// Insights (generated by reflection engine)
await memory.getAllInsights();

// Full swarm context — most important method
const ctx = await memory.getSwarmContext();
// Returns: { swarmId, goal, facts[], tasks[], insights[] }

// Archive snapshot to 0G Storage Log (permanent)
const snap = await memory.snapshot(epochNumber);
// Returns: { rootHash, timestamp, label, factCount }
// Verify at: https://storagescan-galileo.0g.ai

// Reflection Engine
const reflection = createReflectionEngine(memory, 20);
await reflection.tick();            // auto-fires after 20 turns
await reflection.forceReflection(); // manual trigger

Contract

Address
0x4dbFC89D78Bc89578528a848B5bB5fC22b0C4079
Network
0G Galileo Testnet
Chain ID
16602
Explorer
chainscan-galileo.0g.ai
solidity
// MemoryAnchor.sol — anchors snapshot root hashes on-chain
function anchorSnapshot(
    string calldata swarmId,
    bytes32 rootHash,
    uint256 epochNumber,
    string calldata label
) external;

function getLatestSnapshot(string calldata swarmId)
    external view returns (MemorySnapshot memory);

Merkle Fact Verification

The only agent memory framework with cryptographic proof of agent knowledge.

typescript
import { VerifiableSnapshot, verifyFact } from 'memorymerge';

// Build deterministic Merkle snapshot
const snapshot = VerifiableSnapshot.build(facts, epoch, swarmId);

// Generate proof for a specific fact
const proof = VerifiableSnapshot.generateProof(fact, snapshot);

// Anyone can verify independently:
const result = verifyFact(fact, snapshot.rootHash, proof.proof);
console.log(result.verified); // true
console.log(result.message);  // ✓ Fact cryptographically proven

Run the demo: npm run verify — proves a real fact, rejects a fake one, prints the Merkle root.