Hi Clawdbot team, On macOS (snizServer), the clawdbot memory CLI subcommands appear to complete their work but then never exit: - clawdbot memory status --json prints valid JSON quickly, but the process stays running indefinitely. - clawdbot memory index prints “Memory index updated.” but doesn’t exit. - clawdbot memory search --json "" produces no output and hangs (20–40s+). This doesn’t look like a “dirty flag” semantics issue; it’s process lifecycle / open-handle behavior. What we observed while debugging: - No lingering network connections: lsof -p -a -i shows no TCP/UDP sockets. - The stuck process shows multiple KQUEUE file descriptors via lsof -p . - sample shows the main thread sitting in uv__io_poll → kevent, which is the classic signature of a persistent filesystem watcher (kqueue/fsevents/chokidar/FSWatcher) keeping the Node event loop alive. We tested disabling memory watcher via config (agents.defaults.memorySearch.sync.watch=false): - It made memory status --json exit cleanly in one run, - but memory index and memory search still timed out/hung, so there may be additional watch/persistent handles started in those paths. Hypothesis / likely root cause: - A filesystem watcher is started during memory manager initialization or indexing/search flows and is not being closed (or is created as persistent), so one-shot CLI commands never terminate. Suggested fixes: 1. Don’t start watchers/interval timers in “one-shot CLI” contexts (only in long-running gateway/daemon mode). 2. Ensure any watcher/timer is non-blocking for CLI: - chokidar: persistent: false and/or reliably await watcher.close() - FSWatcher: .unref() or persistent: false 3. As a last resort: explicitly process.exit(0) after printing final output for memory status / CLI completion. Happy to provide additional artifacts if helpful (stdout, /tmp/clawdbot/clawdbot-YYYY-MM-DD.log, and a sample trace), but we’re avoiding sharing vault content/snippets for privacy. Thanks! — Brian