Skip to main content

post_cortex_memory/
lib.rs

1// Copyright (c) 2025, 2026 Julius ML
2// Licensed under the MIT License. See LICENSE at the workspace root.
3
4//! Conversation memory orchestrator for post-cortex.
5//!
6//! This crate is the **top of the dependency tree** — it pulls in
7//! [`post_cortex_core`] (domain types), [`post_cortex_storage`]
8//! (RocksDB + SurrealDB backends), [`post_cortex_embeddings`] (BERT +
9//! HNSW), and [`post_cortex_proto`] (gRPC wire types). It owns
10//! [`ConversationMemorySystem`], the lock-free hot/warm/cold memory
11//! hierarchy that ties everything together, plus the content
12//! vectorizer pipeline, semantic query engine, query cache, graph-aware
13//! context assembly, and the relevance scoring helpers.
14//!
15//! Phase 4 of the migration adds a canonical `PostCortexService` trait
16//! impl here so MCP/gRPC transports can delegate to a single internal
17//! handler per operation (TODO.md:106-117). Phase 5 adds the non-
18//! blocking pipeline work queues (TODO.md:136-145).
19
20#![forbid(unsafe_code)]
21// SystemError + memory::Error carry rich variants for transport layers.
22// Boxing them all to satisfy result_large_err would force every caller
23// to deref before pattern matching.
24#![allow(clippy::result_large_err)]
25// Storage actor request/response types are complex tuples by design.
26#![allow(clippy::type_complexity)]
27// `ptr_arg` flags a &mut Vec param that could be &mut [_], but the
28// caller relies on push() — slicing would break the contract.
29#![allow(clippy::ptr_arg)]
30
31pub mod content_vectorizer;
32/// Graph-aware context assembly that combines semantic search results with entity-graph traversals.
33pub mod context_assembly;
34pub mod error;
35pub mod memory_system;
36/// Runtime performance monitoring: operation timers, cache trackers, and health snapshots.
37pub mod performance;
38pub mod pipeline;
39pub mod query_cache;
40pub mod scoring;
41pub mod semantic_query_engine;
42pub mod services;
43
44/// Canonical error type and result alias for this crate.
45pub use error::{Error, Result};
46/// Top-level memory orchestrator and its configuration.
47pub use memory_system::{ConversationMemorySystem, SystemConfig};
48/// Non-blocking write pipeline, configuration, and error types.
49pub use pipeline::{Pipeline, PipelineConfig, PipelineError};
50/// gRPC / MCP service implementation backed by [`ConversationMemorySystem`].
51pub use services::MemoryServiceImpl;