#3364: refactor(memory): extract vector management to dedicated module
Cluster:
Memory Management Enhancements
- Extract sqlite-vec loading and vector table lifecycle to VectorManager class
- Move ~70 lines of vector logic from manager.ts to vector/vector-manager.ts
- manager.ts delegates vector operations to VectorManager instance
- Zero breaking changes to public API
- All existing tests should pass
Part of memory modularization effort to reduce manager.ts complexity (2179 → 2107 lines)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR refactors memory vector support by extracting sqlite-vec extension loading and vector table lifecycle into a new `VectorManager` (`src/memory/vector/vector-manager.ts`). `MemoryIndexManager` (`src/memory/manager.ts`) now delegates vector readiness/state and table resets to this module, reducing `manager.ts` complexity without changing the public API.
Main integration points are `ensureVectorReady()`/`probeVectorAvailability()` and reindex/compaction paths where the DB handle is swapped and vector state is reinitialized.
<h3>Confidence Score: 3/5</h3>
- This PR is likely safe to merge after fixing one error-path state restoration issue.
- The refactor is largely a mechanical extraction into `VectorManager`, and most call sites delegate cleanly. However, in the reindex/compaction error path the `VectorManager` is not recreated when restoring the original DB, which can leave the instance bound to a closed temp database and break subsequent vector operations. Addressing that should bring this back to low risk.
- src/memory/manager.ts (runSafeReindex restore path)
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#18595: feat: native PostgreSQL + pgvector memory backend
by IrriVisionTechnologies · 2026-02-16
72.7%
#4231: fix(memory): use sqlite-vec knn (MATCH+k) for vector search
by leonardsellem · 2026-01-29
72.5%
#4386: fix(memory): persist dirty flag to prevent false positive on status
by Iamadig · 2026-01-30
72.0%
#11258: feat(memory): Add Qdrant Vector Database Provider
by hleliofficiel · 2026-02-07
70.9%
#19920: fix(memory): populate FTS index in FTS-only mode so search returns ...
by forketyfork · 2026-02-18
70.0%
#12596: fix(status): show third-party memory plugins as active instead of u...
by nhadaututtheky · 2026-02-09
69.9%
#20378: refactor: add best-effort comments to empty catch blocks
by Matrix-Meta · 2026-02-18
69.4%
#14073: [wip]support OpenViking Memory Plugin
by Mijamind719 · 2026-02-11
69.4%
#11179: fix(memory): replace confusing "No API key" errors in memory tools ...
by liuxiaopai-ai · 2026-02-07
69.2%
#20882: fix(memory): add gpu config option for local embeddings and surface...
by irchelper · 2026-02-19
69.1%