Memory

Semantic long-term memory backed by a vector database.

MeghaOS remembers. After each conversation, the agent extracts durable facts and stores them in a vector database, then injects relevant ones into the LLM prompt on future queries β€” so responses stay personal and contextual across sessions.

Storage

Memory is backed by a vector database (SQLite backend), living in your device. The wrapper is, which manages two collections:

CollectionContents
user_factsDurable facts extracted about the user and their world
conversation_historyPast conversation turns for semantic recall
Note

the memory store is initialized at startup. a vector database init failures are wrapped so they raise SystemExit(1) and surface clearly in the logs rather than hanging the startup.

The retrieval loop

  1. On each /chat, memory.get_context(query) runs a semantic search over stored facts.
  2. The most relevant facts are injected into the LLM system prompt.
  3. After responding, a background task asks the LLM to extract new facts from the exchange and writes them back to the vector store.

Because retrieval is semantic (embedding similarity), the agent surfaces relevant memories even when the wording differs from how they were originally stored.

Why vector search

Fuzzy recall

"What's my sister's birthday?" matches a stored fact phrased entirely differently.

Scales quietly

Facts accumulate over time; only the top matches enter the prompt, keeping it small.

Related services

  • β€” higher-level memory orchestration.
  • β€” the per-workflow shared variable context used for step-to-step $variable substitution (distinct from long-term memory).