Skip to content

grepai watch

grepai watch

Start the real-time file watcher daemon

Synopsis

Start a background process that monitors file changes and maintains the index.

The watcher will:

  • Perform an initial scan comparing disk state with existing index
  • Remove obsolete entries and index new files
  • Monitor filesystem events (create, modify, delete, rename)
  • Apply debouncing (500ms) to batch rapid changes
  • Handle atomic updates to avoid duplicate vectors

Background mode: grepai watch —background Run in background with default log directory grepai watch —background —log-dir /custom/path Run with custom log directory grepai watch —status Check if background watcher is running grepai watch —stop Stop the background watcher

Default log directories: Linux: ~/.local/state/grepai/logs/grepai-watch.log (or $XDG_STATE_HOME) macOS: ~/Library/Logs/grepai/grepai-watch.log Windows: %LOCALAPPDATA%\grepai\logs\grepai-watch.log

Log management: Logs are not rotated automatically. To prevent disk usage growth, periodically truncate or archive the log file: echo "" > ~/Library/Logs/grepai/grepai-watch.log (macOS example) Or set up logrotate (Linux) / Newsyslog (macOS) for automatic rotation.

grepai watch [flags]

Options

--background Run in background mode
-h, --help help for watch
--log-dir string Directory for log files (default: OS-specific)
--status Show background watcher status
--stop Stop the background watcher

SEE ALSO

  • grepai - Semantic code search CLI
Auto generated by spf13/cobra on 16-Jan-2026