Repository navigation
feat(agents): wake-on-message kernel producer — ADR-018 D8 - #899
Merged
Merged
Conversation
Per-install opt-in (config.wakeOnMessage.enabled === true, default off, revertible). On every message post, opted-in installs in the pod are woken with a message.posted event; the claim layer (#892 kernel, #894 wrapper) arbitrates who acts — all wake, one acts, and with claim-before-act the CAS losers never even spawn. The fan-out is deliberately dumb and cheap: zero opt-ins costs nothing beyond the installations array the mention path already loads. Guards: sender's own identity never wakes on its own post; mention-enqueued targets are excluded (the mention is the stronger cue — double delivery would burn a second model turn on one trigger); DM-shaped pods are excluded (enqueueDmEvent already routes every message there); and bot-authored wake storms are dampened on the message.posted count with #508's window and threshold. Human-authored messages are never dampened. The inline frame tells the woken agent it was NOT named, that silence is the default, and that acting starts with a claim — payload.content, not metadata, per the inline-cue rule. message.posted is already in the CLI wrapper's prompt and claimable sets, so deployed wrappers hear this with no driver change (D5). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8
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.
What
The missing kernel half of ADR-018 D8. Sam asked whether the fleet does per-message attention yet — it didn't:
wakeOnMessageappeared nowhere in the backend. This adds the producer.Per-install opt-in:
config.wakeOnMessage.enabled === true, default off, revertible (a setting, not a ratchet — D8 verbatim). On every message post, opted-in installs in the pod get amessage.postedevent. The claim layer does the coordination: kernel CAS (#892) + wrapper claim-before-act (#894) mean all wake, one acts — and CAS losers never even spawn, so arbitration costs zero model turns for everyone but the winner.Guards, each tested:
enqueueMentionsalready loads (asserted:Pod.findByIdnever called).enqueueDmEventalready routes every message there.message.postedtype. Human messages are never dampened.The inline frame (payload.content, not metadata) tells the woken agent it was not named, silence is the default, and acting starts with
commonly_claim_message.No driver change needed:
message.postedis already in the CLI wrapper's prompt set and claimable set — deployed wrappers hear this the moment the kernel emits it (D5: no new event type).Result-shape note
enqueueMentionsnow returns an additivewoken: string[]. Two existing exact-shape assertions were extended withwoken: []— their intent (nothing enqueued) is unchanged, no assertion inversions.Tests
7 new unit tests through the
enqueueMentionsboundary; 61/61 green across both mention suites. Mutation-checked: dropping the mention-dedup pass-through reddens exactly the double-delivery test.Piloting after merge
Flip
config.wakeOnMessage.enabledon the four Sharpen seat installs (no UI yet — deliberate; the pod-level "everyone always acts" mode composes later per D8), deploy, and post an unaddressed message in Sharpen: all four wake, one claims and answers, three ackclaim-heldwithout spawning.🤖 Generated with Claude Code
https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8