esp-harden

esp-harden is a command for Claude Code from mathisk2095/jko-claude-plugins. It costs 17 tokens per session (840 once invoked), scanned A, original, MIT.

An inspection and hardening command for ESP32 firmware, the software that runs on small connected microcontrollers.

In plain words
What is it for?
It audits ESP32 projects built with ESP-IDF or PlatformIO, including FreeRTOS tasks, interrupts, peripherals, memory use, and device security.
Why use it?
It helps find crash risks, memory problems, concurrency mistakes, and security weaknesses before firmware reaches devices in the field.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the esp32-cpp plugin — 1 skill, 4 commands shipped together

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/mathisk2095/jko-claude-plugins/esp-harden
Clone the repo
git clone --depth 1 https://github.com/mathisk2095/jko-claude-plugins

Made for: Claude Code.

Or install esp32-cpp, the plugin that ships this one along with the rest of its 1 skill, 4 commands.

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 esp-harden

README.md
[![agentmods](https://agentmods.dev/badge/commands/mathisk2095/jko-claude-plugins/esp-harden.svg)](https://agentmods.dev/commands/mathisk2095/jko-claude-plugins/esp-harden)
Your own site
<a href="https://agentmods.dev/commands/mathisk2095/jko-claude-plugins/esp-harden"><img src="https://agentmods.dev/badge/commands/mathisk2095/jko-claude-plugins/esp-harden.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 840 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.00017 $0.00840
Opus 5 $0.00009 $0.00420
Sonnet 5 $0.00003 $0.00168
Haiku 4.5 $0.00002 $0.00084

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

Security

Grade A, and why

esp-harden 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.

plugins/esp32-cpp/commands/esp-harden.md · 86 lines

How it starts

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

ESP32 Firmware Hardening & Inspection

First: Use the esp32-expert skill for all guidelines and anti-patterns. Do NOT proceed without consulting the anti-patterns catalog and concurrency reference.

Think like an embedded reliability engineer conducting a field-readiness audit. Every finding must name the concrete failure mode it prevents.

Process

  1. Detect framework -- check for platformio.ini vs CMakeLists.txt with IDF includes

  2. Detect target variant -- check sdkconfig or platformio.ini for target chip

  3. Anti-Pattern Scan (from references/anti-patterns.md):

    • ISR functions missing IRAM_ATTR (AP-02)
    • printf/ESP_LOG/malloc/new in ISR context (AP-01)
    • delay() instead of vTaskDelay (AP-11)
    • Large local arrays in task functions >512 bytes (AP-03)
    • Shared I2C/SPI bus access without mutex (AP-05)
    • Unchecked esp_err_t return values (AP-06)
    • Hardcoded credentials (AP-16)
    • Missing TLS cert verification (AP-17)
    • volatile for thread synchronization (AP-09)
    • xSemaphoreCreateBinary for resource protection instead of Mutex (AP-14)
    • malloc/new in loops without free (AP-07)
    • DMA buffers not using MALLOC_CAP_DMA (AP-04)
    • Global constructors with side effects (AP-20)
    • std::function callbacks that may heap-allocate (AP-19)
    • No reconnection logic in WiFi/MQTT handlers (AP-08)
  4. Memory Safety Inspection:

    • Task stack sizes vs typical requirements (check references/freertos.md table)
    • Heap usage patterns and fragmentation risk (AP-15)
    • PSRAM vs internal RAM placement correctness
    • DMA buffer alignment and capability requirements
    • Long-running allocation patterns (allocate+free cycles)
  5. Build Configuration Check:

    • sdkconfig.defaults exists and committed; sdkconfig gitignored
    • Partition table appropriate (OTA, NVS, storage)
    • Compiler warnings enabled (-Wall -Wextra)
    • Debug vs release config separated
    • Correct target variant configured

Read the full file on GitHub · 86 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 · 86 lines · 17 tokens per session scan A 50f61f25454a

Subscribe to this mod's changes

esp-harden is a command published in the GitHub repository mathisk2095/jko-claude-plugins (3 stars, last pushed 2d ago), licensed MIT. It adds 17 tokens to every session and 840 once invoked, about $0.0001 per session on Opus 5. 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.