pub fn select_lifecycle_candidates(
project: Option<&MatchedProject>,
records: &[(String, MemoryRecord)],
input: &RouteInput,
limit: usize,
excluded_record_ids: &HashSet<String>,
reference_map: Option<&ReferenceMap>,
) -> Vec<LifecycleCandidate>Expand description
从 lifecycle ledger 的 (record_id, record) 列表里打分 + 过滤 + 截断,产出 top-N lifecycle 候选。
excluded_record_ids 用于去重:已经被 canonical vault note 覆盖的 record_id 不再作为
lifecycle candidate 返回,避免同一条记忆在 context 里双计(note 一次 + lifecycle candidate 一次)。
reference_map 提供 staleness 信息,传 None 跳过 staleness 惩罚。
After initial top-K selection, performs 1-hop relation expansion via related_records
fields. Expanded candidates receive a 30% score penalty and are merged into the result
before final truncation. Records that didn’t score on their own but are referenced by
a top-K record receive a base score derived from the referencing record’s score.