github angelnicolasc/graymatter v0.15.0
GrayMatter v0.15.0

latest releases: v0.21.0, cmd/graymatter/v0.21.0, v0.20.1...
3 months ago

GrayMatter v0.15.0

Persistent memory for Go AI agents. Single binary. Zero infra.

Quick install

go install github.com/angelnicolasc/graymatter/cmd/graymatter@v0.15.0

Prebuilt binaries for Linux, macOS and Windows are in the assets below,
with checksums.txt (sha256). Per-platform download commands are in the
README.


What users get

  • Embedding provider switches self-heal. Change providers and the store re-indexes
    itself under the new provider before serving a single query - stale vectors can no
    longer poison search, and doctor --embeddings shows the whole channel's state:
    coverage, degraded writes, retry backlog.
  • The write path is production-grade. Recall bookkeeping dropped from eight write
    transactions per query to one; confident writes are O(1), race-free, and embed exactly
    once.
  • Retrieval speaks every script. Unicode-native tokenization with plural folding and
    access-anchored recency - measured across three corpora, headline numbers unchanged,
    remaining gaps quantified as decision records rather than folklore.
  • The knowledge graph lives and dies with memory. Entity IDs are type-scoped (stores
    migrate automatically on open), and graph weights decay through the same idempotent
    lifecycle rule as facts.
  • LLM extraction is opt-in and failure-proof. GRAYMATTER_KG_LLM_EXTRACT=1 enables
    Anthropic-backed entity extraction; every failure mode degrades to the deterministic
    regex extractor, never to silence.

Changed

  • Retrieval vocabulary is now Unicode-native. Tokenization segments words in any
    script (accented Spanish stays whole instead of shattering at every accent; CJK text
    yields tokens where it previously produced none) with an ASCII fast path for the common
    case, and folds EN/ES plurals so "Rollbacks" meets "rollback". Recency anchors on last
    access, not creation - the access-tracking machinery finally influences live ranking.
    Measured honestly against all three corpora: headline numbers unchanged, because the
    remaining misses are word-formation and compound-word problems, not segmentation - both
    now precisely quantified in RESULTS-corpora.md as the decision record for fuller
    stemming and adjacency indexing.

  • The production write path stops fighting itself. Recall access tracking used to spawn
    one goroutine holding one bbolt write transaction per returned fact - up to eight write
    transactions and eight goroutines per recall contending with real writers for
    bookkeeping; it now flushes as one batched transaction, update-never-create, so a fact
    deleted mid-recall cannot be resurrected by its own bump. PutConfident no longer
    re-lists the entire agent namespace and text-scans for the fact it just wrote: the write
    path hands back exactly what landed, making confident writes O(1), race-free, and
    guaranteed to embed once.

  • Embedding provider switches self-heal. Changing providers used to leave every old
    vector in place behind a log warning - wrong-dimension embeddings silently poisoning
    similarity search until someone rebuilt by hand. Open now detects the dimension change,
    queues all live facts, adopts the new dimension durably, and re-embeds synchronously
    before serving a single query. The reconciler itself learned the same trick: any queued
    fact whose stored vector length disagrees with the active provider is re-embedded fresh
    and persisted, tombstones never reach the index, and a mid-reindex failure keeps its
    retry marker instead of vanishing.

  • Two new retrieval-quality corpora extend measurement beyond the frozen English set.
    multilingual-es (126 Spanish facts, 15 queries in two declared classes: ASCII-anchor
    reachable vs accent-dependent) and long-horizon (421 facts across 50 sessions with
    genuinely tombstoned late variants). Both ship with deterministic generators. First
    measured baselines: Spanish overall 60% [36–80] for GrayMatter fixed-K against a 27%
    window; long-horizon 100% [68–100] HitRate at 0% Dead and 145 tokens/q while the
    window and recency-only scoring both return none of the early decisions. Every table now
    prints its Wilson 95% interval — six-query point estimates are not laws of nature.

  • The knowledge graph now decays with memory. Node and edge weights only ever grew
    (upsert took max), so a hub entity from a finished project stayed prominent forever, and
    the graph's old decay helper was dead code carrying the multiplicative bug the fact side
    had already fixed. Consolidation gained a Step 5 behind an optional GraphDecayer
    capability: weights recompute from staleness (min(w, exp(-λ·staleness)), idempotent -
    running cycles more often never forget faster) and sub-floor entries prune. The shipped
    kg.GraphAdapter implements it; custom GraphAccessors without the capability are
    untouched.

  • Entity IDs are type-scoped. canonicalID now yields <type>:<label>, so "apple" the
    organization and "apple" the concept stay distinct nodes instead of merging into one.
    Stores written under the v1 scheme are wiped on open - nodes are derivable state - and
    the extraction watermark resets so the next consolidation cycle rebuilds the graph from
    facts exactly once. The extraction bench now matches on normalized label (the stable
    identity) rather than scheme-specific IDs; measured precision under label matching:
    0.973, recall 0.785 on the 105-fact labeled corpus.

  • graymatter doctor --embeddings makes the silent keyword-only fallback visible.
    Put degrades a fact to keyword-only whenever the embedder errors and still returns nil,
    so a broken backend was indistinguishable from an empty store. The store now records the
    lifetime degradation count and the last error (Store.EmbeddingHealth, Store.CountEmbeddings),
    and the new audit reports vector coverage over live facts, degraded writes, the retry
    backlog, and which of the three honest states you are in: healthy channel, supported
    keyword-only (ADR-005), or a failing backend hiding behind that silence. Deterministic like
    doctor --health — reads only store bytes, byte-identical output per store, works with the
    daemon down.

Fixed

  • RecallAll now performs the RRF fusion its documentation always claimed. The
    implementation concatenated agent-first and truncated, so the shared namespace starved
    whenever the agent list filled its topK — while docs/api-stability.md listed RecallAll
    under the deterministic-ordering guarantee and the doc-comment promised Reciprocal Rank
    Fusion. The two namespace rankings are now fused with the same k=60 constant Recall uses
    internally (a shared fact ranked 1 beats an agent fact ranked 8), identical texts across
    namespaces accumulate both contributions and appear once, and ties resolve through a total
    order so repeated calls return identical output.

  • memory_reflect forget/update receipts survive consolidation. The MCP surface
    zeroed a retired fact's weight on top of tombstoning it, which drops it under the prune
    floor (<0.01) — so the next consolidation cycle collected the receipt milliseconds after
    writing it, destroying the audit trail ADR-007 keeps tombstones for. The engine's own
    supersede path argued exactly this and kept the weight; the two paths now agree: the
    tombstone keeps whatever weight decay left it, recall still skips it from the next query
    onward, and ordinary decay collects it in due course.

  • The embeddings chain's third slot works. It dialled
    api.anthropic.com/v1/embeddings — an endpoint that does not exist; Anthropic has never
    offered an embeddings API — so every call failed, and because Put swallows embedder
    errors, anyone relying on that slot silently ran keyword-only memory while believing they
    had vectors. The slot now targets Voyage AI (api.voyageai.com/v1/embeddings, model
    voyage-3, 1024 dims unchanged so existing stores stay valid) keyed off VOYAGE_API_KEY.
    EmbeddingAnthropic/ModeAnthropic remain accepted as deprecated aliases: with
    VOYAGE_API_KEY set they resolve to the Voyage provider; without one they resolve to
    keyword directly instead of constructing a provider guaranteed to fail on every call.
    ADR-005 amended.

  • The Obsidian entity export no longer loses entities to filename collisions. Two
    distinct labels that sanitize identically ("Acme Corp" / "Acme_Corp") wrote the same note
    file — the second silently overwrote the first, taking its Related links and MOC entry
    with it. EntityNoteNames is now the single naming authority for an export: colliding
    names get a deterministic -2/-3 suffix in canonical-ID order, and node files, Related
    links and the entities index all resolve through it.

  • Ollama auto-detection requires an actual Ollama. The probe counted any HTTP status
    below 500 as "reachable", so a captive portal or corporate proxy answering 404 for
    /api/tags made AutoDetect select the Ollama provider on networks without Ollama; every
    embedding failed and Put's silent degradation turned that into keyword-only memory with a
    latency tax on every write.

Added

  • Opt-in LLM entity extraction with a deterministic safety net.
    GRAYMATTER_KG_LLM_EXTRACT=1 enables Anthropic-backed extraction for the knowledge
    graph - cloud API, no local hardware. Every failure mode degrades per-text to the
    regex extractor: unreachable endpoint, invalid JSON, empty answer. A schema gate drops
    model-emitted types and relations outside the declared vocabulary and ignores
    model-provided IDs entirely - identity derives from label+type under the typed scheme.

Compatibility notes

  • Knowledge-graph migration runs once on first open. Stores written by v0.14 wipe
    their derived graph state (nodes/edges are re-extractable from facts) and reset the
    extraction watermark; the next consolidation cycle rebuilds the graph under typed IDs.
    Facts, sessions and checkpoints are untouched.
  • Ranking outputs shift across the board (Unicode tokenization, plural folding,
    recency anchored on access). If you diff recall output between versions, pin versions -
    the golden fixtures were regenerated under the documented -update policy.
  • EmbeddingAnthropic / ModeAnthropic resolve to Voyage AI now. With
    VOYAGE_API_KEY set they work end-to-end; without one they resolve straight to
    keyword-only instead of constructing a provider guaranteed to fail.
  • A provider switch blocks Open() while re-indexing. One-time cost proportional to
    live fact count; progress is logged and the store serves nothing stale in the meantime.
  • MCP forget/update receipts persist until decay collects them, matching ADR-007 -
    they leave recall immediately but stay listed/exportable/auditable.

Don't miss a new graymatter release

NewReleases is sending notifications on new releases.