From dd291961b6d1b629a9446cae83b04218db1b56f4 Mon Sep 17 00:00:00 2001 From: Hermes Bot Date: Tue, 11 Aug 2026 22:44:37 -0400 Subject: [PATCH] livesync-bridge: run as a one-way CouchDB->disk materializer (CHOKIDAR_USEPOLLING=0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bridge exists to feed the AI stack: CouchDB -> notes/ files so rag-ingestion (qdrant) + the memory-vault MCP can read the vault. That direction is network-driven and free. The reverse (disk -> CouchDB) needs a file watcher, but 9p bind mounts emit no inotify events, so catching host/AI disk writes requires chokidar POLLING every file every few seconds — on this ~5,260-file vault that stats ~100k files/min and pegs a core continuously (~128% CPU idle, aggressive fan), even when nothing changes. The AI-RAG use case never needs disk -> CouchDB (humans edit on devices, which sync to CouchDB over the network; device -> CouchDB -> file materialization is unaffected). So default to polling OFF: chokidar sits on inotify, gets no events on 9p, ~0 idle CPU, while CouchDB -> disk keeps working. Validated: idle CPU ~128% -> ~0%, mirror holds at 5,260 files, rag-ingestion keeps ingesting. Set CHOKIDAR_USEPOLLING=1 (INTERVAL now 15s, a saner large-vault default than 3s) only if you edit notes directly on the host FS and need those pushed back up to CouchDB. Co-Authored-By: Claude Opus 4.8 --- services/obsidian-livesync/plugin.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/services/obsidian-livesync/plugin.yaml b/services/obsidian-livesync/plugin.yaml index 9a15d39..c379d4f 100644 --- a/services/obsidian-livesync/plugin.yaml +++ b/services/obsidian-livesync/plugin.yaml @@ -59,12 +59,18 @@ services: image: ordo/livesync-bridge:latest wants_secrets: true env: - # Docker Desktop bind mounts don't emit inotify events, so the bridge's file watcher can't see - # host/AI writes to notes/ live (same limitation rag-ingestion handles with a poll). Chokidar - # polling detects them — validated: an AI/host-written note reaches CouchDB in ~3s. The reverse - # direction (device -> CouchDB -> file) is network-driven and always live. - CHOKIDAR_USEPOLLING: "1" - CHOKIDAR_INTERVAL: "3000" + # ONE-WAY materializer. The bridge's job here is CouchDB -> notes/ files (network-driven, + # always live) so the AI stack (rag-ingestion + memory-vault MCP) can read the vault. The + # REVERSE direction (disk -> CouchDB) needs a file WATCHER, but 9p bind mounts emit no inotify + # events, so the only way to catch host/AI disk writes is chokidar POLLING every file every few + # seconds — on a multi-thousand-file vault that stats ~100k files/min and pegs a core forever + # (~128% CPU idle). The AI-RAG use case never needs disk -> CouchDB (humans edit on devices, + # which sync to CouchDB over the network), so polling is OFF: chokidar sits on inotify and gets + # no events on 9p → ~0 idle CPU, while CouchDB -> disk keeps working. Set USEPOLLING="1" ONLY + # if you edit notes directly on the host filesystem and need those pushed back up to CouchDB + # (INTERVAL is then the poll period; 15s balances CPU vs sync latency on a large vault). + CHOKIDAR_USEPOLLING: "0" + CHOKIDAR_INTERVAL: "15000" volumes: # The vault's notes/ subfolder <-> the bridge's storage root. Same MEMORY_VAULT_PATH the # memory-vault MCP (RW) and rag-ingestion (RO) mount, so notes land in the ONE shared vault