angelnicolasc/graymatter

30 sec to give your AI agents persistent memory. Reduce 90% token consumption while also maintaining quality.

What it solves

AI agents are typically stateless, meaning they forget everything between sessions. This leads to a linear growth in conversation history that consumes excessive context tokens and increases costs. GrayMatter provides a persistent, local-first memory layer that allows agents to recall relevant facts across sessions without needing to inject the entire history.

How it works

GrayMatter operates as a single binary that can be used as an MCP (Model Context Protocol) server or a Go library. It uses a hybrid retrieval system (vector, keyword, and recency) to surface the top-8 most relevant facts for a given query. It features a self-building knowledge graph that extracts typed entities and links them automatically. To maintain memory quality, it employs a deterministic decay system (30-day half-life) and an asynchronous consolidation process that summarizes and prunes facts.

Who it’s for

Developers building AI agents—particularly those in the Go ecosystem—who need a zero-dependency, embeddable memory layer that works with MCP-compatible clients like Claude Code, Cursor, and Windsurf.

Highlights

  • Token Efficiency: Reduces context tokens by up to 90% compared to full-history injection.
  • Zero Dependency: A single static binary (~10 MB) with no requirement for Docker, Redis, or cloud accounts.
  • Self-Building Knowledge Graph: Automatically extracts entities and relationships, with export capabilities to Obsidian.
  • Graceful Embedding Degradation: Supports Ollama, OpenAI, Voyage AI, or falls back to keyword-only retrieval.
  • Observability: Includes a built-in TUI dashboard for monitoring memory cost, recalls, and agent activity.

Related

  • Project
  • Project
  • Project
  • Project
  • Project