Claude Code Status Ambient Light: A Traffic Light System for Real-Time AI Programming Status
Claude Code Status Ambient Light: A Tr…
A hardware traffic light that shows Claude Code's real-time status using Hooks callbacks and serial communication.
This project uses Claude Code's Hooks callback mechanism to drive a physical traffic light system that displays AI programming status in real-time. Red means AI is working, yellow with buzzer alerts means user input is needed, and green means idle. Built on NXP's i.MX RT1186 with Zephyr RTOS, it uses a Python daemon with UDP communication to bridge Claude Code events to serial-controlled LEDs and buzzers, solving the attention management problem in human-AI collaborative coding.
When Your AI Workhorse Needs a "Traffic Light"
As AI programming tools like Claude Code become more widespread, a new workflow is emerging: delegate coding tasks to AI and go do something else. But this approach has a pain point — AI frequently needs user authorization or decisions during execution, popping up input prompts and waiting for confirmation. If you happen to be away from the screen, you'll miss that window, leaving the AI idle and wasting valuable time.
Bilibili creator Peng Xuetian designed a clever hardware project to address this exact problem: Claude Code Programming Status Ambient Light. Using a combination of traffic lights, LED strips, and buzzers, it reflects AI working status in real-time, letting you know the moment AI needs your input — even when you're not watching the screen. This project was entered in the Creative Interaction category of the M-Design Creative Design Competition, offering a novel concept with extremely high practical value.
Core Principle: Hooks Callbacks + Serial Communication
The project's core concept leverages Claude Code's Hooks callback mechanism. Claude Code has multiple critical nodes during execution (such as starting execution, waiting for input, task completion, etc.), and custom scripts can be mounted at these nodes.
The Hooks mechanism here is similar in design philosophy to Git Hooks or the Webpack plugin system — it's a lifecycle callback system designed by Anthropic for Claude Code that allows developers to inject custom scripts at critical nodes during AI agent execution. These scripts can be Shell scripts, Python programs, or compiled binaries. Hooks were originally designed to enhance Claude Code's observability and extensibility, enabling developers to log events, trigger notifications, perform security checks, and more. This event-driven architecture pattern decouples core functionality from extensions, allowing third-party developers to add new features without modifying source code — providing a natural integration point for hardware-linked solutions like this project.
Software Architecture
The software layer is divided into three parts:
- Daemon Process (Python): Runs persistently on the computer, communicating with hardware via serial port on one side and serving as a UDP server receiving status messages on the other.
- Client Script: Triggered by Claude Code at different workflow nodes, sending the current status to the daemon via UDP protocol.
- Status Translation: After receiving status information, the daemon translates it into serial commands and sends them to the underlying hardware.
The project chose UDP (User Datagram Protocol) over TCP for inter-process communication — a design decision that reflects precise understanding of the scenario's characteristics. UDP is a connectionless transport protocol that doesn't require establishing a connection or waiting for acknowledgment, resulting in extremely low single-communication latency. Client scripts triggered by Hooks have an extremely short lifecycle — they only need to send one status message and exit. Using TCP would require a three-way handshake to establish a connection each time, which is unnecessary overhead for such lightweight communication. UDP's "fire and forget" characteristic perfectly matches this scenario: even if a status packet is occasionally lost, the next status change will quickly overwrite it without causing any substantive problems. This pattern of using UDP over local loopback for inter-process communication is already well-established in system monitoring and log collection domains.
The benefit of this architectural design lies in decoupling — Claude Code only needs to call a lightweight UDP client script without directly operating the serial port, while the daemon handles all hardware communication logic.
Hardware Platform
On the hardware side, the project uses NXP's Freedom i.MX RT1186 development board with an Arduino expansion board, connecting external traffic light modules, a buzzer, and LED strips.
The i.MX RT1186 belongs to NXP's crossover processor series, positioned between traditional MCUs (microcontrollers) and MPUs (microprocessors), featuring dual-core Arm Cortex-M33 and Cortex-M7 processors with clock speeds up to 800MHz, along with integrated Gigabit Ethernet TSN (Time-Sensitive Networking) capabilities. "Freedom" is NXP's low-cost development board product line brand, compatible with Arduino expansion board interfaces (i.e., Arduino Uno R3 pin layout), allowing developers to directly use the vast array of off-the-shelf Arduino sensors and actuator modules available on the market, significantly lowering the barrier to prototype development. In this project, the Arduino-compatible interface makes connecting the traffic light module, buzzer, and LED strips essentially plug-and-play.
The underlying firmware is written on the Zephyr operating system, an open-source Real-Time Operating System (RTOS) hosted by the Linux Foundation, designed specifically for resource-constrained embedded devices. It supports hardware platforms ranging from microcontrollers with as little as 8KB RAM to more complex multi-core processors. Zephyr excels in cross-platform compatibility, with its core advantage being the Device Tree abstraction mechanism — a concept borrowed from the Linux kernel that separates hardware configuration from driver code through declarative hardware description files. Developers only need to write or modify .dts files describing pin mappings, peripheral configurations, and other hardware information to port the same application code to different development boards. Compared to traditional RTOS options like FreeRTOS, Zephyr provides a more complete network protocol stack, Bluetooth support, and security features while maintaining the deterministic response capability of real-time systems. Chip manufacturers including NXP, Nordic, and Intel are all major contributors to the Zephyr project.
The daemon process on the computer communicates with the development board via USB virtual serial port (typically appearing as a COM port or /dev/ttyUSB device). The advantages of serial communication include: simple protocol (usually only requiring agreed-upon baud rate and data format), easy debugging (data can be viewed directly with serial terminal tools), and low, stable latency. Compared to wireless solutions like Bluetooth or WiFi, wired serial connections have virtually no connection instability issues during the prototyping phase. The daemon translates high-level semantic states (such as "waiting for input") into serial command bytes sent to the lower-level machine, which parses them and drives the corresponding peripherals. This "upper machine decides, lower machine executes" layered architecture is a classic design pattern in industrial control and IoT devices.
Three States, Three Light Effects
The project defines three clear working states, each with unique audiovisual feedback:
🔴 Red Light: AI is Working
When Claude Code is in Running mode or thinking, the traffic light shows red, and the LED strip displays a flowing light effect. This means the AI is busy, and you can safely do your own thing.
🟡 Yellow Light: Your Input is Needed
When Claude Code needs user authorization or a decision, the traffic light switches to yellow, the LED strip enters breathing light mode, and the buzzer sounds an alert. This is the most critical state — it means the AI is waiting for you, and you need to get back to the screen as soon as possible. The audio alert ensures you won't miss it even if your back is turned to the screen.
🟢 Green Light: Idle State
When Claude Code is idle (task completed or not yet started), the traffic light shows green, and the LED strip displays a rainbow mode. This indicates everything is ready and you can assign new tasks to the AI.
Firmware Program Design
The firmware program structure is also worth mentioning. After startup, the main program first performs hardware initialization, then creates a heartbeat thread that periodically signals the system that the program is running normally. The heartbeat mechanism is a common health monitoring technique in embedded systems — if the main loop gets stuck due to some anomaly, the heartbeat signal stops, and a Watchdog Timer can detect the system abnormality and trigger a reset, ensuring long-term stable device operation.
The most critical part is the command processing loop: it continuously listens for serial data, parses received commands, and controls the traffic light, buzzer, and LED strip states based on the parsing results. The entire logic is clean and straightforward, with rapid state transition responses. Under the Zephyr framework, serial port reading is typically implemented using interrupt-driven or DMA methods to ensure real-time data reception; LED strip control (such as the WS2812B protocol) requires precise timing signals, for which Zephyr's PWM and SPI drivers provide hardware-level support.
Actual Demo Results
In the creator's actual demonstration, the entire workflow is very smooth:
- Claude Code starts in idle state — green light on, LED strip showing rainbow effect
- After issuing the command "Create an empty file Text5.txt," the AI begins execution and the LED strip switches to flowing light
- When the AI requests file creation permission, yellow light turns on, LED strip changes to breathing mode, buzzer sounds
- After the user clicks "Yes" to authorize, the task completes, LED strip returns to rainbow mode, and green light comes back on
The entire process features instant state transitions and clear audiovisual feedback, fully achieving the design goal of "knowing what the AI is doing without looking at the screen." Notably, the end-to-end latency from Hooks trigger to light change is extremely short — UDP local communication is at the microsecond level, serial transmission at the millisecond level, and the human eye perceives virtually no lag.
Practical Value and Extended Thinking
Although this project might seem like a fun hardware gadget, it reveals a serious efficiency problem: In human-AI collaborative programming, how do we reduce the human's perception delay for waiting states?
The essence of this problem is "attention management" in human-computer interaction. Traditional software notifications (such as taskbar flashing, popup alerts) rely on the user's visual attention remaining on the screen, while physical audiovisual signals can penetrate attention barriers — you can hear the buzzer while cooking in the kitchen, or see the light change while sunbathing on the balcony. This design philosophy of "materializing" digital states into environmental perception is already widely applied in smart home and industrial monitoring domains, but introducing it into AI programming workflows is a novel attempt.
Claude Code's current Hooks mechanism provides a natural interface for such extensions. Beyond physical light reminders, similar approaches can be extended to:
- Mobile push notifications: Send to phone via Webhook
- Enhanced desktop notifications: Custom system notification styles and sounds
- Multi-task status panels: Monitor multiple Claude Code instances simultaneously
- Team collaboration scenarios: Let team members know the AI assistant's work progress
- Smartwatch vibration alerts: Sync status to wearable devices via Bluetooth or push services
- Slack/Feishu bot integration: Automatically broadcast AI work progress in team communication tools
From a broader perspective, as AI programming tools become increasingly powerful, the human role is shifting from "coder" to "decision-maker" and "reviewer." This role transformation means humans need to distribute attention across multiple AI agents, much like a project manager simultaneously managing multiple team members. How to make this role transition more efficient and natural, and how to design better Human-in-the-Loop interaction patterns, is a direction worth continuous exploration. This traffic light project provides an elegant answer in the most intuitive way — it proves that sometimes the best human-machine interface isn't a more complex software UI, but a return to humanity's most primitive perception channels: light and sound.
Related articles

Claude Code Desktop Status Capsule: An Open-Source Widget for Real-Time AI Coding Status Monitoring
An open-source desktop status capsule that monitors Claude Code's idle, working, and completed states in real time, with multi-conversation management, memos, and music control for developers.

GPT-5.2 Codex vs Opus 4.5 Hands-On: A Comprehensive Comparison of Coding Ability, Speed, and Developer Experience
Hands-on comparison of GPT-5.2 Codex vs Opus 4.5 across frontend generation, physics simulation, 3D scenes, and code refactoring, with practical selection advice.
Deep Dive into the Three AI Programmin…
Deep Dive into the Three AI Programming Frameworks: The Right Way to Do Specification-Driven Development
Deep dive into the three frameworks of Specification-Driven Development (SDD) for AI programming: Blueprint, Execution Flow, and Change Records — solving the problem of AI code going off the rails.