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.
npx skills add cass-2003/local-workflow-skill --skill memory-leaksgit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote 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/cass-2003/local-workflow-skill/memory-leaks)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/memory-leaks"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/memory-leaks/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.
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/memory-leaks"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/memory-leaks.svg" alt="Reviewed on agentmods" width="80" 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.00163 | $0.03283 |
| Opus 5 | $0.00081 | $0.01641 |
| Sonnet 5 | $0.00033 | $0.00657 |
| Haiku 4.5 | $0.00016 | $0.00328 |
Grade A, and why
memory-leaks scanned grade A with 1 finding 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
if (!cache.has(key)) cache.set(key, fetch(key)) How it starts
The opening of the file, as written. The whole thing — 405 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Memory Leaks Skill — 内存泄漏排查
何时使用
- 服务跑久了内存爆 / OOMKilled
- Chrome 页面用一会卡顿 / 标签页崩溃
- 容器 RSS 持续增长不释放
- 单元测试通过但生产泄漏
- 怀疑某个改动引入泄漏
一、判断真泄漏 vs 假象
真泄漏:内存 monotonic 增长,永不下降,最终 OOM
→ 引用链让 GC 无法回收
假象:
- 工作集大但稳定(cache 满了)→ 不是泄漏
- 临时峰值(处理大请求)→ 不是泄漏
- V8 / GC 延迟回收 → 等几分钟看是否下降
最可靠诊断:长时间观察 RSS 曲线。
# 容器
docker stats <container>
kubectl top pod <pod>
# 进程
ps aux | grep app
top -p <pid>
观察 趋势,不是瞬时值。
二、Node.js 内存模型
RSS = Resident Set Size(OS 视角,进程占的物理内存)
= V8 heap + native heap + libuv buffers + ...
V8 heap = JS 对象(GC 管)
- new space (young generation)
- old space (long-lived)
- large object space
外部缓冲区 = Buffer / ArrayBuffer
原生模块内存 = N-API addon 自管
console.log(process.memoryUsage())
// { rss, heapTotal, heapUsed, external, arrayBuffers }
三、Node 三快照对比法(黄金流程)
1. 服务启动 + 跑一会 → snapshot 1(baseline)
2. 触发可疑操作 N 次
3. 强制 GC → snapshot 2
4. 再触发 N 次 → snapshot 3
5. 对比 snapshot 2 → snapshot 3:净增长就是泄漏
// 启动允许 inspect 和 expose-gc
node --inspect --expose-gc app.js
// 代码或 console:
global.gc()
require('v8').writeHeapSnapshot('./snap-1.heapsnapshot')
Chrome → chrome://inspect → "Memory" → "Load profile" → Comparison view。
Comparison 看什么:
- "Delta" 列正数 = 增加的对象
- 按 retained size 排序
- 点对象看 Retainers(谁持有它,回溯到 GC root)
四、Node 常见泄漏模式
1. 闭包持有大对象
// ❌ 整个 huge 被闭包捕获
function makeHandler(huge) {
return () => console.log('hi') // 没用 huge 但仍引用作用域
}
// ✅ 显式提取需要的
function makeHandler(huge) {
const id = huge.id // 只引用 id
return () => console.log(id)
}
2. EventEmitter 监听器累积
// ❌ 每次 add 都加,never remove
emitter.on('data', handler)
// 1000 次 emitter.on 后,1000 个 handler 引用 closure
// ✅ 用 once 或显式 off
emitter.once('data', handler)
emitter.off('data', handler)
emitter.removeAllListeners('data')
// 检测
emitter.setMaxListeners(20) // 超出告警
emitter.listenerCount('data')
3. setInterval 不清
// ❌
const t = setInterval(() => doStuff(largeObj), 1000)
// largeObj 被 closure 抓住直到 clearInterval
// ✅
const t = setInterval(...)
on('shutdown', () => clearInterval(t))
// Node-specific:让 timer 不阻止退出
t.unref()
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 · 405 lines · 163 tokens per session scan A d1e804e13f10
memory-leaks is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 163 tokens to every session and 3,283 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
debug-optimize-lcp
Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…
systematic-debugging
Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.
diagnose
Trace from a reproduced symptom to the source code that causes it. Pin the specific file and approximate line, rate confidence in the cause and clarity of the fix independently, and always propose a concrete fix.
repro-admin
Reproduce an EmDash admin UI bug. Attach a container, start the demo dev server, drive the admin with agent-browser using the dev-bypass session, and capture the reproduction as screenshots plus a replayable transcript.
log-error-digest
Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…
byted-util-volcengine-detect-retry
An orchestration workflow for Volcengine Cloud Detect, a service that checks websites or network endpoints from test locations.