feat: generic hook relay + notification badges - #48
Merged
Conversation
Event bus architecture: a single hook script relays ALL Claude Code lifecycle events to the autonomOS server. The server decides what to do with each event type — currently tracks notifications for sidebar badges, extensible for future event handling. Hook relay (packages/server/hooks/autonomos-relay.sh): - Reads event JSON from stdin, POSTs to server - Only activates when AUTONOMOS_SERVER env var is set (sessions spawned by autonomOS). Regular Claude Code sessions unaffected. - Fire-and-forget with 2s timeout — silent on server down - Registered on all hook events with async: true Server: - POST /api/hooks/:sessionId — receives raw hook events - GET /api/hooks/:sessionId/notifications — unread count - POST /api/hooks/:sessionId/read — mark as read - buildEnv() injects AUTONOMOS_SERVER + AUTONOMOS_SESSION_ID into PTY env Dashboard: - notificationCounts in store, polled every 3s - Blue dot badge on session cards with unread notifications - Clicking a session marks its notifications as read Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Event bus architecture for Claude Code → autonomOS communication. A single hook script relays ALL lifecycle events to the server, which decides how to handle each one.
Key design decisions:
AUTONOMOS_SERVERset. Regular Claude Code sessions are completely unaffected.What's included
packages/server/hooks/autonomos-relay.shpackages/server/src/routes/hooks.tspackages/server/src/sessions.tsAUTONOMOS_SERVER+AUTONOMOS_SESSION_IDpackages/dashboard/src/store.tsnotificationCounts, fetch/mark-read actionspackages/dashboard/src/components/Sidebar.tsxTest plan
AUTONOMOS_SERVERis in env (env | grep AUTONOMOS)AUTONOMOS_SERVERis NOT set🤖 Generated with Claude Code