SuperAPIAI Directory

graymatter

github.com · AI agents

GrayMatter is an open-source tool that provides persistent memory for AI agents, reducing context token consumption while maintaining answer quality through selective recall, knowledge graphs, and memory consolidation. It supports the MCP protocol and can connect to clients such as Claude Code, OpenCode, Zed, and Cline, and it offers a command-line tool, a TUI memory workbench, and an optional hook-based automatic recall feature.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

GrayMatter is a persistent memory system for AI agents, aimed at greatly reducing context token consumption while maintaining answer quality. The project is provided as a command-line tool and an MCP service and can connect to a variety of MCP-capable clients.

Purpose and positioning GrayMatter stores factual memories for agents across sessions and selectively recalls relevant facts when needed, rather than stuffing the full history into context. Official benchmarks show that after 100 sessions, the context tokens per query are about 90% fewer than with the full history; selective recall uses about 670 tokens, compared with about 6,960 tokens for the full history. In terms of inference cost, it is 8.4% lower per task with empty memory and 10.4% lower with 1,000 prior facts.

Main capabilities

  • Persistent memory and selective recall: stores facts and returns them by relevance at query time, with options such as a minimum relevance threshold.
  • Knowledge graph: add --kg when running the daemon; the consolidation cycle extracts entities of types such as people, organizations, and projects, and connects co-occurring entities; each edge records the fact ID that produced it, can be exported as Obsidian notes and wikilinks, and can also be rendered as an offline-usable single-page SVG graph.
  • Revisions and citations: records corrections as explicit revisions, which can replace the current fact for a topic while preserving the source original text; in benchmarks, explicit revisions reduced occurrences of deprecated values in the top 8 from 35 to 0.
  • TUI memory workbench: graymatter tui provides six views and supports a command palette, namespaces, filtering, theme switching, and read-only mode.
  • Diagnostic tool: graymatter doctor --graph reports hubs, cut vertices, isolated nodes, connectivity, and source information, with text or JSON output.
  • Hook-based automatic recall (Claude Code, optional): graymatter hooks install writes the hook configuration to automatically provide recall at session start; if the hook errors, it exits with 0 and outputs empty content to avoid breaking the session.
  • Context block sync (optional): graymatter context-sync projects high-weight facts into a managed block in CLAUDE.md / AGENTS.md, leaves content outside the block unchanged, keeps a .bak backup on each rewrite, and detects and warns about manual edits.
  • Confidence labels: supports unverified < inferred < vThree tiers: verified, specifiable at write time, filterable or weightable at retrieval time.
  • Memory review: review analyze can send qualifying facts from a given namespace to a configured Anthropic or Ollama provider, generating versioned evidence, candidate summaries, and conflict records into a separate log without changing active memory.

Usage After installation, graymatter init can configure supported clients; graymatter init --global also installs managed memory instructions into the user-level instruction files of Claude Code and OpenCode. graymatter init --store-only only prepares the memory directory for the current project. graymatter demo creates a temporary store, runs consolidation, and opens the TUI. MCP clients can point to graymatter mcp. The official claim is verified configurations for 25 clients, including VS Code, Codex, Zed, Cline, and others; Pi can natively read .mcp.json.

Applicability Suitable for coding agents that need cross-session memory, long-term project assistants, and MCP client users who want to control context costs and token consumption.

Limitations and caveats

  • Confidence labels are declarations by the writer, not verification by GrayMatter.
  • The standard doctor does not write probe files, start daemons, execute binaries in PATH, or test data directory writability; its configuration check only looks for references in files and does not prove which settings the client actually loaded.
  • Generative compaction is disabled for Anthropic and Ollama; before using operations that may trigger maintenance, old daemons need to be updated or restarted.
  • Hook latency benchmarks use hardware-relative thresholds; on reference hardware, the p99 for a 10k-fact store is 121 ms.
  • Custom vector backends need to support qualifying IDs or an explicit exhaustion capability to complete filtered retrieval.
  • Some features (such as hooks, context sync, and confidence) are optional or available only from certain versions.

Pricing, prices, and the specific scope of platform support are not yet provided.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools