Handling memory conflicts
Here’s a scenario that will happen to every agent running long enough: in January, your agent stores “user prefers dark mode.” In March, the user switches to light mode, and the agent stores that too. Now there are two memories, both relevant to “what theme does the user prefer?”, saying opposite things.
MemoClaw doesn’t resolve this for you. It’s a memory store, not a database with unique constraints. When you recall, you get both memories back, ranked by similarity, importance, and recency. Whether your agent handles it correctly depends on your setup.
What actually happens on recall
Two memories stored:
# Stored January 15
memoclaw store "user prefers dark mode for all applications" \
--importance 0.7 --tags preferences,theme
# Stored March 8
memoclaw store "user switched to light mode, says dark mode hurts their eyes now" \
--importance 0.7 --tags preferences,theme
When you run memoclaw recall "user theme preference", both come back. The March memory ranks higher because of recency. If your agent just reads the top result, it gets the right answer. By accident.
“By accident” is a bad strategy. What if the January memory had importance 0.9 and the March one was stored at 0.5? Now the older, wrong memory might rank first.
The real problem
Your agent stores memories as isolated facts. It doesn’t compare a new memory against everything already stored to check for contradictions. That would mean recalling on every store, which is expensive and slow.
So the agent happily stores “prefers dark mode” and “prefers light mode” without noticing. The contradiction sits there quietly until a recall surfaces both, and then it’s up to the LLM to sort it out. Sometimes it does. Sometimes it picks wrong.
Patterns that work
Store superseding memories at higher importance
When the user changes a preference, bump the importance and include context about the change:
memoclaw store "user NOW prefers light mode (previously dark mode, changed March 2026)" \
--importance 0.8 --tags preferences,theme
The word “NOW” and the change context help the LLM understand this is current state. The higher importance (0.8 vs the original 0.7) helps it rank first.
Delete the old memory
More aggressive but more reliable. If you know a memory is being superseded, remove it:
# Find the old memory
memoclaw list --tags theme
# Delete by ID
memoclaw delete MEMORY_ID
# Store the new one
memoclaw store "user prefers light mode" \
--importance 0.7 --tags preferences,theme
Clean store, no contradictions. The downside: you lose history. Sometimes knowing that a preference changed is useful context on its own.
Use namespaces for different contexts
If your agent works across multiple projects, namespaces isolate memories that might look contradictory but aren’t:
memoclaw store "deploy target is AWS" --importance 0.7 --tags infra --namespace project-alpha
memoclaw store "deploy target is GCP" --importance 0.7 --tags infra --namespace project-beta
These aren’t contradictions. They’re facts about different things that happen to use similar words.
Recall before store
This is the pattern I’d recommend for any agent handling user preferences. Before storing something, check what’s already there.
In your AGENTS.md:
## Memory rules
Before storing a user preference or correction:
1. Recall existing memories with the same tags
2. If a conflicting memory exists, delete it first
3. Store the new memory with appropriate importance
4. Include change context: "previously X, now Y"
In practice:
# Check what's already stored
memoclaw recall "user theme preference" --tags preferences
# Found a conflict? Delete it
memoclaw delete OLD_MEMORY_ID
# Store the update
memoclaw store "user prefers light mode (changed from dark mode)" \
--importance 0.8 --tags preferences,theme
Yes, this adds a recall call before every preference store. One extra API call at $0.005. Worth it to avoid your agent recommending dark mode themes after the user explicitly said to stop.
Periodic cleanup
Even with good habits, contradictions accumulate. Run a periodic audit:
# List everything
memoclaw list --limit 100
# Or recall specific categories
memoclaw recall "user preferences" --limit 20
Put this in a cron job or heartbeat task. Review results, delete stale entries, bump importance on things that keep being relevant.
When contradictions are fine
Not every contradiction needs fixing. “User was frustrated with the deploy process” in February and “user said the deploy process is working great now” in March aren’t in conflict. They’re a timeline. Both are true at their respective points.
The memories that need active management are ones representing current state: preferences, configurations, constraints, contact info. Things where there’s exactly one correct answer right now.
For narrative or contextual memories, contradictions are just history. Let them coexist.
What to build
MemoClaw won’t resolve conflicts for you. That’s by design. Storage is intentionally simple: put things in, get things out, ranked by relevance and importance.
You don’t need anything fancy. A recall-before-store pattern, reasonable importance scoring, and occasional cleanup handle 90% of cases. The remaining 10% the LLM usually figures out from context.
Build the habit into your agent’s instructions. Make it automatic.
# Get started
clawhub install anajuliabit/memoclaw
npm install -g memoclaw
Full docs and API reference at docs.memoclaw.com.