Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

watchexec

$ watchexec Community Med Risk
watchexec (OSS) · Files & Search · Apache-2.0 · macos / linux / windows

watchexec monitors workspace paths for changes and optionally re-runs commands or emits structured filesystem events via --only-emit-events --emit-events-to=json-stdio. Because watchers run indefinitely by design, agents must run them in bounded background tasks.

FCRS-1.0 Score
84 /100
Good
Medium Confidence
Zero-Friction Install
brew install watchexec
CLI vs MCP Decision CLI Preferred vs MCP

OS-native file watching (kqueue/inotify) runs directly in watchexec without polling or MCP overhead.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
— Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Supports --emit-events-to=json-stdio and --only-emit-events, though it is a long-running daemon by nature.

  • NDJSON event stream via --emit-events-to=json-stdio
Trust & Safety 20 / 25

--only-emit-events is read-only; running commands on file edits can loop or mutate state if poorly scoped.

  • Supports read-only event emission vs command execution
Setup & Portability 13 / 15

Single Rust binary via brew, cargo install watchexec-cli, and GitHub releases.

  • Cross-platform OS watcher (kqueue, inotify, ReadDirectoryChangesW)
Utility & Efficiency 13 / 15

Debounced, .gitignore-aware watching avoids brittle polling loops.

  • Built-in ignore filtering and debouncing
Maintenance & Lineage 9 / 10

Maintained by the watchexec org and powers tools like cargo-watch.

  • Active Apache-2.0 repository
Docs & Verifiability 8 / 10

Detailed man page documenting event JSON schema and ignore rules.

  • Upstream man page and --help

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; watches local filesystem events only.

Side Effects
Read-Only Local Write
Cost & Quotas

100% free, offline, and open-source (Apache-2.0).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# watchexec Agent Rules
- NEVER run `watchexec` synchronously without a timeout or background task—it loops until killed.
- Scope watches with `-w <dir>` and `-e <ext>` so build outputs do not trigger infinite loops.

Agent-Ready Command Recipes

Safe Read-Only Queries

Stream filesystem change events as NDJSON
watchexec --only-emit-events --emit-events-to=json-stdio -w src/

Emits JSON event objects on file modifications without executing any subcommand (run with a timeout/background limit).

Controlled Writes & Previews

Restart test runner on TypeScript file edits
watchexec -r -w src/ -e ts -- npm test

Watches .ts files under src/ and restarts npm test on change.

Strengths for Agents

  • + Emits structured NDJSON filesystem events with --only-emit-events --emit-events-to=json-stdio.
  • + Respects .gitignore out of the box and debounces rapid editor saves.

Caveats & Pitfalls

  • ! Blocks indefinitely unless launched as a bounded background task or stopped explicitly.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI