feat(examples): Idle Curator — a senior foreman for your agent: while you're away it verifies the work and wakes stale chats with proof, never with empty pings - #50230
Open
DScoNOIZ wants to merge 1 commit into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes # (none — standalone examples contribution; happy to link a tracking issue if you prefer one).
Type of change
What does this PR do?
Every agent CLI wastes its best compute window: the hours the user is away. This PR adds
examples/idle-curator— a complete, working pattern that turns idle time into the highest-quality analysis slot. I have been running it daily on Linux and it changed how stale sessions get handled.The problem in simple words: today an idle session either gets a dumb timer ping ("are you still there?") or nothing at all. A ping with no analysis is noise; silence wastes the one moment when heavy analysis costs nothing because nobody is waiting.
What this does differently, in three parts:
1. It knows whether you are actually gone. Most watchdogs only see app idle. This one fuses two clocks: agent-loop idle (session events + tool hooks) and OS input idle (GNOME Mutter → KDE → X11
xprintidle→unknown). The result is four states instead of a boolean:AWAY(gone, full analysis),FORGOTTEN_TAB(you work next door but forgot this chat — it may still use the time),BACKGROUND(you are at the PC but not in the app),PRESENT(you are typing right here — it stays silent, logs only). No timer ever fires blind.2. Nothing reaches the chat unverified. When a session qualifies, a fresh curator session analyzes its digest and must return a parseable
[wake:VERDICT]contract (CONTINUE / CORRECT / STOP / ABORTplus a lifecycle vote). Then — and this is the point — a separate fact-check session validates every claim against tool outputs, repo files, or at most 3 web lookups, and returns[factcheck:PASS/FAIL]. Anything without PASS is delivered markedUNVERIFIED, never as fact. The curator never grades its own homework; I added this after catching the curator itself making a factual error in a verdict.3. Every module is a settings switch. All 13 keys (
enabled / curator_enabled / factcheck_enabled / presence_enabled, all timeouts, caps) are re-read from JSON every tick — no restart. One key maps to one future GUI control. The Linux probe is per-user userspace (one D-Bus call or a 15 KBXScreenSaverbinary, ~3 ms per minute); turning telemetry off means zero exec, not a stub. Guards included: HIBERNATE after N wakes, exponential backoff on ignored wakes, a blind window so the woken agent's own verification tools never re-trigger the watchdog, stall-push on 3+ consecutive tool errors.Scenarios it covers: you leave for the day →
AWAY, deep multi-agent-quality review by morning; you sit in another tab for an hour →FORGOTTEN_TAB, the old chat still gets its analysis quietly; you type in the chat →PRESENT, zero interruptions; a chat that only asked questions and ran no tools stays invisible by design (nothing to analyze).Files:
wake.js(watchdog plugin),presence.sh+xidle.c(probe + 13-line fallback),curator-agent.md+factcheck.md(agent contracts),wake.json.example,README.md. Additive-only — one newexamples/directory, zero core changes.How did you verify your code works?
node --checkon the plugin: clean. Config parses, all 13 keys validated with range checks.185277 → 188327 msacross a 3 s sleep (counter tracks reality),847 msright after keyboard input.presence.shexit 0 in all paths including unknown-hardware fallback.wake → curator → factcheckinjection cycle needs a 10-minute real idle window, still under observation. It cannot affect the test suite — no core files touched.Screenshots / recordings
Not a UI change. Terminal evidence instead:
Checklist