Skip to main content

Module scoring

Module scoring 

Source
Expand description

Hybrid scoring for memory recall.

Functions§

compute_score
Compute 9-component hybrid score for a memory against a query. The graph parameter is used to look up edge counts for graph strength scoring. The bm25 parameter provides BM25-based token overlap scoring; if the memory is in the index it uses the indexed score, otherwise falls back to score_text. The now parameter makes scoring deterministic and testable by avoiding internal clock reads.
graph_strength_for_memory
Compute graph strength for a memory node by combining raw graph metrics.
truncate_content
Re-export the canonical truncate from codemem-core. Truncate a string to max bytes, appending “…” if truncated. Handles multi-byte UTF-8 safely by finding the nearest char boundary.