Skip to main content

spool/domain/
lifecycle_candidate.rs

1use crate::domain::{ConfidenceTier, MemoryLifecycleState, MemoryScope};
2use serde::{Deserialize, Serialize};
3use ts_rs::TS;
4
5/// 检索排序管道里的 lifecycle 候选。与 `CandidateNote` 同级,
6/// 代表一条被 scope/project 过滤后、按 memory_type 评分进入 top-N 的 ledger 记忆。
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, TS)]
8#[ts(export, export_to = "../frontend/src/lib/types/generated/")]
9pub struct LifecycleCandidate {
10    pub record_id: String,
11    pub title: String,
12    pub summary: String,
13    pub memory_type: String,
14    pub scope: MemoryScope,
15    pub state: MemoryLifecycleState,
16    pub score: i32,
17    pub reasons: Vec<String>,
18    pub project_id: Option<String>,
19    pub confidence: ConfidenceTier,
20    /// Record IDs of existing memories that this candidate contradicts.
21    #[serde(default, skip_serializing_if = "Vec::is_empty")]
22    pub contradicts: Vec<String>,
23}