Feature Request: Agent Hooks / File Watch
Inspired by
Kiro (AWS) — agent hooks automate follow-up actions like running tests when files are saved
What it does
Watch the workspace for file changes and automatically run commands when files are saved.
Proposed CLI
sin-code watch --on-save "*.go" --run "go test ./..."
sin-code watch --on-save "*.ts" --run "npm test"
sin-code watch --on-save "*.py" --run "pytest"
sin-code watch --stop
Current state
SIN-Code has internal/hooks/ (24 lifecycle events) and internal/hooklife/ (programmatic hooks), but no file-system watcher. The hooks fire on agent lifecycle events (tool.pre, tool.post, verify.pass, etc.), not on external file changes.
Implementation approach
- Use
fsnotify (pure Go, no CGO — M2) for file system watching
- New package
cmd/sin-code/internal/filewatch/
- Pattern matching via
filepath.Match or doublestar
- Run command via
sin_bash (goes through permission engine — M4)
- Debounce: max 1 trigger per 2 seconds (avoid rapid-fire on bulk saves)
- Optional:
--notify for desktop notification on pass/fail
Mandate compliance
- M2: fsnotify is pure Go, no CGO
- M4: Watch-triggered commands go through permission engine
- M7: Race-free — watcher goroutine + command execution mutex
Priority: Medium
Effort: Small
Feature Request: Agent Hooks / File Watch
Inspired by
Kiro (AWS) — agent hooks automate follow-up actions like running tests when files are saved
What it does
Watch the workspace for file changes and automatically run commands when files are saved.
Proposed CLI
Current state
SIN-Code has
internal/hooks/(24 lifecycle events) andinternal/hooklife/(programmatic hooks), but no file-system watcher. The hooks fire on agent lifecycle events (tool.pre, tool.post, verify.pass, etc.), not on external file changes.Implementation approach
fsnotify(pure Go, no CGO — M2) for file system watchingcmd/sin-code/internal/filewatch/filepath.Matchor doublestarsin_bash(goes through permission engine — M4)--notifyfor desktop notification on pass/failMandate compliance
Priority: Medium
Effort: Small