Work in progress. This feature is still under active development, and its
behavior or flags may change.
Automatically regenerate Kiro agent files when your configuration changes, using systemd path units.
This feature is Linux-only. On other platforms, kg watch exits with an error.
Quick start
# Watch the current project directory
kg watch
# Watch a specific path
kg watch /home/user/projects/my-app
# List active watchers
kg watch --list
# Disable a watcher
kg watch --disable
How it works
kg watch manages systemd user path units such as kiro-generator-local@<escaped-path>.path via D-Bus.
When systemd detects changes in your .kiro/generators/ directory, it triggers kg generate automatically.
The path is escaped using the same algorithm as systemd-escape --path.
Environment files
kg init creates environment files that control how systemd-triggered runs behave:
$XDG_CONFIG_HOME/kg/systemd/
├── global.env
└── home.env
global.env applies to all systemd-triggered runs:
KG_FORMAT=plain
KG_DIFF=true
home.env applies to home-directory agent generation:
KG_NOTIFY=true
# KG_DEBUG=true
# KG_FORMAT=plain
# KG_COLOR=auto
# KG_DIFF=true
# KG_FORCE=true
These map to CLI flags via clap environment variables:
| Env Var | CLI Flag |
|---|
KG_DEBUG | --debug |
KG_COLOR | --color |
KG_FORMAT | -f |
KG_NOTIFY | --notify |
KG_DIFF | --diff |
KG_FORCE | --force |
Prerequisites
The systemd unit files must be installed in ~/.config/systemd/user/ before kg watch can enable them.
See resources/systemd/ in the repo for the unit files and defaults.
Listing and disabling
# Show all active kg watchers and their state
kg watch --list
# Stop and disable a watcher for the current directory
kg watch --disable
# Stop and disable for a specific path
kg watch --disable /home/user/projects/my-app