Problem
When 30+ sub-agents are running in parallel (as in the v0.8.68 development session on 2026-07-03), the terminal UI becomes increasingly laggy. Observed symptoms:
- Typing latency increases significantly
- Terminal rendering stalls
- Memory pressure on the host machine ("my computer is freaking out")
- Agent completion events flood the parent session, bloating the transcript
This makes high-fan-out orchestration unusable for real work — the tool becomes the bottleneck at exactly the scale where it should shine.
Likely causes
- Agent completion event flooding — Each agent completion sends a
<codewhale:runtime_event> with a full summary into the parent transcript. 30+ completions = massive transcript growth
- Unbounded context growth — No mechanism to summarize or prune completed agent entries from the parent context
- Render thrashing — The TUI re-renders the full transcript on every event, and 30 simultaneous completions trigger 30 re-renders
- Worktree filesystem pressure — 40+ git worktrees each with their own build artifacts consume disk and inode resources
Scope
This issue covers the performance/degradation path:
- Throttle event ingestion — Batch agent completion events into a single render cycle instead of re-rendering per event
- Compress agent results in transcript — Store only verdict + key stats in the parent transcript; full agent output goes to artifact files
- Context budget auto-compaction — Trigger compaction when context pressure exceeds a threshold driven by agent fan-out
- Worktree lifecycle — Auto-delete worktrees after agent completion (or after configurable TTL)
- Render debouncing — Coalesce rapid TUI redraws during high-event periods
Non-goals
- Not reducing agent concurrency. The goal is to handle high fan-out, not avoid it.
- Not removing agent event data — just not rendering it all in the live transcript.
Acceptance
- 30+ concurrent agents should not cause visible typing latency
- Parent context should not grow unboundedly from agent completion events
- Terminal rendering remains responsive during agent storm
- Worktree disk usage is bounded (auto-cleanup)
- Tests: benchmark transcript growth with N simulated agent completions; measure render latency
Evidence
Observed live on 2026-07-03 running CodeWhale 0.8.67 with 41 sub-agents. Terminal became laggy, memory pressure was high, several agents cancelled themselves due to resource contention.
Problem
When 30+ sub-agents are running in parallel (as in the v0.8.68 development session on 2026-07-03), the terminal UI becomes increasingly laggy. Observed symptoms:
This makes high-fan-out orchestration unusable for real work — the tool becomes the bottleneck at exactly the scale where it should shine.
Likely causes
<codewhale:runtime_event>with a full summary into the parent transcript. 30+ completions = massive transcript growthScope
This issue covers the performance/degradation path:
Non-goals
Acceptance
Evidence
Observed live on 2026-07-03 running CodeWhale 0.8.67 with 41 sub-agents. Terminal became laggy, memory pressure was high, several agents cancelled themselves due to resource contention.