feat(db): add truth scoring columns migration (#31)

Add V5__truth_scoring.sql migration:
- truth_value (REAL): 0.0-1.0 truth score from PLN reasoning
- truth_confidence (REAL): 0.0-1.0 confidence in the score
- truth_category (TEXT): verified/plausible/unverified/contradicted
- truth_evaluated_at (TIMESTAMPTZ): when last scored
- ecan_sti (REAL): Short-Term Importance (recency-weighted)
- ecan_lti (REAL): Long-Term Importance (reliability)

Partial indexes for efficient unscored memory queries.
Update MemoryRecord struct with optional truth fields.

Part of #29
This commit is contained in:
Agent Zero
2026-04-04 02:10:15 +00:00
parent b19f65dc0b
commit 5f9d884187
2 changed files with 48 additions and 0 deletions

View File

@@ -30,6 +30,13 @@ pub struct MemoryRecord {
pub metadata: serde_json::Value,
pub created_at: chrono::DateTime<chrono::Utc>,
pub expires_at: Option<chrono::DateTime<chrono::Utc>>,
// Truth scoring fields (populated by background worker)
pub truth_value: Option<f32>,
pub truth_confidence: Option<f32>,
pub truth_category: Option<String>,
pub truth_evaluated_at: Option<chrono::DateTime<chrono::Utc>>,
pub ecan_sti: Option<f32>,
pub ecan_lti: Option<f32>,
}
/// Query result with similarity score
@@ -299,6 +306,13 @@ impl Database {
metadata: row.get("metadata"),
created_at: row.get("created_at"),
expires_at: row.get("expires_at"),
// Truth fields will be populated by issue #39
truth_value: None,
truth_confidence: None,
truth_category: None,
truth_evaluated_at: None,
ecan_sti: None,
ecan_lti: None,
},
similarity: row.get("hybrid_score"),
vector_score: row.get("vector_score"),