Skip to content
Mycelis Roleplay · Guide · 12 min min read

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, or advisory (api.github.com, api.osv.dev, services.nvd.nist.gov) must be listed under runtime.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 via trigger_update without 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 dynamic watch_add) supports device-local quiet windows (from: "19:00", to: "07:00", weekends: true) with a slower quiet.intervalSeconds (e.g., 1800). After an event fires, the source polls more frequently for 10 minutes (up to every 60 s, except heartbeat/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, default true): 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:

  1. Define the area, goals, limits, and reportsTo (human, human:<id>, role:<name>, or device:<id>).
  2. Incoming events from spec.watch land in an Inbox instead of firing immediate tasks.
  3. 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.
  4. Procedures (procedures): Define multi-stage runbooks (such as dev → waitHours: 24 observation → prod restricted to a Tue/Thu 22:00–24:00 maintenance window, with a rollback fallback). 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:

  1. Record: mycelis-roleplay record start captures mouse and keyboard actions using Accessibility element paths (such as AutomationId=btnSubmit), not fragile pixel coordinates. Password fields are never recorded.
  2. Distill: mycelis-roleplay playbook distill --recording <ID> --name <NAME> turns a trace into a parameterized playbook draft.
  3. Add postconditions & confirm: Attach machine postconditions per step with playbook set-expect, then confirm with playbook confirm.
  4. 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