Skip to content

feat(schedule): add hash-suppressed monitor gate - #227

Open
raymondginger2018-sudo wants to merge 1 commit into
HKUDS:mainfrom
raymondginger2018-sudo:feat/schedule-monitor-gate
Open

feat(schedule): add hash-suppressed monitor gate#227
raymondginger2018-sudo wants to merge 1 commit into
HKUDS:mainfrom
raymondginger2018-sudo:feat/schedule-monitor-gate

Conversation

@raymondginger2018-sudo

@raymondginger2018-sudo raymondginger2018-sudo commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Add core.schedule.monitor — a hash-suppressed change detection utility (P4). Before each scheduled LLM tick, run a script or fetch a URL; SHA-256 the output and compare against the last known hash. When nothing changed, skip the LLM call entirely (silent tick). When something changed, inject a unified diff + current output for the next LLM turn.

Design

  • Byte-exact SHA-256 hashing (no normalisation) — even whitespace changes are detected.
  • Source failure (non-zero exit, URL timeout) is treated as ERROR, not as a change; stored hash is preserved.
  • First run records a baseline and returns changed=True.
  • Diff is capped at 4K chars, current output at 8K (avoids flooding the LLM with the change itself).
  • SQLite persistence (MonitorStore) with WAL mode and upsert semantics.
  • Single-fetch architecture: monitor_gate() runs the monitored source exactly once per tick.

Tests

11 tests covering: byte-exact hashing, diff generation and truncation, baseline/change/no-change cases, source failure preservation, MonitorStore persistence (upsert + restart), and monitor_gate high-level flow (persists new hash after change, keeps old hash on source failure).

Motivation

This is the maintainable version of a pattern derived from Hermes cron/monitor.py: one focused feature, no orphan modules, no speculative wiring into unproven consumers.

Add core.schedule.monitor — SHA-256 change detection for scheduled
jobs. Run a script or fetch a URL, compare the output hash against
the last seen value, and skip the LLM call entirely when nothing
changed (silent tick). First run records a baseline; a change
injects a unified diff + current output for the next LLM turn.
State is persisted in a small SQLite store.

Design derived from Hermes cron/monitor.py. Includes tests for
byte-exact hashing, diff truncation, silent no-change, source
failure preservation, and store persistence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant