v0.11: Routines, Cron, And Triggers [PARTIAL]¶
Goal¶
Let the character act on recurring workflows and external events.
Implementation Status¶
- [x] Routine config model (Pydantic).
- [x] Routine persistence store.
- [x] Routine runner (bus injection logic).
- [x] Routine scheduler skeleton (Cron bridge).
- [x]
/routinesmanagement command. - [x] Script pre-processing with bounded stdout context and diagnostics.
- [x] Routine step metadata rendering fixed/tested.
- [x] Busy protection default restored; explicit bypass for internal routine preserved.
- [ ] Multi-skill workflows.
- [ ] Webhook/API triggers.
Scope¶
- Add routine model.
- Support cron schedules for reminders, reports, check-ins, monitoring, and content generation.
- Support script pre-processing where stdout becomes context.
- Support multi-skill workflows later.
- Add webhook/API triggers after command/session/store foundation is stable.
- Keep proactive behavior opt-in and bounded by quiet hours and consent gates.
Routine Fields¶
- name
- trigger type
- schedule/webhook/API event
- target character
- destination channel
- allowed tools
- approval policy
- optional script command, cwd, timeout, and max output
- delivery policy
- quiet hours
- enabled
Module Targets¶
backend/agent/g_agent/routines/model.pybackend/agent/g_agent/routines/store.pybackend/agent/g_agent/routines/scheduler.pybackend/agent/g_agent/routines/runner.pybackend/agent/g_agent/routines/script.pybackend/agent/tests/test_routines_*.py
Acceptance Criteria¶
- Owner can create/list/enable/disable cron routines.
- Routine output routes to a selected channel.
- Script output can become agent context.
- Routines obey tool and approval policy.
- Quiet hours are respected.
References¶
hermes-agent-ref/hermes-already-has-routines.md
Agent Handoff¶
Current G-Agent State¶
cron/service.pyandcron/types.pyalready exist.agent/tools/cron.pyalready exposes scheduling as a tool when cron service is configured.proactive/engine.pyalready implements quiet hours and calendar reminder dedupe.channels/slash_commands.pyalready has/cron.routines/script.pyruns optional script commands without a shell, confines cwd under the workspace, bounds runtime/output, injects stdout as reference-only context, and stores stderr/exit diagnostics in message metadata.
Implementation Strategy¶
Routines should extend cron/proactive instead of creating a parallel scheduler.
Recommended shape:
routines/model.py: routine config model.routines/store.py: persistence.routines/runner.py: converts routine trigger into agent task.routines/scheduler.py: bridges cron service to routines.
Implementation Slices¶
- Add routine model and store.
- Map cron jobs to routine triggers.
- Add destination channel and target character fields.
- Add allowed toolset and approval policy fields.
- Add script pre-processing. Shipped with bounded stdout context and metadata diagnostics.
- Add
/routinescommand. - Add webhook/API triggers after API server exists.
Tests¶
test_routine_store.pytest_routine_scheduler.pytest_routine_runner.pytest_routine_quiet_hours.pytest_routine_script_preprocess.py
Guardrails¶
- Proactive behavior must be opt-in.
- Quiet hours must apply to outbound delivery.
- Dangerous tools in routines must respect approval policy.
- Cron jobs without present user should deny risky actions by default.
Shipped Slice¶
Routine model/store + /routines list + cron bridge skeleton + script
pre-processing with bounded stdout context and metadata diagnostics. Routine
step metadata rendering fixed/tested (test_routine_steps_rendering.py +
routine_script_preprocess). Busy protection default restored; explicit bypass
for internal routine preserved. No webhooks or multi-skill workflows yet.