The current database tools place an unnecessary burden on the agent to manage process lifecycle and do not clearly distinguish between managed and external instances.
Requirements:
Auto-Cleanup (Code):
- Update
DatabaseLifecycleService.mjs in both the Memory Core (ai/mcp/server/memory-core) and Knowledge Base (ai/mcp/server/knowledge-base) servers.
- Add process listeners (
SIGINT, SIGTERM, exit) to automatically kill this.chromaProcess if and only if it exists (i.e., this server is the owner).
- Ensure "client-only" mode (connecting to external DB) remains unaffected by these listeners.
Tool Repositioning (Docs):
- Update
openapi.yaml for both Memory Core and Knowledge Base servers.
stop_database: Mark as a debug/maintenance tool. Clarify that manual invocation is rarely needed due to auto-cleanup, and that it has no effect on external databases.
start_database: Clarify "connect or start" behavior.
- Guidance: Add a note advising that for multi-agent workflows, an externally managed database (via
npm run ai:server-memory) prevents unexpected disconnects when the "owner" agent exits.
Goal: Agents should no longer feel compelled to call stop_database at the end of a session, and "zombie" processes should be prevented for managed instances.
The current database tools place an unnecessary burden on the agent to manage process lifecycle and do not clearly distinguish between managed and external instances.
Requirements:
Auto-Cleanup (Code):
DatabaseLifecycleService.mjsin both the Memory Core (ai/mcp/server/memory-core) and Knowledge Base (ai/mcp/server/knowledge-base) servers.SIGINT,SIGTERM,exit) to automatically killthis.chromaProcessif and only if it exists (i.e., this server is the owner).Tool Repositioning (Docs):
openapi.yamlfor both Memory Core and Knowledge Base servers.stop_database: Mark as a debug/maintenance tool. Clarify that manual invocation is rarely needed due to auto-cleanup, and that it has no effect on external databases.start_database: Clarify "connect or start" behavior.npm run ai:server-memory) prevents unexpected disconnects when the "owner" agent exits.Goal: Agents should no longer feel compelled to call
stop_databaseat the end of a session, and "zombie" processes should be prevented for managed instances.