Triggers
A trigger is a scheduled execution of an agent prompt, a shell command, or an installed skill. Triggers run on the daemon — the daemon’s trigger scheduler goroutine fires them on schedule. State lives in cmdop.db.
Triggers only fire when the daemon is running. If the host is offline, a missed trigger is not automatically replayed — it’s logged as missed and visible in cmdop trigger history.
List / add / remove
cmdop trigger list
cmdop trigger add --name nightly-backup \
--schedule "0 3 * * *" \
--machine vps-audi \
--prompt "rotate logs and tar /var/log to /backup"
cmdop trigger remove nightly-backupSchedule format: standard 5-field cron (minute hour day-of-month month day-of-week).
Trigger types
- Prompt — runs an agent prompt via the local LLM. Useful for “investigate disk usage and post to Slack”.
- Shell — runs a shell command. Useful for raw cron replacement.
- Skill — runs an installed skill. Useful for parameterised templates.
# Prompt-based
cmdop trigger add --name disk-watch --schedule "*/30 * * * *" \
--machine prod-server \
--prompt "if disk usage > 80% on any partition, page on-call"
# Shell-based
cmdop trigger add --name log-rotate --schedule "0 4 * * *" \
--machine vps-audi \
--shell "logrotate /etc/logrotate.conf"
# Skill-based
cmdop trigger add --name health-check --schedule "*/15 * * * *" \
--skill check-services --machine prod-serverEnable / disable
cmdop trigger disable nightly-backup
cmdop trigger enable nightly-backupDisabled triggers stay in the registry but don’t fire. Use this for maintenance windows without losing the configuration.
Health
cmdop trigger health # all triggers
cmdop trigger health nightly-backup # one triggerReports last-run time, last-run outcome, next-fire ETA, and consecutive-failure count.
NAME STATUS LAST RUN OUTCOME NEXT FIRE FAILS
nightly-backup enabled 8h ago ok in 16h 0
disk-watch enabled 12m ago ok in 18m 0
log-rotate disabled 3d ago ok - 0
health-check enabled 3m ago fail in 12m 3History
cmdop trigger history nightly-backup
cmdop trigger history nightly-backup --limit 50 --jsonShows past runs with start/end timestamps, exit code, output snippet, and machine.
Failure handling
After 3 consecutive failures, the trigger:
- Emits a desktop notification.
- Pushes an issue to the Board labelled
trigger-failed. - Stays enabled — but you’ll see the failure count climb in
cmdop trigger health.
Re-enable the green path by fixing whatever’s broken, then either let it succeed naturally or:
cmdop trigger disable health-check
cmdop trigger enable health-check # resets the failure counterRun a trigger manually
cmdop trigger run nightly-backupRuns the trigger immediately, regardless of schedule. Useful for testing without waiting for the next firing.
Where triggers live
State lives in cmdop.db (SQLite) under the trigger tables. Portable across machines via cmdop session save / restore-style snapshots is not supported for triggers — they’re host-bound (the daemon that owns the schedule is the daemon that fires them).