Files
hermes-agent/website/docs/reference
Victor Kyriazakos 3845dbb76c feat(plugins): ctx.register_idle_task runs a plugin job on the curator's idle schedule
A plugin with session-less background work (re-scoring its own data,
suggesting a cleanup) had to run its own timer. register_idle_task(name, fn,
*, interval_hours, min_idle_hours=2, first_run="defer") puts it on the skill
curator's scheduler instead:

- polled from every site that drives the curator (gateway housekeeping per
  served profile, CLI/TUI startup maintenance, the hermes serve maintenance
  tick) through one run_idle_jobs(): the curator, then the active profile's
  plugin tasks;
- the curator's gates via agent/idle_schedule: the min-idle check, the
  interval (floored to 1 h) whose first observation seeds last_run_at and
  defers one interval (first_run="immediate" opts out), and the O_EXCL claim
  file so a task never overlaps itself across threads or processes;
- state per (profile, plugin, task) in <plugin data dir>/idle-tasks/<name>.json
  (last_run_at, run_count, paused, last_summary, last_status, last_error);
  a manager polled outside its own home runs nothing;
- exceptions are logged and recorded, never raised into housekeeping;
- the registration is a PluginRegistration, so unload stops the polling;
- `hermes plugins idle-tasks [plugin] [--pause TASK | --resume TASK]`.

fn receives plain data (name, idle_for_seconds, last_run_at, run_count) and
reaches its ctx through its closure, so the payload also crosses the isolated
plugin host. No capability: the scheduler only calls the plugin's own
function; model calls inside it go through ctx.llm's existing gate.

plugins.py and gateway/run.py are over the file-size cap, so the mixin lives
in hermes_cli/plugins_idle_tasks.py and neither file grows.
2026-11-13 15:30:30 -08:00
..
…