Urgent.News

What's breaking now, across thousands of outlets.

AI

How I Built Memory for a Local AI Companion Without Sending Chats to a Server

A chatbot can sound convincing for five minutes without remembering anything. Then you mention the job interview you were stressed about last week, the name of your dog, or a small detail from a late-night conversation. It replies like none of it happened. That is where most "AI companion" demos fall apart. I am building Local Waifu , a desktop AI companion that runs on the user's own Mac or PC.…

Building a memory system for an AI companion without sending chats to a server presents unique challenges. The first version of memory was to simply save messages, which provided a history but lacked recall capabilities. As the chat history grew, sending it back to a local language model for every message became slow and contextually inefficient.

Thus, chat history and long-term memory were separated. Chat history provides immediate context for the model, while long-term memory consists of important facts, moments, preferences, and relationship details.

These memories are stored in SQLite, a local database, ensuring the app functions without a hosted database. Each character has their own data, so one character's memories do not inadvertently merge with another's. For each memory, the text itself, along with metadata like character association, creation time, importance, emotional weight, usage frequency, and vector embedding, is stored. The vector embedding enables semantic search, allowing the app to find related memories even if they don't share exact keywords.

When recalling memories, similarity alone isn't enough. Recent memories and those with higher emotional weight or previous usefulness should be given more consideration. The memory system extracts a small knowledge graph, representing relationships and entities, which aids in answering structural questions. However, the memory system must include an escape hatch for users to inspect or remove stored data, preventing the companion from feeling intrusive or "monitoring."

Ensuring the embedding model is downloaded correctly during setup prevents silent memory loss, a common issue that can undermine the user's experience.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Stop Blaming the LLM: Why Your AI Agents Keep Failing (And How to Fix Them)

I was staring at a broken Next.js and Express backend integration late at night, convinced my AI agent had lost its mind. It was supposed to be a straightforward n8n automation pipeline.

  • Author blames AI model intelligence, not infrastructure
  • Implements targeted retrieval, MCP servers, durable state, strict verification
  • Shift from prompt to harness engineering improves AI agent performance

RAG explicado: cómo darle a un LLM tu propia información

Un modelo de lenguaje sabe mucho del mundo, pero no sabe nada de tu empresa : tus manuales, tus políticas, tus productos.

  • RAG technique allows LLMs to access and use specific company information
  • Indexes documents into numerical embeddings stored in vector databases
  • System prompt instructs model to use provided context for responses

More from Saturday 22 August →