Feature requestPending

Keep Claude Code session captures small enough to sync by stripping harness text or splitting long sessions

ThanhLinhPosted

The problem

The Claude Code capture hook (capture/hook.js on Stop and SessionEnd) writes one memory per session and rewrites it with the whole transcript after every turn. Long sessions that run for weeks, or that are resumed with claude --resume, grow into single memories of 15 to 18 MB. Since 1.20.1 these are correctly skipped by folder sync and listed under "Too large to sync" (limit 7.3 MB per record), but that means the most valuable working sessions are the ones that never reach the other Mac.

We looked inside three of them (18.0, 17.4 and 15.6 MB). Roughly 80 to 90 percent of each is not conversation: system and "system-reminder" blocks, text that UserPromptSubmit and SessionStart hooks inject into every prompt, project instruction files repeated on every turn, and the MCP tool catalog listed again and again (one tool name prefix alone appears about 2,000 to 2,800 times per session). After keeping only the user prompts and the assistant replies and removing duplicate blocks, the same three sessions came down to 3.8, 3.0 and 1.7 MB, with nothing useful lost.

Trimming them by hand does not last. We rewrote two closed sessions through vault_update and they now sync, but the live session's memory is overwritten with the full transcript again at the next Stop, and a resumed session regrows its memory the same way.

It would help if the capture kept only user and assistant turns and dropped system blocks, system-reminder sections and hook-injected text before saving. When a session is still over the sync limit after that, it could be split into dated parts (for example one memory per compaction segment, or per N turns) that each stay under 7.3 MB, instead of one ever-growing record. A setting for the maximum captured size per memory, and a note in the "Too large to sync" list saying the record is an auto-captured session, would also make the situation easier to understand. Secret-shaped strings (API keys, bearer tokens, signed URL query strings) would ideally be redacted at capture time too, since these transcripts end up in a shared sync folder.

Roadmap progress

  1. PENDING

  2. REVIEWING

    —

  3. PLANNED

    —

  4. IN PROGRESS

    —

  5. COMPLETED

    —

  • — ThanhLinh submitted this request

Discussion0

Newest first
  • No comments yet. Add context or ask a question below.

Sign in to comment, vote and follow this request.

Sign in to reply