Watch Daemon
Background process that keeps your context warm without any manual commands.
Starting the Watcher
$contxt watch# Foreground mode (Ctrl+C to stop)$contxt watch --daemon# Background daemon$contxt watch:stop# Stop the daemon$contxt watch:status# Check if running
What It Monitors
Updates context.files with a 30-second debounce to avoid noise during active editing sessions. Respects .contxtignore and .gitignore.
Automatically runs contxt rules sync whenever the file is saved. Edit the markdown file in your IDE and memory updates within seconds.
Detects branch switches and updates the active memory branch to match. Complements the post-checkout hook for teams who prefer not to install git hooks.
Tracks work sessions with a 30-minute inactivity timeout. Session data informs context summaries and the pre-push hook report.
When a file containing Contxt annotations is modified, runs an incremental re-scan of just that file — not the entire project. New or changed tags become drafts immediately.
Foreground Output
When running in foreground mode, the watcher prints a live activity log with timestamps and event types:
contxt watch — monitoring my-app (main)14:32filessrc/api/billing.ts, src/lib/stripe.ts14:35scan+DECISION "Use Stripe Connect" (draft)14:52contextsession active — 20 min, 4 files15:22sessionended — 50 min, 6 files touched15:22rulesrules.md changed — syncing 2 updates
Daemon Mode
When started with --daemon, the watcher detaches from your terminal and runs as a background process. Its state is tracked via two files:
.contxt/.watch.pidContains the process ID of the running daemon. Deleted automatically when the daemon stops cleanly.
.contxt/watch.logRolling log of all watcher events. Rotated at 5MB. Review with
tail -f .contxt/watch.log.
Resource Usage
The watcher is designed to be invisible in the background:
- Memory: under 50MB RAM
- Polling: native OS file events via chokidar (1s fallback)
- Ignored automatically:
node_modules,dist,build, and.contxtignorepatterns