safe-dev

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

A development checklist for adding a new subsystem to an ESP32-S3 project, such as a task, hardware driver, or Kconfig setting. Kconfig is the system used to choose firmware build options.

In plain words
What is it for?
Use it when adding firmware features, drivers, or configuration symbols and when checking stack sizes, memory effects, and callback placement before flashing.
Why use it?
It reduces hard-to-diagnose crashes by making you add one change, flash it, test it, and save the working result before continuing.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/chayuto/ws-esp32-s3-cam/safe-dev
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 safe-dev

README.md
[![agentmods](https://agentmods.dev/badge/commands/chayuto/ws-esp32-s3-cam/safe-dev.svg)](https://agentmods.dev/commands/chayuto/ws-esp32-s3-cam/safe-dev)
Your own site
<a href="https://agentmods.dev/commands/chayuto/ws-esp32-s3-cam/safe-dev"><img src="https://agentmods.dev/badge/commands/chayuto/ws-esp32-s3-cam/safe-dev.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,376 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.01376
Opus 5 $0.00000 $0.00688
Sonnet 5 $0.00000 $0.00275
Haiku 4.5 $0.00000 $0.00138

Measured 5d ago against content hash de791bc5d097, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

safe-dev scanned grade A with 0 findings 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 5d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/safe-dev.md · 78 lines

How it starts

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

Safe feature-dev loop for ESP32-S3 cry-detect-01

Use this flow when adding a new subsystem (new task, new driver, new Kconfig symbol). Every crash we've had in this project came from skipping one of these checks. Usage: /safe-dev <what-you're-adding>.

Principle: change one thing, verify, then change the next

The ESP32-S3 + native USB-JTAG makes iteration slow because:

  • Every serial-monitor open briefly toggles DTR/RTS → chip resets
  • A bootloop takes ≥5 s per cycle; multi-feature breakage is hard to bisect
  • Assert/panic backtraces require addr2line — only useful if you saved the .elf from the exact build that crashed

So: add one subsystem, flash, verify, commit, then add the next.

Pre-flash checklist

Before every flash, tick these:

  1. New Kconfig enabled? Check if it changes stack sizes / requires companion symbols.

    • CONFIG_FREERTOS_USE_TRACE_FACILITY=y → adds per-TCB bookkeeping; bump small task stacks
    • CONFIG_FATFS_LFN_HEAP=yfopen of long names consumes extra heap; SD open can slow
    • Any new driver component (e.g. driver/temperature_sensor.h) → often pulls in event-loop handlers; do NOT install inside another driver's callback
  2. New task? Start it with 6 KB stack minimum unless you have a reason to go smaller. Add to WDT if it runs > 1 Hz. Pin to core 0 (Wi-Fi/lwIP on 0; model inference on 1).

  3. New callback on event loop? Anything in esp_event_loop_run_task context must be non-blocking. Do not:

    • call fopen/fwrite/SD I/O
    • take long-held mutexes (sd_logger, metrics, etc.)
    • call into sd_logger_ntp_sync_marker which opens+closes files

    Instead: signal a worker task via a queue/semaphore.

  4. New mutex? Write down the lock order on paper. This project has mutexes in sd_logger, web_ui, event_recorder, metrics_logger, noise_floor. A handler that takes two of them in the wrong order will deadlock.

  5. New heap allocation > 1 KB? Use heap_caps_malloc(n, MALLOC_CAP_SPIRAM) not stack, not internal RAM. Our internal DRAM is ~250 KB and every task competes.

  6. Feature flag in Kconfig? Add an CONFIG_CRY_<X>_ENABLED symbol defaulting OFF until verified. That way rollback is sed one line, not revert five files.

Read the full file on GitHub · 78 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. 5d ago First seen · 78 lines · 0 tokens per session scan A de791bc5d097

Subscribe to this mod's changes

safe-dev 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,376 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.