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
38
39
40
41
//! MemoryEdge — typed, weighted relationships between memories.
use serde::{Deserialize, Serialize};
use crate::types::*;
/// The type of relationship between two memories.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EdgeType {
/// Causal: A caused B.
Caused,
/// Temporal: A happened before B.
Before,
/// Semantic: A is related to B.
Related,
/// Contradicts: A conflicts with B.
Contradicts,
/// Supports: A provides evidence for B.
Supports,
/// Supersedes: A replaces B (newer information).
Supersedes,
/// Derived: A was derived/inferred from B.
Derived,
/// Part of: A is a component of B.
PartOf,
}
/// A directed, typed, weighted edge between two memory nodes.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MemoryEdge {
/// Source memory ID.
pub source: MemoryId,
/// Target memory ID.
pub target: MemoryId,
/// Relationship type.
pub edge_type: EdgeType,
/// Strength of the relationship (0.0 to 1.0).
pub weight: f32,
/// When this edge was created.
pub created_at: Timestamp,
}