← все видео

The Ralph Wiggum Loop explained. AI long-running agents made easy!

Morning Maker Show with Sandra and Dan · 2026-02-23 · 17м 44с · 8 172 просмотров · YouTube ↗

Топики: ai-loop-engineering

🎧 Аудио

📝 Summary

model=deepseek-v4-flash · prompt=summary-v7 · 5 585→3 438 tokens · 2026-07-20 12:05:58

🎯 Главная суть

Ralph Loop — техника запуска AI-агента в цикле, где каждая итерация начинается с чистого контекста, а состояние хранится в текстовых файлах и git-коммитах. Агент выбирает задачу из подготовленного списка, реализует её, пишет тесты, проверяет корректность, фиксирует результат и переходит к следующей. Такой подход позволил выполнить 250 задач за 37 часов непрерывной работы по требованиям объёмом 2000 строк. Ключевые условия успеха — детальный PRD, дробление на мелкие задачи с чёткими критериями проверки и грамотно настроенный промпт для каждой итерации.

🔁 Принцип работы Ralph Loop

На каждом шаге цикла агент получает чистый контекст — в него не попадает история предыдущих итераций. Ориентируясь на список задач (task.json), где у каждой указан приоритет и статус (passing или нет), он выбирает самую важную незавершённую задачу. Затем читает её spec-файл с детальным описанием и пошаговой инструкцией, реализует код, пишет тесты, запускает проверки (линтер, type checker), делает скриншот и коммитит изменения. Если все задачи помечены как прошедшие проверку, цикл останавливается.

🧠 Почему чистый контекст важен

LLM при длительном диалоге входит в так называемую «тупую зону» — забывает ранние части разговора и генерирует некачественный код. Сброс контекста на каждой итерации предотвращает это. Между итерациями состояние проекта сохраняется в файловой системе и git, поэтому агент не теряет прогресс, а каждая новая сессия начинается «свежей». Это принципиально отличает Ralph Loop от предыдущих подходов, где контекст рос бесконтрольно.

📋 Требования и декомпозиция — основа успеха

Перед запуском цикла необходимо сформировать Product Requirements Document (PRD). Пользователь может просто выгрузить мысли в произвольной форме («brain dump»), а затем специальный AI-агент превращает их в профессиональный документ. Если агенту не хватает данных, он задаёт уточняющие вопросы. После утверждения executive summary он автоматически разбивает требования на мелкие задачи и для каждой создаёт spec-файл. В этом файле содержатся: подробное описание, шаги реализации, критерии верификации, зависимости и технические заметки. Сам task.json хранит только минимальные метаданные — название, приоритет, статус и ссылку на spec-файл. Это экономит место в контексте на каждой итерации.

🛠️ Практический запуск: установка и первый промпт

Для повторения workflow нужно Docker, Cloud Code и одна команда: npx @pji/ralph-loop. Она устанавливает все скрипты и агентские навыки. Затем пользователь пишет единый промпт с описанием проекта: функциональность, UI-взаимодействия, потоки данных, платёжная интеграция. Рекомендуется сразу указать все необходимые API-ключи в .env (база данных, платёжный сервис, LLM-провайдер). Если интеграция с внешним сервисом неочевидна, агент может опросить пользователя — например: «Для платежей я хочу Polar.sh, но не знаю, как реализовать embedded checkout. Опроси меня и убедись, что я предоставлю все детали». Лучше всего приложить Markdown-версию документации сервиса (например, сохранить страницу SuperData как .md и указать путь в требованиях). Это предотвращает «implementation drift».

🤖 Этап планирования: вопросы, утверждение, декомпозиция

После отправки промпта AI-агент анализирует требования, заполняет пробелы и при необходимости задаёт пользователю вопросы. Когда все неясности сняты, он создаёт executive summary. Если пользователь его утверждает, генерируется полный список задач. Затем каждая задача разбивается на простые шаги реализации — для каждой можно просмотреть и дополнить детали. Пропускать этот этап нельзя: без контроля качества на выходе будут неприятные сюрпризы.

📂 Основной промпт и правила цикла

Главный промпт, который подаётся на каждой итерации, остаётся кратким. Он включает:

Цикл останавливается, когда все задачи проходят проверку. При необходимости можно добавить дополнительные условия выхода.

🎯 Агентские навыки и best practices для масштабирования

Для больших проектов простого промпта недостаточно. В файле agents.md прописаны правила: дробить файлы, не допускать строк длиннее разумного лимита, поддерживать низкое количество строк в модулях. Это предотвращает появление файлов на 7000 строк, с которыми LLM не может работать. Через skills.sh можно установить дополнительные навыки: написание лучших end-to-end тестов, unit-тестов, стандарты фронтенда и бэкенда. Они значительно повышают качество и консистентность кода. Все инструкции должны быть краткими и ёмкими.

⏱️ Применение: прототипирование, тесты, миграции

Ralph Loop особенно эффективен в трёх сценариях:

🔮 Новая роль разработчика

Ральф-луп не заменяет человека, а меняет его функцию. Теперь разработчик становится архитектором и делегатором: он пишет чёткие требования на естественном языке, выбирает технологические решения, утверждает задачи и ревьюит результат. Умение мыслить на высоком уровне и эффективно передавать задачи AI — ключевой навык в ближайшие годы. Цикл — лишь надводная часть айсберга, ставшая возможной благодаря многолетнему прогрессу в AI-кодинге и улучшению моделей.

📜 Transcript

en · 3 195 слов · 42 сегментов · flagged: word_run (1 dropped, q=0.97)

Показать текст транскрипта
Wait, hold up. This shouldn't have worked. Why does it work? I can press the light switch? My god, it did it. It implemented dark mode. There's a new AI coding tool that's been going viral over the past weeks. It made so many waves that some were quick to call it the end of software development. I'm, of course, talking about the Ralph Wiggum loop. On paper, it's an incredibly simple concept. Just have an AI agent loop. over and over until the task is complete on paper. But the reality in the field is this is just the tip of the iceberg. But nobody tells you this and nobody even shows you how to run this thing correctly. Until today, I have spent the past weeks watching hundreds of hours of YouTube and reading countless articles on the topic to put a workflow together that actually works so you don't have to. By the end of this video, You will learn how to run your own route loop and get all the scripts, prompts, and agent skills necessary to get started. How do I know this works? I have used this technique to ship not one, not two, but three complete projects. With this setup, I got AI to work for 37 hours straight, complete over 250 tasks that were based on a humongous 2000 line long requirements document so is this the end of software development i have some thoughts on that a bit later but one thing is certain i will equip you with all the tools that you need to try this out and decide for yourself just keep in mind when you clicked on this video and decided to watch it you instantly joined the top one percent you are at the forefront of technology and that means It's pretty rough out there. Tooling hasn't caught up yet. The closest implementation we have is the Ralph Loop plugin by Cloud Code, which by now has been considered by everybody to be wrong because it actually goes against the Ralph Loop principles. But before that, what is the Ralph Loop and what makes it so powerful anyway? At its core. RALF is a loop that runs the same exact prompt over and over again until it reaches stopping criteria. Every iteration starts from a fresh context. The AI decides what work needs to be done, usually by looking at a task list, and then proceeds with the implementation. When the task is done, it will verify it for correctness. And if all the tests pass, it will mark it as complete and then start on the next iteration. This continues until all tasks are complete. This differs from previous workflows in one critical way. Each iteration starts with a fresh context and the state between iterations is kept in plain old text files and git commits. Why? This keeps the context usage low and prevents the LLM from going into the so-called dumb zone. where it starts to forget the initial parts of the conversation. As a consequence, this allows for more complex projects to be built. And it makes perfect sense. As a human developer, you don't think of the entire project at the same time. When you start on a task, you usually open up the relevant files and you come up with a plan. This is all not that different and perhaps is the reason why the route loop works so well. you need to write requirements. You need to break them down into small manageable tasks and you need to define precise success criteria. Nobody tells you this because let's be honest, it becomes a lot less sexy than running a basic loop. And luckily for you, I read the material already and I have encapsulated it in the workflow. The good news is I've incorporated all of this knowledge into the agent skill I'm about to share with you. In fact, What I'm about to share with you will be incredibly freeing. It will be a way for you to just dump your ideas and your thoughts in your own words. And then there will be a skill that takes that, creates a professional product requirement document, and then breaks it down into tasks for you to review that are perfectly suited for an Agendic AI. that is running in the Ralph loop. So let me show you how to set this up. Before that, I want to share an awesome platform with you. The problem is, as soon as I went to their landing page, I got so many startup ideas that I thought maybe I shouldn't be sharing this with you. You see, we're in a time where building MVPs and trying out ideas has never been easier. You can literally have a tool like Ralph coding while you sleep. So Why not build a startup? Today's sponsor, Superdata, provides an easy way to extract transcripts from sources like YouTube, TikTok, Instagram, or even Facebook. The second I went to Superdata's website, my brain was flooded with business ideas. You could build a B2B brand research app that notifies companies when somebody mentions them in a TikTok video, for example. Or you could code a SaaS that looks at the trending YouTube videos and creates blog posts for search engine optimization. Or you can help companies enter the booming creator economy by creating an app that analyzes an influencer's content and tells them if it aligns with their brand values before partnering up. With Superdata, you can build all of these and a ton more. So check out Superdata at superdata.ai. And why not launch a startup today? Okay, back to it now. I've made it as simple as possible to replicate my workflow. Before we start, you'll need a couple things installed. Docker and Cloud Code. Then you need to run only one command to get started, and that is... npx at pji slash ralph loop and that will install all the necessary scripts and skills so you can focus on your brand new job as a boss and chief architect by the way you can find the link to all instructions prompt and source code in the description of the video after you run the script you can brain dump all of the requirements into one prompt so let's see here i'm going to build an app that creates multi-language subtitles for my youtube videos just give me a second to write it down And that should do it. I wrote that the app should take a video link from YouTube, then transcribe it with Superdata, and then finally generate subtitles in multiple languages that I can download. I dumped everything that I could think of in the prompt. For example, UI interactions, flows, payment integration, and any other technology that I could think of. Pro tip, you should also include any API keys you might need beforehand. Write them down into a .env file. and add them to the root of your project. You typically need some for your database, payment service, or LLM provider if you use that. Without these keys, it will just move forward without actually verifying the implementation, and you might have some really nasty surprises later on. And if you don't know what to put in there, that's perfectly fine. We can ask the AI to help us as part of the requirements. For example, if you're not exactly sure about the payment, you can add this. For payment, I want to use Polar.sh, but I'm not sure exactly how to implement the embedded checkout. Interview me about it and make sure I provide all the necessary details as well as keys or settings needed for the integration. One more important thing here. When you're integrating with a third party service, I recommend that you point the AI agent to the precise documentation of that. service so you avoid implementation drift. Especially with a route loop, you don't want the AI to do guesswork. What works the best is to go to the docs of the service. So for example, let's take SuperData, then press View as Markdown, and then save the Markdown file into your project. In the requirements, you should include links to these Markdown files. So I will do that for SuperData, Polar, and Better Off, just to cover all the third-party services I'm about to use. Okay. Time to send the prompt now. Behind the scenes, there's an agent skill that takes the raw requirements and is trying to fill in the gaps for us. When it can't, it will ask me questions such as this one. After I answer all the questions, it will create an executive summary. If I approve this, it will proceed to create a task list. And then afterwards, it will take each task and break it down into simple implementation steps. For each of them, you'll get the chance to review and specify any additional details it might have missed. Don't skip this. I know you will have an incredible urge to just accept everything and not read the task, but I'm warning you, if you don't, you will have a lot of nasty surprises later. Okay, I'm itching to run the Ralph loop now, but there's just a couple more things we need to do before. Number one, I need to log into my Cloud Code account. And number two, we should probably bootstrap some things in our code base. Now let's log in into CloudCode. Ralph needs CloudCode to run with full permissions. But don't worry, my script runs in a sandbox Docker environment, so CloudCode won't be able to nuke your operating system, for example. To log in into our account, we need to run this Docker command, then answer yes to the bypass permissions mode, and then exit. Number two, you don't really need to bootstrap your code base, but I highly recommend it. Why? It will save you time, tokens, and you will start with better foundation that you control for example i will run the cli to scaffold a backend plus frontend project and while i'm at it i will also install the libraries for off and payments too it just takes a second it's done now the moment we've been waiting for we can finally run ralph.sh and see the magic happen. Ralph picked up a task based on priority and started to implement it. The script shows a sneak peek of what's going on so we can keep an eye on things. And that's it. There's really nothing else we have to do. It will blast through all of the tasks until the project is complete. I recommend that you start with one, two iterations first, just to see that the things are right. And as you get more confident, you can increase it to 10 iterations and then later on to a higher number, such as 30 iterations, which should be enough to let it run. overnight for example but hold up what is really going on behind the scenes how is this all put together it is now time to dive deep into all the prompts and skills and setup a good place to start is the product requirements document we generated this document serves as the source of truth for the entire project that means It can be used to regenerate tasks if needed because it contains all the high level requirements as well as the implementation details. This is way too big for AI to work with. So it has been broken into small. manageable tasks. Let's take a look at those. Tasks are saved into a very efficient task.json file. This needs to be efficient because it will be loaded into context every time a new iteration of the RALF loop starts. They only contain a name, minimal metadata, and most importantly, if they're passing or not. That's how the AI knows which task to pick up next. I'll show you more in just a second, but before that, I want to mention One very important property in the task list. Each task has a link to a spec file. If we open that up, we see a long description as well as detailed steps needed to complete the task. It also mentions how the agent can verify the tasks as well as dependencies and technical notes. So this is how the tasks are set up. But what about the main prompt that is sent with each iteration? This, like the task list itself, should also be kept. small, and to the point. After weeks of iteration, this is what I ended up with. First of all, we point the agent to a summary.md file. This was generated together with the requirements and contains a super brief description of the project. Since we start with a fresh context in each iteration, it is quite important to have this, especially for the more abstract tasks. Next, we provided instructions on how to start the development environment. This is key because we want the AI to have a feedback loop to verify its changes. With this out of the way, it's time to look into the instructions for the task loop itself. In each iteration, the agent picks whatever it deems to be the highest priority task that is not passing. It reads the full spec, then implements, then writes tests, then checks for correctness. At the end, it saves the screenshot, lints, and types checks the code. It then wraps up the task by writing the log entry of what was done, and finally, it commits the changes. If all tasks are passing, then the agent will output promise complete. And that is essentially how the script knows to stop iterating. As I got wiser, I added a few more rules and outputs that should break the loop. On top of that, I also gave the log file less priority. Even though this is different from other route flip implementations out there, I really didn't see any downsides to it. And that's it. After completing hundreds and hundreds of tasks, this is my main prompt. But that is not all. As I got wiser, I added a lot more instructions to agents.md and quite a few extra agent skills. For example, skills to write better end-to-end tests, unit tests, or best practices on front-end and back-end development. This helped a ton with the quality and consistency of the code. I highly encourage you to check skills.sh to install any relevant agent skills, even before you start the loop. The agents.md instructions are extremely important if you want Rolf to scale with a larger codebase. It covers splitting up files, keeping the line number low, and essential best practices. As with the others, you need to keep this file small and concise. Why is this needed? I have discovered this the hard way by finding a 7000 line file in my code base. that the AI was really struggling to work with. Similarly, I have found an end-to-end test file with over 12,000 lines in it. No matter how good models such as Opus 4.5 or GPT 5.2 are, the files will slowly grow and become ineffective. That is, if you don't include these instructions. If you haven't figured it out by now, your role is about to change from the one who executes to the one who plan, architects, delegates and finally reviews the output. Because of that, I think one of the most important skills, pun intended, that you will have to master in 2026 is thinking at a higher level and delegating work effectively. You'll also need to specify user needs, user interfaces or technological choices in plain text in a simple, concise and unambiguous language. This is in part one of the reasons why some say software development is about to fundamentally change in 2026. Now you might ask, why do I need this RALF loop when I can just copy and paste the same prompt over and over again? That is a great question. To me, the loop is just the tip of the iceberg that was enabled by years of AI coding experience and model improvements. It is not that the loop makes this workflow. possible, but it is more that the loop is possible because of this workflow. There is one huge advantage to the loop though. You can set it off and let it run for hours and hours completely unsupervised. That means you can start it before you go to sleep and then wake up in the morning to a bunch of completed tasks. They might not be perfect, but you will be further ahead than when you went to sleep. So this gives you the opportunity to MVP those million dollar ideas you never had time for. You know, the ones you kept in your notes for years and you never got to build. Or perhaps it's time to ship that portfolio website that you never got around to or that crazy side project to automate your garage door. There are lots of opportunities here. So if you ask me that in the real world of software development, is this just hype or is it actually useful you need to understand that this is a tool we've always had tools and software development the difference is that the best developers always know which is the right tool for the job so like any tool it has its own set of strengths and weaknesses for example it can be very good at prototyping at doing mvps and helping you with idea exploration but it's also extremely good at writing automated tests and especially end-to-end tests that are very time consuming traditionally it is also good at migrating an entire code base to a new version of a framework or library or even migrating you to a new cloud for example all that said i think it's very important for you to get comfortable with it try it out do a project see how it works and understand it. Because looking at all the code tests and documentation it has done for me in such a short time, I really think this is not going away anytime soon. And with that, I would like to thank you for watching this video. Remember to like, comment and subscribe. These videos take weeks for us to make. So your support means the world to us. Until next time, happy coding.

⚙️ Pipeline jobs

StageStatusAtt.UpdatedError
download done 1/3 2026-07-20 12:04:36
transcribe done 1/3 2026-07-20 12:05:23
summarize done 1/3 2026-07-20 12:05:58
embed done 1/3 2026-07-20 12:06:00

📄 Описание YouTube

Показать
Learn how to set up a Ralph Wiggum Loop and ship entire apps with AI. 
With one command, you'll be up and running with a Ralph Loop using a secure Docker Sandbox.

Nobody shared a complete Ralph Wiggum workflow for long running tasks that actually works. 
In this video, I break down what a Ralph Loop is, why the Claude Code Ralph Loop plugin shouldn't be used, and how to run your own Ralph loops inside any of the popular CLIs: Claude Code, Codex CLI, Gemini CLI, Copilot CLI, OpenCode and more!

I'll share a github repository, prompts, and the full setup, including prompts, skills and scripts.

This technique that let me run AI for 37 hours straight, completing 250 tasks from a 2000-line requirements doc. Surprisingly, the app worked.

But it was no accident, this is the result of 6 weeks of iteration.
I explain it all in the video!

To try Supadata transcript API & support the channel:
👉 https://dub.sh/ePsQzep

Link to Full guide and Ralph Wiggum Loop Bash script:
👉 https://dub.sh/PBdtVT3

Chapters:
00:00 Overview
02:06 What is the Ralph Loop
04:54 Supadata 
06:14 Step by Step Instructions
06:23 1. Install Ralph Loop
06:43 2. Writing Requirements / PRD
07:41 (handling unknown requirements)
08:41 3. Task generation & review
09:21 4. Log in & bootstrap codebase 
10:18 5. Running Ralph Loop
10:55 How it works
11:25 Task lookup table
11:49 Task specification & acceptance criteria
12:04 Main Prompt Loop
13:25 Pro tips to get the most out of a Ralph Wiggum Loop
14:33 What this means for you
15:11 Ralph Loop use Cases
16:16 Hype or real world value?

By the end of this video, you'll know how to set up and run your own Ralph Wiggum Loop and just build apps by describing them in your own words. You will be able to let the AI agent run unsupervised using Claude Code, Codex, or
Gemini CLI (and more)

The video contains a complete tutorial on the workflow to go from idea to shipped project while you sleep:

1. What the Ralph Wiggum Loop is and why it works
2. Install everything with a single command
3. Brain dump your requirements in plain text
4. Generate a PRD and break it into AI-ready tasks
5. Run the loop and let it code overnight
6. The anatomy behind the scenes: prompts, tasks, skills and agent instructions

---

Check the Ralph Loop package here (free & open source):
👉 https://github.com/pageai-pro/ralph-loop

Tools & resources mentioned in the video:
- Supadata: https://dub.sh/ePsQzep
- PageAI (prod-ready codebase): https://dub.sh/bhulmr0
- Ralph Loop (package): https://dub.sh/PtusXqh

Relevant stack:
- Claude Code (AI CLI): https://dub.sh/gbphlK8
- Docker Sandboxes: https://dub.sh/W8VltGX
- skills.sh (agent skills): https://dub.sh/QfEvPNE
- TanStack Start (project scaffolding): https://tanstack.com/start/latest
- Playwright (E2E testing): https://playwright.dev
- Vitest (unit testing): https://vitest.dev
- Anthropic's research on long-running agents: https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents

Read the long-form tutorial here:
https://pageai.pro/blog/long-running-ai-coding-agents-ralph-loop

---

Morning Maker Show is hosted by Dan (https://x.com/d4m1n) and Sandra (https://x.com/TakoTreba)

Video editing done by 🦋 ClipWing (https://dub.sh/e7ip0bW)

---

♥️ Huge thanks to:

Supadata: https://supadata.ai
Sentry: https://sentry.io
Sevalla: https://sevalla.com
PageAI: https://pageai.pro

for making this show happen!

#ai #coding #ralphloop #claudecode #vibecoding #dev #agentic #startup #saas #entrepreneur #business
#tech #money #marketing #smallbas #indie #motivation #technology #inspiration #indiedeveloper
#indiedev #creator #aicoding #claude #anthropic #docker #openai #codex #gemini #programming
#tutorial #automation