
Grepai Watch Daemon
Start and manage the GrepAI watch daemon so your codebase stays semantically indexed in real time while you and your agent search it.
Overview
grepai-watch-daemon is an agent skill for the Build phase that configures and runs GrepAI’s watch daemon for real-time code indexing and file monitoring.
Install
npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-watch-daemonWhat is this skill?
- Foreground `grepai watch` with progress for full-project scan and live change monitoring
- Background mode with PID and log path at ~/.grepai/daemon.log
- `grepai watch --status` for PID, project path, and files/chunks statistics
- Pipeline: scan → ~512-token chunks → embedder → vector backend → incremental updates
- Ctrl+C stops foreground; troubleshooting guidance for indexing failures
- ~512-token chunks per code segment
- Example output: 245 files and 1,234 chunks indexed
Adoption & trust: 493 installs on skills.sh; 17 GitHub stars; 1/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Your agent’s semantic code search is stale or empty because nobody started indexing or kept the vector store in sync with file edits.
Who is it for?
Indie developers who already use GrepAI and want hands-on control over first-time indexing and background monitoring on a single machine.
Skip if: Teams expecting managed cloud indexing, CI-only one-shot indexes without a long-lived daemon, or repos where embedding APIs cannot run locally or over the network.
When should I use this skill?
Starting initial code indexing, setting up real-time file monitoring, running the daemon in background, or troubleshooting indexing issues.
What do I get? / Deliverables
A running watch process indexes the project, reports chunk counts, and updates embeddings on change so grepai search stays accurate during development.
- Running watch daemon (foreground or background)
- Updated vector index with chunk statistics from --status
Recommended Skills
Journey fit
Real-time chunking, embedding, and vector storage are dev-time agent infrastructure—installed and run while you build, not after launch. Fits agent-tooling because it powers semantic code search and RAG-style context for coding agents inside the repo.
How it compares
Operational companion to static one-off index scripts—focused on continuous watch semantics rather than ad-hoc grep.
Common Questions / FAQ
Who is grepai-watch-daemon for?
Solo and indie builders using GrepAI with coding agents who need live indexing and daemon lifecycle commands (start, background, status) on their project.
When should I use grepai-watch-daemon?
During Build when starting initial indexing, enabling real-time file monitoring, running the daemon in the background while you code, or troubleshooting indexing that stopped updating.
Is grepai-watch-daemon safe to install?
It instructs shell and filesystem access for scanning and daemon management; review the Security Audits panel on this Prism page before enabling it in sensitive repositories.
Workflow Chain
Requires first: grepai config reference
SKILL.md
READMESKILL.md - Grepai Watch Daemon
# GrepAI Watch Daemon This skill covers the `grepai watch` command and daemon management for real-time code indexing. ## When to Use This Skill - Starting initial code indexing - Setting up real-time file monitoring - Running the daemon in background - Troubleshooting indexing issues ## What the Watch Daemon Does The watch daemon: 1. **Scans** all source files in your project 2. **Chunks** code into segments (~512 tokens) 3. **Generates** embeddings via your configured provider 4. **Stores** vectors in your configured backend 5. **Monitors** for file changes in real-time 6. **Updates** the index when files change ## Basic Usage ### Start Watching (Foreground) ```bash cd /your/project grepai watch ``` Output: ``` 🔍 GrepAI Watch Scanning files... Found 245 files Processing chunks... ████████████████████████████████ 100% Indexed 1,234 chunks Watching for changes... ``` Press `Ctrl+C` to stop. ### Start in Background ```bash grepai watch --background ``` Output: ``` 🔍 GrepAI Watch (background) Daemon started with PID 12345 Log file: ~/.grepai/daemon.log ``` ### Check Daemon Status ```bash grepai watch --status ``` Output: ``` ✅ GrepAI Daemon Running PID: 12345 Started: 2025-01-28 10:30:00 Project: /path/to/project Statistics: - Files indexed: 245 - Chunks: 1,234 - Last update: 2 minutes ago ``` ### Stop the Daemon ```bash grepai watch --stop ``` Output: ``` ✅ Daemon stopped (PID 12345) ``` ## Command Reference | Command | Description | |---------|-------------| | `grepai watch` | Start daemon in foreground | | `grepai watch --background` | Start daemon in background | | `grepai watch --status` | Check daemon status | | `grepai watch --stop` | Stop running daemon | ## Configuration ### Watch Settings ```yaml # .grepai/config.yaml watch: # Debounce delay in milliseconds # Groups rapid file changes together debounce_ms: 500 ``` ### Debounce Explained When you save a file, editors often write multiple times quickly. Debouncing waits for changes to settle: | Value | Behavior | |-------|----------| | `100` | More responsive, more reindexing | | `500` | Balanced (default) | | `1000` | Less responsive, fewer reindexing | ## Initial Indexing ### What Gets Indexed The daemon indexes files: - Matching supported extensions (.go, .js, .ts, .py, etc.) - Not in ignore patterns (node_modules, .git, etc.) - Respecting `.gitignore` ### Indexing Progress Large codebases show progress: ``` Scanning files... Found 10,245 files Processing chunks... ████████████████░░░░░░░░░░░░░░░░ 50% (5,122/10,245) ``` ### Indexing Time Estimates | Codebase | Files | Time (Ollama) | Time (OpenAI) | |----------|-------|---------------|---------------| | Small | 100 | ~30s | ~10s | | Medium | 1,000 | ~5min | ~1min | | Large | 10,000 | ~30min | ~5min | ## Real-Time Monitoring After initial indexing, the daemon watches for: - File creation - File modification - File deletion - File renames ### File Change Detection Uses OS-native file watching: - **macOS:** FSEvents - **Linux:** inotify - **Windows:** ReadDirectoryChangesW ### What Triggers Reindexing | Action | Result | |--------|--------| | Save existing file | Re-embed file chunks | | Create new file | Index new chunks | | Delete file | Remove from index | | Rename file | Update path, keep vectors | ## Background Daemon Management ### Starting on System Boot #### macOS (launchd) Create `~/Library/LaunchAgents/com.grepai.watch.plist`: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.grepai.watch</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/grepai</string> <