pub struct ScopeCounts {
pub total: u64,
pub global: u64,
pub always: u64,
pub by_type: HashMap<String, u64>,
pub by_user: HashMap<String, u64>,
pub by_agent: HashMap<String, u64>,
pub by_user_agent: HashMap<String, u64>,
pub by_project: HashMap<String, u64>,
pub growth: HashMap<String, u64>,
}Expand description
The unified database facade for MenteDB.
MenteDb coordinates storage, indexing, graph relationships, query parsing,
context assembly, and cognitive subsystems into a single coherent API.
All internal state is protected by fine-grained locks, so every public method
takes &self. This allows Arc<MenteDb> to be shared across threads without
an external RwLock.
Per-owner/type/scope memory counts, excluding hidden (internal working)
tags, maintained incrementally so the dashboard scope tree and stats read
them in O(1) rather than scanning every memory. String keys keep it
JSON-persistable; it is grounded by a full recount only when no snapshot
exists (owner and type are not otherwise indexed, so a recount costs a full
load and must be avoided on the read path and on every open).
Fields§
§total: u64Non-hidden memories in total.
global: u64Memories with no owner (nil user and agent): the shared/global pool.
always: u64Memories tagged scope:always.
by_type: HashMap<String, u64>Count by memory type name (lowercased, anti_pattern normalized).
by_user: HashMap<String, u64>Count by end-user owner (uuid string).
by_agent: HashMap<String, u64>Count by agent owner (uuid string).
by_user_agent: HashMap<String, u64>Count by "user_uuid|agent_uuid" pair.
by_project: HashMap<String, u64>Count by project name (from scope:project: tags).
growth: HashMap<String, u64>Count by creation month (YYYY-MM, UTC) for the growth timeline. A
memory’s creation month never changes, so this is exact and maintained
incrementally like the rest, giving the dashboard an O(1) growth chart
and an exact “this month” figure without a scan.