Skip to main content

score_lifecycle_candidate

Function score_lifecycle_candidate 

Source
pub fn score_lifecycle_candidate(
    project: Option<&MatchedProject>,
    record_id: &str,
    record: &MemoryRecord,
    input: &RouteInput,
    reference_map: Option<&ReferenceMap>,
    existing_records: Option<&[(String, MemoryRecord)]>,
) -> Option<LifecycleCandidate>
Expand description

按 scope / project 过滤一条 lifecycle 记忆,未通过返回 None。 通过的记忆返回包含 score + reasons + 原始 memory_type 等信息的 LifecycleCandidate

reference_map 提供 staleness 信息:如果某条记忆长时间未被检索, 会施加负分惩罚(-2 到 -8),让更活跃的记忆排在前面。

existing_records 用于矛盾检测:当提供时,会检查当前记忆是否与已有记忆矛盾, 并填充 contradicts 字段(仅可见性标注,不影响分数)。