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
Set your private key
Add Or add it to your OpenClaw config:
MEMOCLAW_PRIVATE_KEY to your environment. If you don’t have a wallet yet, run memoclaw init to generate one.What happens automatically
Once installed, the hook fires on five OpenClaw lifecycle events:| Event | What it does |
|---|---|
| Session start | Recalls memories relevant to the user’s first message and injects them as context |
/new command | Extracts important context from the current session and stores it before the session resets |
| Context compaction | Stores key information before the context window is compressed |
| Heartbeat | Runs periodic consolidation to merge duplicate memories (every 6 hours) |
| Gateway startup | Recalls the 3 most recent memories to restore agent continuity |
What recall looks like
When your agent starts a session, it sees something like:Configuration
All config is via environment variables. No config files needed.| Variable | Required | Default | Description |
|---|---|---|---|
MEMOCLAW_PRIVATE_KEY | Yes | — | Wallet private key for auth and payments |
MEMOCLAW_URL | No | https://api.memoclaw.com | API endpoint |
MEMOCLAW_NAMESPACE | No | default | Memory namespace for isolation |
MEMOCLAW_HOOK_CONSOLIDATE_INTERVAL_MS | No | 21600000 (6h) | Min interval between consolidations |
Multi-agent memory
UseMEMOCLAW_NAMESPACE to control memory isolation between agents.
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: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.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
- npm:
memoclaw-hooks - GitHub:
anajuliabit/memoclaw-hooks