Agent skill

Heap Discipline

by yokki-vans in yokki-vans/InkPointX

Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer).

MITAuto-check passedDevelopment

Install Heap Discipline

skills CLI
$ npx skills add yokki-vans/InkPointX --skill heap-discipline -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yokki-vans/InkPointX heap-discipline --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yokki-vans/InkPointX.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/heap-discipline .claude/skills/heap-discipline && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
heap-discipline
GitHub stars
107
Token cost
~889 tokens
SKILL.md length
430 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer).

  • Works in 5 steps: Stack? Local, bounded, under ~256 bytes… → Compile-time constant? static constexpr… → Allocated once and reused for an… → …
  • Reviewing code that allocates: new / malloc / std::vector / std::string
  • SKILL.md covers Allocation decision procedure, Fragmentation rules, Justify every allocation and Self-review before handoff
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Heap Discipline is an agent skill from yokki-vans/InkPointX. Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer). Use whenever writing or reviewing code that allocates: new / malloc / std::vector / std::string, buffers, caches, or anything held across a loop or an activity lifecycle. Covers makeUniqueNoThrow vs raw new/malloc, fragmentation avoidance, reserve-before-pushback, alloc-once-reuse, stack vs heap sizing, and the chunked grayscale buffer pattern.

Its SKILL.md is about 890 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Embedded systems. It works with ESP32. The repository describes itself as: Firmware for Xteink X3/X4. Personal fork of Crosspoint and CrossInk. The licence is MIT.

When your agent uses it

  • Reviewing code that allocates: new / malloc / std::vector / std::string
  • Anything held across a loop
  • An activity lifecycle

Example prompts

  • “/heap-discipline”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Stack? Local, bounded, under ~256 bytes total: plain array/struct. No
  2. Compile-time constant? static constexpr lives in flash, costs zero DRAM.
  3. Allocated once and reused for an activity's lifetime? Allocate in
  4. Dynamic and fallible? makeUniqueNoThrow(...) /
  5. A C/SDK API takes ownership and frees it itself? Only then raw

What it can do on your machine

Read from SKILL.md and the folder at commit d272143. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Heap Discipline loads about 889 tokens when it runs. Until then it costs about 115 tokens; SKILL.md has 430 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~889

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from yokki-vans/InkPointX at commit d272143, republished under its MIT licence (© yokki-vans). 430 words, ~889 tokens.

Download SKILL.mdSave it as .claude/skills/heap-discipline/SKILL.md (or your agent's skills folder).
name
heap-discipline
description
Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer). Use whenever writing or reviewing code that allocates: new / malloc / std::vector / std::string, buffers, caches, or anything held across a loop or an activity lifecycle. Covers makeUniqueNoThrow vs raw new/malloc, fragmentation avoidance, reserve-before-push_back, alloc-once-reuse, stack vs heap sizing, and the chunked grayscale buffer pattern.

Heap Discipline (ESP32-C3)

CLAUDE.md states the allocation rules. This is the procedure you run while writing the code and the gate you run before handing it back.

The constraint that makes every call matter: ~380KB RAM, no PSRAM, one 48KB framebuffer. Fragmentation, not total usage, is what kills this device. Free-heap can read fine while the largest free block is too small for the next allocation. Optimize for not leaving holes, not just for using fewer bytes.

Allocation decision procedure

Ask in order; stop at the first yes.

  1. Stack? Local, bounded, under ~256 bytes total: plain array/struct. No heap, no fragmentation. Keep frames lean; the task stack is small.
  2. Compile-time constant? static constexpr lives in flash, costs zero DRAM.
  3. Allocated once and reused for an activity's lifetime? Allocate in onEnter, hold in a member, release in onExit. Never per-frame, never per-iteration.
  4. Dynamic and fallible? makeUniqueNoThrow<T>(...) / makeUniqueNoThrow<T[]>(n) from lib/Memory/Memory.h. Null-check, LOG_ERR with the size, return false. It frees on every exit path.
  5. A C/SDK API takes ownership and frees it itself? Only then raw new (std::nothrow) / malloc, with a comment naming who frees it.

Bare new / new[] is never correct here: under -fno-exceptions it calls abort() on OOM instead of returning null.

Show full SKILL.md (224 more words)Show less

Fragmentation rules

  • std::vector: reserve(n) before any push_back loop. Each growth is alloc-copy-free (three heap ops) and leaves a hole. Unknown n: estimate high.
  • No repeated new/delete or growing containers inside a loop or render path. Hoist the allocation out of the loop.
  • Large contiguous blocks fragment worst. Full-screen-class buffers use the chunked storeBwBuffer / restoreBwBuffer path in GfxRenderer so they never demand one contiguous 48KB block. Reuse that path. Do not malloc a second full-screen buffer.
  • std::string / Arduino String: acceptable on cold paths (file I/O, one-shot setup). Banned on hot/render paths. Build text with a stack char[] + snprintf; if a std::string is unavoidable, reserve it first.

Justify every allocation

Per CLAUDE.md's evidence rule: when you add a heap allocation, state in one line why stack/static/reuse was rejected and the worst-case size. If you cannot name the size, you cannot budget it, and you should not allocate it.

Self-review before handoff

  • No bare new/new[]. Every fallible alloc is makeUniqueNoThrow, or a raw alloc with an explicit owner comment.
  • Every allocation is null-checked with LOG_ERR before the error return.
  • No allocation inside a loop or render path that could be hoisted.
  • Every push_back loop has a preceding reserve.
  • Anything allocated in onEnter is released in onExit; member HalFile closed there too.
  • No second full-screen buffer; grayscale uses store/restoreBwBuffer.
  • Each new allocation carries a one-line size + why-not-stack/static note.

© yokki-vans, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/heap-discipline of yokki-vans/InkPointX.

Open the folder on GitHubat commit d272143

Compare with similar skills

Heap Discipline next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Heap Discipline compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Heap Discipline this skillyokki-vans/InkPointX107—~889Automated safety check: PassMIT
RuView Hardware Setupruvnet/RuView97k—~1.8kAutomated safety check: NotesMIT
Esp32 Firmware Engineeralxv2016/folloup-sticky1171 repos~3.8kAutomated safety check: PassGPL-3.0
RuView mmWave Radar Setupruvnet/RuView97k—~907Automated safety check: NotesMIT
Embedded DebugFastLED/FastLED7.5k—~1.4kAutomated safety check: PassMIT
Auto EmbeddedDunCanYounG-1/MICU-auto-embedded253—~1.6kAutomated safety check: PassCC-BY-NC-4.0

Similar skills

  • Brings a RuView CSI sensing node online by building ESP32-S3 or ESP32-C6 firmware, flashing the board, provisioning WiFi and checking the serial output.

    97k GitHub stars~1.8k tokensUpdated today
    DevelopmentAuto-check: notes
  • Esp32 Firmware Engineer

    alxv2016/folloup-sticky

    ESP32 firmware engineering for ESP-IDF projects. An agent skill from alxv2016/folloup-sticky.

    117 GitHub starsUsed in 1 repo~3.8k tokens
    DevelopmentAuto-check passed
  • Sets up and runs 60 GHz and 24 GHz mmWave radar sensing on ESP32 boards in RuView, alone or fused with WiFi CSI.

    97k GitHub stars~907 tokensUpdated today
    DevelopmentAuto-check: notes
  • Embedded Debug

    FastLED/FastLED

    Firmware crash analysis, stack trace decoder, and register dump interpreter for ESP32/ARM/AVR platforms.

    7.5k GitHub stars~1.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Auto Embedded

    DunCanYounG-1/MICU-auto-embedded

    全平台嵌入式 AI 开发框架(对标 Trellis):把 RIPER-5 五阶段协议 + 四文件记忆 + 分层架构门禁 + Scout/Builder/Verifier 多 Agent + 24 个工具调用技能(build/flash/debug/serial/can/modbus/visa/static/memory/rtos/scons),做成『装进工程、项目级 hook…

    253 GitHub stars~1.6k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Embedded Cpp14 Misra

    BlueAndi/Pixelix

    A skill your agent uses when writing, reviewing, or refactoring C/C++ firmware code in this repository (src/, lib/, test/) — creating or editing .h/.hpp/.cpp files, applying MISRA-oriented and…

    443 GitHub stars~2k tokensUpdated 2 days ago
    DevelopmentAuto-check passed

More from yokki-vans/InkPointX

  • Control Flow Clarity

    yokki-vans/InkPointX

    Branching and state-modeling clarity in C/C++. An agent skill from yokki-vans/InkPointX.

    107 GitHub stars~737 tokensUpdated 17 days ago
    Auto-check passed
  • Hal And Abstractions

    yokki-vans/InkPointX

    Layering and abstraction discipline for the firmware. An agent skill from yokki-vans/InkPointX.

    107 GitHub stars~791 tokensUpdated 17 days ago
    Auto-check passed
  • Refactor For Review

    yokki-vans/InkPointX

    Producing small, single-concern, reviewable changes. An agent skill from yokki-vans/InkPointX.

    107 GitHub stars~791 tokensUpdated 17 days ago
    Auto-check passed
  • Scope Discipline

    yokki-vans/InkPointX

    Feature-scope discipline for a dedicated e-reader (not a Swiss Army knife).

    107 GitHub stars~691 tokensUpdated 17 days ago
    Auto-check passed

Works with

Categories

Questions about Heap Discipline

What does Heap Discipline do?

Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer). Heap Discipline is an agent skill from yokki-vans/InkPointX. Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer).

When should I use Heap Discipline?

Heap Discipline fits situations like: reviewing code that allocates: new / malloc / std::vector / std::string; anything held across a loop; an activity lifecycle.

How do I install Heap Discipline in Claude Code?

Run `npx skills add yokki-vans/InkPointX --skill heap-discipline -a claude-code`. Or copy the skill folder (.claude/skills/heap-discipline in yokki-vans/InkPointX) into .claude/skills/heap-discipline in your project. Claude Code loads it when a task matches its description.

How do I install Heap Discipline in Codex?

Run `npx skills add yokki-vans/InkPointX --skill heap-discipline -a codex`. Or copy the skill folder (.claude/skills/heap-discipline in yokki-vans/InkPointX) into .agents/skills/heap-discipline in your project. Codex loads it when a task matches its description.

Can I use Heap Discipline in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yokki-vans/InkPointX --skill heap-discipline -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/heap-discipline, .gemini/skills/heap-discipline, .github/skills/heap-discipline and .opencode/skills/heap-discipline in your project.

What does Heap Discipline need to run?

SKILL.md names no scripts, command-line tools or credentials: Heap Discipline is instructions for the agent only.

Does Heap Discipline access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Heap Discipline safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Heap Discipline use?

Heap Discipline is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Heap Discipline use?

About 889 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Heap Discipline?

Skills that share tags, products or a category with Heap Discipline: RuView Hardware Setup (ruvnet/RuView, 97k stars), Esp32 Firmware Engineer (alxv2016/folloup-sticky, 117 stars), RuView mmWave Radar Setup (ruvnet/RuView, 97k stars) and Embedded Debug (FastLED/FastLED, 7.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Heap Discipline?

yokki-vans (a GitHub user) maintains it in yokki-vans/InkPointX, which has 107 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on September 24, 2026.

Source: yokki-vans/InkPointX on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.