memory-graph-builder

Installation
SKILL.md

Memory Graph Builder

What it does

OpenClaw stores agent memory in a flat MEMORY.md file — one line per fact, no structure, no relationships. This works until your agent has 200+ memories and half of them are duplicates, three contradict each other, and the whole file costs 4,000 tokens every session.

Memory Graph Builder treats MEMORY.md as a raw data source and builds a structured knowledge graph on top of it. Each memory becomes a node with typed relationships to other nodes. The graph enables:

  • Duplicate detection — "User prefers dark mode" and "User likes dark theme" are the same fact
  • Contradiction detection — "User uses Python 3.8" vs "User uses Python 3.12"
  • Staleness detection — Facts older than a configurable threshold that haven't been referenced
  • Memory digest — A compressed, relationship-aware summary that replaces raw MEMORY.md in the system prompt, saving 30-60% tokens

Inspired by OpenLobster's Neo4j-backed graph memory system, adapted to work on top of OpenClaw's existing MEMORY.md without requiring a database.

When to invoke

  • Automatically, nightly at 10pm (cron)
  • After bulk memory additions (e.g., after project-onboarding)
Related skills
Installs
16
GitHub Stars
61
First Seen
Mar 21, 2026