memory

A procedure for finding and fixing memory leaks, where a program keeps holding memory that it no longer needs. It repeatedly runs the suspected code, measures memory use, identifies the retained reference, and checks the result after the fix.

In plain words
What is it for?
Use it to investigate detached interface elements, growing global arrays or caches, and closures that retain large objects in Node.js, Python, or PowerShell programs.
Why use it?
It replaces guesses about memory problems with measurements across many iterations. It helps show whether memory really keeps growing and whether the change stopped that growth.

Skill for Claude CodeCodex

Part of the performance-deity plugin — 17 skills shipped together

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.

agentmods
npx agentmods add skills/v0idos/performance-deity/memory
Any agent
npx skills add v0idOS/performance-deity --skill memory
Clone the repo
git clone --depth 1 https://github.com/v0idOS/performance-deity

Made for: Claude Code, Codex.

Or install performance-deity, the plugin that ships this one along with the rest of its 17 skills.

Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 370 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00033 $0.00370
Opus 5 $0.00016 $0.00185
Sonnet 5 $0.00007 $0.00074
Haiku 4.5 $0.00003 $0.00037

Measured 2d ago against content hash bf53f4752961, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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.

skills/memory/SKILL.md · 48 lines

What it actually says

Execute all four phases in order.

Phase 1 — Isolation

  1. Identify the code suspected of leaking.
  2. Write a wrapper that runs it in an infinite loop or for ≥1,000,000 iterations.

Phase 2 — Instrumentation

Inject memory tracking into the wrapper:

  • Node.js: process.memoryUsage().heapUsed before and after each iteration.
  • Python: tracemalloc.start() / tracemalloc.get_traced_memory().
  • PowerShell: [System.GC]::GetTotalMemory($false).

If memory continuously grows without recovering after GC, the leak is confirmed. Show the growth numerically:

Iteration      0:  10 MB
Iteration 100k:  14 MB
Iteration 500k:  40 MB

Phase 3 — Fix

Identify the uncollected reference:

  • Event listeners not removed from detached DOM nodes
  • Global arrays or caches growing without a size limit
  • Closures retaining large outer-scope objects

Apply the fix:

  • removeEventListener for DOM event listeners
  • WeakMap / WeakRef for object-keyed associations that should not prevent GC
  • Object pooling to reuse memory instead of allocating new objects per cycle

Phase 4 — Report

Re-run the instrumented wrapper and present:

Metric Before After
Memory growth per 10k ops +50MB +0MB
GC pause frequency High Stable

Explain the root cause and the specific reference that was being retained.

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. 2d ago First seen · 48 lines · 33 tokens per session scan A bf53f4752961

Subscribe to this mod's changes

memory is a skill published in the GitHub repository v0idOS/performance-deity (2 stars, last pushed 4mo ago), licensed MIT. It adds 33 tokens to every session and 370 once invoked, about $0.0002 per session on Opus 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-31.

Related

Other skills, from other repositories

agent-evaluation-reporting

Use when summarizing agent evaluations where autonomous, assisted, failed, timed-out, or invalid outcomes must remain distinct and comparable.

sickn33/agentic-awesome-skills · 31 tokens

evaluating-code-models

Evaluates code generation models across HumanEval, MBPP, MultiPL-E, and 15+ benchmarks with pass@k metrics. Use when benchmarking code models, comparing coding abilities, testing multi-language support, or measuring code generation quality. Industry standard from BigCode Project used by HuggingFace leaderboards.

Orchestra-Research/AI-Research-SKILLs · 68 tokens

evaluating-llms-harness

Evaluates LLMs across 60+ academic benchmarks (MMLU, HumanEval, GSM8K, TruthfulQA, HellaSwag). Use when benchmarking model quality, comparing models, reporting academic results, or tracking training progress. Industry standard used by EleutherAI, HuggingFace, and major labs. Supports HuggingFace, vLLM, APIs.

Orchestra-Research/AI-Research-SKILLs · 85 tokens

nemo-evaluator-sdk

Evaluates LLMs across 100+ benchmarks from 18+ harnesses (MMLU, HumanEval, GSM8K, safety, VLM) with multi-backend execution. Use when needing scalable evaluation on local Docker, Slurm HPC, or cloud platforms. NVIDIA's enterprise-grade platform with container-first architecture for reproducible benchmarking.

Orchestra-Research/AI-Research-SKILLs · 76 tokens

Gene Panel Selection Workflow

End-to-end workflow for gene panel design in scRNA-seq and spatial transcriptomics, that should be STRICTLY followed: dataset understanding + smart downsampling + train/test splits, algorithmic selection (HVG/DE/RF/scGeneFit/SpaPROS), optimal sub-panel discovery (ARI vs size), biological completion with a stability…

aristoteleo/PantheonOS · 110 tokens

benchmark-radar

Find, inspect, and check AI benchmark records with the Benchmark Radar CLI. Use when a request needs benchmark discovery, details, recent Radar evidence, or local data health; do not assume why the user needs the results.

ktwu01/benchmark-radar · 48 tokens