Skip to main content

Crate mentedb_cognitive

Crate mentedb_cognitive 

Source
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 Jaccard keyword overlap for cache hits.

  • 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. Supports resume context generation and next-topic prediction.

  • 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 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 write_inference::InferredAction;
pub use write_inference::WriteInferenceConfig;
pub use write_inference::WriteInferenceEngine;

Modules§

interference
pain
phantom
speculative
stream
trajectory
write_inference