memory-gc

memory-gc is a command for Claude Code from elementalsouls/Claude-BugHunter. It costs 40 tokens per session (313 once invoked), scanned A, original, MIT.

A command for inspecting and rotating JSONL ledger files, which store one JSON record per line, used by an autopilot system to remember findings and negative results. Rotation replaces an oversized file with numbered backups.

In plain words
What is it for?
Use it to check ledger sizes, rotate files above a chosen limit, purge old backups, or scan a different ledger directory.
Why use it?
It keeps the ledger from growing without limit while preserving a small number of recent backups.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 engine/memory.py --gc [--rotate] [--purge-backups] [--dir PATH] [--max-mb N].

Part of the Claude-BugHunter plugin — 11 skills, 15 commands shipped together

Good fit Use it to check ledger sizes, rotate files above a chosen limit, purge old backups, or scan a different ledger directory.

Compare 6 commands from other repositories ↓
About the project

Claude Code Spec Workflow is a set of Claude Code commands and agents that organizes software work into documented stages for new features and bug fixes. It is for developers who want Claude Code to handle requirements, design, implementation, issue resolution, and verification through repeatable workflows, with the catalogue entries providing the associated commands and agents.

elementalsouls/Claude-BugHunter · 4,298 stars · on GitHub · elementalsouls.github.io

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/elementalsouls/Claude-BugHunter
agentmods
npx agentmods add commands/elementalsouls/claude-bughunter/memory-gc

Made for: Claude Code.

Or install Claude-BugHunter, the plugin that ships this one along with the rest of its 11 skills, 15 commands.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/elementalsouls/claude-bughunter/memory-gc.svg)](https://agentmods.dev/commands/elementalsouls/claude-bughunter/memory-gc)
Your own site
<a href="https://agentmods.dev/commands/elementalsouls/claude-bughunter/memory-gc"><img src="https://agentmods.dev/badge/commands/elementalsouls/claude-bughunter/memory-gc.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 313 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.00040 $0.00313
Opus 5 $0.00020 $0.00156
Sonnet 5 $0.00008 $0.00063
Haiku 4.5 $0.00004 $0.00031

Measured 8d ago against content hash 9e056ee5352f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

memory-gc 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 8d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • memory-gc — 100% identical, 0 lines differ
commands/memory-gc.md · 34 lines

What it actually says

/memory-gc

Garbage-collect the autopilot ledger (~/.claude/bughunter/memory/). Reports current sizes, rotates oversized files past a configurable cap, or purges old backups.

Usage

/memory-gc                       # report only
/memory-gc --rotate              # rotate files above 10 MB (default cap)
/memory-gc --rotate --max-mb 5   # custom cap
/memory-gc --purge-backups       # delete all .1/.2/.3 backups
/memory-gc --dir <path>          # scan a non-default ledger dir

Implementation

The agent shells out to, from the repo root:

python3 engine/memory.py --gc [--rotate] [--purge-backups] [--dir PATH] [--max-mb N]

Defaults

  • Rotation cap: 10 MB per file · Backups kept: 3 (<file>.1 newest → <file>.3 oldest)
  • Scope: every *.jsonl under the ledger dir (findings.jsonl, negatives.jsonl)

Rotation also fires automatically on append inside the ledger writer, so files stay bounded without any session-end hook.

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. 8d ago First seen · 34 lines · 40 tokens per session scan A 9e056ee5352f

Subscribe to this mod's changes

memory-gc is a command published in the GitHub repository elementalsouls/Claude-BugHunter (4,298 stars, last pushed 2d ago), licensed MIT. It adds 40 tokens to every session and 313 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-30.

Related

Other commands, from other repositories

memory-gc

Inspect or rotate hunt-memory JSONL files (audit.jsonl, patterns.jsonl, journal.jsonl). Caps file size and keeps N rotated backups so memory does not grow unbounded.

Awarexone/Agentic-Bug-Hunter · 37 tokens

remember

Log current finding or successful pattern to hunt memory. Auto-fills from /validate output if available. Usage: /remember.

Awarexone/Agentic-Bug-Hunter · 0 tokens

web3-audit

Smart contract security audit — runs through 10 bug class checklist (accounting desync, access control, incomplete path, off-by-one, oracle errors, ERC4626, reentrancy, flash loan, signature replay, proxy/upgrade). Applies pre-dive kill signals first. Generates Foundry PoC template for confirmed findings. Usage…

Awarexone/Agentic-Bug-Hunter · 0 tokens

bypass-403

Probe a 403/401 endpoint with the most-paid bypass tricks (header injection, path encoding, method swap, WAF fingerprint, vendor-specific). Wraps byp4xx when installed; otherwise runs a built-in matrix of 38+ techniques. Usage: /bypass-403 | /bypass-403 -l.

Awarexone/Agentic-Bug-Hunter · 0 tokens

spray

Password spray with hard guards — typed-hostname confirmation, lockout warning, audit log. Modes: http-form (custom login page), oauth (password grant), o365 + okta (via TREVORspray). Default delay 30min/round + 60s jitter. Usage /spray --mode --users --passes.

Awarexone/Agentic-Bug-Hunter · 0 tokens

autopilot

Run autonomous hunt loop on a target — scope check → recon → rank surface → hunt → validate → report with configurable checkpoints. Usage: /autopilot target.com [--paranoid|--normal|--yolo].

Awarexone/Agentic-Bug-Hunter · 0 tokens