Skip to content
kazma.
ع Star 7 Get Started

Memory — best path (operator guide)

Recommended way to run V2 cognitive memory + Knowledge Library after the memory program. Do not merge stores into one table. Use a unified chat experience on separate stores.

Deep architecture: Memory & RAG.

Chat turn
├─ Personal memory (V2): beliefs + episodes → memory_state.db
├─ Knowledge Library (optional inject) → knowledge_* stores
└─ Optional scale adapters
• pgvector (auto when Postgres DSN is set) / Qdrant
• Postgres dual-mirror or state.role=primary
• Neo4j (dual-write; Dashboard still paints SQLite)
StoreRoleDefault
V2 cognitive“Who I am / what we said”SQLite primary on one node
Knowledge Library“What the docs say” + citationsSeparate store
Dense vectorsEpisode/belief embeddingssqlite-vec → pgvector when you leave one node
Neo4jDual-write of belief triplesOptional
PostgresMulti-process state mirror / primaryOptional
  1. Personal memory — defaults; chat “Remember my favorite color is teal.” then “What color?”
  2. Docs — ingest Knowledge Library; keep Inject Knowledge into chat on (Settings → Memory).
  3. Federated search — Dashboard → Search all knowledge → Federated (MEM / KB chips).
  4. Explain recall (optional) — Settings → Memory → Explain recall; chat workbench shows Memory context with channel chips.
  5. Smart Knowledge search (optional) — expand inject to all active libs on technical questions.
  6. Memory admin (/memory) — graph + entities/beliefs (below).
  7. Smokepwsh -File scripts/memory_smoke.ps1 · Smoke matrix · Recent features
  8. Optional Neo4j — only if you want graph dual-write (below).
  9. Scale — set KAZMA_DATABASE_URL and CREATE EXTENSION vector. pgvector becomes the dense engine automatically (KAZMA_PGVECTOR=0 keeps sqlite-vec). Do not set KAZMA_MEMORY_STATE_ROLE=primary until python scripts/reconcile_memory_mirror.py --dry-run is clean.

Use this page to clean topology without raw SQL.

GoalHow
See the belief graphTop Graph & health canvas; Refresh if labels look stale. Truncation banner also reports connections hidden by the node cap.
Group / ungroup a nodeInspect → Group under→ (click parent) or Ungroup. View-only — beliefs are untouched.
Find an entity beyond the top 150Entities search box → type the name/alias (FTS5, diacritic-insensitive); use Load more if “Showing X of Y” shows more
Rename hub “You” → brand nameEntities: find person User / ent_… or hub → Rename → e.g. Mubder. Canvas hub should show that name.
Rename a project nodeClick node or entity row → Rename (id stays shipx; label becomes ShipX)
Focus list ↔ graphClick a row to zoom the canvas; click a node to highlight the list
Fix a wrong beliefBeliefs tab → Edit (single modal: object / predicate / subject)
Undo a mistaken edit/invalidateClick [Undo] on the action toast (60s window) — or restore from Maintenance → backups for older mistakes
Merge duplicate shellsSet Src + Tgt → Merge (beliefs rewired to target; receipt shows the count)
Link two entitiesSrc + Tgt + predicate → Link
Drop junk beliefsSelect → Invalidate
Why was a belief used?Click a belief → drawer shows “recalled N× · last … · from episode”; Probe from this belief to see neighbors

The canvas center node is always id=user. A separate person shell (ent_… named User) is treated as the same self: rename updates the hub display name, and list click focuses the hub (graph_id: user). Do not expect a second “You” node for that shell.

Deep dive: Memory & RAG — Memory admin UI.

UI: Settings → Memory (/settings?tab=memory)
Includes isolation, KB toggles, backends, Neo4j Test/Sync, and embedder (no separate Embedder tab).

SettingEffect
merge_knowledge_into_chatInject labeled KB into supervisor next to V2 memory
promote_kb_to_episodesSoft-copy top KB hits into episodic rows (tagged)
memory.backends.*Vector / state / graph adapters + failover
Graph provider neo4jDual-write triples; topology paint stays SQLite
tenant_modeshared / per_platform / per_user
KAZMA_MEMORY_ENFORCE_TENANT=1Scope /memory reads, mutations, undo, and graph-clear by request tenant (off = default)
Terminal window
docker compose -f deploy/docker-compose.neo4j.yml up -d
# Env install default (fail-open if server down):
export KAZMA_NEO4J_DEFAULT=1
export KAZMA_NEO4J_PASSWORD=YOUR_PASSWORD_HERE

Or UI: Graph store Neo4j → Save → Test Neo4jSync beliefs → Neo4j.

  • Masked password *** in the form does not wipe the vault secret on Test.
  • Clear graph invalidates SQLite beliefs and deletes that tenant’s Neo4j edges. A manual Sync is only needed if dual-write was down during the clear.
  • Do not make Neo4j a required install for single-user setups.
JobCadence
macro_sleep (decay / tiers) + ego-anchor backfill + FTS drift rebuild~6h
backup + export (beliefs, episodes, merges, archive, audit JSONL) + mirror-drift warning~24h
global reconsolidation (dedupe + re-embed + count recompute)~24h; auto-partitions large corpora

Dashboard: Run reconsolidation, queue retry / Clear failed, component health board.

  • Do not dump KB chunks into the beliefs table as raw SPO without provenance.
  • Do not require Neo4j for a normal install.
  • Do not set KAZMA_MEMORY_STATE_ROLE=primary until python scripts/reconcile_memory_mirror.py --dry-run reports no dead-in-mirror / only-in-mirror rows.
  • Do not treat “memory V2” as a product version entity (hygiene blocks subjects like kazma_v2_4_0).
  • Do not rewrite belief subject ids by hand to “fix” labels — use Rename (display) or Merge (identity).
  • Do not expect empty person shells with zero beliefs to appear as extra graph nodes — self shells focus the hub.