User notifications

RockBot can interrupt you: a scheduled task finds the build broken, a watched resource reaches the state you asked about, or you said “alert me when it’s done”. The agent sends these with the notify_user tool. Configuration, not the model, decides which channel delivers them. Approval push notifications (approval-push.md) travel the same path.

Everything is off by default.

How it works

  1. Something asks to notify. That is the model calling notify_user(title, message, urgency?, link?), or the approval push service with a batch of pending actions.
  2. The guardrails run, in this order:
    • Dedupe. A notification with the same title and text as one sent in the last DedupeWindowMinutes (60) is not sent again. The comparison ignores case and spacing.
    • Rate limit, for notify_user only. It is a token bucket: Burst (3) can go out back to back, then MaxPerHour (10) per hour. A notification over the limit is neither sent nor saved, and the model is told so.
    • Quiet hours. These are global, for every channel. Between QuietHoursStart and QuietHoursEnd, in your time zone:
      • a low or normal notification is saved to a session instead of sent;
      • a high one is still sent;
      • approval notifications wait until quiet hours end, as before.
    • Routing. Route lists sinks in order, ["ntfy"] by default.
      • With RouteMode: first, the first available sink gets the notification. So ["discord", "ntfy"] means “Discord when connected, otherwise ntfy”.
      • With RouteMode: all, every available sink gets it.
  3. The notification is published on the bus as a UserNotification on user.notification.{agent}, with the chosen sinks stamped on it as Targets.
  4. Each targeted sink delivers it and answers with a UserNotificationReceipt on user.notification.receipt.{agent}.
  5. Fallback. A notify_user notification is saved to a session as an ordinary reply when:
    • no sink is available;
    • quiet hours apply;
    • every target reports a failure;
    • or no receipt arrives within ReceiptTimeoutSeconds (60).

    That session is the conversation the run came from, or the scheduled session for scheduled tasks, patrols and other background runs. An approval notification is never saved this way, because every frontend already lists the waiting action.

Each notification writes one log line once it settles. The line holds the id, kind, origin, urgency, sinks, outcome and whether it was saved to a session. It never holds the title or text.

Where notify_user is available

The tool’s source is notifications. The main turn, scheduled tasks and patrols, their subagents, and the turns that handle watch updates all have it. Workers don’t, because they are allowlist-only.

It is not a consequential action, so the action gate never holds it for approval. It changes nothing outside RockBot.

The tool takes no channel argument. What started the run comes from the run itself, never from the model:

  • the origin and session come from the action gate scope;
  • the label is scheduled task {name} for a scheduled task or patrol, or watch {server}/{uri} for a watch update.

When the agent uses it

The tool description, the scheduling skill and the watch guidance all tell the model to notify only when you would want to be interrupted:

  • a failure;
  • an important finding;
  • a watch condition its instructions said to alert on;
  • or an explicit “alert me”.

Ordinary results stay in the reply or the session. A scheduled task or a watch notifies only when its own description or instructions say so, for example “Check last night’s build; if it failed, alert me with the failing step”.

Sinks

Sink Where Available when
ntfy In the agent process (NtfyNotificationSink) It is enabled and has a topic for the notification’s kind

Discord and WhatsApp clients will be sinks too. They subscribe as user-proxy frontends: IUserFrontend.OnNotificationAsync receives every notification, delivers the ones whose Targets name it, and answers with UserProxyService.SendNotificationReceiptAsync.

ntfy

  • Topics. A notify_user notification goes to Topic, the alerts topic. An approval goes to ApprovalTopic.
  • Priority. Urgency maps to ntfy priority: low 2, normal 3, high 5. Approvals keep ConsequentialActionGate:Push:Priority.
  • Link. A link becomes the notification’s click target and a “view” action.
  • Fallback settings. Server, Token and ApprovalTopic fall back to the approval push settings (ConsequentialActionGate:Push:Server, :Token, :Topic). Approval push being on also turns this sink on. So an existing approval push setup keeps working without any change.

On a self-hosted ntfy server with deny-all access, the token’s user needs publish access to the alerts topic as well as the approvals topic. Without it, every alert fails and is saved to the scheduled session instead.

Setting it up

Helm

agent:
  notifications:
    enabled: true               # registers notify_user
    route: []                   # [] = [ntfy]
    routeMode: first
    quietHoursStart: "22:00"    # "" = agent.approvalPush.quietHours*
    quietHoursEnd: "07:00"
    maxPerHour: 10
    burst: 3
    ntfy:
      enabled: true
      topic: "rockbot-alerts"   # required when ntfy.enabled
      server: ""                # "" = agent.approvalPush.server
      approvalTopic: ""         # "" = agent.approvalPush.topic
secrets:
  notifications:
    ntfyToken: ""               # "" = secrets.approvalPush.token

Subscribe to the alerts topic in the ntfy phone app.

Local development

dotnet user-secrets --project src/RockBot.Agent set "AgentHost:Notifications:Ntfy:Token" "tk_..."

Settings

These settings are under AgentHost:Notifications. As environment variables, write them as AgentHost__Notifications__<Key>.

Key Default Meaning
Enabled false Registers the notify_user tool. Approval push doesn’t need it.
Route ["ntfy"] Sinks to try, in order. Setting any replaces the whole list.
RouteMode first first: the first available sink. all: every available sink.
QuietHoursStart, QuietHoursEnd   HH:mm in your time zone, for every channel. A range across midnight works. When neither is set, ConsequentialActionGate:Push:QuietHours* apply.
MaxPerHour 10 The notify_user rate. 0 means no limit. Approvals are never limited.
Burst 3 How many may go out back to back.
DedupeWindowMinutes 60 Identical notifications inside this window are sent once. 0 turns dedupe off.
ReceiptTimeoutSeconds 60 With no receipt by then, the notification is saved to a session.
Ntfy:Enabled false Turns the ntfy sink on. Approval push being on also turns it on.
Ntfy:Server Push:Server The ntfy server’s base URL.
Ntfy:Topic   The alerts topic for notify_user.
Ntfy:ApprovalTopic Push:Topic The topic for approval notifications.
Ntfy:Token Push:Token The bearer token. Set it only from a Secret or user-secrets.

Limits

  • State is in memory. The dedupe window, the rate-limit bucket and the receipts still awaited are kept in memory. A restart forgets them, so a notification awaiting its receipt during a restart is neither confirmed nor saved.
  • No retries. A failed delivery is not retried. A notify_user notification is saved to a session instead.

© 2026 Marimer LLC. RockBot is released under the MIT license.

This site uses Just the Docs, a documentation theme for Jekyll.