[COORD-012] Implement session rotation #152

Closed
opened 2026-01-31 21:05:23 +00:00 by jason.woltje · 0 comments
Owner

Objective

Implement session rotation that spawns fresh agents when context reaches 95% threshold.

Implementation Details

Build session rotation from Part 1:

Rotation process:

  • Detect 95% context threshold
  • Close current agent session
  • Spawn new agent with same type
  • Transfer next issue to new agent
  • Log rotation event with metrics

Prevents context exhaustion by starting fresh when compaction is insufficient.

Context Estimate

  • Files to modify: 1 (context_monitor.py)
  • Implementation complexity: medium (20,000 tokens)
  • Test requirements: medium (10,000 tokens)
  • Documentation: medium (3,000 tokens)
  • Total estimated: 46,800 tokens
  • Recommended agent: glm

Difficulty

medium

Dependencies

  • Blocked by: #159 (COORD-011)
  • Blocks: #161 (COORD-013)

Acceptance Criteria

  • Rotation triggered at 95% context threshold
  • Current session closed cleanly
  • New agent spawned with same type
  • Next issue transferred to new agent
  • Rotation logged with session IDs and context metrics
  • Unit tests (85% coverage minimum)

Testing Requirements

  • Mock agent context at 95% threshold
  • Test session closure
  • Test new agent spawning
  • Test issue transfer
  • Test rotation logging
  • Coverage: 85% minimum
## Objective Implement session rotation that spawns fresh agents when context reaches 95% threshold. ## Implementation Details Build session rotation from Part 1: Rotation process: - Detect 95% context threshold - Close current agent session - Spawn new agent with same type - Transfer next issue to new agent - Log rotation event with metrics Prevents context exhaustion by starting fresh when compaction is insufficient. ## Context Estimate - Files to modify: 1 (context_monitor.py) - Implementation complexity: medium (20,000 tokens) - Test requirements: medium (10,000 tokens) - Documentation: medium (3,000 tokens) - **Total estimated: 46,800 tokens** - **Recommended agent: glm** ## Difficulty medium ## Dependencies - Blocked by: #159 (COORD-011) - Blocks: #161 (COORD-013) ## Acceptance Criteria - [ ] Rotation triggered at 95% context threshold - [ ] Current session closed cleanly - [ ] New agent spawned with same type - [ ] Next issue transferred to new agent - [ ] Rotation logged with session IDs and context metrics - [ ] Unit tests (85% coverage minimum) ## Testing Requirements - Mock agent context at 95% threshold - Test session closure - Test new agent spawning - Test issue transfer - Test rotation logging - Coverage: 85% minimum
jason.woltje added the apiapip0phase-4 labels 2026-01-31 21:05:23 +00:00
jason.woltje added this to the M4.1-Coordinator (0.0.4) milestone 2026-01-31 21:10:04 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#152