每个会话,一眼看清,一键回答。 Every session at a glance.
An answer at a key.

我平时同时开着十来个 Claude Code 会话,等我批准的那个总藏在别的窗口后面。所以我在做一个放在桌上的小键盘:哪个会话在等我,灯告诉我;要批准的命令显示在屏幕上,按一个真键回答。 I usually have ten or so Claude Code sessions open, and the one waiting for me is always behind another window. So I'm building a desk keypad: a light tells me which session is waiting, the screen shows the exact command, and a real key answers it.

Abra 是一个给 Claude Code 用的桌面小键盘 · 自己动手做的 · 每天在用Abra is a desk keypad for Claude Code · built by hand · in daily use

The finished keypad, lit: the screen shows ten session tabs, with tab 1, personal_site, asking Approve? for an edit to a file. Keys 1 and 2 glow orange, keys 3 to 6 green, Approve green and Deny red.
一个真实的请求:personal_site 会话想改一个文件。1、2 号在等我(橙),3 到 6 号做完了(绿),屏幕上有请求时批准和拒绝亮起。A real request: a personal_site session wants to edit a file. Keys 1 and 2 are waiting for me (orange), 3 to 6 are done (green), and Approve and Deny light up while a request is on screen.

为同时开着一堆会话的人做的Made for too many sessions at once

它插在 Mac 的 USB 上,不用切窗口:抬眼看灯,低头按键。It plugs into the Mac over USB, and it never needs a window switch: glance at the lights, press a key.

一个会话一盏灯A light for every session

六个会话键下面各有一颗灯,颜色就是会话的状态。Each of the six session keys has a light under it, and its colour is that session's state.

等你批准(闪)waiting for you (blinks) 在干活working 做完了done 出错error

在 App 里等你回答问题的会话,是橙色常亮。A session waiting on a question in the app glows orange without blinking.

先看清,再批准Read it before you say yes

3.5 寸触摸屏上一页一个会话:它要用什么工具、要跑什么命令,命令用等宽字体显示。The 3.5-inch touch screen shows one session per page: which tool it wants and the command it wants to run, in a monospace font.

真键回答A real key answers

批准和拒绝是两个机械键,有请求等着时会亮起绿灯和红灯。按下去,屏幕上那条请求就有了答案。Approve and Deny are mechanical keys that light green and red while a request is waiting. Press one, and the request on the screen has its answer.

一个旋钮One knob

转动选会话,桌面 App 也跟着切过去;按一下跳到下一个等你的会话;长按打断它。打断还在做Turn it to pick a session, and the desktop app switches to it too. Press it to jump to the next one waiting for you; hold it to interrupt.interrupt coming

十几个会话也装得下Room for a dozen

最多 12 个会话,等你的排最前,1–6 号键永远是前六个。安静了很久的会话也在:键盘会读桌面 App 自己的会话列表。左右滑换会话,上下滑看长消息,中英文都显示。Up to twelve sessions, the ones waiting for you first; keys 1–6 are always the first six. Even quiet sessions show up, read from the desktop app's own list. Swipe sideways to change sessions, up and down for long replies; Chinese names display too.

按住说话,按回车发出Hold to talk, press Return

双倍宽的说话键就是 Cadabra 的听写键,Abra 加 Cadabra,正好是一句咒语:按住说,松开字就打进当前窗口。最后一个键是回车,一条消息从说到发都不用离开键盘。The double-width Talk key is Cadabra's dictation key (Abra and Cadabra, together at last): hold it, talk, and the words land in the window I'm in. The last key is Return, so a whole message goes out without leaving the keypad.

在面包板上批准一个请求Approving a request, on the breadboard

第一阶段的样子:一个个看过会话,批准其中一个。会话是模拟的。Phase one: stepping through the sessions and approving one. The sessions are made up.

拿不准,就不回答When in doubt, it stays quiet

一个能批准命令的键盘,最要紧的是它什么时候不回答。坏掉的键盘绝不能变成悄悄的"同意"。A keypad that can approve commands is mostly about when it doesn't answer. A broken keypad must never turn into a silent yes.

  • 只有按键能说"是"。Only a key press says yes. 键盘回传的是屏幕上那条请求的编号,换了请求就不算;新请求要在屏幕上停够 0.6 秒,按键才有效,免得上一条的按键批准了下一条。The keypad sends back the id of the request on its screen, and a stale id is rejected. A new request must be on screen for 0.6 seconds before a key counts, so a press meant for the last one can't approve the next.
  • 其他情况一律不回答。Anything else is no answer. 没插键盘、后台程序没在跑、终端里的会话、110 秒没人按:都不回答,照常由 Claude Code 自己的对话框问你。No keypad, the daemon not running, a session in the terminal, or 110 seconds without a press: no answer, and Claude Code asks the usual way.
  • 没有"全部批准"键。No "approve all" key. 也不碰任何会话的权限模式。And nothing here touches a session's permission mode.
  • 只在这台 Mac 上。It stays on the Mac. hook 和后台程序之间走本机 HTTP,带共享密钥;后台程序和键盘之间走 USB 串口,键盘先打招呼,后台程序才会往那个端口写东西。The hook talks to the daemon over localhost HTTP with a shared secret, and the daemon talks to the keypad over USB serial, writing to a port only after the keypad says hello.
How it fits together: Claude Code sessions send hook events to a hook script, which forwards them over localhost HTTP to the agentdeck daemon on the Mac; the daemon holds permission requests and talks to the keypad over USB serial, and keys come back with the request id.

从权限请求到按键。From a permission prompt to a key press.

里面有什么What's inside

都是现成的零件,加上打印的外壳和一个打印的键帽。所有尺寸都是拿尺子量的,不照规格书。Off-the-shelf parts, a printed case and one printed keycap. Every dimension came from a ruler, not a datasheet.

主控Brain
Raspberry Pi Pico (RP2040),USB 连 Mac, USB to the Mac
屏幕Screen
3.5 寸电容触摸屏,320 × 4803.5" capacitive touch, 320 × 480
按键Keys
10 个透明外壳的 MX 茶轴,每个键下面一颗 RGB 灯;说话键和回车键直接当 USB 键盘用10 brown MX switches in clear housings, an RGB light under each; Talk and Return act as a USB keyboard
旋钮Knob
KY-040 旋转编码器,金属旋钮KY-040 rotary encoder, metal knob
接线Wiring
手工飞线,每个键一根线直连 Pico;灯共用一根数据线,经 74AHCT125 升到 5 Vby hand, each key on its own Pico pin; the lights share one data wire, lifted to 5 V by a 74AHCT125
外壳Case
3D 打印,118 × 129 mm,倾斜 6°;白色上盖,黑色底壳,螺丝从底下拧3D printed, 118 × 129 mm, tilted 6°; white top, black tray, screws from below
说话键Talk key
打印的 2u 键帽,白底嵌黑色麦克风,十字座单独打印再卡进去a printed 2u keycap, white with a black microphone inlaid, its sockets printed separately and snapped in
Mac 端On the Mac
Claude Code hooks 加一个只用 Python 标准库、开机自启的后台程序,USB 上传 JSONClaude Code hooks and a daemon in plain Python that starts at login, JSON lines over USB
An exploded render of the case: the black tray with the Pico, the LED tray, the switches, the white top plate, and the keycaps and knob on top.
从下往上:装 Pico 的底壳、灯托板、轴、上盖、键帽。From the bottom: the tray with the Pico, the LED tray, the switches, the top plate, the keycaps.

做到哪了Where it stands

一步一步来,每一步先验证再往下走。从面包板到每天在用,用了六天。One step at a time, each one checked before the next. From the breadboard to daily use took six days.

软件Software

完成Done

hook 脚本、后台程序,还有一个终端里的假键盘,先用模拟事件测通。The hook script, the daemon, and a stand-in keypad in a terminal, tested with fake events first.

面包板Breadboard

完成Done

屏幕、灯、按键、旋钮一样一样接上测通。Screen, lights, keys and knob wired and tested one at a time.

外壳The case

完成Done

打印、装配、全部手工焊好,每个键、灯和旋钮都在日志里验过。Printed, assembled and wired by hand, every key, light and the knob checked in the log.

真会话Real sessions

完成Done

装好 hooks,屏幕上是我真实的会话,桌面 App 跟着键盘切换。Hooks installed; the screen shows my real sessions, and the desktop app follows the keypad.

说话和回车Talk and Return

完成Done

说话键接上 Cadabra,最后一个键是回车。The Talk key drives Cadabra, and the last key is Return.

打断Interrupt

下一步Next

长按旋钮打断一个会话。Holding the knob interrupts a session.

开发手记Build log

一路上的故事,写在我的博客里(英文)。The story so far, on my blog.