memory-mgmt-patterns

memory-mgmt-patterns is a skill for Claude Code from HermeticOrmus/LibreEmbed-Claude-Code. It costs 53 tokens per session (1,415 once invoked), scanned A, original, MIT.

A reference guide to managing memory in embedded firmware without unpredictable allocation or fragmentation. It covers fixed memory reserved before the program runs.

In plain words
What is it for?
Use it when creating FreeRTOS tasks, queues, semaphores, and memory pools with fixed storage.
Why use it?
It helps keep memory use predictable and avoids failures caused by repeated dynamic allocation on small devices.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the memory-management plugin — 1 skill, 1 command, 1 agent shipped together

Good fit Use it when creating FreeRTOS tasks, queues, semaphores, and memory pools with fixed storage.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns
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.

Any agent
npx skills add HermeticOrmus/LibreEmbed-Claude-Code --skill memory-mgmt-patterns
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code

Made for: Claude Code.

Or install memory-management, the plugin that ships this one along with the rest of its 1 skill, 1 command, 1 agent.

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 memory-mgmt-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns/github.svg)](https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for memory-mgmt-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/memory-mgmt-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,415 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.00053 $0.01415
Opus 5.5 $0.00021 $0.00566
Sonnet 5.5 $0.00011 $0.00283
Haiku 4.5 $0.00005 $0.00142

Measured 2mo ago against content hash 72be6785f785, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

memory-mgmt-patterns 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 2mo 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/memory-management/skills/memory-mgmt-patterns/SKILL.md · 192 lines

How it starts

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

memory-mgmt-patterns

Knowledge Base

Embedded memory management patterns for deterministic, fragmentation-free firmware.


Pattern 1: Static FreeRTOS Objects

Avoid dynamic allocation for RTOS objects. All objects pre-allocated at compile time.

/* Static task */
static StackType_t  s_sensor_stack[256];
static StaticTask_t s_sensor_tcb;
static TaskHandle_t s_sensor_handle;

/* Static queue: 8 messages of 16 bytes each */
static uint8_t          s_queue_storage[8 * 16];
static StaticQueue_t    s_queue_struct;
static QueueHandle_t    s_queue;

/* Static semaphore */
static StaticSemaphore_t s_sem_struct;
static SemaphoreHandle_t s_sem;

void rtos_objects_create(void)
{
    s_sensor_handle = xTaskCreateStatic(
        sensor_task, "sensor",
        256U, NULL, TASK_PRIO_SENSOR,
        s_sensor_stack, &s_sensor_tcb);
    configASSERT(s_sensor_handle != NULL);

    s_queue = xQueueCreateStatic(8, 16, s_queue_storage, &s_queue_struct);
    configASSERT(s_queue != NULL);

    s_sem = xSemaphoreCreateBinaryStatic(&s_sem_struct);
    configASSERT(s_sem != NULL);
}

Required in FreeRTOSConfig.h: configSUPPORT_STATIC_ALLOCATION 1.


Pattern 2: Memory Pool for Variable-Frequency Messages

When messages arrive at variable rate, a pool prevents heap fragmentation:

/* Message pool: 32 messages, 128 bytes each */
typedef struct {
    uint8_t  data[120];
    uint8_t  len;
    uint8_t  type;
    uint16_t seq;
} msg_t;

#define MSG_POOL_SIZE 32U
static msg_t      s_msg_pool[MSG_POOL_SIZE];
static uint32_t   s_pool_used_mask = 0U;  /* Bitmask: bit N = msg N is in use */

msg_t *msg_alloc(void)
{
    taskENTER_CRITICAL();
    for (uint32_t i = 0; i < MSG_POOL_SIZE; i++) {
        if (!(s_pool_used_mask & (1U << i))) {
            s_pool_used_mask |= (1U << i);
            taskEXIT_CRITICAL();
            return &s_msg_pool[i];
        }
    }
    taskEXIT_CRITICAL();
    return NULL;  /* Pool exhausted: caller must handle */
}

void msg_free(msg_t *m)
{
    uint32_t idx = (uint32_t)(m - s_msg_pool);
    configASSERT(idx < MSG_POOL_SIZE);
    taskENTER_CRITICAL();
    s_pool_used_mask &= ~(1U << idx);
    taskEXIT_CRITICAL();
}

Read the full file on GitHub · 192 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. 2mo ago Changed · +5 lines · +53 tokens per session 72be6785f785
  2. 3mo ago First seen · 187 lines · 0 tokens per session scan A be141cf2e0b3

Subscribe to this mod's changes

memory-mgmt-patterns is a skill published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (50 stars, last pushed 1mo ago), licensed MIT. It adds 53 tokens to every session and 1,415 once invoked, about $0.0002 per session on Opus 5.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

memory-mgmt-patterns compared with skills from other repositories

memory-mgmt-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
memory-mgmt-patternsHermeticOrmus/LibreEmbed-Claude-CodeSkill501mo agoMITA53Claude Code
volt-otatonone-ai/tononeSkill842d agoMITA70Claude Code
volt-firmwaretonone-ai/tononeSkill842d agoMITA76Claude Code
volt-powertonone-ai/tononeSkill842d agoMITA65Claude Code
volt-drivertonone-ai/tononeSkill842d agoMITA63Claude Code
volt-recontonone-ai/tononeSkill842d agoMITA52Claude Code
iot-expertpersonamanagmentlayer/pclSkill461mo agoApache-2.0A59Claude Code