mem_stats
Signature
mem.mem_stats(user_id: str) -> Mapping[str, int]
Returns lightweight counters for the user — useful for diagnostics, dashboards, and verifying that a save actually landed.
note
Always scoped to user_id. Global stats are intentionally not exposed via the public API (privacy + multi-tenant safety).
Parameters
| Parámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
user_id | str | sí | Owner scope. |
Returns
Mapping[str, int] (dict):
At minimum:
observations(int) — total observations stored foruser_id.sessions(int) — total sessions (open or closed) foruser_id.
The store may add additional integer counters in future versions; treat unknown keys as informational.
Examples
- Basic
- Sanity-check after save
stats = mem.mem_stats(user_id="alice")
print(stats["observations"], stats["sessions"])
before = mem.mem_stats(user_id="alice")["observations"]
mem.mem_save(user_id="alice", content="...", type="decision", title="...")
after = mem.mem_stats(user_id="alice")["observations"]
assert after == before + 1