1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Prospective implication record for forward-looking inference.
//!
//! Prospective implications capture what future consequences a memory might
//! have. They enable proactive retrieval: when new context matches an
//! implication's embedding, the source memory is surfaced before it becomes
//! directly relevant.
use serde::{Deserialize, Serialize};
use crate::id::MemoryId;
use crate::timestamp::Timestamp;
/// A forward-looking implication derived from a source memory.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProspectiveImplication {
/// Unique identifier for this implication.
pub id: MemoryId,
/// The memory that generated this implication.
pub source_memory_id: MemoryId,
/// Natural-language description of the anticipated consequence.
pub implication_text: String,
/// When this implication was created (epoch ms).
pub created_at: Timestamp,
}
impl ProspectiveImplication {
/// Create a new prospective implication with auto-generated ID.
#[must_use]
pub fn new(source_memory_id: MemoryId, implication_text: impl Into<String>) -> Self {
Self {
id: MemoryId::new(),
source_memory_id,
implication_text: implication_text.into(),
created_at: Timestamp::now(),
}
}
}