Skip to content

About

USB desktop status display for parallel Claude Code sessions - Arduino Nano ESP32 or RP2040-Zero, ST7735 TFT, and a 3D-printable enclosure.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

72 Commits

Folders and files

Repository files navigation

Session Beacon

A small USB-attached status light for Claude Code. It shows, at a glance, every Claude Code session running on the machine, which ones are waiting on you, and a few coarse usage numbers, on a 1.8" colour TFT sitting next to the monitor.

The problem it solves: with three or four VS Code windows each running Claude Code, it is easy to leave one session blocked on a permission prompt for twenty minutes without noticing. Desktop notifications get lost or dismissed. A dedicated physical display does not.

The finished beacon

Two sessions on screen, in the 25-degree desk stand. bench-metrology last changed state six minutes ago, session-beacon thirty-two seconds ago. The bar down the left of the top row marks the session the footer is describing. The header totals spend across every live session; the footer is caught on its usage page, showing 38% of the rolling five-hour limit and 52% of the seven-day one.


Hardware

Part Notes
Arduino Nano ESP32, headerless ABX00092, not the headered ABX00083. ESP32-S3, native USB CDC, 3.3 V logic. The reference build, complete and in daily use
or Waveshare RP2040-Zero, without headers The cheaper, smaller build, since Wi-Fi is never used. Runs the same firmware from the same source, on the same daemon
1.8" TFT, 128x160, ST7735S SPI, 3.3 V, 8-pin header, this JESSINIE listing. Both panels bought from it were BGR-wired and need a one-line colour-order fix, without which red and blue render swapped. Verify yours; the check is free.
USB-C cable Data + power, nothing else needed
Enclosure, 3 printed parts 40 x 60 mm, 19 mm deep. The middle and back parts come in a version for each board. SolidWorks, STEP and 3MF in enclosure/
Desk stand, 1 printed part, optional Tilts the screen back 25 degrees. The case is a friction fit in the slot, so nothing fastens it
4x M2 x 16 socket-head screws + 4x M2 nuts Head and nut both counter-sunk into the 19 mm stack. Length excludes the head, per the machine screw convention
26 AWG silicone hookup wire, tinned copper Eight conductors, soldered direct to the display's bent-over header. Silicone is required, not preferred: PVC is stiff enough to lift the board out of its retaining ridges

Wiring needs no passives or level shifting: eight conductors, all 3.3 V. The Nano's is carried over from the env_monitoring firmware. See docs/hardware.md for the pinout and bring-up procedure, and docs/enclosure.md for the case and the full bill of materials.

Inside the case

The open case shows why three items in that list are requirements rather than preferences. The Arduino is the headerless board, so its pads are bare and the printed ridges can close directly onto the PCB to retain it. The display's eight-pin header is bent flat against the board with wires soldered straight to it, because a socket would not fit under the lid. And the wire is silicone: one jacket is printed 200 C, which is the rating that stops it shrinking back from the iron on leads this short.

Soldering under a magnifier

Soldering the bent header. Eight joints on 2.54 mm pitch, done under a magnifier lamp.

The RP2040-Zero build, wired and seated in its case

The second build, on a Waveshare RP2040-Zero. Same display, same eight wires, same firmware from the same source; a different mid and back part hold the smaller board. Its parts laid out before assembly, and what differs between the two builds, are in docs/enclosure.md.

The beacon in its stand, from the side

The stand seen from off-axis. Flat on the desk the screen points at the ceiling; 25 degrees back is what makes it readable from a seated position. The case is a friction fit in the slot, so the stand is genuinely optional and nothing about the case depends on it.


How it works

flowchart LR
    subgraph pc["Windows PC"]
        cc1["Claude Code\n(VS Code #1)"]
        cc2["Claude Code\n(VS Code #2)"]
        cc3["Claude Code\n(terminal)"]
        hook["curl\n(one call per hook event)"]
        daemon["beacon-host\n(Python daemon)"]
        cc1 & cc2 & cc3 -->|"hooks + statusline"| hook
        hook -->|"HTTP POST\nlocalhost:47391"| daemon
    end
    subgraph dev["Nano ESP32"]
        fw["firmware"]
        tft["ST7735 TFT"]
        fw --> tft
    end
    daemon -->|"USB serial\nnewline JSON"| fw
Loading
  1. Claude Code hooks fire on session lifecycle events. Each one is a single curl call to the daemon, which measured about eight times cheaper than starting a Python interpreter per event.
  2. beacon-host keeps a per-session state machine (see what the colours mean), decides how loudly each one should be shown, enriches it with cost and context data from the statusline hook, and pushes a compact snapshot to the device whenever anything changes.
  3. Firmware is deliberately dumb: it parses the snapshot and draws it. All policy lives on the host so it can change without reflashing.

On the screen, one row per session:

+----------------------------------------+
| BEACON      6 active         $61.17    |
|----------------------------------------|
|############ env_monitoring     44s ####|  wants you now: filled red, pulsing
|############ data-pipeline       5m ####|  still waiting: filled red, static
| o session-beacon                 2m    |  blue: working
| o inventory..vice2               3m    |  cyan: idle, background work running
| o web-frontend                  15m    |  amber: busy but gone quiet
| o homelab                        7s    |  green: finished its turn
|----------------------------------------|
| ctx  73% [#######...]         opus5    |  <- 4s
| 5h   92% [#########.]      7d  28%     |  -> 4s
+----------------------------------------+

The bar down the far left of the top row marks the session the footer's context page is describing. The footer alternates every four seconds between that session and your account's rolling five-hour and seven-day usage.

State is carried by colour rather than a word, and the elapsed time is how long a session has been in that state. The one that wants you fills its whole row and pulses, which reads from across a desk in a way six-pixel text does not.

The alarm decays. It pulses for two minutes, then holds a static red for another eight, then settles to an amber dot and sinks below the working sessions. Leaving a session parked is a normal way to work, and a red light that never goes out is one you stop reading. Both timings are config. See the attention ladder.

Labels longer than the 16 characters a row has room for lose their middle, not their end, so inventory-service2 shows as inventory..vice2. Two clones of one repository usually differ only at the end of the name.

What the colours mean

Every row is in one of these states. The diagram shows how a session moves between them. All the timings are defaults and can be changed in host/config.toml.

stateDiagram-v2
    direction LR
    state "STARTING: grey dot" as STARTING
    state "WORKING: blue dot" as WORKING
    state "IDLE: green dot" as IDLE
    state "NEEDS_LOOK: cyan dot and age" as NEEDS_LOOK
    state "STALE: amber dot and age" as STALE
    state "ERROR: magenta dot and age" as ERROR
    state "Waiting on you" as ASK {
        state "NEEDS_INPUT: red row, pulsing" as NEEDS_INPUT
        state "NEEDS_HELD: red row, steady" as NEEDS_HELD
        state "WAITING: amber dot and age" as WAITING
        [*] --> NEEDS_INPUT
        NEEDS_INPUT --> NEEDS_HELD: 2 min in
        NEEDS_HELD --> WAITING: 10 min in
    }

    [*] --> STARTING: session opens
    STARTING --> WORKING: you send a prompt
    IDLE --> WORKING: you send a prompt
    ERROR --> WORKING: you send a prompt
    WORKING --> IDLE: Claude finishes its turn
    WORKING --> ERROR: API error, e.g. a rate limit
    WORKING --> STALE: no activity for 5 min
    IDLE --> STALE: no word from Claude Code for 10 min
    STARTING --> STALE: same
    STALE --> WORKING: activity resumes
    WORKING --> ASK: permission prompt or question
    IDLE --> ASK: Claude has waited on you a while
    IDLE --> NEEDS_LOOK: same, but a workflow or background shell is still running
    NEEDS_LOOK --> WORKING: Claude picks up again
    NEEDS_LOOK --> ASK: still quiet 5 min later
    ASK --> WORKING: you answer

    classDef grey fill:#8c8c8c,stroke:#5c5c5c,color:#fff
    classDef blue fill:#009eff,stroke:#0070b8,color:#fff
    classDef green fill:#1db954,stroke:#12803a,color:#fff
    classDef cyan fill:#00e5e5,stroke:#009999,color:#003333
    classDef red fill:#e02020,stroke:#901010,color:#fff
    classDef amber fill:#ffa400,stroke:#b37300,color:#000
    classDef magenta fill:#ff00ff,stroke:#a000a0,color:#fff
    class STARTING grey
    class WORKING blue
    class IDLE green
    class NEEDS_LOOK cyan
    class NEEDS_INPUT,NEEDS_HELD red
    class WAITING,STALE amber
    class ERROR magenta
Loading

Any state goes to ENDED, a grey label, when the session closes, and the row is dropped 30 seconds later.

State On the display What it means What to do
STARTING grey dot The session opened; no prompt yet Nothing
WORKING blue dot Claude is thinking or using tools, or the turn has ended but a subagent it started is still running Nothing
IDLE green dot Claude finished its turn and has nothing left running. Nothing has asked for you yet. This includes a turn that ends with a question in plain text Send the next prompt when you're ready. It turns red once Claude Code reports the session has sat idle a while
NEEDS_LOOK cyan dot, cyan age Claude has gone quiet, but a workflow, background shell or similar is still running, so it is probably waiting on that and not on you Glance at it when convenient. It turns red after 5 min
NEEDS_INPUT whole row red, pulsing Blocked on you. Red at once for a permission prompt or a question dialog; red later for a green row Claude Code has flagged as idle too long Answer it
NEEDS_HELD whole row red, steady The same, 2 to 10 minutes in Answer it
WAITING amber dot, amber age The same, over 10 minutes in. Sorted below working sessions Answer it when you get back
STALE amber dot, amber age Nothing has been heard for longer than a live session stays quiet: 5 min while working, 10 min while green or grey. Usually a window closed without ending the session Check the window
ERROR magenta dot, magenta age The turn ended on an API error such as a rate limit Retry when you can
ENDED grey label The session closed Nothing; the row disappears

Green and red both mean Claude is waiting on you. The difference is whether anything has said so. A finished turn (Stop) is green, because it is not urgent yet. A row turns red when Claude Code says it is blocked: straight away for a permission prompt or a dialog, or a minute after a green row has gone unanswered. That second path used to wait for Claude Code's idle_prompt notification, but 2.1.303 stopped sending it, so the beacon now keeps its own 60-second timer and treats a real idle_prompt as the same signal.

It does notice when that notification never comes. A live session sends it a few minutes into the wait, so a green row that has heard nothing at all for 10 minutes is almost certainly a window closed without ending its session, and it turns amber STALE instead of staying green for a day. A live parked session would have reached amber by then anyway, through the red rungs.

Rows are sorted so the most urgent come first: the red rows, then ERROR, NEEDS_LOOK, WORKING, WAITING, STALE, STARTING, IDLE. The age on each row is how long the session has been in its current state. Across the red and amber rungs it keeps counting, so it shows how long the session has been waiting on you. It restarts when a cyan row turns red. docs/architecture.md has the same machine in terms of Claude Code hook events.

The beacon also reports itself in the terminal, through the same status line that feeds it the cost and context figures:

The beacon marker in the Claude Code status line

The trailing beacon is the daemon confirming it is talking to the device. It turns into beacon? when it is not, which is how an unplugged display or a half-dead daemon announces itself without your having to look away from the terminal. beacon silent means the board is plugged in but has stopped answering. That is worth a glance at the beacon rather than a replug: the daemon cannot see whether the display froze with it or is still drawing perfectly behind a dead return path, and the board reboots itself out of either within a minute. Everything to its left comes from the same payload the device gets.

Details: docs/architecture.md, docs/protocol.md, docs/claude-code-integration.md.


Status

Working end to end on Windows. Hooks feed the daemon, the daemon drives the display, and the whole path has been exercised on real hardware.

Verified on the bench: wiring and panel colour order, firmware rendering and its timers, the daemon and its state machine, hook delivery from live sessions, session labelling, hardware SPI at 24 MHz, session state surviving a daemon restart, and the attention state from a captured idle_prompt.

The attention path is evidence, not reasoning. It was the one part of the display resting on inference: the events that turn a row red had never been seen firing. Both are now captured and committed as fixtures — a Notification carrying notification_type: "idle_prompt", and the dedicated PermissionRequest — so the red row is covered by replayed payloads rather than hand-written ones. The idle_prompt arrived twice for the same unanswered session, which is why the alarm arms only when a session first starts waiting.

One surprise. Refusing a permission prompt did not produce a PermissionDenied, though the hook was registered and the matching PermissionRequest arrived. The CLI turns out to reserve that event for denials made by the auto-mode classifier, not by a person, and a refused call runs no tool so there is no PostToolUse either. Answering a prompt with feedback therefore left the row red until Claude's next tool call. PostToolBatch — which fires once a batch resolves, refusals included — is what closes that gap.

The enclosure is printed and fitted, so it is a finished object rather than a breadboard. Remaining work is comfort rather than function: see docs/roadmap.md.


Contributing and licence

Three licences, one per kind of work, all permissive. Full texts in LICENSES/, and LICENSE maps them to paths.

What Licence
Software and firmware MIT
Enclosure design files CERN-OHL-P-2.0
Documentation and photos CC BY 4.0

Code samples inside the documentation are MIT, not CC BY, so you can copy a pin definition or a shell command without attributing anything. Every dependency is BSD or MIT, so nothing here constrains what you do with it.

There are two builds. The Nano ESP32 is overkill for this: its Wi-Fi and Bluetooth are most of what you pay for and the project uses neither, by design. A Waveshare RP2040-Zero is cheaper and smaller, and runs the same firmware, built from the same source, talking to the same daemon (what the port involved). How the two differ is in docs/enclosure.md. The case is published as STEP as well as mesh, so adapting it to another board does not depend on owning SolidWorks.

Repository layout

firmware/beacon/          Arduino sketch, one source for both boards (Adafruit_ST7735)
firmware/tft_smoketest/   Standalone wiring/display test, flash this first
host/                     Python daemon: hook receiver, state, serial link
  src/beacon_host/
hooks/                    Example Claude Code settings, plus a payload capture tool
scripts/                  install-hooks.ps1, install-task.ps1, restart-daemon.ps1, uninstall.ps1
enclosure/                Three printed parts plus an optional stand: SolidWorks source, STEP, and 3MF
photos/                   Build and finished-device photos, and UI screenshots
docs/                     Architecture, hardware, enclosure, protocol, integration, roadmap

Quick start

Every path below is relative to the repository root. The daemon runs in the foreground and never exits on its own, so it needs a terminal of its own.

1. Build the device

Wire the display per docs/hardware.md, then flash firmware/tft_smoketest and work through the bring-up checks before going near the real firmware. When the colours and geometry look right:

$cli = "$env:LOCALAPPDATA\Programs\Arduino IDE\resources\app\lib\backend\resources\arduino-cli.exe"
& $cli compile --fqbn arduino:esp32:nano_nora firmware/beacon
& $cli upload  --fqbn arduino:esp32:nano_nora -p COM4 firmware/beacon
& $cli board list    # if COM4 is wrong

The display should now read no host, which is correct: nothing is talking to it yet.

2. Install the host software

cd host
uv sync
uv run pytest                        # no hardware needed
uv run beacon-host --dry-run -v      # prints snapshots, Ctrl-C to stop
cd ..

--dry-run still binds the HTTP port, and the daemon refuses to share it, so this exits with cannot bind 127.0.0.1:47391 if one is already running. That is deliberate: two daemons on one port would split the hook events between them at random and neither would show the whole picture. If you have already reached step 5, stop the scheduled task first and start it again afterwards:

./scripts/restart-daemon.ps1 -StopOnly    # from the repository root
# ... run the daemon in the foreground ...
./scripts/restart-daemon.ps1

Use that script for every restart, and never start the daemon with Start-Process: the Scheduled Task cannot stop a daemon it did not launch, so the next restart through the task quietly fails. The script stops every beacon-host process however it was started, and fails unless a fresh daemon answers /health. Stop it the same way before flashing firmware, because the daemon holds the COM port. -StopOnly also disables the task, which would otherwise relaunch the daemon within 5 minutes, and the next normal run enables it again.

3. Terminal 1: start the daemon and leave it running

cd host
uv run beacon-host                   # finds the board by USB id; blocks until Ctrl-C

The display should switch from no host to no sessions. That is the daemon talking to the device with nothing yet to report.

Leave this running. Everything below happens in a second terminal.

4. Terminal 2: install the hooks

cd C:\path\to\session-beacon        # repository root, not host/
./scripts/install-hooks.ps1 -WithStatusLine

Omit -WithStatusLine to keep a status line you already have, at the cost of the cost and context figures, which arrive only through that hook.

Now restart your Claude Code sessions. Hooks are read when a session starts, so nothing reaches the daemon until you do. This is the step people miss.

curl.exe -s http://127.0.0.1:47391/health

events_received should climb as you use Claude Code, and the display should show a row per session.

5. Optional: survive a reboot

The daemon in Terminal 1 dies when you close that window. To have it start at logon instead, with no console:

./scripts/install-task.ps1           # from the repository root
./scripts/restart-daemon.ps1         # starts it now, and confirms it answers

If anything kills the daemon, the task relaunches it within 5 minutes, or as soon as you unlock the workstation. That covers a blank beacon after a restart where the PC never actually rebooted: an app held up the shutdown, but Windows had already ended the daemon. ./scripts/restart-daemon.ps1 brings it back on the spot, and warns if your task was registered by an older install-task.ps1 that lacks these triggers. If it does, run install-task.ps1 again.

To undo all of it, including the hooks, the scheduled task, the running daemon and the logs:

./scripts/uninstall.ps1 -WhatIf    # show what it would touch
./scripts/uninstall.ps1

Setup reaches outside this repository, so deleting the folder would leave a Scheduled Task, hooks in your Claude Code settings and a daemon holding a COM port behind. The uninstall script keeps anything it did not create: your own hooks, your other settings, your config file, and a status line it replaced is restored rather than dropped.

If the display says no sessions, the daemon and the wiring are fine and Claude Code simply is not calling the hooks. Check events_received at /health, then re-run install-hooks.ps1 and restart your sessions.

If the display shows fewer sessions than you have open, that is a different fault and the hooks are not the cause. A session sitting on a prompt sends no events, so it is only known to the daemon from its saved state; check the rows field at /health against what is on screen. Some sessions are dropped on purpose: any session with no activity for restore_max_age_s (24 h), and, after the PC restarts, every session from before the restart, because none of them can have survived it.

If the display shows a session you closed long ago, typically an amber row with an age in days, its window was killed without telling Claude Code to end the session. A Windows Update restart does this. The row goes by itself once it has been silent for 24 hours, and restarting the scheduled task clears it at once if the PC has rebooted since.

If the footer says no statusline data, everything else is working but the statusline hook is not installed. That hook is the only source of cost and context figures. Re-run install-hooks.ps1 -WithStatusLine and restart your sessions. If you already had a status line of your own, the installer saves it and uninstall.ps1 puts it back.

About

USB desktop status display for parallel Claude Code sessions - Arduino Nano ESP32 or RP2040-Zero, ST7735 TFT, and a 3D-printable enclosure.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages