ws-ESP32-S3-CAM: Command for Claude Code

.claude/commands/monitor.md

monitor is a command for Claude Code from chayuto/ws-ESP32-S3-CAM. It costs 0 tokens per session (1,835 once invoked), scanned A, original, MIT.

A command for reading serial output from an ESP32-S3 board, including macOS-specific handling for USB serial connections.

In plain words
What is it for?
Use it to monitor the board for a set time, inspect boot and application logs, and reset or open the serial connection without triggering the DTR/RTS issue.
Why use it?
It avoids a common macOS problem where opening the serial port changes reset signals and leaves the board in download mode instead of running the application.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions Claude Code.

This is chayuto/ws-ESP32-S3-CAM's own configuration. It tells Claude Code how to work on ws-ESP32-S3-CAM itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ws-ESP32-S3-CAM configures →

Reuse

Borrowing it

Nothing to install: this file belongs to chayuto/ws-ESP32-S3-CAM. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/chayuto/ws-ESP32-S3-CAM/main/.claude/commands/monitor.md
Clone the repo
git clone --depth 1 https://github.com/chayuto/ws-ESP32-S3-CAM

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for monitor

README.md
[![agentmods](https://agentmods.dev/badge/commands/chayuto/ws-esp32-s3-cam/monitor.svg)](https://agentmods.dev/commands/chayuto/ws-esp32-s3-cam/monitor)
Your own site
<a href="https://agentmods.dev/commands/chayuto/ws-esp32-s3-cam/monitor"><img src="https://agentmods.dev/badge/commands/chayuto/ws-esp32-s3-cam/monitor.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,835 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01835
Opus 5 $0.00000 $0.00918
Sonnet 5 $0.00000 $0.00367
Haiku 4.5 $0.00000 $0.00184

Measured 6d ago against content hash 82823133bb94, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

monitor scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

2. **Network probe** (no DTR impact): `ping 192.168.1.100` + `curl http://cry-detect-01.local/metrics`. If either works, app is running — issue is pyserial-side, use Fix 1 above.
.claude/commands/monitor.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Read serial output from the board

idf.py monitor does not work in non-TTY contexts (Claude Code, piped shells, subshells) — it exits immediately and looks like success. Use pyserial directly, and respect the macOS DTR trap below.

Usage: /monitor [seconds] (default 15)


⚠ The macOS DTR trap — read this before "why is serial silent?"

On macOS, opening /dev/cu.usbmodem* raises DTR and RTS by default. For the ESP32-S3's native USB-Serial-JTAG, DTR=asserted drives GPIO0 low and RTS=asserted drives EN low — i.e. every time pyserial opens the port, the chip is forced back into download-mode / held in reset. The device never boots the app, so serial stays silent, so you keep re-opening the port, so it stays stuck. Spent ~20 min of cry-detect-01 bring-up debugging this on 2026-04-17.

Symptoms:

  • First serial read shows rst:0x15 (USB_UART_CHIP_RESET), boot:0x0 (DOWNLOAD(USB/UART0))waiting for download.
  • Subsequent reads return 0 bytes.
  • esptool ... chip_id succeeds (proves USB is fine; device is in download mode).
  • Red LED (CH32V003 P6) stays off or dim; power-LED (green) stays solid.

Fix 1 — stty -hupcl + dd (works reliably)

stty -f /dev/cu.usbmodem3101 -hupcl 2>/dev/null
dd if=/dev/cu.usbmodem3101 of=/tmp/boot.log bs=1 count=50000 &
DD_PID=$!; sleep 15; kill $DD_PID 2>/dev/null; wait 2>/dev/null
head -200 /tmp/boot.log

stty -hupcl tells the driver not to drop DTR on close. dd opens the device at a lower level than pyserial and doesn't assert modem control lines. This is what actually grabbed the backtrace that unblocked us.

Fix 2 — pyserial but set dtr/rts before open

~/.espressif/python_env/idf5.5_py3.14_env/bin/python -u -c "
import serial, time, sys
ser = serial.Serial()
ser.port = '/dev/cu.usbmodem3101'
ser.baudrate = 115200
ser.timeout = 0.2
ser.dtr = False   # must be set BEFORE open
ser.rts = False   # must be set BEFORE open
ser.open()
# Optional: pulse RTS only to reset without touching DTR
ser.rts = True; time.sleep(0.2); ser.rts = False; time.sleep(0.4)
start = time.time()
while time.time()-start < 20:
    n = ser.in_waiting
    if n: sys.stdout.buffer.write(ser.read(n)); sys.stdout.buffer.flush()
    else: time.sleep(0.05)
ser.close()
"

Read the full file on GitHub · 141 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 141 lines · 0 tokens per session scan A 82823133bb94

Subscribe to this mod's changes

monitor is a command published in the GitHub repository chayuto/ws-ESP32-S3-CAM (5 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,835 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.