From 308958453d7b556dcd9da8ccec6f1064130ff899 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Sun, 3 May 2026 00:17:03 +0200 Subject: [PATCH] docs(sf): memory-relations.ts header reflects actual writers + readers The file header described an aspirational design ("LINK actions emitted by the memory extractor, or future /sf memory link CLI") that never matched code reality. As of this session: Writers shipped: (a) applyMemoryActions auto-links co-extracted memories with related_to (b9bff3762) (b) /sf memory import loads explicit edges from JSON Read consumers shipped: (1) getRelevantMemoriesRanked graph-boost (55b14c3f7) (2) sf_graph MCP tool (pre-existing) Updated the header so a contributor reading top-down sees the current data flow, not the original plan. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/resources/extensions/sf/memory-relations.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/resources/extensions/sf/memory-relations.ts b/src/resources/extensions/sf/memory-relations.ts index dbc02b4c2..89fbbbe6d 100644 --- a/src/resources/extensions/sf/memory-relations.ts +++ b/src/resources/extensions/sf/memory-relations.ts @@ -1,9 +1,15 @@ // SF Memory Relations — knowledge-graph edges between memories // -// Phase 4 companion to memory-store.ts. Edges live in the `memory_relations` -// table and are created by (a) explicit LINK actions emitted by the memory -// extractor, or (b) future `/sf memory link` CLI commands. All writes go -// through the single-writer gate in `sf-db.ts`. +// Edges live in the `memory_relations` table and are produced by: +// (a) `applyMemoryActions` auto-linking co-extracted memories with +// `related_to` (confidence 0.5) — same-batch memories from the +// extractor share narrative context. +// (b) `/sf memory import` loading explicit edges from a JSON export. +// Read consumers: +// (1) `getRelevantMemoriesRanked` walks edges of cosine top-N memories +// and applies a one-pass intra-pool score boost (damping 0.4). +// (2) `sf_graph` MCP tool exposes BFS traversal for explicit queries. +// All writes go through the single-writer gate in `sf-db.ts`. import { _getAdapter, isDbAvailable } from "./sf-db.js";