workspace-watch
workspace-watch demonstrates github.com/tmc/apple/x/fswatch,
a zero-cgo Darwin FSEvents wrapper with event coalescing, debouncing, typed
event flags, and gitignore-style path filtering for live RAG re-indexing,
coding-agent workspace triggers, and Metal shader hot-reload.
Running
Self-contained demo (default when no directories are passed):
CGO_ENABLED=0 go run ./examples/coreservices/workspace-watch -demo
Watch one or more directories live:
CGO_ENABLED=0 go run ./examples/coreservices/workspace-watch -latency 15ms -debounce 150ms .
Measured output
Measured on Apple M4 Max, macOS 26.6.2 (CGO_ENABLED=0 go run ./examples/coreservices/workspace-watch -demo):
workspace-watch demo
workspace: /private/var/folders/.../T/workspace-watch-demo-...
options: latency=15ms debounce=150ms ignoreDotGit=true ignore=[build/ node_modules/ *.tmp]
[burst] Created|IsDir kernels
[burst] Created|Modified|Renamed|IsFile src/agent.go
[burst] Removed|Renamed|IsFile src/agent_v2.go
[coalesce] Created|Modified|IsFile kernels/attention.metal
summary:
ignored writes filtered: 4/4 (leaked=0)
rapid edits coalesced: 10 writes -> 1 delivered event(s)
delivery latency (12 samples): min=2.98ms p50=12.81ms p95=84.40ms max=84.40ms
Verification
CGO_ENABLED=0 go vet ./x/fswatch ./examples/coreservices/workspace-watch
CGO_ENABLED=0 go test -v -count=1 ./x/fswatch ./examples/coreservices/workspace-watch
go test -race -v -count=1 ./x/fswatch ./examples/coreservices/workspace-watch