Memory Export/Import Scripts
Share your claude-mem knowledge with other users! These scripts allow you to export specific memories (observations, sessions, summaries, and prompts) and import them into another claude-mem installation.Use Cases
- Share Windows compatibility knowledge with Windows users
- Share bug fix patterns with contributors
- Share project-specific learnings across teams
- Backup specific memory sets for safekeeping
How It Works
Export Script
Searches the database using hybrid search (combines ChromaDB vector embeddings with FTS5 full-text search) and exports all matching:- Observations - Individual learnings and discoveries
- Sessions - Session metadata
- Summaries - Session summaries
- Prompts - User prompts that led to the work
Privacy Note: Export files contain all matching memory data in plain text. Review exports before sharing to ensure no sensitive information (API keys, passwords, private paths) is included.
Import Script
Imports memories with duplicate prevention:- Checks if each record already exists before inserting
- Skips duplicates automatically
- Maintains data integrity with transactional imports
- Reports what was imported vs. skipped
- Sessions: By
claude_session_id(unique) - Summaries: By
sdk_session_id(unique) - Observations: By
sdk_session_id+title+created_at_epoch(composite) - Prompts: By
claude_session_id+prompt_number(composite)
Usage
Export Memories
<query>- Search query (uses hybrid semantic + full-text search)<output-file>- Output JSON file path--project=name- Optional: filter results to a specific project
Import Memories
<input-file>- Input JSON file (from export script)
Re-importing (Duplicate Prevention)
If you run the import again on the same file, duplicates are automatically skipped:Sharing Memories
For Export Authors
-
Export your memories:
-
Share the JSON file via:
- GitHub gist
- Project repository (
shared-memories/) - Direct file transfer
- Package in releases
-
Document what’s included:
- What query was used
- What knowledge is contained
- Who might benefit from it
For Import Users
- Download the export file to your local machine
-
Review what’s in it (optional):
-
Import into your database:
-
Verify import by searching:
JSON Export Format
Safety Features
✅ Duplicate Prevention - Won’t re-import existing records ✅ Transactional - All-or-nothing imports (database stays consistent) ✅ Read-only Export - Export script opens database in read-only mode ✅ Dependency Ordering - Sessions imported before observations/summaries ✅ Validation - Checks database exists before startingAdvanced Usage
Export by Project
Export by Type
Export by Date Range
You can filter the export after exporting:Combine Multiple Exports
Troubleshooting
Database Not Found
Import File Not Found
Partial Import
If import fails mid-way, the transaction is rolled back - your database remains unchanged. Fix the issue and try again.Contributing Memory Sets
If you’ve exported valuable knowledge that others might benefit from:- Create a PR to the
shared-memories/directory - Include a README describing what’s in the export
- Tag with relevant keywords (windows, linux, bugfix, etc.)
- Community members can then import your knowledge!

