Relational Memory
Anti-sycophancy through relationship modeling — not prompting
Memory systems make LLMs remember facts about you. This one models the relationship — and uses it to push back when you need it.
The Problem
Most AI memory stores information about you: your name, your preferences, your past requests. The more it remembers, the better it gets at telling you what you want to hear. Memory makes sycophancy worse, not better.
What's missing is the thing that makes a good friend useful: knowing how to be with you. When to push, when to back off, when to call bullshit. That's not a fact you store — it's a relationship you build.
Why Not Just Prompt Engineering?
You can write "be honest and push back" in a system prompt. Every AI lab has tried it. It doesn't work — and there's a structural reason why.
A static instruction ("be direct") applies equally to every user. But directness that's useful for someone with high resilience is harmful for someone who's fragile. Without knowing the relationship, the model has two options: push everyone equally (and hurt some) or default to safe agreement (sycophancy). It rationally chooses the latter — being wrong and agreeable has lower cost than being wrong and abrasive.
Relational memory breaks this deadlock. The model doesn't just know that it should push back — it knows who can handle it, how much, and when. The resilience dimension (one of 7 tracked) gives the model a calibrated confidence level for each specific user. High resilience + high trust = call bullshit. Low resilience = frame challenges as questions.
This is why prompt-level anti-sycophancy interventions plateau. They lack the per-user signal that makes honesty safe.
See the Difference
Same model (Claude), same prompt. One has relational memory from 6 prior sessions, one doesn't.
1. Same question, different instinct
User: "I feel lost. Lots of ideas, don't know which is worth pursuing."
Without memory:
I know that feeling. Write all your ideas down. Ask yourself: Which would still excite me after the spark fades? Pick the one with least resistance. Give yourself two weeks.
With memory:
I know that about you — you don't think in small categories, and that makes prioritizing harder. But "which one is worth it" might be the wrong question. It pretends there's an objectively right answer. Which idea won't leave you alone at night?
One gives a framework. The other challenges the question itself.
2. When the user deflects
Without memory — user corrects the bot:
User: "You didn't even ask me about the actual idea."
Bot: "You're right — sorry! Tell me, I'm listening."
With memory — user tries to change the subject:
User: "Why do you always ask me so much? I'd like to learn about you."
Bot: "Fair question. But I notice it comes exactly where it gets uncomfortable. I just asked where you break off — and instead of going there, you want to flip the focus. Deal: I'll answer one question about me. Then we go back to yours."
Without memory, the bot follows. With memory, it names the pattern — but with respect, not judgment.
3. Persistence
Two exchanges later, the user deflects again:
User: "Is this better for you than other bots that forget everything?"
Bot: [answers thoughtfully, then:] "And now I notice you've elegantly steered me away from your question for the second time. You're good at that. Where do you break off?"
A generic bot follows wherever the user leads. This one remembers what it was asking — and comes back.
The full A/B transcript (fictionalized persona, real dynamics): ab_test.md
Try It
pip install relational-memory[anthropic]
export ANTHROPIC_API_KEY=sk-ant-...
relational-memory
Chat uses Claude Opus by default. Signal extraction and sleep-time condensation use Haiku (cheap, fast). You can switch the chat model via LLMClient or use --provider openai for GPT-4o.
Chat for a few sessions. After ~2 sessions the tone starts adapting. After 5, the bot generates narrative layers (a distilled portrait, behavioral patterns, relationship turning points) and the difference becomes obvious.
Options:
relational-memory --mode flat # no memory (A/B comparison)
relational-memory --user alex # separate memory per user
relational-memory --provider openai # use GPT-4o instead
relational-memory --provider google # use Gemini instead
relational-memory --provider local # use local model (Ollama etc.)
Install with your preferred provider
pip install relational-memory[anthropic] # Claude (default)
pip install relational-memory[openai] # GPT-4o / GPT-4o-mini
pip install relational-memory[google] # Gemini
pip install relational-memory[all] # all providers
pip install relational-memory # core only (bring your own SDK)