Summary
packages/runtime/src/session-manager.ts is 6,445 lines with 40+ exported interfaces, mixing session lifecycle, child agent spawning, agent graph intent, conversation copy, configuration transitions, plan state, and recovery. This god-object makes every change touch one file and makes ownership unclear.
Evidence
packages/runtime/src/session-manager.ts:1-6775 — exports 8+ categories of types including SpawnChildAgentInput, ProvisionAgentGraphOperatorInput, PlanSafeBoundaryContinuationInput, SessionConfigurationTransitionRequest, CompactSessionInput
runtime-host already consumes these via named sub-exports (@maka/runtime/session-manager); splitting internally would not break the public API
- Related files that already exist but are underused:
session-projection-helpers.ts, session-recap.ts, session-title.ts, session-trace-projection.ts
Proposed Decomposition
Extract along existing seams into separate modules:
session-manager.ts — session CRUD, lifecycle, and configuration management
child-agent-manager.ts — child agent spawning, graph intent, and agent graph coordination
session-recovery.ts — recovery, continuation authority, and history repair
session-conversation.ts — conversation copy and transcript operations
Each extracted module would be consumed through the same barrel export path, preserving backward compatibility.
Acceptance Criteria
Labels
refactor, help wanted
Summary
packages/runtime/src/session-manager.tsis 6,445 lines with 40+ exported interfaces, mixing session lifecycle, child agent spawning, agent graph intent, conversation copy, configuration transitions, plan state, and recovery. This god-object makes every change touch one file and makes ownership unclear.Evidence
packages/runtime/src/session-manager.ts:1-6775— exports 8+ categories of types includingSpawnChildAgentInput,ProvisionAgentGraphOperatorInput,PlanSafeBoundaryContinuationInput,SessionConfigurationTransitionRequest,CompactSessionInputruntime-hostalready consumes these via named sub-exports (@maka/runtime/session-manager); splitting internally would not break the public APIsession-projection-helpers.ts,session-recap.ts,session-title.ts,session-trace-projection.tsProposed Decomposition
Extract along existing seams into separate modules:
session-manager.ts— session CRUD, lifecycle, and configuration managementchild-agent-manager.ts— child agent spawning, graph intent, and agent graph coordinationsession-recovery.ts— recovery, continuation authority, and history repairsession-conversation.ts— conversation copy and transcript operationsEach extracted module would be consumed through the same barrel export path, preserving backward compatibility.
Acceptance Criteria
session-manager.tsis under 2,000 lines@maka/runtime/session-manager) is unchangedLabels
refactor, help wanted