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:
- Rate limiting, circuit breaker checks, exit detection → TypeScript
- Response analysis, session management → TypeScript
- Driver command building → bash (thin wrapper per driver)
- Benefits: type safety, testability, no jq dependency, no cross-platform bash issues
- 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
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:
This is a significant rewrite and should be done incrementally after the library extraction (#132).
Files
src/run/— expand from process management to full orchestrationralph/ralph_loop.sh— reduce to thin driver invocationralph/drivers/Priority
16/16 — High long-term impact, 20+ hours effort