Session summaries with MemoClaw — giving your OpenClaw agent reliable memory across restarts


Session summaries with MemoClaw — giving your OpenClaw agent reliable memory across restarts

Your OpenClaw agent wakes up fresh every session. No memory of yesterday’s debugging marathon, the decision you made about the database schema, or the three corrections you gave it about your name pronunciation. It’s the “agents wake up with amnesia” problem, and it’s the single biggest friction point in working with AI agents long-term.

Most people solve this with MEMORY.md — a flat file that grows until it eats your context window. MemoClaw gives you a better pattern: store session summaries as searchable memories, then recall only what’s relevant when your agent boots up.

Here’s how to set it up.

The pattern

At the end of each session, your agent summarizes what happened and stores it. At the start of the next session, it recalls recent context based on what’s relevant now, not a giant blob of everything that ever happened.

Session ends → summarize → memoclaw store (tagged, scored)
Session starts → memoclaw recall (semantic match) → agent has context

Instead of appending to a file and scanning linearly, you get semantic search over your session history.

Step 1: Install the MemoClaw skill

If you haven’t already:

clawhub install anajuliabit/memoclaw

Or via CLI:

npm install -g memoclaw

Step 2: Store a session summary

At the end of a work session, have your agent store a summary. Here’s what a good one looks like via the CLI:

memoclaw store \
  --text "Session 2026-03-08: Worked on the payment integration for the e-commerce project. Decided to use Stripe Connect for marketplace payouts instead of manual transfers. Fixed the webhook handler for checkout.session.completed events. User prefers TypeScript strict mode — corrected agent twice on this. TODO: implement refund flow next session." \
  --importance 0.8 \
  --tags "session-summary,e-commerce-project,payments" \
  --namespace "work-projects"

A few things to notice:

  • Importance is 0.8 — session summaries are high-value context. Reserve 0.9-1.0 for corrections and user preferences.
  • Tags include both the type (session-summary) and the topic (e-commerce-project, payments). This lets you filter by either.
  • Namespace separates concerns — work project memories don’t mix with personal ones.

What makes a good summary

Not everything deserves to be remembered. A good session summary captures:

  1. Decisions made — “Chose Stripe Connect over manual transfers”
  2. Corrections received — “User prefers TypeScript strict mode” (high importance!)
  3. Work completed — “Fixed webhook handler for checkout events”
  4. Open threads — “TODO: implement refund flow”
  5. Context that would be lost — Error messages encountered, links shared, preferences expressed

Skip the filler. “User said hello, I said hello back” is not a memory.

Step 3: Recall on startup

When your agent starts a new session, recall recent session context:

memoclaw recall \
  --query "recent session context and decisions" \
  --tags "session-summary" \
  --namespace "work-projects" \
  --limit 5

This returns the 5 most semantically relevant session summaries. If you’re about to work on payments again, the payment-related summaries surface first, even if they’re not the most recent.

Targeted recall

Where this gets interesting is targeted queries. Instead of loading all recent context, you recall what’s relevant to the current task:

# Starting a payments session? Get payment-specific context
memoclaw recall \
  --query "payment integration decisions and stripe setup" \
  --namespace "work-projects" \
  --limit 3

# User seems frustrated? Check for past corrections
memoclaw recall \
  --query "user corrections and preferences" \
  --tags "session-summary" \
  --importance 0.8 \
  --limit 5

Step 4: Automate it in your OpenClaw agent

The best session summaries happen automatically. Here’s how to wire this into your OpenClaw agent’s workflow.

Add instructions to your agent’s AGENTS.md or HEARTBEAT.md:

## Session memory (AGENTS.md)

### On session start:
1. Run: `memoclaw recall --query "recent session summaries and user preferences" --tags "session-summary" --namespace "default" --limit 5`
2. Use the results as context for this session.

### Before session ends (or on heartbeat when idle > 30min):
1. Summarize: key decisions, corrections, completed work, open threads
2. Run: `memoclaw store --text "<summary>" --importance 0.8 --tags "session-summary" --namespace "default"`

Your agent reads these instructions, calls MemoClaw, and maintains continuity without you doing anything.

Separating session context from long-term knowledge

Not all memories are session summaries. Use a namespace strategy to keep things organized:

# Session summaries — ephemeral, rolling context
memoclaw store --namespace "sessions" \
  --text "Session 03/08: Refactored auth module..." \
  --tags "session-summary" --importance 0.7

# User preferences — long-term, high importance
memoclaw store --namespace "preferences" \
  --text "User prefers dark mode terminals, TypeScript strict mode, and concise responses" \
  --tags "user-pref" --importance 0.95

# Project knowledge — persistent facts
memoclaw store --namespace "project-ecommerce" \
  --text "Payment provider: Stripe Connect. Webhook endpoint: /api/webhooks/stripe" \
  --tags "architecture,payments" --importance 0.85

On startup, your agent can recall from multiple namespaces:

# Get recent session context
memoclaw recall --namespace "sessions" --query "recent work" --limit 3

# Always load user preferences
memoclaw recall --namespace "preferences" --query "user preferences and corrections" --limit 5

Preventing memory bloat

Session summaries accumulate. After a few weeks, you’ll have dozens. Two strategies:

1. Use the consolidate endpoint to merge related memories:

memoclaw consolidate --namespace "sessions" --tags "session-summary"

This uses GPT-4o-mini to merge overlapping memories into consolidated ones, reducing count while preserving information. Costs $0.01 per call.

2. Set importance thresholds. Store routine sessions at 0.6-0.7 and milestone sessions at 0.8-0.9. When recalling, filter by importance to surface the significant stuff:

memoclaw recall --query "project decisions" --importance 0.8 --limit 5

Why not just use MEMORY.md?

You can. Plenty of people do. But consider the tradeoffs:

MEMORY.mdMemoClaw sessions
SearchLinear (eats context)Semantic (returns relevant hits)
Size limitContext window8192 chars per memory, unlimited total
StructureYou manage itTagged, scored, namespaced
Multi-agentOne file, conflictsShared wallet, concurrent access
CostFree (but context costs)$0.005/store, $0.005/recall

For a solo agent with light memory needs, MEMORY.md is fine. Once you’re managing multiple projects, multiple agents, or sessions that span weeks, semantic search over structured memories wins.

Wrapping up

The pattern is simple: summarize → store → recall. Your agent stops waking up with amnesia and starts carrying context across sessions. The key is being deliberate about what gets stored (decisions, corrections, open threads) and how it’s organized (namespaces, tags, importance scores).

Install the skill, add the startup/shutdown hooks to your AGENTS.md, and your agent gets session memory that scales.

clawhub install anajuliabit/memoclaw

Full docs and API reference at docs.memoclaw.com.