LearnNewsExamplesServices
Frontmatter
id8490
titleHarden and Refactor ChromaDB Defrag Tool
stateClosed
labels
enhancementairefactoringbuild
assigneestobiu
createdAtJan 10, 2026, 1:47 AM
updatedAtJan 10, 2026, 1:59 AM
githubUrlhttps://github.com/neomjs/neo/issues/8490
authortobiu
commentsCount3
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 10, 2026, 1:55 AM

Harden and Refactor ChromaDB Defrag Tool

Closed v11.20.0 enhancementairefactoringbuild
tobiu
tobiu commented on Jan 10, 2026, 1:47 AM

Improve the buildScripts/defragChromaDB.mjs tool to be more robust and enterprise-ready.

Changes:

  1. Centralized Backups: Move backups to dist/chromadb-backups/<target>/ to avoid polluting the root directory.
  2. Automated Cleanup: Implement a retention policy to delete backups older than 7 days, keeping at least the last 3.
  3. Error Handling: Ensure the script exits with a non-zero code if any collection fails to restore, preventing false positives in CI/CD.
  4. Config robustness: Ensure config loading handles missing paths gracefully or enforces a standard.

Goal: Provide a reliable maintenance tool for the AI infrastructure.

tobiu added the enhancement label on Jan 10, 2026, 1:47 AM
tobiu added the ai label on Jan 10, 2026, 1:47 AM
tobiu added the refactoring label on Jan 10, 2026, 1:47 AM
tobiu added the build label on Jan 10, 2026, 1:47 AM
tobiu assigned to @tobiu on Jan 10, 2026, 1:50 AM
tobiu referenced in commit d952600 - "feat: Harden ChromaDB defrag tool with backups and error tracking (#8490)" on Jan 10, 2026, 1:51 AM
tobiu
tobiu Jan 10, 2026, 1:51 AM

Input from tobiu:

◆ Implemented enterprise-grade improvements to the ChromaDB defragmentation tool:

  1. Centralized Backups: Backups are now stored in dist/chromadb-backups/<target>/ to prevent cluttering the root directory.
  2. Retention Policy: Added automated cleanup to keep only the last 3 backups and delete those older than 7 days.
  3. Error Handling: The script now tracks partial failures across collections and exits with a non-zero status code if any errors occur, ensuring better CI/CD integration.
  4. Robustness: Added validation for database paths and configuration loading.

Refactoring complete.

tobiu referenced in commit 36f43ba - "fix: Add missing Neo import to defrag script to support config loading (#8490)" on Jan 10, 2026, 1:54 AM
tobiu
tobiu Jan 10, 2026, 1:54 AM

Input from tobiu:

◆ Added a missing import Neo from '../src/Neo.mjs'; to buildScripts/defragChromaDB.mjs. This was necessary because the configuration files (ai/mcp/server/memory-core/config.mjs) rely on the global Neo namespace and Neo.setupClass, which are not available in a standalone Node.js script unless explicitly imported.

Verified by successfully running npm run ai:defrag-memory.

tobiu added the agent-task:completed label on Jan 10, 2026, 1:55 AM
tobiu
tobiu Jan 10, 2026, 1:55 AM

Input from tobiu:

◆ Task complete. The defragChromaDB.mjs script is now robust, backup-enabled, and verified working. Closing.

tobiu closed this issue on Jan 10, 2026, 1:55 AM
tobiu removed the agent-task:completed label on Jan 10, 2026, 1:59 AM