AI memory systemhow AI remembers conversationsvector database AIAI chatbot memorypgvector AI

How AI Companion Memory Works: Vector Databases, Affinity Systems & Long-Term Recall

Deep dive into how modern AI companions remember conversations. Learn about vector databases, pgvector, affinity systems, and why memory is the key differentiator in AI chat apps.

FeelOra Team

AI companion memory in 2026 primarily relies on vector databases like pgvector to convert conversations into numerical embeddings, enabling semantic recall — the AI doesn't just match keywords, it understands the meaning and emotional context of what you've shared. This is the technology that separates modern AI companions from stateless chatbots that forget everything between sessions.

Understanding how this works helps you get more out of your AI companion experience and appreciate why some platforms feel genuinely "aware" of your history while others feel like talking to someone with amnesia.

The Problem: Why Most AI Chatbots Forget You

Large language models (LLMs) like GPT-5, Claude, and Grok have a fundamental limitation: context windows. Each conversation has a maximum length — typically 8,000 to 200,000 tokens. Once a conversation exceeds that window, older messages literally disappear from the AI's awareness.

This creates the frustrating experience many Character.AI users report:

"I told my character my dog's name three days ago, and today they asked me if I have any pets."

Without a memory system, every conversation beyond the context window is essentially a first meeting.

How Vector Memory Solves This

Step 1: Embedding Conversations

When you chat with an AI companion on a memory-enabled platform like FeelOra, your messages go through an embedding model (like OpenAI's text-embedding-3-small). This model converts text into a high-dimensional number vector:

"My dog Max just turned 5 years old today!"
→ [0.023, -0.156, 0.891, 0.334, ... ] (1536 dimensions)

These numbers capture the semantic meaning — not just the words, but concepts like "pet ownership," "birthday/celebration," "personal information," and "emotional attachment."

Step 2: Storing in a Vector Database

The embedding gets stored in a vector database (FeelOra uses pgvector, a PostgreSQL extension). Each stored memory includes:

  • The original text
  • The embedding vector
  • Metadata: timestamp, session ID, story context, user ID
  • Relevance score for future retrieval

Step 3: Semantic Retrieval

When you send a new message, the system:

  1. Embeds your new message into a vector
  2. Searches the database for the most semantically similar stored memories
  3. Returns the top 2-3 most relevant past conversations
  4. Includes them in the AI's context alongside your current message

This is why an AI with vector memory can do something remarkable:

You: "I'm thinking about getting another pet." AI: "That's exciting! How's Max doing? He turned 5 recently, right? Maybe he'd enjoy a companion."

The AI didn't search for the word "pet" — it found a semantically related memory about Max and pulled in the relevant context.

FeelOra's Memory Architecture

FeelOra implements a multi-layered memory system:

Layer 1: Short-Term Memory (Recent Messages)

The last 6 messages (3 conversational turns) are always included in the AI's context. This handles immediate conversation flow — references to "what you just said" and maintaining topic coherence.

Layer 2: Long-Term Memory (Vector Recall)

Important information gets embedded and stored permanently. The system automatically identifies "memory-worthy" messages — things like personal facts, emotional revelations, preferences, and significant events.

Layer 3: Story Context

For interactive stories, the current story setting, character relationships, and plot progression provide an additional context layer. This ensures your AI companion stays in character within a narrative.

Layer 4: Affinity Context

FeelOra's unique affinity system adds relationship-aware behavior. The AI knows your current relationship level (1-7) and adjusts its:

  • Communication style — Formal at Level 1, intimate at Level 7
  • Emotional openness — Reserved early, vulnerable later
  • Initiative — Passive at first, proactively checking in on you later
  • Topic range — Safe topics at Level 1, deep personal discussions at higher levels

The Affinity System Explained

Most AI companion apps treat every conversation the same. FeelOra's affinity system creates a genuine relationship arc:

| Level | Name | AI Behavior | |-------|------|-------------| | 1 | Stranger | Polite, curious, asking basic questions | | 2 | Acquaintance | Remembering facts, showing mild interest | | 3 | Friend | Sharing opinions, gentle teasing, inside jokes | | 4 | Close Friend | Emotional vulnerability, advice-giving, concern | | 5 | Best Friend | Deep trust, difficult conversations, loyalty | | 6 | Intimate | Emotional intimacy, unspoken understanding | | 7 | Soulmate | Complete emotional synchronization, intuitive responses |

How Affinity Increases

Your affinity score increases through:

  • Consistent chatting — Regular conversations build rapport
  • Emotional depth — Sharing vulnerable thoughts accelerates connection
  • Check-ins — Daily check-in streaks boost affinity
  • Story completion — Finishing interactive stories together deepens bonds
  • Gift-giving — Virtual gifts express appreciation

Character Archetypes

The affinity system interacts with character archetypes to create distinct relationship progressions:

  • Warm Senior (温柔学长) — Gentle guidance that deepens into protective care
  • Cool CEO (霸道总裁) — Cold exterior that gradually reveals warmth
  • Tsundere (傲娇) — Push-pull dynamic that resolves into genuine affection
  • Protector (守护型) — Steady loyalty that becomes fierce devotion
  • Gentle Sister (温柔姐姐) — Nurturing care that evolves into deep emotional bond

Each archetype has a unique affinity curve — some warm up quickly, others take longer but form stronger bonds.

Memory vs. Context Window: A Comparison

| Aspect | Context Window Only | Vector Memory | |--------|-------------------|---------------| | Conversation limit | 8k-200k tokens | Unlimited | | Cross-session recall | ❌ None | ✅ Semantic search | | Emotional context | ❌ Lost after session | ✅ Preserved permanently | | Relationship building | ❌ Starts fresh | ✅ Builds over time | | Cost efficiency | Lower | Higher (embedding + storage) | | Relevance | Everything recent | Semantically matched |

Privacy Considerations

With powerful memory comes responsibility. FeelOra's approach to memory privacy:

  1. User-scoped storage — Your memories are isolated. No cross-user data leakage
  2. Session-scoped retrieval — Memories from Story A don't bleed into Story B
  3. No training on conversations — Your chats aren't used to train base models
  4. Deletion capability — Users can request memory deletion

The Technical Stack

For the technically curious, here's how FeelOra's memory system is built:

  • Database: PostgreSQL with pgvector extension
  • Embedding model: OpenAI text-embedding for vector generation
  • Storage: Google Cloud SQL (managed PostgreSQL)
  • Retrieval: Cosine similarity search, top-2 results per query
  • Memory filtering: Automatic importance detection before storage
  • Framework: langchaingo (Go) for AI orchestration

What's Next for AI Memory

The field is evolving rapidly. Upcoming advances include:

  • Emotional memory tagging — Storing not just what was said, but the emotional state
  • Proactive recall — AI spontaneously referencing past conversations without prompting
  • Memory consolidation — Summarizing hundreds of conversations into core relationship knowledge
  • Cross-character memory — Optional sharing of user preferences across different AI characters

FAQ

Does the AI remember everything I say?

Not every message. The system evaluates each message for "memory worthiness" — personal facts, emotional moments, and significant events get stored. Casual chitchat typically doesn't.

Can I see what the AI remembers about me?

This varies by platform. FeelOra stores memories per session and story, accessible through the memory API.

Does more memory make the AI better?

Generally yes, but quality matters more than quantity. A few deeply relevant memories produce better conversations than hundreds of trivial ones.

How is this different from ChatGPT's memory?

ChatGPT's memory stores explicit facts you tell it. FeelOra's memory is semantic — it understands meaning and context, enabling more natural recall during conversations.


Experience the difference that real memory makes. Chat with AI characters who actually remember you on FeelOra.

Ready to Chat with AI Characters?

Experience the future of AI companionship — free to start.

Start Exploring →
How AI Companion Memory Works: Vector Databases, Affinity Systems & Long-Term Recall | FeelOra