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) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-03 00:17:03 +02:00
parent a37737c4af
commit 308958453d

View file

@ -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";