Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

watch

Watch for file changes and re-index continuously in the background.

Synopsis

bobbin watch [OPTIONS] [PATH]

Description

The watch command starts a long-running process that monitors the filesystem for changes and incrementally re-indexes modified files. It uses OS-native file notification (inotify on Linux, FSEvents on macOS) with configurable debouncing to batch rapid changes.

The watcher:

  • Creates/modifies — re-parses, re-embeds, and upserts chunks for changed files.
  • Deletes — removes chunks for deleted files from the vector store.
  • Skips.git/ and .bobbin/ directories are always excluded. Additional include/exclude patterns come from bobbin.toml.
  • Deduplicates — files whose content hash hasn’t changed are skipped.

The process responds to Ctrl+C and SIGTERM for clean shutdown.

Arguments

ArgumentDefaultDescription
[PATH].Directory containing .bobbin/ config

Options

OptionDefaultDescription
--repo <NAME>Repository name for multi-repo indexing
--source <DIR>same as PATHSource directory to watch (if different from config dir)
--debounce-ms <MS>500Debounce interval in milliseconds
--pid-file <FILE>Write PID to this file for daemon management
--generate-systemdPrint a systemd service unit to stdout and exit

Examples

Watch the current directory:

bobbin watch

Watch with a shorter debounce for fast feedback:

bobbin watch --debounce-ms 200

Multi-repo setup — watch a separate source directory:

bobbin watch --repo frontend --source ../frontend-app

Write a PID file for daemon management:

bobbin watch --pid-file /tmp/bobbin-watch.pid &

Generate a systemd user service:

bobbin watch --generate-systemd > ~/.config/systemd/user/bobbin-watch.service
systemctl --user enable --now bobbin-watch

Systemd Integration

The --generate-systemd flag prints a ready-to-use systemd service unit. The generated unit:

  • Uses Type=simple with automatic restart on failure.
  • Sets RestartSec=5 and RUST_LOG=info.
  • Includes the resolved working directory and any --repo/--source flags.

Prerequisites

Requires a bobbin index. Run bobbin init and bobbin index first to create the initial index, then use watch to keep it up to date.

See Also