AgentDeck: Skill for Claude Code

.agents/skills/esp32-heap-discipline/SKILL.md

esp32-heap-discipline is a skill for Claude Code, Codex from puritysb/AgentDeck. It costs 122 tokens per session (1,568 once invoked), scanned A, original, MIT.

Rules for managing memory in AgentDeck firmware for ESP32 boards. Firmware is software running directly on a device, and PSRAM is an extra type of memory available on some boards.

In plain words
What is it for?
Use it when writing or reviewing firmware that allocates memory for buffers, strings, vectors, caches, canvases, or data kept across render loops.
Why use it?
It helps prevent slow rendering, memory fragmentation, and failures caused by allocating data in the wrong kind of memory. The correct rules differ between boards with and without PSRAM.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is puritysb/AgentDeck's own configuration. It tells Claude Code and Codex how to work on AgentDeck 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 AgentDeck configures →

Reuse

Borrowing it

Nothing to install: this file belongs to puritysb/AgentDeck. 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/puritysb/AgentDeck/master/.agents/skills/esp32-heap-discipline/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/puritysb/AgentDeck

Made for: Claude Code, Codex.

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 esp32-heap-discipline

README.md
[![agentmods](https://agentmods.dev/badge/skills/puritysb/agentdeck/esp32-heap-discipline.svg)](https://agentmods.dev/skills/puritysb/agentdeck/esp32-heap-discipline)
Your own site
<a href="https://agentmods.dev/skills/puritysb/agentdeck/esp32-heap-discipline"><img src="https://agentmods.dev/badge/skills/puritysb/agentdeck/esp32-heap-discipline.svg" alt="Measured on agentmods" height="20"></a>
Per session 122 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,568 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00122 $0.01568
Opus 5 $0.00061 $0.00784
Sonnet 5 $0.00024 $0.00314
Haiku 4.5 $0.00012 $0.00157

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

Security

Grade A, and why

esp32-heap-discipline 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 7d 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.

.agents/skills/esp32-heap-discipline/SKILL.md · 103 lines

How it starts

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

ESP32 Heap Discipline

Memory rules for esp32/ firmware. Adapted from crosspoint-reader's heap-discipline skill to AgentDeck's multi-board reality. This is the procedure you run while writing firmware and the gate before handing it back.

The board split — know which world you're in

AgentDeck firmware targets two memory regimes. Check the board macros first.

  • PSRAM boardsBOARD_BOX_86, BOARD_IPS35, BOARD_AMOLED, BOARD_IPS10 (ESP32-S3 / -P4, 8–32MB PSRAM). Large canvases/caches go in PSRAM (ps_malloc / MALLOC_CAP_SPIRAM). But per-pixel / LVGL draw buffers and PPA rotation buffers must stay in internal SRAM (MALLOC_CAP_INTERNAL): PSRAM writes are ~30× slower, so a PSRAM draw buffer makes every widget render crawl (see the IPS10 rationale in esp32/src/ui/display.cpp). Plenty of total RAM here; the constraint is write latency and internal-SRAM headroom, not bytes.
  • No-PSRAM boardsBOARD_TTGO (classic ESP32, ~160KB heap), BOARD_ESP32_C6_147 (single-core RISC-V), BOARD_LED8X32 (TC001). This is crosspoint's world: every allocation matters and fragmentation, not total usage, is what kills the device. Free heap can read fine while the largest free block is too small for the next alloc. Optimize for not leaving holes.

The canvas/buffer code already encodes this split (renderer.cpp::init uses static pre-allocated buffers on TTGO/C6 and ps_malloc+SRAM fallback elsewhere). Match the existing pattern; don't invent a third path.

Allocation decision procedure

Ask in order; stop at the first yes.

  1. Stack? Local, bounded, under ~256 bytes: plain array/struct. The task stacks are sized per board in config.h (STACK_UI) — keep frames lean.
  2. Compile-time constant? static constexpr lives in flash, costs zero DRAM. Lookup tables and string literals belong here.
  3. Allocated once and reused for the screen/activity lifetime? Allocate at init, hold in a static/member, reuse every frame. Never per-frame, never per-iteration, never in the render/flush path.
  4. Dynamic and fallible? makeUniqueNoThrow<T>(...) / makeUniqueNoThrow<T[]>(n) from esp32/src/util/memory.h. Null-check, log, return. It frees on every exit path. Use makeScopedCleanup([&]{ … }) for non-owning teardown (the header is kept C++11-safe — led8x32 builds at gnu++11 — so construct the guard via the factory, not C++17 CTAD).
  5. A C/SDK API takes ownership / the object lives for the device lifetime? Only then raw new / heap_caps_alloc / ps_malloc, with a null-check + Serial.printf error and a comment naming who owns it. The display driver objects in display.cpp are this case (one-time, device-lifetime).

Read the full file on GitHub · 103 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. 7d ago First seen · 103 lines · 122 tokens per session scan A c0cd0d6e63d7

Subscribe to this mod's changes

esp32-heap-discipline is a skill published in the GitHub repository puritysb/AgentDeck (222 stars, last pushed today), licensed MIT. It adds 122 tokens to every session and 1,568 once invoked, about $0.0006 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-30.

Related

Other skills, from other repositories

Embedded C/C++ rules for MCU, STM32, HAL, interrupts, DMA, memory constraints, a

Embedded C/C++ rules for MCU, STM32, HAL, interrupts, DMA, memory constraints, and hardware-focused testing.

AmariahAK/atlarix-skills · 21 tokens

c-pro

Write efficient C code with proper memory management, pointer arithmetic, and system calls. Handles embedded systems, kernel modules, and performance-critical code. Use PROACTIVELY for C optimization, memory issues, or system programming.

Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI · 47 tokens

cpp-coding-standards

C++ coding standards based on the C++ Core Guidelines (isocpp.github.io). Use when writing, reviewing, or refactoring C++ code to enforce modern, safe, and idiomatic practices.

affaan-m/ECC · 48 tokens

doca-argp

Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring docaargpinit → register params → docaargpstart → docaargpdestroy in order; picking a parameter type from the full public enum (DOCAARGPTYPESTRING, INT, BOOLEAN, DEVICE, DEVICEREP…

NVIDIA/skills · 267 tokens

embedded-stm32

Best practices for embedded C/C++ development on STM32 microcontrollers using the HAL, covering peripherals, DMA, interrupts, memory constraints, and hardware-focused testing. Use when writing STM32 HAL code, configuring peripherals generated by STM32CubeMX, working with interrupts or DMA, debugging with SWD/JTAG…

Mindrally/skills · 87 tokens

hip-kernel-optimization

This skill should be used when writing or tuning HIP kernels on AMD/NVIDIA GPUs, covering memory coalescing, shared-memory tiling, bank conflict avoidance, warp primitives, occupancy, vectorization, async ops, loop unrolling, and profiling.

AMD-AGI/Apex · 56 tokens