mirror of
https://github.com/elementalsouls/Claude-BugHunter.git
synced 2026-11-24 20:30:23 +01:00
Each command file had only a description: field; the required name: field was absent, causing NLPM registration to fail for all commands. Co-Authored-By: Claude Code <noreply@anthropic.com>
2.2 KiB
2.2 KiB
name, description
| name | description |
|---|---|
| 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. |
/memory-gc
Garbage-collect the hunt-memory directory. Reports current sizes, rotates oversized files past a configurable cap, or purges old backups.
Why This Exists
Append-only logs grow without bound. On active hunters:
audit.jsonlcan reach 100 MB+ in months (every outbound request)patterns.jsonlandjournal.jsonlaccumulate forever
This command surfaces that growth and gives you a one-shot fix.
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 hunt-memory dir
What It Does
- Walks the hunt-memory directory recursively.
- Finds
audit.jsonl,patterns.jsonl, andjournal.jsonlfiles at any depth. - Prints a per-file table: live size, total (live + backups), backup count, status.
- With
--rotate: renames oversize files to<file>.1, shifting older backups up to<file>.{keep}. The oldest is dropped. - With
--purge-backups: removes every.1/.2/.3backup, keeping only live files.
Implementation
The agent shells out to:
python -m tools.memory_gc [args]
from the repo root.
Defaults
- Rotation cap: 10 MB per file
- Backups kept: 3 (so
<file>.1newest →<file>.3oldest) - Scope:
hunt-memory/and any nested target dirs
Auto-rotation fires automatically in two places:
- On every write — inside
AuditLog.log()andPatternDB.save()when the next append would exceed the cap. - On session end — a
Stophook in.claude/settings.jsonrunspython3 -m tools.memory_gc --rotateso long sessions that wrote a lot but never crossed the cap mid-session still get cleaned up.
So this slash command is mainly for ad-hoc reporting (/memory-gc with no args) and manual cleanup of accumulated backups (/memory-gc --purge-backups).