Skip to main content

Agent File Rename Plan

Status: fully implemented. All loop_* files have been renamed to agent_* and turn_*, turn.go and turn_exec.go have been merged into turn_state.go, and the pipeline files (pipeline.go, pipeline_setup.go, pipeline_llm.go, pipeline_execute.go, pipeline_finalize.go) exist. The current pkg/agent/ directory matches the final file structure listed below. Nothing in this plan is pending.

Goal​

Unify pkg/agent/ package file naming to resolve the loop_* prefix naming confusion and unclear responsibility boundaries.

Change Overview​

File Renames (12 files)​

OriginalNewDescription
loop.goagent.goAgentLoop main body + lifecycle methods
loop_message.goagent_message.goMessage handling and routing
loop_outbound.goagent_outbound.goResponse publishing
loop_event.goagent_event.goEvent system
loop_command.goagent_command.goCommand processing
loop_steering.goagent_steering.goSteering message handling
loop_transcribe.goagent_transcribe.goAudio transcription
loop_media.goagent_media.goMedia processing
loop_mcp.goagent_mcp.goMCP initialization
loop_utils.goagent_utils.goUtility functions
loop_inject.goagent_inject.goDependency injection
loop_turn.goturn_coord.goTurn coordinator

File Merges (2 → 1)​

OriginalNewDescription
turn.go + turn_exec.goturn_state.goTurn-related type definitions

Final File Structure​

pkg/agent/
├── agent.go # AgentLoop + Run/Stop/Close lifecycle
├── agent_message.go # Message processing
├── agent_outbound.go # Response publishing
├── agent_event.go # Event system
├── agent_command.go # Command processing
├── agent_steering.go # Steering
├── agent_transcribe.go # Transcription
├── agent_media.go # Media processing
├── agent_mcp.go # MCP
├── agent_utils.go # Utility functions
├── agent_inject.go # Dependency injection
├── turn_coord.go # runTurn + coordinator
├── turn_state.go # turnState + turnExecution + Control + ToolControl + LLMPhase
├── pipeline.go # Pipeline struct + NewPipeline
├── pipeline_setup.go
├── pipeline_llm.go
├── pipeline_execute.go
└── pipeline_finalize.go

Naming Convention​

PrefixContentExample
agent_*AgentLoop method filesagent_message.go, agent_event.go
turn_*Turn lifecycle relatedturn_coord.go, turn_state.go
pipeline_*Pipeline methodspipeline_setup.go, pipeline_llm.go
context_*Context managementcontext_manager.go, context_legacy.go
hook_*Hook systemhook_process.go, hook_mount.go

Architecture Layers​

┌─────────────────────────────────────────────────────────┐
│ AgentLoop (agent.go) │
│ - Message loop Run/Stop/Close │
│ - Dependency injection (agent_inject.go) │
│ - Message routing (agent_message.go) │
│ - Response publishing (agent_outbound.go) │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Turn Coordinator (turn_coord.go) │
│ - runTurn(): main coordinator │
│ - abortTurn(): abort │
│ - selectCandidates(): model selection │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Pipeline (pipeline_*.go) │
│ - SetupTurn(): initialization │
│ - CallLLM(): LLM call │
│ - ExecuteTools(): tool execution │
│ - Finalize(): finalization │
└─────────────────────────────────────────────────────────┘

Verification Results​

  • ✅ go build ./pkg/agent/... - Pass
  • ✅ go vet ./pkg/agent/... - No warnings
  • ✅ go test ./pkg/agent/... -skip "TestSeahorse|TestGlobalSkillFileContentChange" - Pass