LongCut logo

Claude Code Ralph Loop: Run Claude Code For Hours Autonomously & Code ANYTHING!

By WorldofAI

Summary

Topics Covered

  • Part 1
  • Part 2
  • Part 3
  • Part 4
  • Part 5

Full Transcript

Before we get started with this video, I just want to say happy new year's everyone. I hope that this new year is

everyone. I hope that this new year is filled with immense peace, joy, and prosperity for you and your loved ones.

But with that out of the way, we all have heard about Cloud Code. This is a remarkable agentic AI coding tool that lives directly within your terminal. It

allows you to turn ideas into working code faster than ever before, helping you build, refractor, as well as shipping with incredible speed. However,

one problem cloud code has is its single pass default nature. Even though that cloud can reason extremely well, it stops as soon as it believes the output

is good enough. In many ways, it's constrained by implicit thinking or execution budget when in reality it could do much better with native persistent loops. This is why today I'm

persistent loops. This is why today I'm back to showcase an incredible new framework that directly fixes this problem by adding force persistence.

This framework is called Ralph Loop.

Ralph Loop is actually based off of a Simpsons character, Ralph Wigum. This is

because that character, if you watch the show, embodies this childlike persistence, which repeatedly fails, making silly mistakes, yet stubbornly continues in an endless loop until it

eventually succeeds. This is mirroring

eventually succeeds. This is mirroring the AI's iterative, errorprone, but relentless, autonomous coding process.

With Ralph, Claude is no longer allowed to simply exit. It's forced to keep working until the task is truly finished. In simple terms, Ralph loop is

finished. In simple terms, Ralph loop is a framework that forces Claude code to operate in a continuous intelligent loop that autonomously is going to be iterating on its own work for as long as

you want it to run. And don't worry, they have a capability that allows you to restrict it for max iterations so that it doesn't just run through a lot of tokens and run up unnecessary costs.

What's really incredible about Ralph is how simple it is. It's a lightweight plugin that Entropic has made available and you can install it with a single command. From there, you can run this

command. From there, you can run this plugin and then use Ralph loop with a simple task and Claude will continuously reenter the loop via a stop hook. It is

going to accumulate progress over time by reading and improving its own files.

And at its core, it's essentially just a simple bash loop, but it is going to get the job done right. Huge props to Joffrey Huntley for developing this implementation. But what's wild is that

implementation. But what's wild is that Ralph's looping approach has already enabled people to run multiple sub agents together to complete extremely complex tasks. In this case over here, a

complex tasks. In this case over here, a project that would normally cost 50K USD to develop a full-on product was completed using Ralph's loop under $300.

And without Ralph loop, the user actually had extreme difficulty in getting the task to be completed, which wasn't even 10% completed as to what it was with Ralph Loop. Here is another

wild example where Ralph was even used to help create an entirely new programming language. Yep, an actual

programming language. Yep, an actual programming language, the Gen Z programming language, which believe it or not is usable in certain real world scenarios. for it to fully create that

scenarios. for it to fully create that new programming language. It was

something that sat for 30 hours to fully develop it. And it just sat AFK and ran

develop it. And it just sat AFK and ran that iterative loop to fully develop all the components. Before we get started, I

the components. Before we get started, I just want to mention that you should definitely go ahead and subscribe to the World of AI newsletter. I'm constantly

posting different newsletters on a weekly basis. So, this is where you can

weekly basis. So, this is where you can easily get up-to-date knowledge about what is happening in the AI space. So

definitely go ahead and subscribe as this is completely for free. So to get started it is super simple. Just make

sure you have the prerequisites and obviously that's by having cloud code installed and you can easily install it with a simple command where you can run this within your terminal. So in this

case I have WSL ready and locked in. I

can simply paste in this clock code command and it will install it onto my computer. Once installed you need to be

computer. Once installed you need to be on an update that allows you to use the /plugins command. And in this case, once

/plugins command. And in this case, once if you are on the latest update like 2.0.76, you should be able to use the /plugin command where you're going to be able to see that it is going to be able to allow

you to manage and create new plugins directly within the terminal. Then what

you want to do is head over to this page, which I'll leave in the description below, and copy the /plugin install command. You're going to need

install command. You're going to need this to then have it functional with clock code. So, simply go ahead and

clock code. So, simply go ahead and paste it in one time, not twice like me, and go ahead and click enter. This will

go ahead and install this plugin onto our computer and within clock. After

installing, you're going to be able to see that the /plugin command has been installed. So, if you run /plugin,

installed. So, if you run /plugin, you're going to be able to see the Ralph plugin has been installed. Now, what we can do is use the loop functionality. So

this is where you can use /raal loop and then your task and the completion promise as done. This will make sure that clock code will automatically work

on the task as number one tries to exit stop the hook blocks exit stops hook feeds the same prompt back and repeats until completion. So it's going to work

until completion. So it's going to work in this continuous loop with this five-step process and make sure that claude gets the best answer outputed.

And like I mentioned, you have the ability to add in a constraint so that it doesn't use up too many tokens. You

can add in a max iteration so that it doesn't just keep on going through an endless loop without achieving anything.

And before I have it generate something in an endless loop, some prompt best practices that you should keep in mind is that you want to have a clear completion criteria. You can't just have

completion criteria. You can't just have it work on saying that make it good. You

need to make sure that there is a strict guideline of what you want it to achieve so that it is able to have actionable items rather than just say make it good.

You want to also have incremental goals where you want to have different phases as to what you want the AI to achieve.

Self-correction is also recommended where you can't just say write code for feature X. You wanted to implement

feature X. You wanted to implement features based off of the following to-do. So have it write the failing

to-do. So have it write the failing test, implement the feature, run the test and then work through this guideline to make sure that it is able to achieve it. There's also escape

hatches which it recommends that you always use max iteration as a safety purpose, a safety net you can say. So

here is just a rough example of a quick start that I had sent in with this demo where I told it to use the Ralph loop command. Build me a REST API for to-dos.

command. Build me a REST API for to-dos.

requirements, our crude operations, input validations, test, alpha, and a couple other things. And you can see that, oh, sorry, not this one, but you can see right here that it is running

this continuous loop to help us autonomously build out this REST API to-dos. But thanks to Ralph, it is going

to-dos. But thanks to Ralph, it is going to work on various iterations so that pod is going to scaffold the API and it's going to write the crude roots better than how you would when you're

sending in a prompt to an AI agent to generate something. And you can see

generate something. And you can see thanks to the Ralph loop, it was able to create this todo rest API which you can then access and readily use. So I ran a

couple of sessions and I'm going to be comparing two different apps that I had generated. One is with a regular cloud

generated. One is with a regular cloud code that doesn't use the Ralph loop and this is where it's powered by the Opus 4.5 and it generated this paint tool.

This is a basic tool. You can see that it has a lot of cool features actually already inside. You can change the brush

already inside. You can change the brush size. So this is something that you

size. So this is something that you would typically see from a basic paint app. Now just compare it to this app.

app. Now just compare it to this app.

This is a paint flow app that was generated with the Ralph loop enabled within cloud code and this is with the opus 4.5. This is something that added

opus 4.5. This is something that added so many more features that we had requested it to add. This is where you can work with this demo app or sorry demo image and you can actually use

various sorts of features like generate a random art which I'll do in a second.

But there's actually a mirror that you can basically add in different components like a spray feature. So if

you want to add in different sorts of attributes like a spray can that adds in different sorts of effects to your image, you can do so. I don't know if this looks any good, but this is just

something random, a feature that you can actually implement within your app.

There is a paint fillup feature. You

have the ability to erase certain things, draw certain things. You have

the ability to add in shapes, lines, text, as well as emojis, which is actually pretty interesting. So, if I want, I can add in these different things. So, you can see that it did a

things. So, you can see that it did a great job in adding in all these components, which is just great to see.

You can even enhance certain things, add in your own photos. So, overall, this is an app that it was able to fully create endlessly and it was able to add in the

best features to it. If you like this video and would love to support the channel, you can consider donating to my channel through the super thanks option below. Or you can consider joining our

below. Or you can consider joining our private Discord where you can access multiple subscriptions to different AI tools for free on a monthly basis plus daily AI news and exclusive content plus

a lot more. But that's essentially the Ralph loop. This is something that I

Ralph loop. This is something that I believe will be really helpful for a lot of us who want to have an AI agent that can autonomously run intelligently, not just autonomously on its own. Something

that can run intelligently. that I

believe is a key criteria for any AI agent and I believe Ralph loop enables that. So I'll leave all these links in

that. So I'll leave all these links in the description below so that you can easily get started. Huge props to the developer. I'll leave all these blogs

developer. I'll leave all these blogs that I showcase in the video in the description there as well. But make sure you go ahead and subscribe to the second channel, join our newsletter, join the discord, follow me on Twitter, and lastly, make sure you guys subscribe,

turn on notification bell, like this video, and please take a look at our previous videos cuz there's a lot of content that you'll truly benefit from.

But with that thought guys, have an amazing day, spread positivity, and I'll see you guys fairly shortly. Hope this

new year is filled with lots of joy, peace, as well as prosperity. And I wish you guys all the best. But with that thought, guys, thank you guys so much for watching. Have an amazing day, and

for watching. Have an amazing day, and I'll see you guys fairly soon. He

suffers.

Loading...

Loading video analysis...