* fix: export/import scripts now use API instead of direct DB access Export script fix: - Add format=json parameter to SearchManager for raw data output - Add getSdkSessionsBySessionIds method to SessionStore - Add POST /api/sdk-sessions/batch endpoint to DataRoutes - Refactor export-memories.ts to use HTTP API Import script fix: - Add import methods to SessionStore with duplicate detection - Add POST /api/import endpoint to DataRoutes - Refactor import-memories.ts to use HTTP API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: update analyze-transformations-smart.js to use bun:sqlite Replace better-sqlite3 import with bun:sqlite to align with v7.1.0 migration. * chore: remove all better-sqlite3 references from codebase - Updated scripts/analyze-transformations-smart.js to use bun:sqlite - Merged PR #332: Refactored import/export scripts to use worker API instead of direct DB access - Updated PM2-to-Bun migration documentation All better-sqlite3 references have been removed from source code. Documentation references remain as appropriate historical context. * build: update plugin artifacts with merged changes Include built artifacts from PR #332 merge and analyze-transformations-smart.js update. --------- Co-authored-by: lee <loyalpartner@163.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
5.9 KiB
Common Issue Resolutions
Quick fixes for frequently encountered claude-mem problems.
Issue: Nothing is Remembered After /clear
Symptoms:
- Data doesn't persist across sessions
- Context is empty after
/clear - Search returns no results for past work
Root cause: Sessions are marked complete but data should persist. This suggests:
- Worker not processing observations
- Database not being written to
- Context hook not reading from database
Fix:
-
Verify worker is running:
cd ~/.claude/plugins/marketplaces/thedotmack/ npm run worker:status -
Check database has recent observations:
sqlite3 ~/.claude-mem/claude-mem.db "SELECT COUNT(*) FROM observations WHERE created_at > datetime('now', '-1 day');" -
Restart worker and start new session:
cd ~/.claude/plugins/marketplaces/thedotmack/ npm run worker:restart -
Create a test observation:
/skill version-bumpthen cancel -
Check if observation appears in viewer:
open http://127.0.0.1:37777 # Or manually check database: sqlite3 ~/.claude-mem/claude-mem.db "SELECT * FROM observations ORDER BY created_at DESC LIMIT 1;"
Issue: Viewer Empty After Every Claude Restart
Symptoms:
- Viewer shows no data at http://127.0.0.1:37777
- Stats endpoint returns all zeros
- Database appears empty in UI
Root cause:
- Database being recreated on startup (shouldn't happen)
- Worker reading from wrong database location
- Database permissions issue
Fix:
-
Check database file exists and has data:
ls -lh ~/.claude-mem/claude-mem.db sqlite3 ~/.claude-mem/claude-mem.db "SELECT COUNT(*) FROM observations;" -
Check file permissions:
ls -la ~/.claude-mem/claude-mem.db # Should be readable/writable by your user -
Verify worker is using correct database path in logs:
grep "Database" ~/.claude-mem/logs/worker-$(date +%Y-%m-%d).log -
Test viewer connection manually:
curl -s http://127.0.0.1:37777/api/stats # Should show non-zero counts if data exists
Issue: Old Memory in Claude
Symptoms:
- Context contains outdated observations
- Irrelevant past work appearing in sessions
- Context feels stale
Root cause: Context hook injecting stale observations
Fix:
-
Check the observation count setting:
grep CLAUDE_MEM_CONTEXT_OBSERVATIONS ~/.claude-mem/settings.json -
Default is 50 observations - you can adjust this:
{ "env": { "CLAUDE_MEM_CONTEXT_OBSERVATIONS": "25" } } -
Check database for actual observation dates:
sqlite3 ~/.claude-mem/claude-mem.db "SELECT created_at, project, title FROM observations ORDER BY created_at DESC LIMIT 10;" -
Consider filtering by project if working on multiple codebases
Issue: Worker Not Starting
Symptoms:
- Worker status shows not running or error
- Health check fails
- Viewer not accessible
Root cause:
- Port already in use
- Bun not installed
- Missing dependencies
Fix:
-
Try manual worker start to see error:
cd ~/.claude/plugins/marketplaces/thedotmack/ bun plugin/scripts/worker-service.js # Should start server on port 37777 or show error -
If port in use, change it:
mkdir -p ~/.claude-mem echo '{"CLAUDE_MEM_WORKER_PORT":"37778"}' > ~/.claude-mem/settings.json -
If dependencies missing:
cd ~/.claude/plugins/marketplaces/thedotmack/ npm install npm run worker:start
Issue: Search Results Empty
Symptoms:
- Search skill returns no results
- API endpoints return empty arrays
- Know there's data but can't find it
Root cause:
- FTS5 tables not synchronized
- Wrong project filter
- Database not being queried correctly
Fix:
-
Check if observations exist in database:
sqlite3 ~/.claude-mem/claude-mem.db "SELECT COUNT(*) FROM observations;" -
Check FTS5 table sync:
sqlite3 ~/.claude-mem/claude-mem.db "SELECT COUNT(*) FROM observations_fts;" # Should match observation count -
Try search via API directly:
curl "http://127.0.0.1:37777/api/search/observations?q=test&format=index" -
If FTS5 out of sync, restart worker (triggers reindex):
cd ~/.claude/plugins/marketplaces/thedotmack/ npm run worker:restart
Issue: Port Conflicts
Symptoms:
- Worker won't start
- Error: "EADDRINUSE: address already in use"
- Health check fails
Fix:
-
Check what's using port 37777:
lsof -i :37777 -
Either kill the conflicting process or change claude-mem port:
mkdir -p ~/.claude-mem echo '{"CLAUDE_MEM_WORKER_PORT":"37778"}' > ~/.claude-mem/settings.json cd ~/.claude/plugins/marketplaces/thedotmack/ npm run worker:restart
Issue: Database Corrupted
Symptoms:
- SQLite errors in logs
- Worker crashes on startup
- Queries fail
Fix:
-
Backup the database:
cp ~/.claude-mem/claude-mem.db ~/.claude-mem/claude-mem.db.backup -
Try to repair:
sqlite3 ~/.claude-mem/claude-mem.db "PRAGMA integrity_check;" -
If repair fails, recreate (loses data):
rm ~/.claude-mem/claude-mem.db cd ~/.claude/plugins/marketplaces/thedotmack/ npm run worker:restart # Worker will create new database
Prevention Tips
Keep claude-mem healthy:
- Regularly check viewer UI to see if observations are being captured
- Monitor database size (shouldn't grow unbounded)
- Update plugin when new versions are released
- Keep Claude Code updated
Performance tuning:
- Adjust
CLAUDE_MEM_CONTEXT_OBSERVATIONSif context is too large/small - Use
/clearto mark sessions complete and start fresh - Use search skill to query specific memories instead of loading everything