grepai-watch-daemon
Skill20 starsChanged 34 days agoMITView on GitHub
Configure and manage the GrepAI watch daemon. Use this skill for real-time code indexing and file monitoring.
In this repository26 other files it gives its agents.
- grepai-languagesSkill
- grepai-troubleshootingSkill
- grepai-workspacesSkill
- grepai-config-referenceSkill
- grepai-ignore-patternsSkill
- grepai-initSkill
- grepai-embeddings-lmstudioSkill
- grepai-embeddings-ollamaSkill
- grepai-embeddings-openaiSkill
- grepai-installationSkill
- grepai-ollama-setupSkill
- grepai-quickstartSkill
- grepai-chunkingSkill
- grepai-mcp-claudeSkill
- grepai-mcp-cursorSkill
- grepai-mcp-toolsSkill
- grepai-search-advancedSkill
- grepai-search-basicsSkill
- grepai-search-boostingSkill
- grepai-search-tipsSkill
- grepai-storage-gobSkill
- grepai-storage-postgresSkill
- grepai-storage-qdrantSkill
- grepai-trace-calleesSkill
- grepai-trace-callersSkill
- grepai-trace-graphSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Scans: all source files in your project
- Distinctive: line 116
When you save a file, editors often write multiple times quickly.
- Distinctive: line 130
Not in ignore patterns (node_modules, .git, etc.)
- Distinctive: line 154
After initial indexing, the daemon watches for:
- Very specific: line 260
After grepai watch --stop, an empty *.pid.lock file stays in the log directory.
- Distinctive: line 262
Run separate daemons for each project:
- Distinctive: line 316
Use OpenAI for faster cloud embeddings
- Distinctive: line 317
Add more ignore patterns
- Distinctive: line 332
Check inotify limits (Linux):
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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:
- Scans all source files in your project
- Chunks code into segments (~512 tokens)
- Generates embeddings via your configured provider
- Stores vectors in your configured backend
- Monitors for file changes in real-time
- Updates the index when files change
Basic Usage
Start Watching (Foreground)
cd /your/project
grepai watchOutput:
🔍 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
grepai watch --backgroundOutput:
🔍 GrepAI Watch (background)
Daemon started with PID 12345
Log file: ~/.grepai/daemon.logCheck Daemon Status
grepai watch --statusOutput:
✅ 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 agoStop the Daemon
grepai watch --stopOutput:
✅ 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
# .grepai/config.yaml
watch:
# Debounce delay in milliseconds
# Groups rapid file changes together
debounce_ms: 500Debounce 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 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>
<string>watch</string>
</array>
<key>WorkingDirectory</key>
<string>/path/to/your/project</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>Load:
launchctl load ~/Library/LaunchAgents/com.grepai.watch.plistLinux (systemd)
Create ~/.config/systemd/user/grepai-watch.service:
[Unit]
Description=GrepAI Watch Daemon
After=network.target
[Service]
Type=simple
WorkingDirectory=/path/to/your/project
ExecStart=/usr/local/bin/grepai watch
Restart=always
[Install]
WantedBy=default.targetEnable:
systemctl --user enable grepai-watch
systemctl --user start grepai-watchChecking Logs
Background daemons write their logs, PID files and PID locks to the log directory:
| OS | Log directory |
| macOS | ~/Library/Logs/grepai/ |
| Linux | $XDG_STATE_HOME/grepai/logs/ (default ~/.local/state/grepai/logs/) |
| Windows | %LOCALAPPDATA%\grepai\logs\ |
# Background daemon logs (macOS)
tail -f ~/Library/Logs/grepai/*.log
# Or with systemd
journalctl --user -u grepai-watch -fMultiple Projects
One Daemon Per Project
Only one watch daemon can run per project or git worktree: the daemon holds its PID lock for its whole lifetime, so a second grepai watch on the same project fails with watcher is already running (PID ...) (or another grepai watch process is starting (lock held) when two starts race). Search, trace and MCP processes are not affected and can run alongside the daemon.
After grepai watch --stop, an empty *.pid.lock file stays in the log directory. This is expected; it is reused by the next daemon.
Run separate daemons for each project:
# Terminal 1: Project A
cd /path/to/project-a
grepai watch --background
# Terminal 2: Project B
cd /path/to/project-b
grepai watch --backgroundUsing Workspaces
For multi-project setups:
grepai workspace create my-workspace
grepai workspace add my-workspace /path/to/project-a
grepai workspace add my-workspace /path/to/project-b
grepai watch --workspace my-workspaceTroubleshooting
Daemon Won't Start
❌ Problem: "Another daemon is already running" ✅ Solution:
grepai watch --stop
grepai watch --background❌ Problem: "Config not found" ✅ Solution: Initialize first:
grepai init
grepai watch❌ Problem: "Embedder connection failed" ✅ Solution: Start your embedding provider:
ollama serve # For OllamaIndexing Issues
❌ Problem: Files not being indexed ✅ Solution: Check ignore patterns in config, ensure file extension is supported
❌ Problem: Indexing very slow ✅ Solutions:
- Use OpenAI for faster cloud embeddings
- Add more ignore patterns
- Increase chunking size
❌ Problem: Index seems outdated ✅ Solution: Clear and reindex:
rm .grepai/index.gob
grepai watchFile Watch Issues
❌ Problem: Changes not detected ✅ Solutions:
- Reduce debounce_ms
- Check inotify limits (Linux):
echo 65536 | sudo tee /proc/sys/fs/inotify/max_user_watches
Best Practices
- Run in background: For continuous monitoring
- Use workspace for monorepos: Better organization
- Set up auto-start: launchd or systemd
- Check logs periodically: Monitor for errors
- Reindex after config changes: Especially after changing embedding model
Status Check
Regular health check:
grepai statusOutput:
✅ GrepAI Status
Project: /path/to/project
Config: .grepai/config.yaml
Embedder: Ollama (nomic-embed-text)
Storage: GOB (.grepai/index.gob)
Index:
- Files: 245
- Chunks: 1,234
- Size: 12.5 MB
- Last updated: 2025-01-28 10:30:00
Daemon: Running (PID 12345)Output Format
Watch daemon status:
✅ Watch Daemon Active
Mode: Background
PID: 12345
Project: /path/to/project
Initial Index:
- Files scanned: 245
- Chunks created: 1,234
- Duration: 45s
Real-time Monitor:
- Debounce: 500ms
- Events processed: 23
- Last event: 5 minutes ago
Next steps:
- Run 'grepai search "query"' to search
- Run 'grepai watch --status' to check status
- Run 'grepai watch --stop' to stop daemonDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

