Codebase Guide
Workspace layout
Memorose is a Cargo workspace with four crates plus a Next.js dashboard:Crate dependency graph
Crate responsibilities
memorose-common
Shared foundations used by the rest of the workspace:- core types such as
Event,EventContent,MemoryUnit,GraphEdge, andL3Task - runtime config loading in
src/config.rs - serialization helpers and shared enums
memorose-core
Business logic and storage orchestration:| Module | Path | Role |
|---|---|---|
engine/ | src/engine/ | MemoroseEngine orchestration and domain workflows |
storage/ | src/storage/ | RocksDB, vector, text, blob, and system metadata backends |
worker.rs | src/worker.rs | background consolidation, forgetting, insights, and related cycles |
llm/ | src/llm/ | Gemini and OpenAI provider clients |
graph/ | src/graph/ | graph storage, traversal, cache, and query helpers |
ingest/ | src/ingest/ | multimodal ingest helpers |
raft/ | src/raft/ | openraft integration |
arbitrator.rs | src/arbitrator.rs | memory conflict and correction planning |
reranker.rs | src/reranker.rs | weighted or external reranking |
Storage backends
All undermemorose-core/src/storage/:
| File | Backend | Purpose |
|---|---|---|
kv.rs | RocksDB | durable key-value storage for events and memory units |
index.rs | LanceDB + Tantivy | vector and text indexing |
graph.rs | custom | graph edge persistence |
blob.rs | file system | asset storage |
system_kv.rs | RocksDB | internal metadata, jobs, and control state |
memorose-server
The HTTP layer:main.rs: route definitions and server bootstraptypes.rs: request / response payload typesshard_manager.rs: shard routing and cluster coordination helpersdashboard/: auth and handler modules backing dashboard and management endpoints
memorose-gateway
The stateless routing layer used in some deployments:- maps requests to backend nodes by shard
- reads gateway-specific env vars such as
SHARD_COUNT - does not own persistent state
Dashboard frontend
Thedashboard/ app currently contains:
Useful patterns
Dashboard cache
Dashboard API responses are cached withstate.dashboard_cache.
Bitemporal and scoped retrieval
Retrieval supports valid-time, transaction-time,org_id, and agent_id inputs through the server request payloads.
Route truth
When in doubt, treat these as the primary references:crates/memorose-server/src/main.rscrates/memorose-server/src/types.rscrates/memorose-common/src/config.rs

