Skip to main content

FactStore

Trait FactStore 

Source
pub trait FactStore: Send + Sync {
Show 19 methods // Required methods fn upsert_fact_with_provenance<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, value: &'life3 str, source: &'life4 str, channel_id: Option<&'life5 str>, privacy: FactPrivacy, first_seen_at: Option<DateTime<Utc>>, source_excerpt: Option<&'life6 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait; fn get_facts<'life0, 'life1, 'async_trait>( &'life0 self, category: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn reconcile_personal_memory<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _write: &'life1 PersonalMemoryWrite, _source: &'life2 str, _source_excerpt: Option<&'life3 str>, _channel_id: Option<&'life4 str>, _privacy: FactPrivacy, ) -> Pin<Box<dyn Future<Output = Result<PersonalMemoryWriteResult>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn get_canonical_memory_facts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn record_memory_recall<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _fact_ids: &'life1 [i64], _episode_ids: &'life2 [i64], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn fold_restated_facts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn upsert_fact<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, value: &'life3 str, source: &'life4 str, channel_id: Option<&'life5 str>, privacy: FactPrivacy, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait { ... } fn get_relevant_facts<'life0, 'life1, 'async_trait>( &'life0 self, _query: &'life1 str, max: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_relevant_facts_for_channel<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, max: usize, _channel_id: Option<&'life2 str>, _visibility: ChannelVisibility, _requester_is_owner: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn update_fact_privacy<'life0, 'async_trait>( &'life0 self, _fact_id: i64, _privacy: FactPrivacy, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn stamp_fact_provenance<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, _source: &'life3 str, _first_seen_at: Option<DateTime<Utc>>, _source_excerpt: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn delete_fact<'life0, 'async_trait>( &'life0 self, _fact_id: i64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn delete_fact_by_key<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_all_facts_with_provenance<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn search_facts<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _query: &'life1 str, _limit: usize, _config: &'life2 FactSearchConfig, ) -> Pin<Box<dyn Future<Output = Result<FactSearchReport>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn project_extracted_fact_graph<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, _source_excerpt: &'life3 str, _graph: &'life4 ExtractedMemoryGraph, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn refresh_fact_memory<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn memory_health_report<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MemoryHealthReport>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn repair_memory_projections<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MemoryHealthReport>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Layer-2 facts storage and retrieval (including privacy + channel provenance).

Required Methods§

Source

fn upsert_fact_with_provenance<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, value: &'life3 str, source: &'life4 str, channel_id: Option<&'life5 str>, privacy: FactPrivacy, first_seen_at: Option<DateTime<Utc>>, source_excerpt: Option<&'life6 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

Upsert a fact with full provenance data.

Source

fn get_facts<'life0, 'life1, 'async_trait>( &'life0 self, category: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all facts, optionally filtered by category.

Provided Methods§

Source

fn reconcile_personal_memory<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _write: &'life1 PersonalMemoryWrite, _source: &'life2 str, _source_excerpt: Option<&'life3 str>, _channel_id: Option<&'life4 str>, _privacy: FactPrivacy, ) -> Pin<Box<dyn Future<Output = Result<PersonalMemoryWriteResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Reconcile an entity-aware personal-memory write atomically.

Source

fn get_canonical_memory_facts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Compatibility projection of active canonical facts and relationships.

Source

fn record_memory_recall<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _fact_ids: &'life1 [i64], _episode_ids: &'life2 [i64], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Record that these facts and episodes were shown to a model. Recall counts drive Core Profile salience and decay, so only content that actually reached a prompt or a tool result may count; fetching a candidate that was then cut by a budget is not a recall.

Source

fn fold_restated_facts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Supersede active automated facts that restate another active fact in the same category, keeping the most authoritative copy. Returns how many rows were folded. Soft: superseded rows remain as history.

Source

fn upsert_fact<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, value: &'life3 str, source: &'life4 str, channel_id: Option<&'life5 str>, privacy: FactPrivacy, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Upsert a fact with channel provenance and privacy level.

Source

fn get_relevant_facts<'life0, 'life1, 'async_trait>( &'life0 self, _query: &'life1 str, max: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get facts semantically relevant to a query, falling back to get_facts on error.

Source

fn get_relevant_facts_for_channel<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, max: usize, _channel_id: Option<&'life2 str>, _visibility: ChannelVisibility, _requester_is_owner: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get facts for a specific channel context, respecting privacy levels.

requester_is_owner controls the DM short-circuit: only the owner sees the full unfiltered graph (incl. Private + other-channel facts) in a 1:1 DM. A non-owner (an allowlisted Guest) gets the same privacy filtering as a group channel — Global + same-channel facts only, never Private or other-channel — so owner secrets can’t leak into a guest’s prompt context.

Source

fn update_fact_privacy<'life0, 'async_trait>( &'life0 self, _fact_id: i64, _privacy: FactPrivacy, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update a fact’s privacy level (e.g., channel → global after approval).

Source

fn stamp_fact_provenance<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, _source: &'life3 str, _first_seen_at: Option<DateTime<Utc>>, _source_excerpt: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Record where the active fact at this key came from.

Source

fn delete_fact<'life0, 'async_trait>( &'life0 self, _fact_id: i64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Soft-delete a fact by superseding it.

Source

fn delete_fact_by_key<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Soft-delete a fact by category and key. Returns true if a fact was found and deleted.

Source

fn get_all_facts_with_provenance<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all active facts with provenance info for memory management display.

Source

fn search_facts<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _query: &'life1 str, _limit: usize, _config: &'life2 FactSearchConfig, ) -> Pin<Box<dyn Future<Output = Result<FactSearchReport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Explicit fact search: one ranked list plus query-relevant related facts. Ranking lives in crate::search; a store only gathers facts and scores. The default returns an empty report so stores without search keep compiling.

Source

fn project_extracted_fact_graph<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, _source_excerpt: &'life3 str, _graph: &'life4 ExtractedMemoryGraph, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Persist a model-extracted semantic graph for an already-written fact. Implementations must validate the graph and retain claim provenance.

Source

fn refresh_fact_memory<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _category: &'life1 str, _key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Refresh canonical claim/vector projections for the active fact at this key.

Source

fn memory_health_report<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MemoryHealthReport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn repair_memory_projections<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MemoryHealthReport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§