Skip to content

refactor(run): migrate loop orchestration to TypeScript #133

@LarsCowe

Description

@LarsCowe

Problem

The entire loop orchestration is in bash (~2750 lines), requiring jq for JSON processing and cross-platform compatibility workarounds (GNU vs BSD stat, timeout, date). The TypeScript side already manages the process lifecycle but delegates all logic to bash.

Proposal (long-term)

Move loop orchestration to TypeScript while keeping bash only for CLI invocation:

  1. Rate limiting, circuit breaker checks, exit detection → TypeScript
  2. Response analysis, session management → TypeScript
  3. Driver command building → bash (thin wrapper per driver)
  4. Benefits: type safety, testability, no jq dependency, no cross-platform bash issues
  5. Must maintain all 5 driver contracts (claude-code, codex, opencode, cursor, copilot)

This is a significant rewrite and should be done incrementally after the library extraction (#132).

Files

  • src/run/ — expand from process management to full orchestration
  • ralph/ralph_loop.sh — reduce to thin driver invocation
  • All 5 drivers in ralph/drivers/

Priority

16/16 — High long-term impact, 20+ hours effort

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestralph-loopRalph autonomous loop improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions