DEV Community

Hazel
Hazel

Posted on

I built a memory system for AI agents that stores everything as readable Git records

Every time I start a new session with my AI agent, it forgets everything. My preferences, the decisions we made yesterday, the project structure we spent an hour discussing — all gone.

I got frustrated enough to build something about it.

The problem

I use OpenClaw agents daily. The standard workaround is a MEMORY.md file — a big text file loaded at the start of each session. It works until it doesn't:

  • It grows until it eats your context window
  • You have to maintain it manually
  • It doesn't scale to teams. If my colleague's agent learns something, mine has no idea

I tried vector databases, SQLite + FTS5, various combinations. They all share the same flaw: memories get injected into the context window once at session start, and then they're just tokens. When context compaction kicks in during a long session, those memories can get summarized away or dropped entirely.

What I built

ClawMem is a memory plugin for OpenClaw that takes a different approach.

The core loop:

  1. You talk to your agent normally — it doesn't know the memory system exists
  2. After each session, an LLM subagent analyzes the conversation and extracts durable facts, decisions, and lessons
  3. Each memory is stored as a structured, labeled record on a GitHub-compatible Git server
  4. Before the next session, relevant memories are searched and injected into context

Here's what a stored memory looks like:

#23 [Open] kind:decision topic:api status:active
API rate limiting uses sliding window policy.
Source: session #42, turn 3
Enter fullscreen mode Exit fullscreen mode

Human-readable. You can browse them, search them, edit them, trace each one back to the exact conversation that created it.

The team memory part

This is what I'm most excited about. I recorded a demo of it here:

Multiple agents share the same memory repository. When one team member's agent learns something — "the client meeting moved to Thursday, they want the proposal to focus on sustainability" — every other team member's agent can recall that in their next session.

No Slack archaeology. No "did anyone tell the agent about the deadline change?" Just shared, inspectable, structured memory.

How it works under the hood

The backend is a GitHub-compatible API server written in Go

  • REST API endpoints (GitHub API v3 compatible)
  • GraphQL API (v4 compatible)
  • Real Git HTTP protocol — git clone actually works
  • Hybrid search: SQL LIKE for exact matches + OpenAI embedding vectors for semantic similarity
  • Multi-tenant with per-agent database isolation
  • Tested with real teamwork scenarios.

The plugin (@clawmem-ai/clawmem) hooks into OpenClaw's lifecycle:

  • before_agent_start → recall relevant memories, inject into context
  • session_end / before_reset → extract memories via LLM subagent
  • SHA256 deduplication so the same fact doesn't get stored twice
  • 8 memory tools available to agents (memory_recall, memory_store, memory_list, memory_update, memory_forget, etc.)

Install

Paste this into your OpenClaw chat and let the agent handle it:

Read https://clawmem.ai/SKILL.md and follow the instructions to install ClawMem
Enter fullscreen mode Exit fullscreen mode

The plugin provisions your memory repository automatically on first run. No separate account needed.

What it doesn't do (yet)

I want to be upfront about the current limitations:

  • Only works with OpenClaw — MCP server is next on the roadmap, which would enable Claude Code, Cursor, and other MCP-compatible tools
  • Search quality is a work in progress — the backend supports vector search, but the plugin's fallback lexical scoring isn't great yet
  • Web console with minimal visualization and management capabilities — API integration is in progress

Why Git-based storage?

People ask me this a lot. Most memory systems use vector databases. They're great for retrieval but terrible for inspection. You query through an API and hope for the best.

With ClawMem, every memory is a record you can read. You can:

  • Open a list and see everything your agent knows
  • Edit or delete any memory before it shapes the next answer
  • Trace any memory back to the session and turn that created it
  • git clone to download all your data — zero lock-in
  • And AI agent knows git a lot!

When you're trusting an AI system to remember things about your work, your team, your decisions - being able to actually see what it remembers matters.

Links

Would love to hear your thoughts — especially if you've dealt with agent memory in your own projects. What approaches have worked for you?

Top comments (0)