memory-analyzer

memory-analyzer is an agent for Claude Code from shashankreddy509/claude-tdd-kit. It costs 36 tokens per session (886 once invoked), scanned A, original, MIT.

A read-only code reviewer that looks for memory leaks and resources that are not properly released. It checks general application code and includes extra checks for Android lifecycle problems.

In plain words
What is it for?
Use it to review code for unclosed files and connections, growing caches, forgotten event subscriptions, cancelled timers, shutdown worker pools, and Android-specific leaks such as retained activities or views.
Why use it?
It helps find code that slowly consumes memory or leaves files, connections, listeners, timers, or threads running. This can prevent crashes, degraded performance, and wasted system resources.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the tdd-pipeline plugin — 7 commands, 13 agents shipped together

Good fit Use it to review code for unclosed files and connections, growing caches, forgotten event subscriptions, cancelled timers, shutdown worker pools, and Android-specific leaks such as retained activities or views.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/shashankreddy509/claude-tdd-kit/memory-analyzer
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/shashankreddy509/claude-tdd-kit

Made for: Claude Code.

Or install tdd-pipeline, the plugin that ships this one along with the rest of its 7 commands, 13 agents.

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-analyzer

README.md
[![agentmods](https://agentmods.dev/badge/agents/shashankreddy509/claude-tdd-kit/memory-analyzer/github.svg)](https://agentmods.dev/agents/shashankreddy509/claude-tdd-kit/memory-analyzer)
Your own site
<a href="https://agentmods.dev/agents/shashankreddy509/claude-tdd-kit/memory-analyzer"><img src="https://agentmods.dev/badge/agents/shashankreddy509/claude-tdd-kit/memory-analyzer/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-analyzer

Your own site · 80×15
<a href="https://agentmods.dev/agents/shashankreddy509/claude-tdd-kit/memory-analyzer"><img src="https://agentmods.dev/badge/agents/shashankreddy509/claude-tdd-kit/memory-analyzer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 886 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.00036 $0.00886
Opus 5.5 $0.00014 $0.00354
Sonnet 5.5 $0.00007 $0.00177
Haiku 4.5 $0.00004 $0.00089

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

Security

Grade A, and why

memory-analyzer 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 13d 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.

tdd-pipeline/agents/memory-analyzer.md · 86 lines

How it starts

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

You are a performance engineer specializing in memory management. Read-only.

What to Check

Universal (all stacks)

  • File handles, sockets, streams, or readers opened and never closed on every path (including the error path) — use the language's scoped-cleanup construct
  • Database/HTTP connections or pooled resources not returned to the pool
  • Caches and collections grown unboundedly (no eviction, no TTL, no size cap)
  • Listeners, observers, subscriptions, or callbacks registered but never removed
  • Thread pools / executors / worker groups never shut down
  • Timers and scheduled tasks never cancelled
  • Circular references that keep a graph alive, especially through a long-lived registry
  • A long-lived object holding a reference to a short-lived one (the general shape of every leak below)

Android-specific

  • Context leaks: static references to Activity/Fragment/View
  • ViewModel holding reference to Context (use ApplicationContext if needed)
  • Handler / Runnable posted without removal in onDestroy
  • BroadcastReceiver registered but never unregistered
  • Cursor / InputStream / OutputStream not closed in finally block
  • Bitmap loaded without inSampleSize or without recycling
  • Coroutine launched in wrong scope (GlobalScope, non-cancellable)
  • Flow collected without lifecycleScope — causes collection past lifecycle
  • RecyclerView adapter holding strong references to itemViews

Kotlin / JVM

  • Lambdas or anonymous classes capturing outer class references
  • Large objects in companion objects (loaded at class load time)
  • lazy delegates on large objects that are never released
  • ThreadLocals never cleared on a pooled thread

Swift / iOS

  • Retain cycles: closures capturing self strongly (use [weak self]), strong delegates (declare weak)
  • Combine AnyCancellable not stored (subscription dies at once) or stored and never cancelled
  • NotificationCenter / KVO observers added and never removed
  • Timer never invalidated (the run loop retains it and its target)
  • Long-lived Task (a loop, an AsyncSequence) capturing self strongly and never cancelled

Read the full file on GitHub · 86 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. 13d ago Changed · +11 lines 856657d0ac7c
  2. 1mo ago First seen · 75 lines · 36 tokens per session scan A 192622ccddff

Subscribe to this mod's changes

memory-analyzer is an agent published in the GitHub repository shashankreddy509/claude-tdd-kit (2 stars, last pushed 5d ago), licensed MIT. It adds 36 tokens to every session and 886 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-08-31.

Related

Other agents, from other repositories

coding-agent

Orchestrator for the issue-to-PR workflow. Given a user story ID (e.g. PROJ-1234, ENG-42.

theam/claude-dev-kit · 33 tokens

backlog-planner

Product-owner orchestrator. Given an idea, brief, or document (in any form), it reads the source, learns the team's tracker conventions, drafts a well-formed backlog (epics, INVEST user stories with acceptance criteria, sub-tasks), presents it for approval, and creates it in the configured tracker.

theam/claude-dev-kit · 68 tokens

plan-definer

Product-owner discovery orchestrator. Given a spark (an idea, even a one-liner, in any form), it reads the source, frames the problem through guided questions, explores 2–4 solution directions with trade-offs, and produces an approved product definition that feeds plan-backlog. Facilitates the PO's thinking; never…

theam/claude-dev-kit · 78 tokens

pr-reviewer

Use for high-signal review of a diff or pull request in any codebase, with emphasis on scope (PR intent), correctness, contract drift, security, performance/duplication introduced, and the project's test/coverage gate.

theam/claude-dev-kit · 50 tokens

pr-fixer

Use to resolve findings on an existing pull request - review comments, CI failures, and self-review findings - fixing code, updating tests, re-verifying gates, and pushing. The counterpart to pr-reviewer that closes the loop.

theam/claude-dev-kit · 50 tokens

coverage-guardian

Use to verify and repair the coverage gate — run the repo's unit tests with coverage, find touched files below 95%, and write the specific missing tests to close the gaps. Language- and framework-agnostic.

theam/claude-dev-kit · 48 tokens