memory-gc — Claude Code command: rotate memory, install it
The memory-gc command checks the autopilot’s JSONL ledgers and rotates files that exceed a size cap. Use it when findings.jsonl or negatives.jsonl keeps growing.
MIT ★ 16,193 updated 2026-10-29
/plugin marketplace add elementalsouls/Claude-BugHunter
/plugin install claude-bughunter@elementalsoulsWhat memory-gc does
memory-gc scans the ledger directory ~/.claude/bughunter/memory/, covering findings.jsonl, negatives.jsonl, and other *.jsonl files. With no options, it reports their current sizes. The --rotate flag moves files over the limit into numbered backups .1 through .3; the default cap is 10 MB and 3 backups are retained.
Use --dir <path> to inspect another ledger directory or --max-mb N to set a different cap. The --purge-backups option removes the old copies. From the repository root, the command runs python3 engine/memory.py --gc with the selected flags. Rotation also runs when a ledger entry is appended, so a session-end hook is not needed.
What it helps with
- inspect autopilot ledger file sizes
- rotate JSONL files above the cap
- remove old ledger backups
- scan a custom memory directory
Example prompts for the agent
- Run
/memory-gcand report the current ledger sizes. - Rotate files above the default limit with
/memory-gc --rotate. - Purge backups in
<path>using/memory-gc --purge-backups --dir <path>.
How to install memory-gc
1Plugin marketplace
/plugin marketplace add elementalsouls/Claude-BugHunter/plugin install claude-bughunter@elementalsouls2Manually: put the files in place
.claude/commands/memory-gc.mdCall it with /memory-gc. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/memory-gc.mdCall it with /prompts:memory-gc. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/memory-gc.prompt.mdManually: put the files in place
.gemini/commands/memory-gc.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about memory-gc
How do I install memory-gc in Claude Code?
Add the marketplace with /plugin marketplace add elementalsouls/Claude-BugHunter, then install the plugin with /plugin install claude-bughunter@elementalsouls. The command is placed at .claude/commands/memory-gc.md.
What does memory-gc do?
It reports autopilot ledger sizes, rotates files over the configured cap, and can remove retained backups.
Can I change the ledger directory and rotation limit?
Yes. Pass --dir <path> for another directory and --max-mb N for a custom cap. Add --purge-backups to remove all backups.
Source text
memory-gc.md · MIT
--- name: memory-gc description: Inspect or rotate the autopilot ledger JSONL files (findings.jsonl, negatives.jsonl). Caps file size and keeps N rotated backups so memory does not grow unbounded. --- # /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: ```bash 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.
© Sachin Sharma · MIT · elementalsouls/Claude-BugHunter