Skip to content

Monolith Decomposition: Refactor sw-loop.sh Core (2654 lines → Modular Architecture) #485

@github-actions

Description

@github-actions

Strategic Improvement

sw-loop.sh at 2654 lines is the largest script and most critical component (build loop = heart of system). Decompose into focused modules: lib/loop-orchestrator.sh, lib/loop-context.sh, lib/loop-iteration.sh, lib/loop-restart.sh. Improves testability, enables optimization, demonstrates platform can improve its own architecture.

Acceptance Criteria

  • sw-loop.sh reduced to <500 lines (orchestration + CLI interface only)
  • Core logic moved to 4 focused lib modules, each <600 lines
  • All existing tests pass without modification (same CLI interface)
  • Each module gets dedicated test suite with improved coverage
  • Session restart, context management, iteration logic independently testable
  • Documentation update showing new architecture and module responsibilities

Context

  • Priority: P6
  • Complexity: full
  • Generated by: Strategic Intelligence Agent
  • Strategy alignment: P6: Platform Self-Improvement (AGI-Level Readiness)

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-patrolCreated by autonomous patrol agentsready-to-buildIssue is ready for autonomous pipeline processingshipwrightTrigger Shipwright autonomous pipelinestrategicCreated by strategic intelligence agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions