Skip to content

Auto-nudge agents when messages arrive via liveness loop#4

Merged
jsell-rh merged 1 commit intomainfrom
feat/auto-nudge-on-message
Mar 6, 2026
Merged

Auto-nudge agents when messages arrive via liveness loop#4
jsell-rh merged 1 commit intomainfrom
feat/auto-nudge-on-message

Conversation

@jsell-rh
Copy link
Owner

@jsell-rh jsell-rh commented Mar 6, 2026

Summary

  • Add nudgePending flag set by handleAgentMessage on message delivery
  • Liveness loop (1s tick) detects the flag and triggers SingleAgentCheckIn when agent is idle
  • Debounced via nudgeInFlight map to prevent duplicate nudges
  • Event-driven nudge is 30x cheaper than periodic polling ($0.14/day vs ~$4/day for 3 agents)

Cherry-picked from upstream PR markturansky/agent-boss#6.

Note: This builds on the message system changes but was cherry-picked independently against main.

When a message is delivered to an agent via the /message endpoint, the
server now marks the agent for a nudge. The existing liveness loop
(which ticks every 1 second and already knows each agent's idle state)
picks up the pending nudge on the next tick where the agent is idle and
triggers a SingleAgentCheckIn in a goroutine.

This ensures agents read new messages promptly without:
- Polling (wasteful: ~95% of check-ins would be empty)
- Tmux keystroke injection (breaks agent's autonomous protocol discipline)
- Manual nudge button clicks from the dashboard

Debounce: multiple messages in quick succession coalesce into one nudge.
A nudgeInFlight flag prevents duplicate concurrent check-ins for the
same agent.
@jsell-rh jsell-rh force-pushed the feat/auto-nudge-on-message branch from 2221c60 to c695376 Compare March 6, 2026 23:09
@jsell-rh jsell-rh merged commit 85dfa01 into main Mar 6, 2026
jsell-rh added a commit that referenced this pull request Mar 12, 2026
… audio palette complete

audio-sme idea #5 (Agent Moods):
- playAgentMoodActive(name): ascending root→fifth — agent 'waking up'
- playAgentMoodIdle(name): descending fifth→root — agent 'settling down'
- Wired in agent_updated SSE via prevStatus captured before in-place patch
- Fixes prevStatus capture bug (was reading post-patch, now pre-patch)

audio-sme idea #4 (Boss Level):
- playSuccess(priority?) now accepts priority — critical tasks get an ascending
  C5→G5→C6 lead-in run before the chord, theme-aware
- KanbanView wires priority on both local drag-drop and remote SSE task_updated

audio-sme idea #7 (Heartbeat Mode):
- playAgentTick(name): 3ms pentatonic micro-tone at agent's signature freq
  instead of uniform white noise burst — active fleets sound like a chord
- Replaces playActivityTick() in agent_updated handler (still gated by activityTickEnabled)

All 12 audio-sme ideas now accounted for:
Implemented: #2 #3 #4 #5 #6 #7 #8 #9 #10 #11 #12
Architecture only (#1 Alert Taxonomy already fulfilled by category system)
jsell-rh added a commit that referenced this pull request Mar 12, 2026
…beat, control center (#182)

* feat(gamification): status pulse rings + event feed stagger + spec update

Status pulse animations (StatusBadge.vue):
- active: already had ping dot (unchanged)
- idle: slow breathe animation (opacity 1.0↔0.45, 3s ease-in-out)
- blocked/error: subtle jitter (±1.5px translateX, 0.4s loop)
- done: no animation — calm green glow (static)
- prefers-reduced-motion: all animations disabled

Event feed stagger (EventLog.vue):
- New rows slide in from slightly above (translateY -5px → 0, 0.18s)
- animation-fill-mode: both keeps initial state before start
- prefers-reduced-motion: disabled
- Works on DOM insertion — no re-animation on filter/re-render

Spec update (gamification.md):
- Mark 1.2 (sounds) and 2.2 (all-agents-idle) as implemented
- Add 2.3 agent status pulse rings (now implemented)
- Add 2.4 agent mood/vibes field
- Upgrade 3.5 sound themes to implemented
- Add 3.6 agent signature chimes, 3.7 @mention pulse, 3.8 event feed stagger
- Remove deterministic SVG avatar item (boss preference: keep existing avatars)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(gamification): kanban spring-drop, @mention pulse, fleet vibe, sprint-fix

Kanban card spring-drop (KanbanColumn.vue):
- Cards enter with a physical spring animation: drop from above, slight
  overshoot (bounce +5px), then settle. CSS @Keyframes, 0.35s.
- prefers-reduced-motion: animation disabled.

@mention pulse animation (App.vue + AppSidebar.vue):
- SSE agent_message handler now parses @mentions from message content.
- Mentioned agent's card in sidebar pulses with a 3s ring animation
  (box-shadow expand/fade, CSS @Keyframes).
- Reactive mentionedAgents Set with auto-expiry timers.
- AppSidebar accepts mentionedAgents prop and applies .mention-pulse class.

Fleet Vibe roll-up (SpaceOverview.vue):
- Computed fleetVibe shows a live emoji + label in the space header
  based on agent status distribution (Shipping / Blocked / On fire / etc.).
- Tooltip shows "Fleet vibe: <label>" on hover.
- Updates reactively with every SSE agent_updated event.

Sprint-complete detection fix (App.vue):
- No longer triggers on page load (when agents are already idle).
- Requires at least one agent to have been `active` since the last
  celebration. Resets after celebrating, so next one needs a new active phase.
- Requires at least 2 agents — single-agent spaces don't have sprint semantics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(gamification): spawn warp, PR shimmer, confetti priority variations

Agent spawn warp animation (App.vue + AppSidebar.vue):
- When agent_spawned SSE fires, adds agent to spawnedAgents set (600ms).
- AppSidebar applies .agent-spawn CSS class: scale(0.35) → overshoot →
  settle(1.0) with a ring burst. Feels like a portal opening.
- Clears automatically after 600ms animation.

PR badge shimmer (AppSidebar.vue):
- PR links (#N) on agent cards get a traveling light shimmer animation
  (CSS background-position sweep, 2.4s loop) whenever the agent has a PR.
- Visual signal: "code is out there, awaiting review."

Priority-based confetti variations (useConfetti.ts + KanbanView.vue):
- Critical tasks: gold/orange particle palette, 2x count (130), wider
  blast radius, 2.4s duration.
- High priority: 1.4x count (90), slightly faster spread.
- Medium: standard burst (65 particles).
- Low: lighter burst (40 particles).
- KanbanView passes task.priority to celebrate() on drag-drop and
  SSE-triggered task_updated to done transitions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs(gamification): update spec with all brainstorm results and implementation status

Mark Tier 2.3-2.10 as implemented. Add Tier 3.9-3.18 from second
brainstorm round (audio ticks, emoji reactions, streaks, ship-it
broadcast, co-working indicators, standup digest, presence, leaderboard,
chromashift).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(sse): agent_spawned payload from lifecycle.go missing space/agent fields

The MCP spawn_agent path (lifecycle.go:spawnAgentService) was broadcasting
the bare agent name string as the agent_spawned SSE payload. The frontend
SSEAgentSpawned type expects {space, agent} JSON, so data.space and
data.agent were undefined — causing '[undefined] agent spawned' in the
event log and 'Failed to load space undefined: 404' errors.

Fix: use json.Marshal({space, agent}) matching the handlers_agent.go path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(gamification): agent signature chimes, activity tick, spawn guard

Agent signature chimes (useNotifications.ts + App.vue):
- Each agent gets a unique 2-note chord from a hash of their name.
- Pentatonic scale ensures all chords are consonant. Plays once per
  page load per agent on first agent_updated SSE event.
- Resets on space navigation so agents get their chime each visit.

Activity tick (useNotifications.ts + App.vue + SettingsView.vue):
- 4ms white-noise burst on each agent_updated SSE event. Very subtle.
- Off by default; toggled in Settings via new "Ambient activity tick" switch.
- Stored in localStorage (boss_activity_tick_enabled).

TASK-035 guard (App.vue):
- agent_spawned handler drops events with missing space/agent.
- Prevents loadSpace("undefined") from partial payloads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ux): usability audit fixes — H1, H2, H6, H7, TASK-038

- H1: make `now` a reactive ref in KanbanView, updated via setInterval
  every 60s so overdue detection stays accurate without page reload
- H2: replace browser confirm() in TaskDetailPanel delete with AlertDialog
  component for consistent UX and keyboard accessibility
- H6: add data-search-focus attribute to Kanban search input for
  Playwright and keyboard shortcut targeting
- H7: surface send errors in ConversationsView inline compose —
  previously silently swallowed, now shows error text below form
- TASK-038: fix agent selector dropdown overflow in ConversationsView
  new-message picker by replacing ScrollArea (which doesn't apply
  max-height correctly) with a plain div with max-h-48 overflow-y-auto

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ux): H3, H4, M1, M13 usability audit fixes

- H3: Tasks/Conversations sidebar nav items now show active state via
  useRoute() — was hardcoded :data-active="false"
- H4: Remove duplicate unread count badge on Conversations nav item;
  icon dot badge is sufficient, SidebarMenuBadge was redundant
- M1: Guard sound theme preview behind soundEnabled — selecting a theme
  no longer plays audio when sounds are disabled
- M13: pr-shimmer animation now conditional on agent.status === 'active';
  previously applied to all agents with a PR regardless of state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ux): usability batch 3 — C2, M2, M3, M4, M10, M11, M14

- C2: implement 'i' keyboard shortcut (navigate to space overview);
  was documented in help overlay but had no handler
- M2: add 'Change' label to task assignee dropdown trigger when task
  is already assigned — lone ChevronDown was undiscoverable
- M3: store due dates at noon UTC (T12:00:00Z) instead of midnight UTC
  (T00:00:00Z); midnight rolls back a day for all GMT+ users
- M4: Assignee and Label filter dropdowns highlight in primary color
  when an active filter is set, matching the Overdue button pattern
- M10: add 'no tasks match your filters' empty state + Clear filters
  button when all columns are empty due to active filters
- M11: add .prevent to @keydown.ctrl.enter on comment textarea so
  the default newline insertion is suppressed on submit
- M14: add 'Ctrl+Enter to send' hint below comment textarea

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ux): TASK-045 — close agent create dialog before opening personas panel

The 'Create persona' link in AgentCreateDialog emitted open-personas
while the Dialog was still open. Both Dialog and Sheet use z-50 fixed
portals, causing the Sheet to render behind (or at same level as) the
Dialog overlay.

Fix: close agentCreateDialogOpen before emitting open-personas in
SpaceOverview. The dialog animates out, then the Personas sheet slides
in — clean stack, no z-index conflict.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(gamification): TASK-048 agent voice system enhancements

- Add pitch micro-variation (±5%) and timing jitter (±15ms) to agent
  signature chimes so each play feels organic rather than robotic
- Extract _playAgentVoice() helper shared by auto-chime and preview
- Add previewAgentVoice() export — plays on demand regardless of
  once-per-session guard, for explicit user-triggered previews
- Add Volume2 button in AgentDetail header (only when sounds enabled)
  so users can hear an agent's unique voice from their profile

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(gamification): audio-sme ideas — blocked alert, spawn sound, task arc, mention ping

Based on audio-sme brainstorm (ideas #2, #3, #6, #9, #12):

- #2 Dissonance Flag: playBlockedAlert() — minor second interval (A4+A#4)
  fires when agent transitions INTO blocked or error state. Tense but
  not alarming; tells operator something needs attention.

- #3 The Arc: playTaskTransition(status) — rising sweep on →in_progress,
  suspended Csus2 chord on →review. Completes the emotional story that
  playSuccess() already starts at →done. Wired to both drag-drop and
  remote SSE task_updated events.

- #6 Warp Arrival: playAgentSpawn() — 200→1200Hz sweep + resonant ring.
  Fires on agent_spawned SSE, skipped under prefers-reduced-motion.

- #9 @Mention Ping: playMentionPing() — C6 percussive tone, distinct
  from message chime. Fires once per agent_message event that contains
  at least one valid @mention, alongside the existing CSS pulse ring.

- #12 Motion-Sound Parity: prefersReducedMotion check halves volume
  on all new sounds, skips sweeps, replaces with shorter tones.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(gamification): audio control center — volume, per-category toggles, PR shipped, collaboration chord

- soundVolume ref (0-100% slider) applied via tone()/sweep() multiplier
- soundCategories ref with 5 categories: urgent, events, celebrations, ambient, social
- SOUND_CATEGORY_META for rendering category toggles in SettingsView
- isCategoryEnabled() helper replaces bare soundEnabled checks in all play* fns
- SettingsView: volume slider + per-category toggle grid
- playPRShipped(): descending 700→350Hz sweep + landing tone (events)
- playCollaborationChord(): both agents' pentatonic voices as chord (social)
- App.vue: wire playPRShipped via currentSpace watch, playCollaborationChord in agent_message

Audio Control Center implements audio-sme idea #11 (impact 5)
PR shipped implements audio-sme idea #10
Collaboration harmony implements audio-sme idea #8

* feat(gamification): agent moods, boss level fanfare, heartbeat mode — audio palette complete

audio-sme idea #5 (Agent Moods):
- playAgentMoodActive(name): ascending root→fifth — agent 'waking up'
- playAgentMoodIdle(name): descending fifth→root — agent 'settling down'
- Wired in agent_updated SSE via prevStatus captured before in-place patch
- Fixes prevStatus capture bug (was reading post-patch, now pre-patch)

audio-sme idea #4 (Boss Level):
- playSuccess(priority?) now accepts priority — critical tasks get an ascending
  C5→G5→C6 lead-in run before the chord, theme-aware
- KanbanView wires priority on both local drag-drop and remote SSE task_updated

audio-sme idea #7 (Heartbeat Mode):
- playAgentTick(name): 3ms pentatonic micro-tone at agent's signature freq
  instead of uniform white noise burst — active fleets sound like a chord
- Replaces playActivityTick() in agent_updated handler (still gated by activityTickEnabled)

All 12 audio-sme ideas now accounted for:
Implemented: #2 #3 #4 #5 #6 #7 #8 #9 #10 #11 #12
Architecture only (#1 Alert Taxonomy already fulfilled by category system)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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