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.
curl -O https://raw.githubusercontent.com/puritysb/AgentDeck/master/.agents/skills/esp32-heap-discipline/SKILL.mdgit clone --depth 1 https://github.com/puritysb/AgentDeckWrote 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.
[](https://agentmods.dev/skills/puritysb/agentdeck/esp32-heap-discipline)<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>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.
| Model | Per session | Once 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 |
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.
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 boards —
BOARD_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 inesp32/src/ui/display.cpp). Plenty of total RAM here; the constraint is write latency and internal-SRAM headroom, not bytes. - No-PSRAM boards —
BOARD_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.
- Stack? Local, bounded, under ~256 bytes: plain array/struct. The task
stacks are sized per board in
config.h(STACK_UI) — keep frames lean. - Compile-time constant?
static constexprlives in flash, costs zero DRAM. Lookup tables and string literals belong here. - 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.
- Dynamic and fallible?
makeUniqueNoThrow<T>(...)/makeUniqueNoThrow<T[]>(n)fromesp32/src/util/memory.h. Null-check, log, return. It frees on every exit path. UsemakeScopedCleanup([&]{ … })for non-owning teardown (the header is kept C++11-safe —led8x32builds at gnu++11 — so construct the guard via the factory, not C++17 CTAD). - 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.printferror and a comment naming who owns it. The display driver objects indisplay.cppare this case (one-time, device-lifetime).
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.
- 7d ago First seen · 103 lines · 122 tokens per session scan A c0cd0d6e63d7
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.
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.
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.
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.
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…
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…
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.