Skip to content

Orphaned sessions cause 3GB+ RAM usage and 2m44s commit times #591

@alexfosterinvisible

Description

@alexfosterinvisible

Summary

Orphaned sessions accumulate silently and cause severe performance degradation:

  • RAM: entire hooks claude-code stop processes consuming 1.7GB+ each (two concurrent = 3.4GB)
  • Commit speed: entire hooks git post-commit takes 2 minutes 44 seconds per commit (synchronous, blocking)
  • Session accumulation: 76 orphaned sessions accumulated over 18 days without any warning

Impact

This went unnoticed for weeks. Real cost:

  • Every git commit blocked for ~3 minutes
  • With 6 commits per session, that is ~16 minutes of dead time per session
  • Two concurrent session stops consumed 3.4GB RAM on a dev laptop
  • entire status showed 60+ "active" sessions that were actually dead

Root Cause

Sessions from Claude Code subagents (spawned via Agent tool) are not properly cleaned up when the parent session ends. These zombie sessions remain in Entire's state and are re-processed on every commit hook and session stop.

The condensation pipeline loads full JSONL transcripts into memory. With large transcripts (up to 15MB each) and 76 sessions to process, memory balloons.

Reproduction

  1. Use Claude Code with frequent subagent spawning over several days
  2. Run entire status - observe dozens of "active" sessions from days/weeks ago
  3. Make a git commit - observe multi-minute blocking
  4. Check RAM: ps aux | grep entire shows 1.5GB+ per process

Workaround

# Fix stuck sessions (needs ACCESSIBLE=1 for non-interactive use)
ACCESSIBLE=1 entire doctor

# Clean orphaned sessions
entire clean --force

# Verify
entire status

This brought my session count from 60+ down to 12, and commit times back to normal.

Suggestions

  1. Auto-cleanup: Expire sessions that have been idle for >24h (or configurable threshold)
  2. Memory cap: Stream/chunk transcript processing instead of loading full JSONL into memory
  3. Async post-commit: The post-commit hook should run in the background. A 2m44s synchronous hook on every commit is not acceptable
  4. Visibility: Warn when orphaned session count exceeds a threshold (e.g. >10)
  5. Subagent awareness: Detect when a Claude Code session spawns subagents and auto-close their Entire sessions when the parent ends

Environment

  • Entire CLI: entire version (installed via Homebrew)
  • OS: macOS 15.4 (Apple Silicon)
  • Agent: Claude Code (Opus 4.6)
  • Strategy: manual-commit
  • Repo transcript count: 374 JSONL files, 323MB total
  • Largest single transcript: 15MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions