agentsmesh watch
Watch the .agentsmesh/ directory for changes and automatically regenerate on save. Useful during active editing sessions where you want to see changes reflected immediately in tool-specific directories.
Usage
agentsmesh watch [flags]Flags
| Flag | Description |
|---|---|
--global | Watch ~/.agentsmesh/ and regenerate user-level outputs. |
--targets <csv> | Limit regeneration to specific target IDs. |
Examples
Watch and regenerate for all targets
agentsmesh watchStarts a file watcher. Every time a file in .agentsmesh/ changes, generation runs automatically after a 300ms debounce.
Watch for specific targets only
agentsmesh watch --targets claude-codeagentsmesh watch --targets cursor,gemini-cliWatch home-level global config
agentsmesh watch --global --targets claude-codeOnly regenerates the specified targets on each change. Faster if you only need output for one or two tools.
Debounce behavior
The 300ms debounce batches rapid file saves (e.g., when your editor saves multiple files at once or during a search-and-replace). Only one generation runs per edit session, not one per file save.
Lock file handling
The watch loop ignores its own lock file writes to prevent infinite regeneration cycles. The same behavior applies to ~/.agentsmesh/.lock in global mode.
Stopping the watcher
Press Ctrl+C to stop the watch loop.
Typical workflow
# Terminal 1: start the watcheragentsmesh watch
# Terminal 2: edit canonical filesvi .agentsmesh/rules/security.md# → generation runs automatically in Terminal 1
# When done, commit everythinggit add .agentsmesh/ .claude/ .cursor/git commit -m "update security rules"