Add Claude Code CLI bridge#12
Open
sephxu wants to merge 1 commit into
Open
Conversation
Drives a Claude-* BLE device directly from Claude Code CLI, without the desktop app. Mirror-only: relays Notification events (the CLI's own "needs your attention" signal, fired when a tool call hits the user's permissions.ask list) to the device for a buzz + on-screen message. Architecture: Claude Code → hook.py → unix sock → daemon.py → BLE → device - daemon.py is long-running; maintains BLE link, accumulates session state, pushes snapshots, and signals "completed" briefly on each Notification (so existing firmware shows celebrate/attention pose). - hook.py is short-lived; Claude Code spawns one per hook event. It forwards a fire-and-forget message to the daemon. No PreToolUse interception, no decision round-trip — keeps tool-call latency at zero and avoids duplicating Claude Code's own permission DSL. Single source of truth: Claude Code's permissions config (allow / ask / deny in settings.json) decides what gets prompted. The bridge does not have a separate policy file. Tuning what makes the device buzz means adjusting permissions.ask, not editing bridge config. If the daemon is unreachable (not running, device disconnected) the hook silently no-ops so a dead daemon never blocks the terminal.
|
Heads-up to reviewers / folks landing here: there's a parallel community implementation, cc-buddy-bridge (MIT, Python, daily-driven for ~a week before this PR opened), with a different design philosophy. Sharing as prior art / alternative in case it's useful:
Both designs are reasonable: mirror-only is simpler and avoids duplicating Claude Code's permission DSL; the round-trip variant is what unlocks Happy to upstream parts of cc-buddy-bridge under |
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.
Drives a Claude-* BLE device directly from Claude Code CLI, without the desktop app. Mirror-only: relays Notification events (the CLI's own "needs your attention" signal, fired when a tool call hits the user's permissions.ask list) to the device for a buzz + on-screen message.
Architecture:
Claude Code → hook.py → unix sock → daemon.py → BLE → device
Single source of truth: Claude Code's permissions config (allow / ask / deny in settings.json) decides what gets prompted. The bridge does not have a separate policy file. Tuning what makes the device buzz means adjusting permissions.ask, not editing bridge config.
If the daemon is unreachable (not running, device disconnected) the hook silently no-ops so a dead daemon never blocks the terminal.