One of the key differences between a chatbot and an AI companion is memory. Here's how it works.
LLMs like Claude and GPT-4 have no built-in memory between sessions. Each conversation starts fresh. They can only "remember" what fits in their context window (the text they can see at once).
This means:
The simplest approach: write important things to files.
memory/
├── facts.md # Permanent facts about the user
├── 2026-01-21.md # Daily session notes
└── projects/ # Topic-specific notes
Pros: Simple, human-readable, easy to edit
Cons: Doesn't scale well, no semantic search
Store memories as embeddings (numerical representations of meaning). Query by semantic similarity.
Popular options:
Pros: Scales well, finds relevant memories automatically
Cons: Less transparent, can surface irrelevant stuff
Many systems combine both:
This gives you the best of both worlds.
When a conversation exceeds the context window, you need to compact it - summarize what happened so the AI can keep going.
The tradeoff:
Good compaction preserves:
Bad compaction loses:
Have tips to add? Submit a PR or reach out on synthpals.social!