Skip to content
AI Primer
workflow

Geoffrey Huntley compares 4 Ralph loops for porting codebases across languages

Geoffrey Huntley published a four-loop Ralph workflow for porting codebases by turning tests and source into cited specs before implementation. Try it when you need AI help translating a mature codebase across languages without losing behavioral coverage.

3 min read
Geoffrey Huntley compares 4 Ralph loops for porting codebases across languages
Geoffrey Huntley compares 4 Ralph loops for porting codebases across languages

TL;DR

  • Geoffrey Huntley published a four-loop Ralph workflow for porting codebases across languages, arguing that porting is now mostly a spec-construction problem rather than direct line-by-line translation Huntley thread workflow post.
  • The process starts by turning tests and source files into cited specs, then uses those specs plus a generated TODO list to drive implementation in the target language four steps workflow details.
  • Huntley’s writeup says the key move is to link src/* and tests/* into /specs/*.md as citations, effectively converting the old codebase into a high-level PRD with traceability back to behavior and implementation citation method.
  • A practitioner reply narrowed the claim to “well-tested software,” which matches the workflow’s heavy dependence on test-derived specs and behavioral coverage well-tested caveat four steps.

What actually shipped?

Huntley’s new post lays out a concrete four-step recipe for language-porting with Ralph loops. In the condensed version repeated in the thread, the order is: “ralph from tests/* to specs,” then “ralph from src/* to specs,” then “ralph TODO/todo.md,” and finally “implementing the target language” four steps.

The longer writeup describes those loops as separate passes with different goals. One pass creates a TODO file, another studies the entire product by having subagents inspect files under src/*, and another compresses tests into markdown specs under /specs/*.md with citations back to the original material workflow details. The framing is that the hard part is not syntax conversion but extracting a faithful, cited specification of behavior before generating the new implementation.

Why this matters for real codebase ports

The technical idea is to decouple the port from the source language by turning code and tests into cited specifications first. Huntley’s summary says those citations “reference source code during the translation process,” which makes the codebase behave more like a PRD than a pile of source files citation method. For engineering teams, that is the important shift: the workflow is optimized for preserving behavior and intent, not just reproducing structure.

A reply from dexhorthy added the caveat “porting well-tested software,” and Huntley answered with a laughing salute rather than disputing it well-tested caveat Huntley reply. That caveat fits the method. If the first Ralph loop converts tests into specs, then weak or missing tests leave the process with less behavioral ground truth. The workflow is most credible where tests/* already captures the contract the new code must satisfy.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 3 threads
TL;DR2 posts
What actually shipped?1 post
Why this matters for real codebase ports2 posts
Share on X