pub struct ProjectKnowledge {
pub project_root: String,
pub project_hash: String,
pub facts: Vec<KnowledgeFact>,
pub patterns: Vec<ProjectPattern>,
pub history: Vec<ConsolidatedInsight>,
pub updated_at: DateTime<Utc>,
pub judged_pairs: Vec<JudgedPair>,
}Fields§
§project_root: String§project_hash: String§facts: Vec<KnowledgeFact>§patterns: Vec<ProjectPattern>§history: Vec<ConsolidatedInsight>§updated_at: DateTime<Utc>§judged_pairs: Vec<JudgedPair>Implementations§
Source§impl ProjectKnowledge
impl ProjectKnowledge
pub fn run_memory_lifecycle(&mut self, policy: &MemoryPolicy) -> LifecycleReport
pub fn new(project_root: &str) -> Self
pub fn check_contradiction( &self, category: &str, key: &str, new_value: &str, policy: &MemoryPolicy, ) -> Option<Contradiction>
pub fn remember( &mut self, category: &str, key: &str, value: &str, session_id: &str, confidence: f32, policy: &MemoryPolicy, ) -> Option<Contradiction>
pub fn add_pattern( &mut self, pattern_type: &str, description: &str, examples: Vec<String>, session_id: &str, policy: &MemoryPolicy, )
pub fn remove_fact(&mut self, category: &str, key: &str) -> bool
Source§impl ProjectKnowledge
impl ProjectKnowledge
pub fn consolidate( &mut self, summary: &str, session_ids: Vec<String>, policy: &MemoryPolicy, )
pub fn format_summary(&self) -> String
pub fn format_aaak(&self) -> String
pub fn format_wakeup(&self) -> String
Source§impl ProjectKnowledge
impl ProjectKnowledge
Sourcepub fn import_facts(
&mut self,
incoming: Vec<KnowledgeFact>,
merge: ImportMerge,
session_id: &str,
policy: &MemoryPolicy,
) -> ImportResult
pub fn import_facts( &mut self, incoming: Vec<KnowledgeFact>, merge: ImportMerge, session_id: &str, policy: &MemoryPolicy, ) -> ImportResult
Import facts from an external source with a configurable merge strategy. Returns (added, skipped, replaced) counts.
Sourcepub fn export_simple(&self) -> Vec<SimpleFactEntry>
pub fn export_simple(&self) -> Vec<SimpleFactEntry>
Export current facts as a simple JSON array (community-compatible schema).
Source§impl ProjectKnowledge
impl ProjectKnowledge
pub fn save(&self) -> Result<(), String>
Sourcepub fn mutate_locked<T>(
project_root: &str,
f: impl FnOnce(&mut Self) -> T,
) -> Result<(Self, T), String>
pub fn mutate_locked<T>( project_root: &str, f: impl FnOnce(&mut Self) -> T, ) -> Result<(Self, T), String>
Runs a read-modify-write cycle under both an in-process mutex and a
cross-process file lock, then saves atomically. The knowledge is
(re)loaded inside the locks so the closure always operates on the
latest on-disk state; this is what prevents lost updates when several
remember calls run in parallel — whether as threads in one process
(parallel MCP calls) or as separate processes (parallel CLI invocations,
CLI + daemon + MCP server) — see issue #326. Returns the persisted
knowledge plus the closure’s return value so the caller can build a
response from the committed state.
pub fn load(project_root: &str) -> Option<Self>
pub fn load_or_create(project_root: &str) -> Self
Sourcepub fn migrate_legacy_empty_root(
target_root: &str,
policy: &MemoryPolicy,
) -> Result<bool, String>
pub fn migrate_legacy_empty_root( target_root: &str, policy: &MemoryPolicy, ) -> Result<bool, String>
Migrates legacy knowledge that was accidentally stored under an empty project_root (“”)
into the given target_root. Keeps a timestamped backup of the legacy file.
Source§impl ProjectKnowledge
impl ProjectKnowledge
pub fn recall(&self, query: &str) -> Vec<&KnowledgeFact>
pub fn recall_by_category(&self, category: &str) -> Vec<&KnowledgeFact>
pub fn recall_at_time( &self, query: &str, at: DateTime<Utc>, ) -> Vec<&KnowledgeFact>
pub fn timeline(&self, category: &str) -> Vec<&KnowledgeFact>
pub fn list_rooms(&self) -> Vec<(String, usize)>
pub fn recall_for_output( &mut self, query: &str, limit: usize, ) -> (Vec<KnowledgeFact>, usize)
pub fn recall_by_category_for_output( &mut self, category: &str, limit: usize, ) -> (Vec<KnowledgeFact>, usize)
Trait Implementations§
Source§impl Clone for ProjectKnowledge
impl Clone for ProjectKnowledge
Source§fn clone(&self) -> ProjectKnowledge
fn clone(&self) -> ProjectKnowledge
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProjectKnowledge
impl Debug for ProjectKnowledge
Source§impl<'de> Deserialize<'de> for ProjectKnowledge
impl<'de> Deserialize<'de> for ProjectKnowledge
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ProjectKnowledge
impl RefUnwindSafe for ProjectKnowledge
impl Send for ProjectKnowledge
impl Sync for ProjectKnowledge
impl Unpin for ProjectKnowledge
impl UnsafeUnpin for ProjectKnowledge
impl UnwindSafe for ProjectKnowledge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more