memory-gc

A maintenance command for JSONL ledger files, which store one JSON record per line. It reports their size, rotates files that exceed a limit, and can remove older rotated copies.

In plain words
What is it for?
Use it to inspect the memory ledger, rotate oversized findings or negatives files, set a size limit, or purge their backups.
Why use it?
It prevents the ledger from growing without limit and keeps old backups under control.

Command

Part of the Claude-BugHunter plugin — 11 skills, 15 commands 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 commands/zyrexnn/cybermes/memory-gc
Clone the repo
git clone --depth 1 https://github.com/Zyrexnn/Cybermes

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

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. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00040 $0.00313
Opus 5 $0.00020 $0.00156
Sonnet 5 $0.00008 $0.00063
Haiku 4.5 $0.00004 $0.00031

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

This is a copy

100% identical to memory-gc — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

knowledge/Claude-BugHunter/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. 3d 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 Zyrexnn/Cybermes (668 stars, last pushed 3d ago), licensed Apache-2.0. 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. It is 100% identical to memory-gc, differing in 0 lines, and is treated as a copy.