From e6c1f520ac720bdda1c0c0a2378763fe5023ac13 Mon Sep 17 00:00:00 2001 From: SJK-py Date: Fri, 13 Mar 2026 03:31:42 -0700 Subject: [PATCH] suppress unnecessary heartbeat notifications Appends a strict instruction to background task prompts (cron and heartbeat) directing the agent to return a `` token if there is nothing material to report. Adds conditional logic to intercept this token and suppress the outbound message to the user, preventing notification spam from autonomous background checks. --- nanobot/heartbeat/service.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nanobot/heartbeat/service.py b/nanobot/heartbeat/service.py index 831ae85..916c813 100644 --- a/nanobot/heartbeat/service.py +++ b/nanobot/heartbeat/service.py @@ -153,9 +153,15 @@ class HeartbeatService: logger.info("Heartbeat: OK (nothing to report)") return + taskmessage = tasks + "\n\n**IMPORTANT NOTICE:** If there is nothing material to report, reply only with ." + logger.info("Heartbeat: tasks found, executing...") if self.on_execute: - response = await self.on_execute(tasks) + response = await self.on_execute(taskmessage) + + if response and "" in response: + logger.info("Heartbeat: OK (silenced by agent)") + return if response and self.on_notify: logger.info("Heartbeat: completed, delivering response") await self.on_notify(response)