Skip to content

File Watcher

obsidian_palace.search.watcher

File watcher for re-indexing vault changes into MemPalace.

Uses watchfiles to monitor the vault directory for markdown file changes and triggers incremental re-indexing into the ChromaDB index. Handles file creation, modification, and deletion events.

logger = logging.getLogger(__name__) module-attribute

watch_vault() -> None async

Watch the vault directory for file changes and re-index.

Runs as a background task during the application lifecycle. Monitors for .md file creates, modifications, and deletions. Uses watchfiles.awatch for efficient async filesystem monitoring.

On create/modify: re-indexes the file via MemPalace (mtime-aware, so unchanged files are skipped). On delete: removes the file's drawers from the ChromaDB index.