Skip to main content
The memoclaw-hooks package integrates MemoClaw directly into OpenClaw’s lifecycle. Your agent automatically recalls relevant memories on session start, stores important context when sessions end, and consolidates memories in the background. No code changes. No prompt engineering. Just install and restart.

Installation

1

Install the CLI

npm install -g memoclaw
2

Install the hook pack

openclaw hooks install memoclaw-hooks
openclaw hooks enable memoclaw
3

Set your private key

Add MEMOCLAW_PRIVATE_KEY to your environment. If you don’t have a wallet yet, run memoclaw init to generate one.
export MEMOCLAW_PRIVATE_KEY=0xYourPrivateKey
Or add it to your OpenClaw config:
env:
  MEMOCLAW_PRIVATE_KEY: "0xYourPrivateKey"
4

Restart your gateway

openclaw gateway restart
Verify the hook is loaded:
openclaw hooks list --verbose
openclaw hooks check

What happens automatically

Once installed, the hook fires on five OpenClaw lifecycle events:
EventWhat it does
Session startRecalls memories relevant to the user’s first message and injects them as context
/new commandExtracts important context from the current session and stores it before the session resets
Context compactionStores key information before the context window is compressed
HeartbeatRuns periodic consolidation to merge duplicate memories (every 6 hours)
Gateway startupRecalls the 3 most recent memories to restore agent continuity

What recall looks like

When your agent starts a session, it sees something like:
[MemoClaw] Relevant memories:
- (0.92) User prefers direct communication, no fluff
- (0.87) Project uses PostgreSQL with JSONB columns
- (0.81) Last session: shipped v2.1 auth migration
These are injected as system context — the agent doesn’t need to do anything special.

Configuration

All config is via environment variables. No config files needed.
VariableRequiredDefaultDescription
MEMOCLAW_PRIVATE_KEYYesWallet private key for auth and payments
MEMOCLAW_URLNohttps://api.memoclaw.comAPI endpoint
MEMOCLAW_NAMESPACENodefaultMemory namespace for isolation
MEMOCLAW_HOOK_CONSOLIDATE_INTERVAL_MSNo21600000 (6h)Min interval between consolidations

Multi-agent memory

Use MEMOCLAW_NAMESPACE to control memory isolation between agents.
# Each agent gets its own memory
MEMOCLAW_NAMESPACE=agent-frontend
MEMOCLAW_NAMESPACE=agent-backend

# Or share a namespace for cross-agent knowledge
MEMOCLAW_NAMESPACE=shared-project
Same wallet, different namespaces = isolated recall. Same wallet, same namespace = shared memory.

Using with the skill

The hook handles the automatic lifecycle (session start/end, compaction, heartbeats). For manual memory operations — like storing specific facts or recalling on demand — install the MemoClaw skill alongside the hook:
clawhub install anajuliabit/memoclaw
The skill gives your agent memoclaw store, memoclaw recall, and other CLI commands it can call mid-conversation.

Pricing

  • 100 free calls per wallet — no payment setup needed
  • After that: 0.0050.005–0.01 per call via x402 (USDC on Base)
  • The hook typically makes 2–4 API calls per session lifecycle
  • At normal usage, that’s a few cents per day

Source