Triggers, Event Watchers, Duties & Playbooks
Push Instead of Prompting (spec.watch)
Digital employees do not have to sit idle waiting for a human prompt. With event sources (spec.watch), they wake up automatically when an email, calendar event, file, API task item, webhook, security advisory, or metric threshold fires:
- Zero idle token cost: The Supervisor evaluates sources deterministically without calling an LLM (or receives instant push notifications). A task starts only when a new event actually arrives, carrying the operator's predefined standing goal (
goal). - Strict data-vs-instruction separation (
SEC-1): Email bodies, webhook payloads, and file paths are attached strictly as data — external content can never inject instructions or override policies. - Exactly-once triggering: Each event key is deduplicated in the database; items already present on initial startup establish a baseline without flooding tasks.
All 11 Watch Source Types
| Type | Triggers When | Key Options |
|---|---|---|
imap |
New email arrives | IMAP IDLE (idle: true, default): Mail server pushes new mail immediately (with intervalSeconds fallback and up to 15 min reconnect). Filters: fromContains, subjectContains, markSeen: false. |
webhook |
Local HTTP POST | Listens strictly on 127.0.0.1:<port>/hooks/<path> using a Vault Bearer token (secret). For internet-facing webhooks, agents create Hub webhooks (see below). |
http |
API / status change | Exactly one of jsonPath (a.b[0].c), pattern (regex), or items (array path + itemId + itemTitle → each new item spawns its own task). Optional Vault auth. |
feed |
New RSS 2.0 / Atom entry | url or urlSecret, contains filter (minimum 60 s interval). |
advisory |
CVE or new release | provider: github-releases (repos), osv (packages or fromInventory: true), nvd (keywords, minSeverity). Minimum 900 s interval. |
ics |
Upcoming calendar event | url, urlSecret, or path, leadMinutes before start (supports RFC 5545 recurrence), summaryContains filter. |
file |
File created/changed/deleted | Absolute path, glob pattern, events: [created, changed, deleted], recursive. |
process |
Process starts or stops | name, on: started | stopped. |
threshold |
Metric crosses boundary | metric: cpu (%), memory (free MB), disk (free % under path), http (number at jsonPath); above/below, consecutive checks. |
drift |
Inventory deviates | Detects added, changed, or removed entries compared to onboarding baseline (ignore list). |
heartbeat |
Periodic check-in | Minimum 300 s interval; inspects systems/inboxes and reports only when action is needed. |
Remember the network allowlist: Every host used by
feed,http, oradvisory(api.github.com,api.osv.dev,services.nvd.nist.gov) must be listed underruntime.sandbox.network.allow.
Public Hub Webhooks & Notification Channels
Local device webhooks bind strictly to loopback. When an employee needs a public webhook for GitHub, Jira, Stripe, Alertmanager, or n8n, it creates one directly on the Hub via trigger_create, trigger_list, trigger_update, and trigger_delete (policy action watch.manage):
- Device-scoped & rate-limited: Up to 10 webhooks per device, 30 tasks/hour flood limit, max 64 KB payload.
- Secret URL stored in Vault: The Hub saves the full webhook URL and token inside a device-scoped Vault entry
hook-<name>(url,ping). The agent writes{{secret:hook-<name>.url}}into external tools and never sees the plaintext token. - Channel bookkeeping (
wiredTo) & re-wiring: Each webhook records which external tool it is wired into. When replacing a tool, the agent checks connected triggers, configures the new tool, and updates the record viatrigger_updatewithout changing URLs or tokens. - Silence detection (
expectWithinMinutes): If no payload or dead-man's ping (POST {hook}/ping) arrives within the expected window, the Hub dispatches one repair task to that device. - Bridging services without webhooks (e.g., n8n): Use an n8n trigger (or Schedule + API poll) followed by an HTTP Request (
POST) node pointing at the Hub webhook URL stored in n8n credentials.
Quiet Hours, Readiness Reports & Outage Alerts
- Quiet hours (
quiet): Any source (including dynamicwatch_add) supports device-local quiet windows (from: "19:00",to: "07:00",weekends: true) with a slowerquiet.intervalSeconds(e.g.,1800). After an event fires, the source polls more frequently for 10 minutes (up to every 60 s, exceptheartbeat/advisory). - Readiness reports (
watch.reports/duty.reports): Daily or weekly summaries report the exact state of every notification channel (healthy, failing since, silent since, paused) and last event timestamp without calling an LLM. - Immediate outage alerts (
watch.alerts, defaulttrue): Fires one alert (plus automatic recovery notice) if a local source fails continuously for one hour, a Hub webhook goes silent past its expectation, or the duty budget is exhausted.
Ongoing Duties (spec.duty) Instead of One-Off Tasks
A role configured with a Duty (spec.duty) acts as a continuous owner of an operational domain:
- Define the
area,goals,limits, andreportsTo(human,human:<id>,role:<name>, ordevice:<id>). - Incoming events from
spec.watchland in an Inbox instead of firing immediate tasks. - A configurable triage brain (
triage.brain) — for instance a fast, inexpensive model — classifies each item (ignore, note, work, urgent). Ambiguous items wait safely for human review. - Procedures (
procedures): Define multi-stage runbooks (such asdev→waitHours: 24observation →prodrestricted to a Tue/Thu22:00–24:00maintenancewindow, with arollbackfallback). Execution order, wait timers, and maintenance windows are enforced deterministically.
Schedules (schedule_create)
Employees can schedule recurring cron jobs or one-time tasks (schedule.create, approval-gated under souffleur). Inspect and toggle schedules in the Cockpit under Workflows → Triggers or via mycelis-roleplay schedule list | add | enable | disable | remove.
Recording & Playbooks (Workflows)
For deterministic, repeatable multi-step procedures:
- Record:
mycelis-roleplay record startcaptures mouse and keyboard actions using Accessibility element paths (such asAutomationId=btnSubmit), not fragile pixel coordinates. Password fields are never recorded. - Distill:
mycelis-roleplay playbook distill --recording <ID> --name <NAME>turns a trace into a parameterized playbook draft. - Add postconditions & confirm: Attach machine postconditions per step with
playbook set-expect, then confirm withplaybook confirm. - Run: Execute confirmed workflows on demand, on a schedule, or from triggers under Roleplay → Workflows (
/dashboard/roleplay/playbooks).
Browser Meetings (meeting)
With the meeting capability and settings under Tuning → Meetings, an employee joins browser meetings (meeting_join), listens via virtual audio loopback (transcription), and speaks through a virtual microphone (speech). Choose between mention-only (wake words) and all utterances trigger modes.
Next steps
- Security, Vault, Rules & Audit Log — how
{{secret:...}}, allowlists, and the ledger protect your environment - Blueprint Reference — full YAML syntax for
watchandduty - CLI Reference —
record,playbook,schedule, andevents
