Skip to content

Sonny leads: a self-set next look instead of a fixed heartbeat - #433

Merged
lydakis merged 4 commits into
mainfrom
claude/project-thread-u2fp8q
Oct 30, 2026
Merged

lydakis merged 4 commits into
mainfrom
claude/project-thread-u2fp8q

Conversation

@lydakis

@lydakis lydakis commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

🤖 Generated with Claude Code

Why

George picked "Rule, self-set next look" for adaptive check-ins. The design page is at https://claude.ai/artifact/MwvJjZSo5CXVV79PZPsv1T.

A lead hears only when something happens. So anything that goes stale quietly, such as a review waiting, a deadline coming up, or a question nobody answered, needs a look that the lead schedules itself. There is no fixed heartbeat by default.

What

Role text

  • lead.md gets one paragraph after the triggers paragraph:
    • The lead keeps one repeating trigger, LEAD.next, set to the earliest time anything it holds would go stale. It judges that from stakes, from how much is moving around each thing, from how soon things are due, and from how urgent the person is.
    • Everything the lead hears feeds that judgement, its tasks and the person's connected sources alike. No source is named.
    • An if gate skips the look while the person is writing. The gate checks that ~/.agent/memory said lists nothing from them since twenty minutes ago.
    • After a look that finds nothing, the next one comes later.
    • Outside the person's hours, anything that can wait is left for their morning. The hours come from memory, or the lead learns them from when the person writes and saves them.
    • Each look ends by setting the trigger again, or by removing it once nothing is open. It tells the person only what needs them.
  • superlead.md: the superlead's next look holds only what spans projects.
  • FEATURES.md: this entry is added to the Proactive leads row.

The trigger repeats instead of being a one-shot --at, because a one-shot whose turn fails leaves no trace (#422).

memory said dates a message by when it was written (Codex review)

  • The problem. said listed every message in any turn that ran since SINCE. A task's opening prompt from hours ago therefore counted as the person writing for as long as the task ran, and the gate never fired.
  • The fix. History has no per-message times, so a turn's opening message is dated by the turn's started_ms. It is dropped when that time is before SINCE. Messages sent into the turn later still count.
  • The nightly cleanup reads through the same function. It gets the same fix, since it had the same overlap.
  • Memory. At most one opening message is held at a time.
  • Tests and docs. The cleanup test now covers a turn that started before the last cleanup and was steered after it. docs/SONNY.md describes the rule.

Open risk

The gate's memory said walks every bot's turns once per look, with one turns request per bot. That's fine at a look every few hours. At thousands of bots it should be measured.

Tests

cargo test -p sonny passes (536), and clippy is clean. The results of a scenario eval will be posted here. Its scenarios: a release coming up, a review waiting overnight, nothing open, and the person mid-conversation.

A lead hears only when something happens, so what goes stale quietly (a
review waiting, a deadline near, an unanswered question) needs a look the
lead sets itself. lead.md: keep one repeating trigger, LEAD.next, at the
earliest time something held would go stale, judged from its stakes,
pace, due date and the person's urgency, with everything heard feeding
that judgement; gated to skip while the person is writing; later after a
look that found nothing; outside the person's hours (from memory, else
learned from when they write) leave what can wait; removed once nothing
is open. superlead.md: its next look holds only what spans projects.

A repeating trigger rather than a one-shot, since a one-shot's failed
turn leaves no trace (#422). No code change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6
@lydakis lydakis self-assigned this Oct 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T05:09:09.430543Z 51f922e New commits
🔒 Security Review ✅ Completed 2026-10-30T05:10:07.522405Z 51f922e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9eb454c179

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/agents/lead.md Resolved
# Conflicts:
#	sonny/FEATURES.md
#	sonny/agents/superlead.md
…r turn

`memory said SINCE` listed every message in a turn that ran since then, so
the prompt that started a long turn hours ago still counted as recent, and
a next look gated on it never fired while that turn ran. History keeps no
times, so the message that opens a turn is dated by the turn's start and
dropped when that is before SINCE; what the person sent into it later
still counts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3613c8a731

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/said.rs Resolved
@lydakis
lydakis merged commit 3b46ceb into main Oct 30, 2026
4 checks passed

lydakis commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Scenario eval results

One pass of 4 runs on chatgpt/gpt-6.1-sol, built from 52fff75. That commit has the same role text as the merge but not the said fix. Each run used a fresh HOME and project, with the person's words as the only news. Every launchd job was removed afterwards.

run .next after each message if gate right call?
release (freeze in 2 days, 2 PRs) at one-off, ~1 h out none timing plausible; one-off, not repeating
overnight (review while asleep, back in 9 h) at one-off at the person's return none timing right; one-off
nothing open (review today → merged) every 1h, then removed after "nothing pending" none yes, set then removed
person writing (two quick asks, then a 4 h vendor wait) none, none, then at +4 h (named shop.lead.next, not evalshop.lead.next) none no look while chatting; one-off

What worked:

  • Every lead kept a .next trigger.
  • Timings followed the stakes: one hour before a freeze, the person's return after a night.
  • The "nothing" lead removed its trigger once nothing was left open.
  • No lead set a look while the person was mid-conversation.

What didn't:

  • No lead gave the trigger an if gate. The gate check therefore never ran.
  • 3 of 4 leads used a one-off at instead of a repeating every. A one-off whose gate skips it is gone, which is why the role asks for a repeating trigger.
  • One lead guessed its own name wrong.

The prose names neither field nor the command concretely enough. A follow-up will name every (not at/in) and explain why, give the gate as a ready command, and give the trigger's name by example.

Cost: 1.88 M input tokens (1.68 M cached) and 24.6 k output over 16 turns. Most of it went to the release and overnight leads also starting monitors.


Generated by Claude Code

lydakis pushed a commit that referenced this pull request Oct 30, 2026
…ample

The eval of #433 showed leads setting the look as a one-off `at` (3 of 4),
with no if command (4 of 4), and one under the wrong name. A one-off whose
if command says no ends, so a skipped look was gone. lead.md now says the
look repeats (every, or cron for a set hour), never at or in, gives the
skip-while-writing check as a command, names it by example
(web.lead.next for web.lead), and says the next setting uses replace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6
lydakis added a commit that referenced this pull request Oct 30, 2026
…ample (#449)

* Sonny triggers: a sent one-shot keeps its row until its turn ends well

A one-off, or a `--runs` trigger's last run, deleted its state row as soon
as its message went out, so a turn that failed afterwards (offline, a login
expired) left nothing for /background, the footer's count or the triggers
tool to show. Its row now stays, and whoever asks the daemon how its turn
ended removes it once that turn completed with any answer passed on; a
failed one stays until removed, as systemd keeps a failed unit until
reset-failed. Fixes #422.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny triggers: forget a done one-shot also once it ends after its turn

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Runtime tests: a sent one-shot keeps its row until its turn ends well

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny triggers: forgetting a done one-shot never waits for the lock

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny: the lead's next look repeats, with a ready check and a name example

The eval of #433 showed leads setting the look as a one-off `at` (3 of 4),
with no if command (4 of 4), and one under the wrong name. A one-off whose
if command says no ends, so a skipped look was gone. lead.md now says the
look repeats (every, or cron for a set hour), never at or in, gives the
skip-while-writing check as a command, names it by example
(web.lead.next for web.lead), and says the next setting uses replace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

---------

Co-authored-by: Claude <[email protected]>
lydakis added a commit that referenced this pull request Oct 30, 2026
…454)

* Sonny triggers: a sent one-shot keeps its row until its turn ends well

A one-off, or a `--runs` trigger's last run, deleted its state row as soon
as its message went out, so a turn that failed afterwards (offline, a login
expired) left nothing for /background, the footer's count or the triggers
tool to show. Its row now stays, and whoever asks the daemon how its turn
ended removes it once that turn completed with any answer passed on; a
failed one stays until removed, as systemd keeps a failed unit until
reset-failed. Fixes #422.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny triggers: forget a done one-shot also once it ends after its turn

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Runtime tests: a sent one-shot keeps its row until its turn ends well

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny triggers: forgetting a done one-shot never waits for the lock

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny: the lead's next look repeats, with a ready check and a name example

The eval of #433 showed leads setting the look as a one-off `at` (3 of 4),
with no if command (4 of 4), and one under the wrong name. A one-off whose
if command says no ends, so a skipped look was gone. lead.md now says the
look repeats (every, or cron for a set hour), never at or in, gives the
skip-while-writing check as a command, names it by example
(web.lead.next for web.lead), and says the next setting uses replace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

* Sonny triggers test: a lock just dropped may still be held a moment

a_fire_ends_only_the_trigger_it_ran_for failed once on macOS (#380's
run): forget_done returned 0 right after the test dropped the lock it
held. flock belongs to the open file, and a process another test forks
shares it until it execs, so the lock can stay taken a moment after the
drop. forget_done is built for that (Sonny's window tries again on its
next refresh), so the test now tries again for up to five seconds, as
the window would.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGEbQZnXUy1kATtYcQ6

---------

Co-authored-by: Claude <[email protected]>
@lydakis lydakis mentioned this pull request Oct 30, 2026
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.

2 participants