1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// Copyright (c) 2025, 2026 Julius ML
// Licensed under the MIT License. See LICENSE at the workspace root.
//! Canonical service trait for post-cortex.
//!
//! `PostCortexService` is the **single internal entrypoint** that every
//! transport layer (gRPC, MCP, REST, future SDKs) delegates to. Per
//! TODO.md:106-117 we never want two transports re-implementing the same
//! operation with subtly different validation; they each translate their
//! wire payload, then call the same method on this trait. The canonical
//! impl lives in [`post-cortex-memory`](https://docs.rs/post-cortex-memory)
//! as `MemoryServiceImpl`.
//!
//! ## Scope
//!
//! Phase 4 introduces the trait skeleton with the **read/write/search/manage**
//! operations every transport exposes. Phases 6 + 7 (MCP and daemon
//! extraction) migrate the existing handlers to delegate here; until then
//! both transports still call into `ConversationMemorySystem` directly.
//!
//! Trait methods intentionally take small, immediately-usable request
//! types defined in `types` rather than huge proto structs — keeping
//! the surface readable from non-gRPC consumers. gRPC handlers do the
//! proto-to-domain translation in a single `From`/`Into` module at the
//! transport boundary (Phase 7).
//!
//! ## Object safety
//!
//! The trait is intentionally object-safe (no generic methods, no `Self`
//! return types) so consumers — `post-cortex-mcp` in particular — can
//! hold an `Arc<dyn PostCortexService>` and let downstream Rust projects
//! plug in their own implementation without touching the MCP layer.
use Arc;
use async_trait;
use crateSystemError;
pub use *;
/// 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).
/// Convenience alias — most consumers carry the trait behind an `Arc`.
pub type DynPostCortexService = ;