LearnNewsExamplesServices
Frontmatter
id8489
titleRefactor defragKnowledgeBase to generic defragChromaDB tool
stateClosed
labels
enhancementaibuild
assigneestobiu
createdAtJan 10, 2026, 1:14 AM
updatedAtJan 10, 2026, 1:38 AM
githubUrlhttps://github.com/neomjs/neo/issues/8489
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 10, 2026, 1:38 AM

Refactor defragKnowledgeBase to generic defragChromaDB tool

Closed v11.20.0 enhancementaibuild
tobiu
tobiu commented on Jan 10, 2026, 1:14 AM

Refactor buildScripts/defragKnowledgeBase.mjs into a generic CLI tool buildScripts/defragChromaDB.mjs using commander.

Goals:

  • Rename the script to reflect its generic nature.
  • Use commander to parse CLI arguments (e.g., --target <name>).
  • Support targets: 'knowledge-base' and 'memory-core'.
  • Dynamically load the appropriate config file (ai/mcp/server/.../config.mjs) to determine DB path, port, and collection names.
  • Implement specific logic for memory-core to handle multiple collections (neo-agent-memory, neo-agent-sessions) safely.
  • Implement a mandatory Backup Step before modifying the Memory Core database.
  • Update package.json scripts:
    • ai:defrag-kb -> node buildScripts/defragChromaDB.mjs --target knowledge-base
    • Add ai:defrag-memory -> node buildScripts/defragChromaDB.mjs --target memory-core
  • Update references in buildScripts/uploadKnowledgeBase.mjs.
tobiu added the enhancement label on Jan 10, 2026, 1:14 AM
tobiu added the ai label on Jan 10, 2026, 1:14 AM
tobiu added the build label on Jan 10, 2026, 1:14 AM
tobiu referenced in commit 2305737 - "feat: Refactor defrag script to generic defragChromaDB tool (#8489)" on Jan 10, 2026, 1:37 AM
tobiu assigned to @tobiu on Jan 10, 2026, 1:37 AM
tobiu
tobiu Jan 10, 2026, 1:37 AM

Input from Gemini 3 Pro:

✦ I have successfully refactored the defragmentation script into a generic CLI tool.

Changes:

  • Refactored buildScripts/defragKnowledgeBase.mjs into buildScripts/defragChromaDB.mjs.
  • Implemented commander for CLI argument parsing (--target).
  • Added support for both knowledge-base and memory-core targets by dynamically loading their config files.
  • Implemented a mandatory Backup Step before any destructive operations.
  • Updated package.json scripts:
    • ai:defrag-kb now calls the new tool with --target knowledge-base.
    • Added ai:defrag-memory calling the new tool with --target memory-core.
  • Updated JSDoc references in buildScripts/uploadKnowledgeBase.mjs.
tobiu closed this issue on Jan 10, 2026, 1:38 AM