From 8e26a9d9dd68ef73ebb795efa33009f570ed6c47 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 1 Mar 2026 16:16:44 -0600 Subject: [PATCH] store: Migration Script: Default-to-Named-Graph Memory Transfer --- ...t-to-named-graph-memory-transfer-5fb6b3.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 graph/solutions/migration-script-default-to-named-graph-memory-transfer-5fb6b3.md diff --git a/graph/solutions/migration-script-default-to-named-graph-memory-transfer-5fb6b3.md b/graph/solutions/migration-script-default-to-named-graph-memory-transfer-5fb6b3.md new file mode 100644 index 00000000000..450d04bbf47 --- /dev/null +++ b/graph/solutions/migration-script-default-to-named-graph-memory-transfer-5fb6b3.md @@ -0,0 +1,34 @@ +--- +id: 5fb6b3c0-cc6a-4baa-8552-8d2731379b0b +type: solution +title: "Migration Script: Default-to-Named-Graph Memory Transfer" +tags: [cognitive-memory, migration, multi-graph, python, script, solution] +importance: 0.85 +confidence: 0.8 +created: "2026-03-01T22:16:44.476551+00:00" +updated: "2026-03-01T22:16:44.476551+00:00" +--- + +# Memory Migration Script: Default to Named Project Graphs + +## Location +`/mnt/NV2/Development/cognitive-memory/scripts/migrate-memories.py` + +## Problem +Memories accumulated in the default cognitive-memory graph without project-level separation. Needed a way to migrate them into named project graphs based on tag matching. + +## Solution +Standalone Python script (`migrate-memories.py`) that migrates memories from the default cognitive-memory graph to named project graphs. + +### Key Features +- **Tag-based classification**: routes memories to target graphs by matching tags +- **Flags**: `--dry-run`, `--no-git`, `--cleanup-overlaps` +- **File operations**: moves/copies `.md` files, updates `_index.json`, `_embeddings.json`, `_state.json` in both source and target +- **Edge handling**: classifies edges as migrate vs orphan, strips cross-graph edge references from frontmatter +- **Overlap detection**: memories tagged for multiple projects are COPIED (not moved) to each target graph; tracked in `_migration_overlaps.json` +- **Idempotent**: safe to re-run +- **Atomic JSON writes**: via `tempfile + os.replace()` +- **Git auto-commit**: commits changes after successful migration + +## Git Commit +Committed as `11a046f`, closes Gitea issues #4, #5, #6.