Import & Merge
Six tools for moving memory data in and out of VEKTOR — from a simple export CLI to a full drop-folder consolidation daemon with causal lineage reconstruction. All tools are additive: they never modify the core memory engine.
Memory Export
Exports all memories to JSON, Markdown, or CSV. Supports filtering by tag, importance, date, namespace, and limit. No wire-in required — standalone CLI only.
CLI
node vektor-export.js json # → memories-export.json node vektor-export.js markdown # → memories-export.md node vektor-export.js csv # → memories-export.csv node vektor-export.js json --out ./backup.json node vektor-export.js json --tag trading node vektor-export.js json --min-importance 0.7 node vektor-export.js json --limit 100 node vektor-export.js json --since 2025-01-01 node vektor-export.js json --namespace research node vektor-export.js json --db ./custom.db
Programmatic
const { exportMemory } = require('./vektor-export'); const result = await exportMemory({ format: 'json', tag: 'trading', minImportance: 0.7, out: './backup.json', }); // → { dest: './backup.json', count: 42, format: 'json' }
DB auto-detection order
Checks VEKTOR_DB_PATH env var → ./slipstream-memory.db → ./vektor-slipstream-memory.db → AppData path. Override with --db.
Schema Migrations
Idempotent additive migrations — safe to run repeatedly. Never drops or modifies existing columns. Runs automatically on first boot of any module that requires new columns.
Migrations
| ID | Description |
|---|---|
| 001 | Add tags TEXT column to memories |
| 002 | Add confidence REAL column (default 1.0) |
| 003 | Add source_db TEXT column (tracks import origin) |
| 004 | Create vektor_migrations tracking table |
| 005 | Index on memories.tags |
| 006 | Index on memories.confidence |
| 007 | Add namespace TEXT column (required by v1.4+) |
| 008 | Add pinned INTEGER column |
| 009 | Index on memories.namespace |
CLI
node vektor-migrate.js node vektor-migrate.js --db ./slipstream-memory.db
Programmatic
const { runMigrations } = require('./vektor-migrate'); await runMigrations('./slipstream-memory.db');
Drop-Folder Daemon
Watches an ./import/ folder. Drop any .db file in — it auto-merges into the main database. Debounced 1.5s to handle slow file copies. Processes files already in the folder on startup. Failed merges move to import/error/, successful merges move to import/done/.
Wire-in
try{const _iw=require2('./vektor-import-watch');_iw.startImportWatcher().catch(function(){});} catch(_){}
.db file into the ./import/ folder at any time — while the agent is running or offline. The daemon picks it up on startup if dropped while offline.
Environment Variables
| Variable | Default | Description |
|---|---|---|
| VEKTOR_IMPORT_DIR | ./import | Watched folder path |
| VEKTOR_IMPORT_TARGET_DB | ./slipstream-memory.db | Target DB to merge into |
DB Merge Engine
Core merge engine used by the drop-folder daemon. Merges memories from any source .db file into the target using content-hash dedup. Dangling edges are guarded. Processed files auto-move to import/done/.
CLI
node vektor-db-merge.js --folder ./import --target ./slipstream-memory.db
Programmatic
const { mergeDb } = require('./vektor-db-merge'); const report = await mergeDb({ source: './import/old-agent.db', target: './slipstream-memory.db', }); // → { merged: 142, skipped: 18, total: 160 }
Namespace Isolation
Manages per-project or per-user SQLite DB files under a namespaces/ directory. Routes remember() to the active namespace. recall() targets the active namespace by default, or queries all namespaces simultaneously with the /cross prefix.
Wire-in
try{ const _ns=require2('./vektor-namespace'); await _ns.initNamespaces(memRef,{push,getMemory}); }catch(_){}
Switching Namespaces
// Switch at runtime (e.g. from /ns chat command) await _ns.setActiveNamespace('trading', memRef); // Cross-namespace recall — queries ALL namespaces simultaneously const results = await memory.recall('/cross your query');
Environment Variables
| Variable | Default | Description |
|---|---|---|
| VEKTOR_NAMESPACE | default | Active namespace name |
| VEKTOR_NAMESPACE_DIR | ./namespaces | Path to namespaces folder |
| VEKTOR_NS_CROSS_RECALL_LIMIT | 5 | Results per namespace on cross-query |
| VEKTOR_NAMESPACE_ENABLED | true | Set to false to disable |
CLI
node vektor-namespace.js list node vektor-namespace.js create research node vektor-namespace.js stats node vektor-namespace.js query research "your query" node vektor-namespace.js merge trading default
MAGMA Causal Diff
When merging imported DBs, reconstructs the causal lineage — detecting which memories evolved from which across DBs. Preserves the why a memory changed, not just deduplicates content. Three conflict resolution strategies: importance-wins, newest-wins, and llm-arbitrate.
Wire-in (registers as global, called by import-watch)
try{const _mg=require2('./vektor-magma-diff');globalThis.__magmaDiff=_mg;} catch(_){} // In vektor-import-watch.js, after merge completes: if(globalThis.__magmaDiff){ await globalThis.__magmaDiff.magmaMerge(srcPath, targetPath, { push, callLLM }); }
Conflict Resolution Strategies
| Strategy | Description |
|---|---|
| importance-wins | Higher importance score takes precedence |
| newest-wins | Most recently updated memory wins (default fallback) |
| llm-arbitrate | LLM compares both memories and picks the winner. Times out after 8s and falls back to newest-wins |
Environment Variables
| Variable | Default | Description |
|---|---|---|
| MAGMA_RESOLVE_STRATEGY | newest-wins | Conflict resolution strategy |
| MAGMA_LLM_TIMEOUT_MS | 8000 | LLM arbitration timeout (ms) |
What gets written to the DB
| Table | Description |
|---|---|
| magma_edges | Causal edges between memories (source → derived) |
| magma_lineage | Full provenance chain per memory |
| magma_diff_log | Audit log of every merge decision |
better-sqlite3 and sql.js (required for Claude DXT). Auto-detects Electron context and skips native binary if running inside the DXT sandbox.