Back to feed
Dev.to
Dev.to
7/16/2026
Giving a Telegram bot long-term memory with SQLite and local embeddings

Giving a Telegram bot long-term memory with SQLite and local embeddings

Short summary

A practical architecture for giving a self-hosted Telegram AI assistant persistent memory using SQLite and local embeddings. Five SQLite tables store facts, lessons, journal entries, and emotional state across sessions. A local multilingual embedding model generates vectors for cosine-similarity retrieval, keeping all conversation data on the server with no external vector DB. Retrieved memories are prepended to the system prompt so the assistant remembers without re-explanation.

  • Five SQLite tables (facts, lessons, journal, emotions, state) provide durable cross-session memory
  • Local multilingual embedding model generates vectors for cosine-similarity retrieval — no data leaves the server
  • Top-k relevant memories are prepended to the system prompt each turn for continuity
  • Full stack runs on a cheap Linux VPS with one-command install via Avelina

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more