Problem
Verified circular-dependency cluster among agentLifecycle.js ↔ cosAgents.js ↔ cosAgentLifecycle.js ↔ subAgentSpawner.js ↔ agentCliSpawning.js ↔ agentManagement.js. agentLifecycle.js already uses a dynamic await import('./agentManagement.js') specifically to dodge the cycle at load time.
Approach (decided)
Extract a shared "agent registry/state" module with no dependents in this set; have lifecycle/spawner/management modules depend on it one-directionally instead of on each other. Remove the dynamic-import workaround once the cycle is gone.
Acceptance
- No runtime import cycle in this cluster; agent spawn/lifecycle tests pass.
Found by the /do:better audit (2026-07-21). Deferred from automated remediation because it is a large/high-churn structural change best landed deliberately rather than auto-merged.
Problem
Verified circular-dependency cluster among
agentLifecycle.js↔cosAgents.js↔cosAgentLifecycle.js↔subAgentSpawner.js↔agentCliSpawning.js↔agentManagement.js.agentLifecycle.jsalready uses a dynamicawait import('./agentManagement.js')specifically to dodge the cycle at load time.Approach (decided)
Extract a shared "agent registry/state" module with no dependents in this set; have lifecycle/spawner/management modules depend on it one-directionally instead of on each other. Remove the dynamic-import workaround once the cycle is gone.
Acceptance
Found by the /do:better audit (2026-07-21). Deferred from automated remediation because it is a large/high-churn structural change best landed deliberately rather than auto-merged.