Skip to content

Running on a schedule

Enable crons per agent and run the scheduler.

Crons are opt-in per agent. The cron in an agent’s agent.json (and mergeEnsurer.cron for the merge ensurer) is only the default pattern; nothing runs on a schedule until you enable it.

The easiest way is the TUI: select an agent in the Agents tab, press space, and pick “Run on cron…”. That edits the pattern, enables it, and starts the scheduler in the background.

Terminal window
# Enable a cron (the pattern defaults to the one in agent.json)
vteam cron enable improver
vteam cron enable coder '*/10 * * * *'
# Start the scheduler for the enabled crons (foreground)
vteam cron start
# Check whether the scheduler is running, which crons are enabled, and when they fire next
vteam status
# Disable a cron
vteam cron disable improver

See vteam cron for the full command reference.

Enabled crons are local to your machine and live in the project’s state directory. One scheduler runs the crons of every vteam project on the machine, so you start it once, from anywhere. It rereads the enabled crons every 2 seconds, so enabling, changing, or disabling a cron takes effect without a restart. When no crons are left enabled and no scheduled run is still going, the scheduler stops on its own. Enabled crons survive a scheduler stop or a reboot: they show as paused until the scheduler starts again (vteam cron start, or S in the TUI).

vteam cron start is a foreground process; stop it with Ctrl+C. A scheduler the TUI starts runs in the background and writes its output to ~/.local/state/vteam/scheduler/scheduler.log. While a scheduler runs it writes its pid to ~/.local/state/vteam/scheduler/cron.pid; a second vteam cron start refuses to start, and vteam status uses the file to report whether the scheduler is up.

If an agent is still running when its next cron tick fires, the tick is skipped.

Cron expressions have 5 fields (minute hour day month weekday) and support ranges, steps, lists, month and weekday names, and 7 for Sunday; L and # are not supported. When both day-of-month and day-of-week are set, either one matching fires the job.

Each scheduled run writes its own log file, the same as a manual vteam run (see Logs). The scheduler prints the job table of every project (each job as <project>/<agent>), then one line per job start, finish, failure, stop, or skipped tick, stamped with the time of day; starts and failures include the path to that run’s log file.

The default agents ship with these patterns, used when you enable their cron:

Agent Default cron Meaning
coder */5 * * * * every 5 minutes
improver 0 * * * * on the hour
security-analyst 15 */4 * * * every 4 hours at quarter past
test-writer 30 */2 * * * every 2 hours at half past
reviewer */30 * * * * every 30 minutes
merge-ensurer */15 * * * * every 15 minutes (mergeEnsurer.cron)