|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package mimir.v1; |
| 4 | + |
| 5 | +// Mimir gRPC service — maps all MCP tools to gRPC RPCs for the v2.0 platform. |
| 6 | +service Mimir { |
| 7 | + // CRUD |
| 8 | + rpc Remember(RememberRequest) returns (RememberResponse); |
| 9 | + rpc Recall(RecallRequest) returns (RecallResponse); |
| 10 | + rpc GetEntity(GetEntityRequest) returns (EntityMessage); |
| 11 | + rpc Forget(ForgetRequest) returns (ForgetResponse); |
| 12 | + |
| 13 | + // Graph |
| 14 | + rpc Link(LinkRequest) returns (LinkResponse); |
| 15 | + rpc Unlink(UnlinkRequest) returns (UnlinkResponse); |
| 16 | + rpc Traverse(TraverseRequest) returns (TraverseResponse); |
| 17 | + |
| 18 | + // Journal |
| 19 | + rpc Journal(JournalRequest) returns (JournalEvent); |
| 20 | + rpc Timeline(TimelineRequest) returns (TimelineResponse); |
| 21 | + |
| 22 | + // State |
| 23 | + rpc StateSet(StateSetRequest) returns (StateSetResponse); |
| 24 | + rpc StateGet(StateGetRequest) returns (StateEntry); |
| 25 | + rpc StateDelete(StateDeleteRequest) returns (StateDeleteResponse); |
| 26 | + rpc StateList(StateListRequest) returns (StateListResponse); |
| 27 | + |
| 28 | + // AI |
| 29 | + rpc Ask(AskRequest) returns (AskResponse); |
| 30 | + rpc Embed(EmbedRequest) returns (EmbedResponse); |
| 31 | + rpc Cohere(CohereRequest) returns (CohereResponse); |
| 32 | + |
| 33 | + // Lifecycle |
| 34 | + rpc Decay(DecayRequest) returns (DecayResponse); |
| 35 | + rpc Prune(PruneRequest) returns (PruneResponse); |
| 36 | + rpc Compact(CompactRequest) returns (CompactResponse); |
| 37 | + rpc Score(ScoreRequest) returns (ScoreResponse); |
| 38 | + |
| 39 | + // Quality |
| 40 | + rpc Conflicts(ConflictsRequest) returns (ConflictsResponse); |
| 41 | + |
| 42 | + // Vault |
| 43 | + rpc VaultExport(VaultExportRequest) returns (VaultExportResponse); |
| 44 | + rpc VaultImport(VaultImportRequest) returns (VaultImportResponse); |
| 45 | + |
| 46 | + // Ops |
| 47 | + rpc Health(HealthRequest) returns (HealthResponse); |
| 48 | + rpc Stats(StatsRequest) returns (StatsResponse); |
| 49 | + rpc Context(ContextRequest) returns (ContextResponse); |
| 50 | + rpc WorkspaceList(WorkspaceListRequest) returns (WorkspaceListResponse); |
| 51 | + |
| 52 | + // v2.0: Federation |
| 53 | + rpc Federate(FederateRequest) returns (FederateResponse); |
| 54 | + rpc Share(ShareRequest) returns (ShareResponse); |
| 55 | + |
| 56 | + // v2.0: Streaming |
| 57 | + rpc WatchJournal(WatchJournalRequest) returns (stream JournalEvent); |
| 58 | + rpc StreamContext(StreamContextRequest) returns (stream ContextChunk); |
| 59 | +} |
| 60 | + |
| 61 | +// ── Core entity ── |
| 62 | +message EntityMessage { |
| 63 | + string id = 1; |
| 64 | + string category = 2; |
| 65 | + string key = 3; |
| 66 | + string body_json = 4; |
| 67 | + string status = 5; |
| 68 | + string type = 6; |
| 69 | + repeated string tags = 7; |
| 70 | + double decay_score = 8; |
| 71 | + int64 retrieval_count = 9; |
| 72 | + string layer = 10; |
| 73 | + string topic_path = 11; |
| 74 | + bool archived = 12; |
| 75 | + string archive_reason = 13; |
| 76 | + bool verified = 14; |
| 77 | + string source = 15; |
| 78 | + bool always_on = 16; |
| 79 | + double certainty = 17; |
| 80 | + string workspace_hash = 18; |
| 81 | + string agent_id = 19; |
| 82 | + string visibility = 20; |
| 83 | + int64 created_at_unix_ms = 21; |
| 84 | + int64 last_accessed_unix_ms = 22; |
| 85 | +} |
| 86 | + |
| 87 | +message JournalEvent { |
| 88 | + string id = 1; |
| 89 | + string event_type = 2; |
| 90 | + string evaluated_json = 3; |
| 91 | + string acted_json = 4; |
| 92 | + string forward_json = 5; |
| 93 | + string category = 6; |
| 94 | + string key = 7; |
| 95 | + string entity_id = 8; |
| 96 | + string agent_id = 9; |
| 97 | + int64 created_at_unix_ms = 10; |
| 98 | +} |
| 99 | + |
| 100 | +// ── CRUD ── |
| 101 | +message RememberRequest { |
| 102 | + string category = 1; |
| 103 | + string key = 2; |
| 104 | + string body_json = 3; |
| 105 | + string status = 4; |
| 106 | + string type = 5; |
| 107 | + repeated string tags = 6; |
| 108 | + double importance = 7; |
| 109 | + string topic_path = 8; |
| 110 | + repeated string recall_when = 9; |
| 111 | + bool always_on = 10; |
| 112 | + double certainty = 11; |
| 113 | + string workspace_hash = 12; |
| 114 | + string agent_id = 13; |
| 115 | + string visibility = 14; |
| 116 | +} |
| 117 | +message RememberResponse { string id = 1; string action = 2; string category = 3; string key = 4; } |
| 118 | + |
| 119 | +message RecallRequest { |
| 120 | + string query = 1; |
| 121 | + optional string category = 2; |
| 122 | + optional string type = 3; |
| 123 | + int64 limit = 4; |
| 124 | + int64 offset = 5; |
| 125 | + double min_decay = 6; |
| 126 | + optional string topic_path = 7; |
| 127 | + bool include_archived = 8; |
| 128 | + string mode = 9; |
| 129 | + optional int64 preview_cap = 10; |
| 130 | + optional bool always_on = 11; |
| 131 | + double content_weight = 12; |
| 132 | + double diversity_halving = 13; |
| 133 | + optional string workspace_hash = 14; |
| 134 | + optional string agent_id = 15; |
| 135 | + optional string visibility = 16; |
| 136 | +} |
| 137 | +message RecallResponse { repeated EntityMessage items = 1; int64 total = 2; } |
| 138 | + |
| 139 | +message GetEntityRequest { string id = 1; } |
| 140 | +message ForgetRequest { string category = 1; string key = 2; string reason = 3; } |
| 141 | +message ForgetResponse { bool ok = 1; } |
| 142 | + |
| 143 | +// ── Graph ── |
| 144 | +message LinkRequest { string from_category = 1; string from_key = 2; string to_id = 3; string relationship = 4; } |
| 145 | +message LinkResponse { bool ok = 1; } |
| 146 | +message UnlinkRequest { string from_category = 1; string from_key = 2; string to_id = 3; } |
| 147 | +message UnlinkResponse { bool ok = 1; } |
| 148 | +message TraverseRequest { string category = 1; string key = 2; int32 max_depth = 3; int32 max_nodes = 4; } |
| 149 | +message TraverseResponse { repeated EntityMessage nodes = 1; } |
| 150 | + |
| 151 | +// ── Journal ── |
| 152 | +message JournalRequest { |
| 153 | + string event_type = 1; |
| 154 | + string category = 2; |
| 155 | + string key = 3; |
| 156 | + string entity_id = 4; |
| 157 | + string agent_id = 5; |
| 158 | + string evaluated_json = 6; |
| 159 | + string acted_json = 7; |
| 160 | + string forward_json = 8; |
| 161 | +} |
| 162 | +message TimelineRequest { |
| 163 | + optional int64 from_ms = 1; |
| 164 | + optional int64 to_ms = 2; |
| 165 | + optional string event_type = 3; |
| 166 | + optional string category = 4; |
| 167 | + optional string entity_id = 5; |
| 168 | + int64 limit = 6; |
| 169 | + int64 offset = 7; |
| 170 | +} |
| 171 | +message TimelineResponse { repeated JournalEvent events = 1; int64 total = 2; } |
| 172 | + |
| 173 | +// ── State ── |
| 174 | +message StateSetRequest { string key = 1; string value_json = 2; optional int64 ttl_seconds = 3; } |
| 175 | +message StateSetResponse { bool ok = 1; } |
| 176 | +message StateGetRequest { string key = 1; } |
| 177 | +message StateEntry { string key = 1; string value_json = 2; optional int64 expires_at_unix_ms = 3; int64 created_at_unix_ms = 4; } |
| 178 | +message StateDeleteRequest { string key = 1; } |
| 179 | +message StateDeleteResponse { bool ok = 1; } |
| 180 | +message StateListRequest { string prefix = 1; } |
| 181 | +message StateListResponse { repeated string keys = 1; } |
| 182 | + |
| 183 | +// ── AI ── |
| 184 | +message AskRequest { string query = 1; int32 top_k = 2; } |
| 185 | +message AskResponse { string answer = 1; } |
| 186 | + |
| 187 | +message EmbedRequest { |
| 188 | + optional string category = 1; |
| 189 | + optional string key = 2; |
| 190 | + optional string text = 3; |
| 191 | + optional string batch_category = 4; |
| 192 | + int32 batch_limit = 5; |
| 193 | +} |
| 194 | +message EmbedResponse { int64 embedded = 1; optional string id = 2; int32 dimensions = 3; } |
| 195 | + |
| 196 | +message CohereRequest { |
| 197 | + bool dry_run = 1; |
| 198 | + int32 max_links = 2; |
| 199 | + int32 promote_threshold = 3; |
| 200 | + double archive_threshold = 4; |
| 201 | +} |
| 202 | +message CohereResponse { |
| 203 | + int64 examined = 1; int64 promoted = 2; int64 decayed = 3; |
| 204 | + int64 linked = 4; int64 archived = 5; |
| 205 | +} |
| 206 | + |
| 207 | +// ── Lifecycle ── |
| 208 | +message DecayRequest {} |
| 209 | +message DecayResponse { int64 entities_checked = 1; int64 entities_updated = 2; int64 auto_archived = 3; } |
| 210 | +message PruneRequest { optional string category = 1; optional double min_decay = 2; optional int32 older_than_days = 3; int32 limit = 4; bool dry_run = 5; } |
| 211 | +message PruneResponse { int64 archived = 1; } |
| 212 | +message CompactRequest { bool dry_run = 1; double min_decay = 2; } |
| 213 | +message CompactResponse { int64 archived = 1; } |
| 214 | +message ScoreRequest { string category = 1; string key = 2; double score = 3; } |
| 215 | +message ScoreResponse { bool ok = 1; } |
| 216 | + |
| 217 | +// ── Quality ── |
| 218 | +message ConflictsRequest { string category = 1; double threshold = 2; int64 limit = 3; int64 offset = 4; } |
| 219 | +message ConflictsResponse { repeated ConflictPair pairs = 1; } |
| 220 | +message ConflictPair { EntityMessage entity_a = 1; EntityMessage entity_b = 2; double similarity = 3; bool certainty_boosted = 4; } |
| 221 | + |
| 222 | +// ── Vault ── |
| 223 | +message VaultExportRequest { string vault_dir = 1; optional string workspace_hash = 2; } |
| 224 | +message VaultExportResponse { int64 files_created = 1; int64 files_updated = 2; } |
| 225 | +message VaultImportRequest { string vault_dir = 1; } |
| 226 | +message VaultImportResponse { int64 files_created = 1; int64 files_updated = 2; } |
| 227 | + |
| 228 | +// ── Ops ── |
| 229 | +message HealthRequest {} |
| 230 | +message HealthResponse { bool healthy = 1; } |
| 231 | +message StatsRequest {} |
| 232 | +message StatsResponse { |
| 233 | + int64 total_entities = 1; int64 total_journal = 2; int64 total_state = 3; |
| 234 | + int64 db_size_bytes = 4; |
| 235 | +} |
| 236 | +message ContextRequest { repeated string categories = 1; int64 limit = 2; optional string agent_id = 3; } |
| 237 | +message ContextResponse { string context = 1; } |
| 238 | +message ContextChunk { string content = 1; } |
| 239 | +message WorkspaceListRequest {} |
| 240 | +message WorkspaceListResponse { repeated string categories = 1; } |
| 241 | + |
| 242 | +// ── Federation ── |
| 243 | +message FederateRequest { string from_workspace = 1; string to_workspace = 2; string vault_dir = 3; } |
| 244 | +message FederateResponse { int64 exported = 1; int64 remapped = 2; int64 imported = 3; } |
| 245 | +message ShareRequest { string category = 1; string key = 2; string to_workspace = 3; } |
| 246 | +message ShareResponse { string shared_id = 1; string action = 2; string from_workspace = 3; string to_workspace = 4; } |
| 247 | + |
| 248 | +// ── Streaming ── |
| 249 | +message WatchJournalRequest { optional string category = 1; } |
| 250 | +message StreamContextRequest { int32 interval_seconds = 1; int64 limit = 2; } |
0 commit comments