GrayMatter

Persistent memory for AI agents in one local binary: recall only the top-8 relevant facts, cut context tokens by up to 90%, and build a knowledge graph automatically.

Stars
★ 489
Last updated
2d ago
FARS reviewed
Nov 28, 2026
License
MIT
Primary language
Go

At a glance

How it runs
CLIMCP serverLibrary / SDK
Works with
Universal · cross-platformCodex · Claude Code · OpenAI API · Claude API
Cost
Free, no paid service needed
Setup effort
Low · running in minutes
You'll need
Go toolchain (optional, for go install or building from source)Ollama or OPENAI_API_KEY or VOYAGE_API_KEY (optional, for semantic embeddings)Shell / CLILocal filesystemMCP Server
Typical use
A solo developer who keeps returning to the same repo in Claude Code and needs a release date that moved from Friday to Monday to survive across sessions, without the retired date resurfacing
Not a fit if
  • Teams needing multi-tenant or cloud-synced memory; the project is deliberately local-first single node
  • Python or TypeScript projects wanting an in-process memory library; the library is Go-only
  • Users who want a hosted SaaS with an SLA instead of operating a local binary
Maintenance
Commits in the last 30 dayslast commit 2026-11-27
Source review
66/100 · Some gaps

What does this agent do, and when should you use it?

GrayMatter is a Go memory layer for AI agents shipped as a single ~10 MB static binary that stores facts in a bbolt file at .graymatter/gray.db, indexes them with chromem-go, and returns a top-8 context block built from hybrid vector, keyword and recency ranking instead of replaying full history. It is usable three ways: as a CLI (graymatter init, remember, recall, revise, forget, consolidate, tui), as an MCP stdio server (graymatter mcp serve) that Claude Code, Cursor, Codex, OpenCode and other clients call, and as an importable Go library (graymatter.New, Remember, Recall). Optional Claude Code hooks inject recall on every prompt and re-inject it after /compact, while context-sync projects high-weight facts into a managed block inside CLAUDE.md or AGENTS.md under an explicit token budget. Running the daemon with --kg extracts typed entities and co-mention edges that can be rendered as a self-contained offline page or exported to Obsidian and Graphviz. Everything stays local with loopback-only, bearer-authenticated network surfaces, and embeddings degrade from Ollama to OpenAI to Voyage AI to keyword-only, so the tool works with no keys at all.

Write path: Remember, memory_add or graymatter remember stores a fact with its namespace, optional confidence label (unverified / inferred / verified) and provenance in bbolt; revise records an explicit replacement, marks the prior fact as a tombstone, and immediately stops returning the old value, with a receipt naming what it replaced. Read path: Recall and memory_search rank facts with vector, keyword and recency signals and return a top-8 block; recall --explain prints each fact's ranking signals, fused score and provenance. Maintenance path: consolidate applies decay (default 30-day half-life), pruning and optional entity extraction, while pin exempts a fact from both decay and pruning. Integration path: graymatter init writes MCP entries into .mcp.json, .cursor/mcp.json, ~/.codex/config.toml, opencode.jsonc and several other client configs, hooks install registers SessionStart, UserPromptSubmit, PreCompact and SessionEnd in .claude/settings.json, and context-sync writes a marker-fenced block into instruction files with a .bak of every previous version. Inspection path: graymatter tui opens a six-view workbench (Memory, Recall, Activity, Graph, Usage, Status), kg render emits an inline force-directed SVG page or .dot file, and doctor --graph reports hubs, articulation points, orphans, connectivity and provenance completeness.

  1. A solo developer who keeps returning to the same repo in Claude Code and needs a release date that moved from Friday to Monday to survive across sessions, without the retired date resurfacing
  2. A team split across Cursor, Codex and OpenCode that wants one local memory store shared by several MCP clients after a single graymatter init
  3. A Go engineer building an agent service who wants to Recall before the LLM call and Remember after it, with no extra database to operate
  4. A researcher or compliance reviewer who needs to audit why a fact was recalled, which source it came from, and which correction superseded it
  5. A user who wants agent memory made visible: kg render for an offline graph page, or export --format obsidian so entities become notes and edges become wikilinks
  6. A project whose CLAUDE.md / AGENTS.md keeps growing, using doctor --audit to measure tokens, duplicates, staleness and marker conflicts

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • go install github.com/angelnicolasc/graymatter/cmd/graymatter@latest
  • brew install angelnicolasc/tap/graymatter
  • scoop install graymatter
Config files
~/.codex/config.toml
Install notes cover
Windows · macOS · Linux · Docker

How do you install or deploy this agent?

You need a Go toolchain only if you use go install or build from source; prebuilt binaries need nothing else. There is no Docker, Redis or cloud account involved.

Install with Go:

go install github.com/angelnicolasc/graymatter/cmd/graymatter@latest

Homebrew on macOS / Linux:

brew install angelnicolasc/tap/graymatter

Scoop on Windows:

scoop bucket add angelnicolasc https://github.com/angelnicolasc/scoop-bucket
scoop install graymatter

Or fetch a prebuilt release binary (Linux x86_64 shown):

curl -sSL https://github.com/angelnicolasc/graymatter/releases/download/v0.21.0/graymatter_0.21.0_linux_amd64.tar.gz | tar -xz && sudo mv graymatter /usr/local/bin/

Build from source instead:

git clone https://github.com/angelnicolasc/graymatter
cd graymatter
CGO_ENABLED=0 go build -ldflags="-s -w" -o graymatter ./cmd/graymatter

Then wire the current project and check the setup:

graymatter init              # .graymatter/ + MCP config + memory block
graymatter init --hooks      # Claude Code: recall injected every turn
graymatter doctor            # read-only observations, readiness not evaluated

How do you use this agent?

Start with the fully offline demo, which seeds a scratch store, runs consolidation and opens the TUI:

graymatter demo
graymatter kg render --out kg-graph.html

Everyday memory operations:

graymatter remember "agent" "text"
graymatter recall "agent" "query" --explain
graymatter revise "agent" "old" "new"
graymatter forget "agent" "fact"
graymatter pin "agent" "fact"
graymatter consolidate "agent"

Register the MCP server at user scope for Claude Code (Codex reads ~/.codex/config.toml, which init handles):

claude mcp add --scope user --transport stdio graymatter -- graymatter mcp serve

To prepare only a project's memory directory before a session, repeatable and side-effect limited:

graymatter init --store-only --quiet

Embed it in Go:

ctx := context.Background()
mem := graymatter.New(".graymatter")
defer mem.Close()

mem.Remember(ctx, "sales-closer", "Maria didn't reply Wednesday. Third touchpoint due Friday.")
facts, _ := mem.Recall(ctx, "sales-closer", "follow up Maria")

Opt into knowledge-graph extraction and render the graph:

graymatter daemon run --kg
graymatter kg render --out graph.html
graymatter doctor --graph --html graph.html

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

External MCP tool bridge

Inherits capabilities of connected MCP servers; audit third-party servers before enabling.

What are this agent's strengths and limitations?

Pros
  • Publishes reproducible numbers rather than claims: the token_count benchmark drops context from ~6,960 to ~670 tokens per query at 100 sessions (-90%), alongside a 113-task paired inference-cost benchmark and a revision benchmark that takes retired facts in the top-8 from 35 to 0
  • Very light deployment: one ~10 MB static binary, bbolt plus chromem-go in pure Go, no Docker, Redis, config files or cloud account, and a zero-dependency keyword mode that runs fully offline
  • Broad, documented client coverage: a single graymatter init wires Claude Code, Cursor, Codex, OpenCode, Antigravity, Windsurf and VS Code Copilot, with verified configs for 25 clients in docs/integrations.md
  • Genuinely explainable recall: recall --explain exposes ranking signals, fused score and provenance per fact; revise keeps tombstones and replacement receipts; explicit confidence labels participate in the final score
  • Clear safety boundary: network surfaces bind loopback-only with bearer auth, recalled facts are treated as untrusted input and fenced, and hook failures exit 0 so a broken memory never breaks a session
  • MIT licensed, with four entry points (CLI, MCP server, REST server, Go library) and 13 ADRs that record tradeoffs plus the condition under which each should be reversed
Limitations
  • The library is Go-only; Python and TypeScript teams can only reach it through MCP or the REST server, not in-process
  • Local-first single node by design and explicitly not multi-tenant; cross-project memory federation is a deferred roadmap issue, so sharing memory across machines or teams has no official path
  • Automatic pruning removes unpinned facts once weight falls below 0.01, tombstones included, so long-lived knowledge depends on disciplined use of pin
  • Several behaviours are version- or configuration-gated: confidence options and init --store-only arrived in v0.20.0, unsupported daemon options return an update-or-restart error, and generative compaction is disabled for Anthropic and Ollama
  • Semantic recall quality depends on an optional embedding provider; the keyword-only fallback is weaker, and custom vector backends need an eligible-ID or explicit-exhaustion capability to support filtered search
  • Turn-by-turn auto-injection hooks are Claude Code only, hooks are not global by default and skip unprepared directories, so other clients still need their own wiring

How does this agent compare with similar options?

The repository positions itself against two adjacent categories. Code graphs parse a source tree and expose symbols, call edges and blast radius, with the repo as source of truth; GrayMatter never reads source, facts exist only because something deliberately wrote them, and they carry a 30-day half-life that a code graph must never have, since a stale fact means something changed while a stale code graph means nothing did. Context compressors shrink payloads already moving through the transport; GrayMatter never sees your traffic, the agent writes one distilled sentence and recalls a few later, and the two stack. The benchmarks also compare against an organized notes folder: on 113 paired tasks, the core profile cost less on 94 of them and solved 50 tasks versus 44 for the folder.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
GrayMatter This agent 66 · Some gaps CLIFree ★ 489 2d ago Go Codex · Claude Code · OpenAI API · Claude API
Remnic Agent Memory 73 · Some gaps CLIFree + model costs ★ 235 1d ago TypeScript ChatGPT · Codex · Claude Code · OpenAI API
Ori Mnemos 56 · Major gaps CLIFree ★ 339 1mo ago TypeScript Claude Code · OpenAI API · Claude API
GraphMind Code Graph 55 · Major gaps Desktop appFreemium ★ 219 2d ago Rust Claude Code · Claude.ai

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Some gaps
66/ 100 5-point scale 3.3 / 5
Trust 14/29
Reliability 8/14
Adaptability 16/18
Convention 14/18
Effectiveness 9/13
Verifiability 5/8
Why each dimension lost points
Trust14 / 29 · 2.4/5

Evidence shows a local single binary with no default cloud dependency, plus --read-only, --no-create, opt-in hooks, and usage adapters that do not auto-discover credentials. However, on Windows the daemon relies only on a 256-bit token and any local process can reach loopback; 0600 is POSIX-only. Memory writes, forgets, and pruning have no user confirmation, bbolt is plaintext with no encryption at rest, and init rewrites multiple client configs. Deductions: least privilege and sensitive-data protection are thin, and rollback relies mainly on .bak files and preserved configs rather than a general undo for memory mutations.

Reliability8 / 14 · 2.9/5

Docs and CI are fairly complete, with specific failure behavior: hooks exit 0 with empty stdout, init returns nonzero on partial apply, and unsupported compact operations report update/restart errors. But go.mod declares go 1.23.0 while AGENTS.md requires Go 1.25.5+, and README says “no config files” although several config files exist. Dependencies are public Go modules pinned to versions, so availability is adequate.

Adaptability16 / 18 · 4.4/5

README/CLAUDE.md clearly separate three audiences: users installing it, agents working in a project that uses it, and contributors. AGENTS.md gives explicit “when to call which tool” trigger rules, and capability boundaries are well documented (no Gemini adapter, review sends explicitly, doctor does not test writability). Environment coverage spans Linux/macOS/Windows and many MCP clients, though Windows ACL/PATH caveats remain.

Convention14 / 18 · 3.9/5

Install notes are thorough (go install, Homebrew, Scoop, prebuilt binaries, MCP wiring). Known limitations and the MIT license are explicit, and version numbers plus ADRs are traceable. But there is no CHANGELOG file, maintenance responsibility points only to an unverified publisher, and the information architecture is long.

Effectiveness9 / 13 · 3.5/5

Outputs are usable (CLI/JSON/TUI/MCP structured responses), and the value proposition is backed by in-repo benchmarks. However, the 90% token-reduction figure comes from a self-built benchmark with a keyword embedder, and marginal value and cost advantage are not independently verified.

Verifiability5 / 8 · 3.1/5

Most claims trace to benchmarks/RESULTS.md, ADRs, and docs; usage separates reported from estimated values, and doctor separates readiness from observations. But some performance claims depend on specific benchmark conditions, cross-source inconsistencies exist (e.g., Go version), and the line between fact and inference is not always sharp.

Risks and how to mitigate them
  • On Windows the daemon's loopback access is protected only by a 256-bit token; any local process can connect, and 0600 is POSIX-only, so local isolation of the memory store is weak.
  • The memory store is plaintext bbolt with no encryption at rest; AGENTS.md says never store secrets, but there is no technical enforcement or scanning.
  • Decay/pruning can remove live facts, and forget/revise have no confirmation step; enable automatic maintenance cautiously for production memory.
  • init rewrites multiple client configs; replacing an existing MCP entry requires explicit --replace-mcp, and a partial apply returns nonzero while retaining successful writes.
  • Core numbers such as 90% token reduction and lower cost come from in-repo benchmarks with a keyword embedder; they lack independent reproduction and should not be generalized to all models or workloads.
  • go.mod declares Go 1.23.0 while AGENTS.md requires Go 1.25.5+; verify the actual module files before building.
Evidence confidence: Low Reviewed Nov 28, 2026 Reviewed revision c1b9b77cfa40
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/graymatter.svg)](https://followagents.com/en/agents/graymatter)
<a href="https://followagents.com/en/agents/graymatter"><img src="https://followagents.com/badge/graymatter.svg" alt="FARS review"></a>

FAQ

Do I need an LLM or an API key to use it?
No. The base mode is TF-IDF plus recency with zero dependencies, and graymatter demo runs fully offline with no keys and no Ollama. Semantic recall is optional through a local Ollama model, OPENAI_API_KEY or VOYAGE_API_KEY, and the four modes degrade in that order.
Where is memory stored, and does data leave my machine?
Facts live in .graymatter/gray.db, a bbolt single-writer store, with vectors handled by chromem-go. Network surfaces bind loopback only and require bearer auth. Text is only sent to a third party if you explicitly configure a cloud embedding provider.
A fact became wrong. Will the old value keep coming back?
Use graymatter revise to record an explicit replacement; the old fact is retired as a tombstone and immediately drops out of recall, and the receipt names what it replaced. In the revision benchmark, storing corrections as independent facts surfaced retired values in 35 of 35 queries; explicit revisions brought that to zero.
Does memory survive context compaction in Claude Code?
Yes. The SessionStart hook re-injects the freshest live facts plus __shared__ conventions after /compact, PreCompact writes a deterministic checkpoint before compaction, and SessionEnd checkpoints and runs detached maintenance. Hook errors exit 0 with empty stdout, so a failed memory never blocks the session.
What happens to facts nobody touches any more?
Unpinned facts decay on a default 30-day half-life and can be pruned once weight falls below 0.01, including tombstones. Pin the conclusions you need to keep; pinned facts are exempt from decay and pruning, and unpin restores normal behaviour.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts