---
name: "Split agents/pool/mod.rs into submodules"
---

# Refactor 415: Split agents/pool/mod.rs into submodules

## Current State

- TBD

## Desired State

Refactor the monolithic server/src/agents/pool/mod.rs (2407 lines) into focused submodules within the pool/ directory.

## Acceptance Criteria

- [ ] types.rs contains StoryAgent, PendingGuard, AgentInfo, composite_key, and related helper structs
- [ ] lifecycle.rs contains start_agent, stop_agent, wait_for_agent and their unit tests
- [ ] worktree.rs contains create_worktree, get_project_root, find_active_story_stage and their unit tests
- [ ] query.rs contains list_agents, available_agents_for_stage, get_log_info, subscribe, drain_events and their unit tests
- [ ] process.rs contains kill_all_children, kill_child_for_key, ChildKiller registry methods and their unit tests
- [ ] test_helpers.rs contains inject_test_agent and its variants (4 methods)
- [ ] mod.rs contains AgentPool struct, new(), and re-exports all public types
- [ ] Unit tests live in their respective module files, not in a separate tests module
- [ ] No public API changes — all existing imports continue to work

## Out of Scope

- TBD
