size

size is a command for Claude Code from jzl-maker/EA-SKILL. It costs 0 tokens per session (1,557 once invoked), scanned A, original, MIT.

A command that reads a Keil compiler .map file, a build report describing where firmware uses memory. It reports Flash, RAM, stack, and heap allocation and compares usage with warning limits.

In plain words
What is it for?
Use it with Keil MDK projects to scan a map file, calculate memory usage, and show normal, warning, or over-limit status. It can also output JSON.
Why use it?
It makes it easier to spot firmware that is approaching the chip's memory limits before the problem causes a build or runtime failure.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it with Keil MDK projects to scan a map file, calculate memory usage, and show normal, warning, or over-limit status. It can also output JSON.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/jzl-maker/ea-skill/size
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/jzl-maker/EA-SKILL

Made for: Claude Code.

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 size

README.md
[![agentmods](https://agentmods.dev/badge/commands/jzl-maker/ea-skill/size/github.svg)](https://agentmods.dev/commands/jzl-maker/ea-skill/size)
Your own site
<a href="https://agentmods.dev/commands/jzl-maker/ea-skill/size"><img src="https://agentmods.dev/badge/commands/jzl-maker/ea-skill/size/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 size

Your own site · 80×15
<a href="https://agentmods.dev/commands/jzl-maker/ea-skill/size"><img src="https://agentmods.dev/badge/commands/jzl-maker/ea-skill/size.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,557 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.00000 $0.01557
Opus 5.5 $0.00000 $0.00623
Sonnet 5.5 $0.00000 $0.00311
Haiku 4.5 $0.00000 $0.00156

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

Security

Grade A, and why

size 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 1mo 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.

commands/size.md · 90 lines

How it starts

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

命令: /ea size (固件资源分析)

功能

解析 Keil 编译生成的 .map 文件,统计固件 Flash / RAM / 栈 / 堆 使用情况,并支持超限预警(使用率 ≥ warn 警告,≥ err 超限)。

能力 数据来源 说明
Flash 用量 Total ROM Size(Code + RO Data + RW Data) 对比 Flash 容量出使用率
RAM 用量 Total RW Size(RW Data + ZI Data) 对比 RAM 容量出使用率
栈/堆 Global Symbols 里 STACK / HEAP Section ⚠️ startup 定义的分配量,非运行期峰值
超限预警 使用率 vs --warn/--err 阈值 ✅ 正常 / ⚠️ 偏高 / ❌ 超限
容量来源 Execution Region 的 Max(链接脚本区域上限) --flash-kb/--ram-kb 可覆盖

适用:Keil MDK 工程(armcc v5 / armclang v6 的 .map 格式)。GCC/其他工具链暂不支持。

调用方式

py <SKILL>/tools/resource/scripts/size_tool.py --project <工程目录>
# 自动扫描工程下最新 .map → 输出 Flash/RAM 使用率 + 栈/堆 + 预警

# 显式指定 .map(编译产物在 Listings/ 或 build/ 下)
py .../size_tool.py --map build/xxx.map

# 覆盖容量 + 收紧阈值(芯片实际容量与链接脚本不一致时)
py .../size_tool.py --map build/xxx.map --flash-kb 512 --ram-kb 144 --warn 85 --err 92

# AI 解析用 JSON
py .../size_tool.py --map build/xxx.map --json

参数表

参数 必须 说明
--map <file> 是(动作) 显式指定 .map 文件
--project <dir> 是(动作) 工程目录,扫描最新 .map
--flash-kb N 否 Flash 容量 KB(缺省用链接脚本 region Max)
--ram-kb N 否 RAM 容量 KB(缺省用链接脚本 region Max)
--warn 否 预警阈值 %(默认 90)
--err 否 超限阈值 %(默认 95)
--json 否 结构化 JSON 输出
--dry-run 否 只打印流程不解析

工作流程(AI 执行闭环)

1. 定位 .map     --project 扫描,或 --map 显式指定(通常 Listings/ 或 build/ 下)
2. 容量确定      缺省 region Max;芯片手册容量与链接脚本不符时 --flash-kb/--ram-kb 覆盖
3. 读取总量      Flash = Total ROM,RAM = Total RW
4. 计算使用率    used/capacity × 100 → ✅/⚠️/❌
5. 栈/堆         STACK/HEAP 分配量(startup 定义)
6. 预警判断      任一 ≥ warn 提示,≥ err 标超限 → 结论(是否逼近容量上限)

示例闭环:/ea size --project . --flash-kb 512 --ram-kb 144 → Flash 21.8% ✅、RAM 50.4% ✅、栈 32KB → 判断固件内存余量充足。

注意事项

  1. 栈/堆是分配量:STACK/HEAP 是启动文件里定义的大小(本工具读 .map 符号值),不是运行期实际峰值。实际峰值栈用 /ea debug 读 SP(__initial_sp - SP)测量。
  2. 容量缺省取链接脚本 region Max:.sct 里 LOAD_REGION/RW_IRAM1 的 Max 就是芯片可用量;若链接脚本人为缩小区域(如给 BootLoader 预留),Max 会小于芯片容量,此时用 --flash-kb/--ram-kb 覆盖成芯片真实值。
  3. ZI-data 计入 RAM:Total RW = RW Data + ZI Data(含 bss 未初始化段)。
  4. GBK 编码兼容:工程路径含中文时 .map 可能是 GBK 编码,解析器自动回退。
  5. ⚠️ Flash 口径与 Keil 面板可能差几百字节 —— 两个数都对,别当成 bug。

Read the full file on GitHub · 90 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. 1mo ago Changed f0cd40b605ce
  2. 1mo ago Changed · +12 lines 6c485928d06f
  3. 1mo ago Changed a31840f630a8
  4. 1mo ago First seen · 78 lines · 0 tokens per session scan A a81fcbfeb600

Subscribe to this mod's changes

size is a command published in the GitHub repository jzl-maker/EA-SKILL (9 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,557 tokens. 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-31.