feat: implement provenance tagging and poisoning protection (issue #33)

This commit is contained in:
2026-03-10 00:45:45 +01:00
parent a74720c32d
commit 4521868ff0

View File

@@ -14,6 +14,8 @@ pub mod stage4;
use std::collections::HashMap;
use crate::provenance::ProvenanceRecord;
/// A candidate memory entry passing through the retrieval pipeline.
/// Carries accumulated scores from each stage.
#[derive(Debug, Clone)]
@@ -46,6 +48,8 @@ pub struct RetrievalCandidate {
pub corpus_score: f32,
/// Combined/final score after all stages.
pub final_score: f32,
/// Provenance metadata loaded from the provenance table.
pub provenance_metadata: Option<ProvenanceRecord>,
}
/// Parameters controlling the staged retrieval pipeline.
@@ -61,6 +65,10 @@ pub struct RetrievalParams {
pub tag_filter: Option<String>,
/// Final result limit (from `QueryMemoryRequest.limit`, defaults to 5).
pub result_limit: u32,
/// Minimum trust level for provenance filtering.
pub min_trust_level: Option<i32>,
/// Whether to exclude revoked memories from results.
pub exclude_revoked: bool,
}
impl RetrievalParams {
@@ -76,6 +84,8 @@ impl RetrievalParams {
relevance_threshold: config.relevance_threshold,
tag_filter,
result_limit: if result_limit == 0 { 5 } else { result_limit },
min_trust_level: None,
exclude_revoked: true,
}
}
}