Quick fix
# One-liner: write BASE_URL / AUTH_TOKEN into the worker config and restart
echo "BASE_URL=$ANTHROPIC_BASE_URL" > ~/.claude-mem/.env && echo "AUTH_TOKEN=$ANTHROPIC_AUTH_TOKEN" >> ~/.claude-mem/.env && claude-mem restart
What you will run into
Using a third-party model like DeepSeek, after switching from OAuth to an API key, /mem-search reports No previous sessions found - even though there was memory before.
You think the memory is gone; actually it's inconsistent auth info: the worker doesn't read the ANTHROPIC_BASE_URL / AUTH_TOKEN env vars and you need to sync them manually into ~/.claude-mem/.env (upstream Issue #2666).
Why this happens
claude-mem's worker keeps its own environment config (~/.claude-mem/.env) and doesn't follow your shell's env vars.
After switching auth methods, the shell has the new config but the worker still holds the old one - so session capture fails and the search naturally returns nothing.
Sync .env + restart the worker + trigger one session again.
The key mental model: memory capture is a side path, not part of the main process.
claude-mem's worker is a separate process that subscribes to session events and keeps its own auth config (~/.claude-mem/.env) — the ANTHROPIC_* env vars in your shell only affect the Claude Code main process; the worker reads none of them.
After switching auth methods, the main process talks fine with the new key while the worker still holds the old config, so the "capture chain" is broken: sessions are simply not recorded, and search naturally reports "no previous sessions".
The memory is not lost; the chain is down. So the fix must do all three steps: sync .env → restart the worker (reload config) → trigger one session again (let the new config actually run one capture).
Step by step
1. Sync auth into the worker config — Required
Edit ~/.claude-mem/.env, writing the current BASE_URL / AUTH_TOKEN (or the matching ANTHROPIC_* values) to match the shell environment.
2. Restart the worker — Required
claude-mem restart
3. Trigger one session again — Required
Open a new session to let it capture, then verify with /mem-search.
How to confirm it works
claude-mem status && claude-mem search "last topic"
Worker ready and search returns results = success (after switching auth, syncing .env + restarting is the core).
Other environments
| Environment | Notes |
|---|---|
| OAuth -> API Key | Must sync ~/.claude-mem/.env and restart |
| DeepSeek etc. | Use the actual BASE_URL/AUTH_TOKEN |
| No memory after switching | Memory isn't lost; the capture chain isn't connected; trigger a session again |
Symptom
After switching from OAuth to an API key for third-party models like DeepSeek, /mem-search reports No previous sessions found.
Cause
Inconsistent auth info; the worker doesn't read the ANTHROPIC_BASE_URL/AUTH_TOKEN env vars and needs them manually synced into ~/.claude-mem/.env (upstream Issue #2666).
Solution
- Manually sync BASE_URL / AUTH_TOKEN in
~/.claude-mem/.env. - Restart the worker (
claude-mem restart). - Trigger one session capture again, then search.
Verification Evidence
- CSDN zxqsoftware/161293220 (2026-05).
- Upstream Issue #2666.
Applicable tools (1)
This problem is linked from the tool pages below — reachable from either side.
claude-memBundled solutions (combos)
This problem is part of the following verified bundles.
Source & evidence
← Sessions & Memory domain | Problem Catalog Experience | Facing another issue? Go to the Helpdesk