Expand description
§mentedb-cognitive: Cognitive Engine for MenteDB
This crate implements the seven cognitive features that distinguish MenteDB from a conventional vector database. These features run at write time and read time, giving the engine awareness of the knowledge it holds.
§Modules
-
interference: Detects pairs of memories similar enough to confuse an LLM, generates disambiguation text, and reorders context to maximize separation. -
pain: Records negative experiences (failed actions, user corrections) as pain signals with intensity and decay. Surfaces warnings during context assembly. -
phantom: Detects references to entities not present in the knowledge base (phantom memories). Flags gaps so the agent can acquire missing knowledge. -
speculative: Pre-assembles context windows for predicted upcoming queries based on conversation trajectory. Uses cosine similarity on embeddings with keyword overlap as fallback. -
stream: Monitors the LLM’s output token stream in real time, comparing against stored facts to detect contradictions, forgotten knowledge, corrections, and reinforcements mid-generation. -
trajectory: Tracks the reasoning arc of a conversation as a sequence of decision states. Learns topic transition patterns via a Markov chain frequency map that improves predictions over time. Supports resume context generation, next-topic prediction, and feedback reinforcement from cache hits. -
write_inference: Runs inference at write time to detect contradictions, create relationship edges, mark obsolete memories, adjust confidence, and trigger belief propagation automatically.
Re-exports§
pub use interference::InterferenceDetector;pub use interference::InterferencePair;pub use llm::ClusterMember;pub use llm::CognitiveLlmService;pub use llm::ConsolidationDecision;pub use llm::ContradictionVerdict;pub use llm::EntityCandidate;pub use llm::EntityMergeGroup;pub use llm::InvalidationVerdict;pub use llm::LlmJudge;pub use llm::LlmJudgeError;pub use llm::MemorySummary;pub use llm::MockLlmJudge;pub use llm::TopicLabel;pub use pain::PainRegistry;pub use pain::PainSignal;pub use phantom::EntityRegistry;pub use phantom::PhantomConfig;pub use phantom::PhantomMemory;pub use phantom::PhantomPriority;pub use phantom::PhantomTracker;pub use speculative::CacheEntry;pub use speculative::CacheStats;pub use speculative::SpeculativeCache;pub use stream::CognitionStream;pub use stream::StreamAlert;pub use stream::StreamConfig;pub use stream::TokenEvent;pub use trajectory::DecisionState;pub use trajectory::TrajectoryNode;pub use trajectory::TrajectoryTracker;pub use trajectory::TransitionMap;pub use write_inference::InferredAction;pub use write_inference::WriteInferenceConfig;pub use write_inference::WriteInferenceEngine;
Modules§
- interference
- Interference detection between confusable memories.
- llm
- LLM powered cognitive judgment for memory operations.
- pain
- Pain signal registry for negative experience tracking.
- phantom
- Phantom memory detection for knowledge gaps.
- speculative
- Speculative context pre assembly cache.
- stream
- Real time LLM output stream monitoring.
- trajectory
- Conversation trajectory tracking and prediction.
- write_
inference - Write time inference engine for automatic relationship discovery.