NIIA Watcher Daemon
The NIIA Watcher daemon monitors file system changes with intelligent filtering and event batching, providing real-time updates to the Monolex application.Overview
Features
Intelligent Filtering
Pre-configured ignore patterns:.git/directoriesnode_modules/- Build artifacts (
target/,dist/,build/) - Temporary files (
*.tmp,*.swp) - OS files (
.DS_Store,Thumbs.db)
Event Batching
Debounces rapid file changes:Cross-Platform Support
| Platform | Backend |
|---|---|
| macOS | FSEvents |
| Linux | inotify |
| Windows | ReadDirectoryChangesW |
Events
Event Types
Event Format
JSON over Unix socket:Configuration
Watch Paths
Ignore Patterns
Default patterns:Usage
Starting the Watcher
Listening to Events
Database Integration
Watcher events are persisted to SQLite:~/Library/Application Support/Monolex/protocols/niia/database/niia-watcher.db
Characteristics
| Metric | Value |
|---|---|
| Binary size | 2.75MB |
| Memory usage | Low |
| Event latency | Fast |
| Watched paths | Scalable |
| Throughput | High |
Logging
Troubleshooting
Watcher Not Starting
Events Not Firing
- Check if path is being watched
- Verify path isn’t ignored by filters
- Check event batching delay
- Review watcher logs
High CPU Usage
Usually caused by:- Watching too many files
- Rapid file changes (reduce debounce time)
- Recursive watch on large directories
SMPC/OFAC Applied
| Principle | Application |
|---|---|
| SMPC | Single purpose: file watching only |
| Simple event types: create/modify/delete/rename | |
| Clear ignore patterns | |
| OFAC | Batching emerged from event storm handling |
| Filtering emerged from noise reduction need | |
| Database storage emerged from persistence need |