Research.mp4

Research

There's a certain type of work you need to do with agents that can result in really expensive explore phases. For instance, you might need to integrate with an external service that you don't have the documentation for locally, or maybe a service where the documentation doesn't exist or isn't public.

Understanding the Problem

When working through a Ralph loop across multiple context windows, the explore phase structure looks something like this:

Diagram showing context window with explore, implementation, and testing phases

The longer and more expensive the explore phase is, the more you benefit from reducing it. This explore phase might be long because it needs to go to an external documentation site and fetch all the docs. Maybe it can't quite find what it's looking for and so it needs to continually search:

Over multiple runs, let's say you run this 10 times over a massive Ralph loop. This is just going to get really, really expensive.

Diagram showing Ralph loop split across multiple context windows

The solution? Reduce the size of these explore phases so you spend more time in the "smart zone" with less token spend:

Diagram showing reduced explore phases for more efficient loops

The Research Phase Solution

One of the best ways to do that is to start off before you actually go into a Ralph loop with a research phase. In other words, you look at everything you need to do for the PRD, you take all of the external documentation and you cache it into an asset locally.

This typically takes the form of a research.md file.

Example of research.md file

It might be: