pub trait PostCortexService:
Send
+ Sync
+ 'static {
// Required methods
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthReport, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn update_context<'life0, 'async_trait>(
&'life0 self,
req: UpdateContextRequest,
) -> Pin<Box<dyn Future<Output = Result<UpdateContextResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn bulk_update_context<'life0, 'async_trait>(
&'life0 self,
req: BulkUpdateContextRequest,
) -> Pin<Box<dyn Future<Output = Result<BulkUpdateContextResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn semantic_search<'life0, 'async_trait>(
&'life0 self,
req: SemanticSearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SemanticSearchResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn query_context<'life0, 'async_trait>(
&'life0 self,
req: QueryContextRequest,
) -> Pin<Box<dyn Future<Output = Result<QueryContextResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn assemble_context<'life0, 'async_trait>(
&'life0 self,
req: AssembleContextRequest,
) -> Pin<Box<dyn Future<Output = Result<AssembleContextResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn manage_session<'life0, 'async_trait>(
&'life0 self,
req: ManageSessionRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageSessionResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn manage_workspace<'life0, 'async_trait>(
&'life0 self,
req: ManageWorkspaceRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageWorkspaceResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn manage_entity<'life0, 'async_trait>(
&'life0 self,
req: ManageEntityRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageEntityResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_structured_summary<'life0, 'async_trait>(
&'life0 self,
req: StructuredSummaryRequest,
) -> Pin<Box<dyn Future<Output = Result<StructuredSummaryResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn admin<'life0, 'async_trait>(
&'life0 self,
req: AdminRequest,
) -> Pin<Box<dyn Future<Output = Result<AdminResponse, SystemError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Canonical post-cortex service.
Every transport (gRPC, MCP, REST, future SDKs) delegates to this trait so there is exactly one implementation per operation across the codebase. See the module-level docs for the design rationale.
Default implementations are kept minimal — the production impl is
post_cortex_memory::services::MemoryServiceImpl. Downstream Rust
projects can implement this trait against their own storage +
embeddings stack and reuse the rest of the post-cortex ecosystem
(MCP tools, gRPC client, summary view).
Required Methods§
Sourcefn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthReport, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthReport, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns a snapshot of system health. Cheap — the only operation that does not flow through the storage actor and is safe to call from a heartbeat probe.
Sourcefn update_context<'life0, 'async_trait>(
&'life0 self,
req: UpdateContextRequest,
) -> Pin<Box<dyn Future<Output = Result<UpdateContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn update_context<'life0, 'async_trait>(
&'life0 self,
req: UpdateContextRequest,
) -> Pin<Box<dyn Future<Output = Result<UpdateContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Persist a single context update for a session and enqueue derived work (embedding, HNSW upsert, graph update, summary refresh) onto background pipelines. Returns once the entry is durably persisted; embeddings / vector index land asynchronously per TODO.md:136-145.
Sourcefn bulk_update_context<'life0, 'async_trait>(
&'life0 self,
req: BulkUpdateContextRequest,
) -> Pin<Box<dyn Future<Output = Result<BulkUpdateContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn bulk_update_context<'life0, 'async_trait>(
&'life0 self,
req: BulkUpdateContextRequest,
) -> Pin<Box<dyn Future<Output = Result<BulkUpdateContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Batch variant of Self::update_context. Backends use storage
write batches when available (RocksDB transaction).
Sourcefn semantic_search<'life0, 'async_trait>(
&'life0 self,
req: SemanticSearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SemanticSearchResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn semantic_search<'life0, 'async_trait>(
&'life0 self,
req: SemanticSearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SemanticSearchResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Run a semantic similarity search against persisted content. Scope determines whether the query runs against a single session, a workspace, or the global index.
Sourcefn query_context<'life0, 'async_trait>(
&'life0 self,
req: QueryContextRequest,
) -> Pin<Box<dyn Future<Output = Result<QueryContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn query_context<'life0, 'async_trait>(
&'life0 self,
req: QueryContextRequest,
) -> Pin<Box<dyn Future<Output = Result<QueryContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Run a structured/keyword query against the session’s context updates. Faster than semantic search; no embedding required.
Sourcefn assemble_context<'life0, 'async_trait>(
&'life0 self,
req: AssembleContextRequest,
) -> Pin<Box<dyn Future<Output = Result<AssembleContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn assemble_context<'life0, 'async_trait>(
&'life0 self,
req: AssembleContextRequest,
) -> Pin<Box<dyn Future<Output = Result<AssembleContextResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Graph-aware retrieval: semantic search + entity neighbourhood traversal + impact analysis, all merged into one assembled context payload.
Sourcefn manage_session<'life0, 'async_trait>(
&'life0 self,
req: ManageSessionRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageSessionResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn manage_session<'life0, 'async_trait>(
&'life0 self,
req: ManageSessionRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageSessionResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Manage session lifecycle (create / list / load / search / update / delete). The variant carried in the request determines which operation runs — letting callers (especially MCP) treat sessions as a single tool surface.
Sourcefn manage_workspace<'life0, 'async_trait>(
&'life0 self,
req: ManageWorkspaceRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageWorkspaceResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn manage_workspace<'life0, 'async_trait>(
&'life0 self,
req: ManageWorkspaceRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageWorkspaceResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Manage workspace lifecycle (create / list / get / delete /
add-session / remove-session). Same shape as
Self::manage_session.
Sourcefn manage_entity<'life0, 'async_trait>(
&'life0 self,
req: ManageEntityRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageEntityResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn manage_entity<'life0, 'async_trait>(
&'life0 self,
req: ManageEntityRequest,
) -> Pin<Box<dyn Future<Output = Result<ManageEntityResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Manage entity lifecycle (delete / delete-update). Cascades through the entity graph; storage-layer side effects (vector index purge, summary invalidation) run on background pipelines.
Sourcefn get_structured_summary<'life0, 'async_trait>(
&'life0 self,
req: StructuredSummaryRequest,
) -> Pin<Box<dyn Future<Output = Result<StructuredSummaryResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_structured_summary<'life0, 'async_trait>(
&'life0 self,
req: StructuredSummaryRequest,
) -> Pin<Box<dyn Future<Output = Result<StructuredSummaryResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Compose the structured summary view for a session — a hierarchical projection over context updates, decisions, problems, and entity importance.
Sourcefn admin<'life0, 'async_trait>(
&'life0 self,
req: AdminRequest,
) -> Pin<Box<dyn Future<Output = Result<AdminResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn admin<'life0, 'async_trait>(
&'life0 self,
req: AdminRequest,
) -> Pin<Box<dyn Future<Output = Result<AdminResponse, SystemError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Run an admin operation (vectorize session, create checkpoint, fetch vectorization stats, etc.). Variant-dispatched like session/workspace/entity for symmetry.