memory

memory is a command for Claude Code from HermeticOrmus/LibreEmbed-Claude-Code. It costs 26 tokens per session (936 once invoked), scanned A, original, MIT.

A command for examining firmware memory, generating fixed-block pools, adding MPU stack guards, and auditing task stack usage. A map file or ELF file is a build output that records where program code and data are placed.

In plain words
What is it for?
Use it to inspect ELF or map files, create pools, configure stack protection, and generate high-water-mark audits for FreeRTOS tasks.
Why use it?
It helps reveal memory usage and catch stacks that are too small before they corrupt other data.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

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

Good fit Use it to inspect ELF or map files, create pools, configure stack protection, and generate high-water-mark audits for FreeRTOS tasks.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/hermeticormus/libreembed-claude-code/memory/github.svg)](https://agentmods.dev/commands/hermeticormus/libreembed-claude-code/memory)
Your own site
<a href="https://agentmods.dev/commands/hermeticormus/libreembed-claude-code/memory"><img src="https://agentmods.dev/badge/commands/hermeticormus/libreembed-claude-code/memory/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

Your own site · 80×15
<a href="https://agentmods.dev/commands/hermeticormus/libreembed-claude-code/memory"><img src="https://agentmods.dev/badge/commands/hermeticormus/libreembed-claude-code/memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 936 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.00026 $0.00936
Opus 5.5 $0.00010 $0.00374
Sonnet 5.5 $0.00005 $0.00187
Haiku 4.5 $0.00003 $0.00094

Measured 15d ago against content hash 82179ec5de85, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

memory 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 15d 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/commands/memory.md · 110 lines

How it starts

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

/memory

Memory management command: pool allocators, stack sizing, heap analysis, MPU protection.

Trigger

/memory <action> [options]

Actions

analyze

Analyze memory usage from a map file or ELF.

/memory analyze --elf firmware.elf
/memory analyze --map firmware.map --show-stacks

pool

Generate a fixed-block memory pool for a data type.

/memory pool --type msg_t --count 32 --thread-safe freertos
/memory pool --size 128 --count 16 --type generic

protect

Generate MPU configuration for stack protection.

/memory protect --mcu stm32f4 --guard-stack --region 7
/memory protect --mcu stm32h7 --regions "bootloader=ro,app-stack=guard"

audit

Generate stack high-water mark audit code.

/memory audit --tasks "sensor=256,comm=512,display=384" --alert-threshold 32

Process

  1. Run arm-none-eabi-size to get current SRAM usage.
  2. Identify all FreeRTOS objects and their sizes.
  3. Check uxTaskGetStackHighWaterMark for each task after 24h of typical operation.
  4. Calculate: stack usage = (initial_stack_depth - hwm) * 4 bytes.
  5. Set minimum stack = peak_usage * 1.5 (50% headroom).

Output Examples

Memory budget calculation

Flash:
  .text + .rodata: 48,320 bytes (48KB)
  .data LMA copy:     512 bytes
  Total flash:     48,832 / 1,048,576 bytes (4.6%)

SRAM:
  .data (init):      512 bytes
  .bss  (zero):    4,096 bytes
  FreeRTOS heap:  32,768 bytes
  Task stacks:     6,144 bytes  (sensor=1KB, comm=2KB, display=1.5KB, idle=256B, timer=512B)
  Total SRAM:     43,520 / 131,072 bytes (33%)

Stack sizing formula

Required stack = local variables + nested call chain depth + interrupt overhead
  + printf with %d: ~256 bytes
  + printf with %f: ~1024 bytes (avoid in embedded)
  + FreeRTOS queue send/receive: ~64 bytes
  + IRQ save/restore frame: 32 bytes (8 stacked registers * 4 bytes)

Minimum for a sensor task doing I2C reads and printf:
  = 256 (locals) + 128 (calls) + 256 (printf %d) + 64 (queue) + 32 (IRQ) = 736 bytes ≈ 192 words
  With 50% headroom: 288 words → use 384 words (configurable in 256-word steps)

Read the full file on GitHub · 110 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. 15d ago First seen · 110 lines · 26 tokens per session scan A 82179ec5de85

Subscribe to this mod's changes

memory is a command published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (50 stars, last pushed 6d ago), licensed MIT. It adds 26 tokens to every session and 936 once invoked, about $0.0001 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-10-01.