Repository navigation
GrayMatter v0.3.0
Breaking changes
This is a pre-1.0 release. The following breaking changes harden the API and are the right long-term design.
ctx-first API (all public Memory methods)
Every Remember, Recall, RememberShared, RecallShared, RecallAll method now accepts context.Context as the first argument. The redundant *Ctx variants (RememberCtx, RecallCtx, etc.) are removed. Consolidate was already ctx-first — all methods are now consistent.
Before:
mem.Remember("agent", "observation")
facts, _ := mem.Recall("agent", "query")After:
ctx := context.Background()
mem.Remember(ctx, "agent", "observation")
facts, _ := mem.Recall(ctx, "agent", "query")Store() → Advanced()
Memory.Store() *memory.Store is removed. Use Memory.Advanced() AdvancedStore instead. AdvancedStore is a narrow interface (List, Delete, Stats, DB, UpdateFact, PendingVectorCount, …) that exposes only what CLI/MCP/TUI callers need. Internal *memory.Store refactors no longer break the public API surface.
New features
Health observability
New() preserves the never-panic convenience contract but now makes degraded state detectable:
mem := graymatter.New(".graymatter")
if !mem.Healthy() {
log.Fatalf("graymatter: %v", mem.Status().InitError)
}Healthy() bool— false when the underlying store failed to openStatus() Status—{Healthy, Mode, InitError, DataDir}for structured diagnostics
Durable vector reconciliation
Closes the inconsistency window between bbolt (durable source of truth) and the chromem-go vector index.
- A new
bucketPendingVectorbbolt bucket is written in the same transaction as each fact. It is cleared only after the vector upsert confirms success. - A background
vectorReconcileLoop(default 30s, configurable viaConfig.VectorReconcileInterval; 0 disables) continuously drains the pending queue. The inconsistency window shrinks from "until next process restart" to "until next reconcile tick". Store.PendingVectorCount() int— exposed onAdvancedStorefor health monitoring.Config.OnVectorIndexErrorcallback — mirrors the existingOnConsolidateErrorpattern; called when inline indexing fails so you can route the event to your APM stack.reconcileVectors()at startup is now O(pending) instead of O(all facts).
ConsolidateThreshold default: 100 → 20
The previous default meant consolidation (the headline token-saving feature) never fired for demos or early production use. 20 facts fires within a realistic first week of agent usage while still giving the LLM enough material to summarise meaningfully.
Migration guide
# Find all call sites in one grep:
grep -rn "\.Remember(\|\.Recall(\|\.RememberShared(\|\.RecallShared(\|\.RecallAll(\|\.Store()\|RememberCtx\|RecallCtx" .- Add
ctx context.Contextas first arg to everyRemember/Recall/RememberShared/RecallShared/RecallAllcall. - Replace
mem.Store()withmem.Advanced(). The returnedAdvancedStoreinterface covers all methods CLI/MCP/TUI callers need; if you called a method not on the interface, open an issue. - If you used
RememberCtx/RecallCtx(the old ctx variants), collapse them — they are now the canonical methods. - Add
if !mem.Healthy() { log.Fatal(...) }afterNew()in production entrypoints.