-
-
Notifications
You must be signed in to change notification settings - Fork 1
Coco Watch
coco watch monitors your working tree for changes and re-runs a configured generation task (review, commit draft, or both) on each debounced save. It acts as a background reviewer that flags issues as you code, or as a live commit-message preview while staging.
# Default: continuous code review on every settled change set
coco watch
# Keep a commit-message draft current as you stage
coco watch --draft
# Run both review and draft on every settle
coco watch --review --draft
# Only watch staged changes (not the full working tree)
coco watch --staged
# Run one pass and exit (useful in scripts/CI)
coco watch --once-
coco watchstarts a filesystem watcher on the repository root (or just the index when--stagedis set). - When files change, a debounce timer starts (default 500ms). Rapid successive edits coalesce into a single "settled" event.
- On settle, the watcher computes a content digest of the current diff. If the digest matches the last successful run, the LLM call is skipped entirely (no cost incurred for touch-saves or formatting-only changes).
- When the diff has actually changed, the configured operation(s) run against the current change set.
- Results print to stdout. With
--json, each state transition emits a newline-delimited JSON event for editor integration.
| Flag | Default | Description |
|---|---|---|
--review |
true (when neither flag given) |
Re-run a code review each time the change set settles |
--draft |
false |
Keep a commit-message draft current as you stage |
--staged |
false |
Watch staged changes only (git diff --cached) instead of the full working tree |
--conventional |
false |
Constrain --draft output to Conventional Commits |
--language <lang> |
config value | Write output in this language |
--interval <ms> |
15000 |
Minimum milliseconds between LLM calls (cost control) |
--debounce <ms> |
500 |
Milliseconds to wait after the last fs event before treating the change set as settled |
--once |
false |
Run a single pass immediately and exit |
--json |
false |
Emit line-delimited JSON events (one per state change) |
The --interval flag (default 15 seconds) sets an absolute floor on how frequently LLM calls fire, regardless of how often you save. Combined with the content-digest guard (unchanged diffs never trigger a call), coco watch stays cost-effective even in rapid-iteration sessions.
For tighter control, set a budget via telemetry.budget.monthlyUsd in your config and coco doctor --cost will warn when you approach your cap.
With --json, each state transition emits a JSON object on stdout:
Event types: ready, idle, skipped, running, result, error, stopped.
Ctrl+C (SIGINT) or SIGTERM stops the watcher cleanly: in-flight LLM calls are cancelled via AbortController, the watcher closes, and a final stopped event emits.
# Background reviewer while developing (default)
coco watch
# Live commit message preview for staged work
coco watch --draft --staged --conventional
# One-shot review of current changes (CI-friendly)
coco watch --once --json
# Long settle for slow-saving editors
coco watch --debounce 2000
# Lower cost ceiling: at most one call per minute
coco watch --interval 60000- Command Reference — full flag listing
-
Config Overview —
telemetry.budgetandservicesettings
{"type":"ready","repoRoot":"/path/to/repo","operations":["review"],"scope":"worktree"} {"type":"running","operation":"review"} {"type":"result","operation":"review","data":{...},"warnings":[]} {"type":"skipped","reason":"unchanged","digest":"sha256:abc..."} {"type":"idle"} {"type":"stopped"}