livesync-bridge: run as one-way CouchDB→disk materializer (kill idle polling CPU) - #175
Merged
Merged
Conversation
…R_USEPOLLING=0) 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 <noreply@anthropic.com>
AlienWalker1995
added a commit
that referenced
this pull request
Aug 12, 2026
…rite workflow) (#176) PR #175 defaulted the bridge to one-way (CouchDB->disk only) for a pure-RAG read use case. But agents (Hermes/Claude) and host edits write docs INTO notes/ and need them to flow UP to CouchDB -> devices, which one-way disabled. Restore bidirectional, but at a 60s poll interval instead of the original 3s: polling stats every file each tick, so 3s on a ~5k-file vault pegged a core (~128% CPU), while 60s keeps the write workflow (updates reach CouchDB within a minute) at ~6% CPU. Validated: a file written into notes/ reached CouchDB within the poll window; idle CPU is a fraction of the 3s figure. Set USEPOLLING=0 for a read-only mirror at ~0 CPU if nothing writes to notes/ host-side. Co-authored-by: Hermes Bot <hermes@ordo-ai-stack.local> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
livesync-bridgesat at ~128% CPU continuously (aggressive fan), even with nothing changing. Cause: the bridge watches thenotes/folder to push host/AI disk edits back up to CouchDB, but 9p bind mounts emit no inotify events, so the only way to catch disk writes isCHOKIDAR_USEPOLLING=1— chokidarstat()s every file every 3s. On this ~5,260-file vault that's ~100k stat calls/minute over the slow Windows↔VM boundary, pinning a core forever.Fix
Default the bridge to a one-way CouchDB→disk materializer (
CHOKIDAR_USEPOLLING=0):notes/promptly, sorag-ingestion→ qdrant and the memory-vault MCP keep seeing your notes.CHOKIDAR_INTERVALbumped 3s → 15s as a saner large-vault default for anyone who re-enables polling.Validated
rag-ingestioncontinues embedding notes into the qdrantdocumentscollection (1,883 vectors).Re-enable bidirectional
Set
CHOKIDAR_USEPOLLING=1(INTERVAL controls the poll period) only if you edit notes directly on the host FS and need those pushed back up to CouchDB.🤖 Generated with Claude Code