Claude Meter
An ESP32 development project.
Parts and sourceBefore you start
Confirm board compatibility and supported firmware targets in the upstream documentation.
Upstream README
claude-meter
Claude Code usage limits and session state on an AWTRIX 3 pixel clock (Ulanzi TC001).

7% 49%: the 5 hour window and the week. The 5 hour number is green under 50%, yellow under 80%, red above.- Bottom row: weekly usage as a bar. The white pixel is how much of the week has passed, so you can see if you are ahead of your budget. The week colour follows that pace: green while usage stays behind time, yellow when it gets ahead, red when it is more than 15 points ahead or above 90%.
- Top right indicator: all Claude Code sessions together. Blinking red: one is waiting for you (a permission prompt or a question). Green: something is working. Off: idle.
WAIT <project>pops up once with a short beep when a session starts waiting, with the name of its folder.
No API keys and no requests to Anthropic. Claude Code already passes rate_limits to the status line command, and hooks report what each session is doing. Everything stays on your machine and the clock on your LAN. Python 3 standard library only.
Inspired by @osk2's AWTRIX status light for Codex.
How it works
Claude Code ── status line JSON ──> save_limits.py ──> ~/.claude/statusline-limits-cache.json ─┐
└─ hooks ─────────────> agent_state_hook.py ──> ~/.claude/agent-state/*.json ──────┤
v
awtrix_limits.py (daemon) ── HTTP ──> AWTRIX
save_limits.pyis a status line command. It savesrate_limitsand prints5h 7% · week 49%, or runs your own status line and prints its output instead.agent_state_hook.pywrites one small file per session:run,wait,done, or removes it onend.awtrix_limits.pychecks those files every 2 seconds and pushes a custom app, the indicator and notifications to the clock. The frame has a 15 minute lifetime, so it disappears by itself if the daemon stops.
Interrupting Claude or rejecting a prompt fires no hook, so a wait would stick. The daemon handles it by checking the session transcript: any new record after the wait means you already answered.
Setup
-
Status line. In
~/.claude/settings.json:"statusLine": {"type": "command", "command": "python3 /path/to/claude-meter/save_limits.py"}Already have a status line? Keep it by passing it as arguments:
"statusLine": {"type": "command", "command": "python3 /path/to/claude-meter/save_limits.py python3 /path/to/your_statusline.py"} -
Hooks, in the same file (merge with any hooks you already have):
"hooks": { "UserPromptSubmit": [{"hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py run", "async": true}]}], "PostToolUse": [{"hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py run", "async": true}]}], "PreToolUse": [{"matcher": "AskUserQuestion", "hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py wait", "async": true}]}], "Notification": [ {"matcher": "permission_prompt|elicitation_dialog|elicitation_url_dialog", "hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py wait", "async": true}]}, {"matcher": "idle_prompt", "hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py done", "async": true}]} ], "Stop": [{"hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py done", "async": true}]}], "StopFailure": [{"hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py done", "async": true}]}], "SessionStart": [{"matcher": "startup|resume|clear", "hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py done", "async": true}]}], "SessionEnd": [{"hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/agent_state_hook.py end", "async": true}]}] } -
Try it once:
AWTRIX_HOST=192.168.1.50 python3 awtrix_limits.py --once -
Run it in the background (macOS):
sed -e "s|__DIR__|$PWD|" -e "s|__AWTRIX_HOST__|192.168.1.50|" \ com.tolixx.claude-meter.plist > ~/Library/LaunchAgents/com.tolixx.claude-meter.plist launchctl load ~/Library/LaunchAgents/com.tolixx.claude-meter.plist tail -f /tmp/claude-meter.logmacOS asks once for Local Network access for Python. On Linux, any way to keep a process running works (a systemd user unit, tmux).
Settings
Environment variables for awtrix_limits.py:
| Variable | Default | |
|---|---|---|
AWTRIX_HOST |
(required) | IP or hostname of the clock |
AWTRIX_APP |
claude |
name of the custom app on the clock |
AWTRIX_ICON |
none | icon to show next to the numbers; it must already be on the clock |
AWTRIX_WAIT_SOUND |
a short two-note beep | RTTTL melody the clock's buzzer plays with WAIT; empty for silence. The clock's own sound setting must be on |
CLAUDE_LIMITS_CACHE |
~/.claude/statusline-limits-cache.json |
also read by save_limits.py |
A fresh session has no rate_limits until its first request, so the cache keeps the last values. Limits belong to the account, so they are still right; a window that has already reset counts as 0%.
Handheld remote (optional)
An Anbernic RG40XX H on muOS shows the same sessions and limits, and answers permission prompts: A allows, B denies.
Under each session a five step bar shows its effort level (low to max, red on max; grey when thinking is off). Claude Code passes effort and thinking only to the status line, so this needs save_limits.py as the status line command (on its own or wrapping yours, see Setup).
Claude Code ── PermissionRequest hook ──> permission_hook.py ──> ~/.claude/agent-remote/pending/
^ │
decisions/ │ v
└──── remote_server.py <── HTTP (LAN, token) ── handheld
remote_server.pyservesGET /state(sessions, pending prompts, limits) andPOST /decideon port 8787. Every request needs theX-Tokenheader; the token is created on the first run in~/.claude/agent-remote/token.permission_hook.pywaits up to 90 s for a button, but only while the handheld is polling. With the app closed it returns at once and you get the normal prompt in the terminal. It never approves anything by itself: no answer, no decision.handheld/agent_remote.pyis Python 3 standard library only. It draws with the SDL2 and SDL2_ttf libraries muOS already ships, through ctypes.
Approving a prompt runs a command on your Mac, so keep the token secret and the port on your LAN.
To keep some projects off the handheld (for a demo, or work you don't want on a second screen), list their folder names in ~/.claude/agent-remote/hide, one per line. Their prompts skip the handheld and go straight to the terminal.
-
Server (macOS):
sed -e "s|__DIR__|$PWD|g" com.tolixx.claude-remote.plist > ~/Library/LaunchAgents/com.tolixx.claude-remote.plist launchctl load ~/Library/LaunchAgents/com.tolixx.claude-remote.plist python3 remote_server.py --token -
Hook, in
~/.claude/settings.json(not async, it has to wait for the answer):"PermissionRequest": [{"hooks": [{"type": "command", "command": "python3 /path/to/claude-meter/permission_hook.py", "timeout": 120}]}] -
Handheld. Turn on Wi-Fi and SSH in muOS (Configuration → Web Services), then:
ssh root@<handheld> mkdir -p /mnt/mmc/MUOS/application/.agentremote scp handheld/agent_remote.py root@<handheld>:/mnt/mmc/MUOS/application/.agentremote/ scp "handheld/Agent Remote.sh" root@<handheld>:/mnt/mmc/MUOS/application/ echo '{"server": "http://<mac>:8787", "token": "<token>"}' | ssh root@<handheld> 'cat > /mnt/mmc/MUOS/application/.agentremote/config.json'Then open Applications → Agent Remote. MENU or SELECT+START quits. Errors go to
.agentremote/log.txt.
License
MIT