What happened
state/recent.md and state/archive.md in a project's memory folder grew unbounded over months of daily use:
recent.md — 6.4 GB
archive.md — 1.8 GB (present in two separate state folders for the same logical project — see note below)
The SessionStart hook cats both files into every new session's context. Once they hit multi-GB size, every claude launch in that project froze. On macOS this also caused iTerm2's memory usage to balloon to ~56GB, forcing a full system restart to recover.
Root cause (as far as I could tell)
Unlike now.md / today-*.md / core-memories.md, which appear to get rotated per the plugin's own tiered-history scheme, recent.md and archive.md have no size cap or rotation — they only ever get appended to. Over enough sessions/days, that's unbounded growth with no ceiling.
Fix I applied (workaround, not a real fix)
For each bloated file:
mv state/recent.md state/recent.md.bak
touch state/recent.md
# confirmed `claude -p 'ping'` worked again
rm state/recent.md.bak # once confirmed working
This recovers the session but discards all history that was in the file — there's no way to salvage/re-compress the old content back down to a reasonable size with the tools I had available.
Secondary issue noticed while debugging
Two separate state/ folders exist for what is logically the same project, because a __ in the real directory name (__XX) gets encoded differently across sessions/worktrees:
~/.claude/projects/-Users-sergii-Documents-WORK-PHP---XX-autoparts/state/
~/.claude/projects/-Users-sergii-Documents-WORK-PHP-__XX-autoparts-worktrees-ai-helper/state/
Both had their own independently-bloated archive.md. Not sure if that's expected (different physical worktree paths) or a slug-encoding bug, flagging it in case it's related.
Suggested fix
Some form of size cap / rotation on recent.md and archive.md, similar to what already exists for the tiered daily logs — e.g. roll over to an archive-of-archives once a size threshold is hit, rather than appending forever.
Environment
- macOS (Darwin 25.5.0)
- Claude Code 2.1.221 → 2.1.228 (updated during troubleshooting, bug present on both)
- Plugin:
remember@claude-plugins-official
What happened
state/recent.mdandstate/archive.mdin a project's memory folder grew unbounded over months of daily use:recent.md— 6.4 GBarchive.md— 1.8 GB (present in two separate state folders for the same logical project — see note below)The
SessionStarthookcats both files into every new session's context. Once they hit multi-GB size, everyclaudelaunch in that project froze. On macOS this also caused iTerm2's memory usage to balloon to ~56GB, forcing a full system restart to recover.Root cause (as far as I could tell)
Unlike
now.md/today-*.md/core-memories.md, which appear to get rotated per the plugin's own tiered-history scheme,recent.mdandarchive.mdhave no size cap or rotation — they only ever get appended to. Over enough sessions/days, that's unbounded growth with no ceiling.Fix I applied (workaround, not a real fix)
For each bloated file:
This recovers the session but discards all history that was in the file — there's no way to salvage/re-compress the old content back down to a reasonable size with the tools I had available.
Secondary issue noticed while debugging
Two separate
state/folders exist for what is logically the same project, because a__in the real directory name (__XX) gets encoded differently across sessions/worktrees:~/.claude/projects/-Users-sergii-Documents-WORK-PHP---XX-autoparts/state/~/.claude/projects/-Users-sergii-Documents-WORK-PHP-__XX-autoparts-worktrees-ai-helper/state/Both had their own independently-bloated
archive.md. Not sure if that's expected (different physical worktree paths) or a slug-encoding bug, flagging it in case it's related.Suggested fix
Some form of size cap / rotation on
recent.mdandarchive.md, similar to what already exists for the tiered daily logs — e.g. roll over to an archive-of-archives once a size threshold is hit, rather than appending forever.Environment
remember@claude-plugins-official