Skip to content
Linkdrop
Links

S01E05 · Building Workflows, Not Tool Stacks: MEGA lesson video by Theo Browne

Theo Browne explains how he builds and revises agent workflows using prompts and skills, including Soul Loop for cross-model code review. He also demonstrates scheduled, multi-model triage of T3 Code pull requests and discusses making merges safer with verification and rollback practices.

videoTheo Browne · hq.mega.dev · Saved Nov 19, 2026

mega course, agent skills, coding agents, pull requests, agent prompting

Transcript of the lesson video for S01E05 of the MEGA.dev course, by Theo Browne. Agenda: Workflows · Quality · User Experience · User Interfaces · Security · Business. The video plays on the lesson page in MEGA Student HQ (needs a login).

0:02 It's time to pull together everything we've learned so far to talk about workflows. How do we take advantage of what the model sees, knows, and can do in order to make workflows that make sense for us to deliver software more effectively and faster? There are a lot of different places that we can encode the way that we work. We can do it with code itself by writing scripts, custom functionality, CI rules, lint rules, all those types of things to make certain behaviors happen. We could even write code to change how code gets landed or how code is pushed up from our agents. We could rewrite the GitHub CLI or wrap it in some way where we are restricting what the model is capable of.

When models were dumber, that made a lot of sense, but they've gotten pretty smart now. So putting your time into building custom wrapper functions around your tools to prevent them from doing the wrong thing, probably not the best use of your time. The reality is that your workflows should primarily live in places like your prompts themselves and the skills that your agent has access to. And these workflows can be very dynamic and involve a lot of code, but it's using these three things that really makes workflows cemented. And where things start to get really fun is once you start to compose all of these capabilities. I'm gonna start with a specific example of a skill I use that I found really helpful, Soul Loop.

Soul Loop is a skill that I made because I noticed that OpenAI's model, specifically GPT-5-6 Soul, might not be my favorite for writing code, but they were incredibly thorough for reviewing it. So when I used models that I preferred working with, which at the time was Fable Five, it changes all the time, doesn't matter, I noticed that the GPT models were a really good thing to bring in to give feedback on my changes before I pushed them up to a PR and wasted my other code review agents and my team's time. A thing I think a lot about, and I think it'll be useful to know that this is something that's always on my brain, is the merge button.

Merge button itself is just a button, but there's a lot that goes into the before and after of that button. Something I know about myself is I get incredibly frustrated when I go to a PR and I want to merge it, but I can't because I don't know if the changes are good. I don't have a way to check the work that it did and see if it functions or not, or I'm waiting on somebody else to approve the thing. Even worse, though, is the other side. Once I click merge, what if the changes were broken? What if they do cause problems? How do I undo the damage? So when I think about the merge button, I think a lot about the before, which is, how do I make sure that by the time I go to this PR, I have everything I need to verify the changes are good and have the confidence to hit merge because I know that the code is probably good by the time it's in that PR?

And then the other side, which is, if it did end up bad, 'cause no matter how good you guys are at writing code, even if you have the best engineers in the world obsessively reviewing things, mistakes will break through your systems. So how do you handle those mistakes and undo the damage before it affects too many people? This is stuff like a staged rollout or really good nightly systems where beta testers catch things early, a proper QA org and system, whatever it is, making it so that merging is less scary because by the time you're in the PR, it's more likely to be good, and after you merge, if it is broken, it's really easy to revert with a minimal amount of damage.

These are the things I think the most about when I think about my workflows, and you'll see this as I describe how they work. I wanna be clear, though. You don't have to think the way I think. Do I think I am correct in the way I have done the before and after of the merge button? Mostly, yeah. There are ups and downs for the way I think. There's obviously systems where you can't so simply revert a change. Like, if I was writing code for a pacemaker, I would probably be fired. But the way I work makes a lot more sense for the companies I've worked at, like Amazon and Twitch, where you can stage your changes and make sure things are good ahead of time.

But you should adjust your workflows based on how you work and what is and isn't working for you. But more importantly, you should be willing to adjust them as things change, and believe me, they are going to change a lot. That's why I'm choosing this Soul Loop skill as a starting point. I know I only wrote this a few months ago with GPT-5-6 Soul, but I've actually had to adjust this skill multiple times since, and I think this will help you understand the way I think about things. So this skill was originally actually very, very simple. My first version of this skill was almost hilariously simple. Use GPT-5-6 Soul to review your work. Keep asking for feedback and addressing it until you have code that both you and Soul agree on.

You can call Soul using the Codex CLI, with an example at the end of how to call the CLI. This immediately worked decently well and allowed for Claude to get good feedback from Soul. But I noticed some problems almost immediately. First off, after it did all of the Soul Loops, it would come back and say, "Yeah, Soul likes the code, and I do too." But that's not where I want it to end. I want it to stop with a pull request that is filed so that I have code that both Soul and whatever Claude model I was using agree on so I can go merge it. So I added that at the end here.

I added, "When you both agree, file a pull request with your changes." And then I had a different problem. I would go to the pull request, and I saw that Macroscope or Code Rabbit or Greptile caught something else that my agents didn't catch. So I added another thing to the end. Babysit the PR until all automated reviewers and CI are green. And then I kept the skill pretty static for a while, but I did notice a few little things that were annoying, specifically that it would loop way longer than it should occasionally, and the result of those long loops was massive scope creep. So I went back to the top, and I adjusted again.

Stop after three loops if you can't agree. Push back on nets, and don't let these reviews

5:30 bloat your scope. And after all of these changes were in, things were feeling pretty good. But as always, I was auditing the things that my agents were doing and asking questions, and I noticed that my agents were screwing up a lot when they were calling Codex-P, and a lot of the time, Claude would choose to spin up a subagent for Claude and then have that subagent call Codex. And then it would read through the whole history of what Codex did in the Codex CLI to get the context it felt like it was missing, and it ended up massively bloating the context and increasing my bill for Claude by however many tokens Codex used. And after I noticed this, I made more adjustments.

This is when I introduced the capability I showed in the last lesson, which is I allowed for Soul to be used inside of Claude on all of my devices so that I could just have Claude use Soul as a sub-agent instead of having to leave the harness entirely for it. That said, I noticed that Claude didn't quite understand how to instantiate the sub-agent with a specific model that wasn't in its m- the immediate family of models that it had in some list internally. So I ended up making a custom sub-agent that was hardcoded in Claude Code that allowed it. So after I set up the custom Soul agent in Claude Code, I changed the rule here to say, "You can call Soul using the custom Soul agent with your sub-agent tool."

And that was great. And again, I left it for a while. But then new capabilities appeared, specifically in T3 Code. We got the ability to have Claude call Codex within T3 Code itself, which was obviously better for a bunch of reasons. So I changed it again. You can call Soul using the delegate tool in T3 Code. Initially, it was actually calling this with the new thread tool, which annoyed me, so I had to change it again to specify delegate tool. And I even had to make some adjustments to the MCP descriptions in T3 Code to get this just right. Again, if you rely on open source tools, you can fix these things when they break, and you can often convince the maintainers to take on those fixes.

But this helps show a workflow I liked, which is have a different model family review my changes and how I have adjusted it over time as I used it and noticed the different things that were and weren't working how I wanted. If you have a skill that you use regularly that you have not edited in months, I have concerns. You should spend a lot of time reading the skills that you're using and modifying them to better fit the behaviors that you do, and more importantly, don't want. One of the biggest things that was hard for me to accept is this idea that Markdown itself is executable now. Back in my day, the idea that you could have something.

js and pipe this into Node.js and have it do something was just mind-blowing to me, because JavaScript was this weird language you ran in the browser. It wasn't meant to be an executable thing you ran in your CLIs. But now, you can take something.markdown and pipe that into Claude, and it will execute it, almost like it's code. Is it deterministic? No. But I'll be real, JavaScript barely feels deterministic nowadays. So, yeah. Getting this into my head changed how I build entirely, and I realized that a lot of the processes that I had, a lot of the code I had written, a lot of the side projects I'd built could just actually be a Markdown file now.

And for some things that are dynamic and strange, this actually is quite nice. And there's a lot of different ways that you could do this. As you can probably guess, with a big open source project like T3 Code, we get a ton of pull requests. We get as many as 800 to 1,000 a day sometimes. And getting through all of this is nearly impossible, and we're always gonna miss some easy wins that people have put up as pull requests for us. And I hate that. It makes me feel bad. So one of the things that I built is a scheduled prompt that runs every day at 9:00 p.m. that will go through the T3 Code code base and ask it to triage open PRs that were opened or updated in the last 24 hours, and then come back with the results and tell me specifically, what are some simple PRs that I should go take a look at that are ready to merge?

Since we get so many pull requests, doing all of this with an expensive model like Opus would put us out of business. So I have it using Haiku to do the individual PR audits, and then when Haiku flags some that it thinks are really good, it then passes that up to Opus to finish it. The craziest thing here, though, is that no code was written. I didn't program anything for this flow. Here is the super complex workflow I built here. Every day at 9:00 p.m., I want you to do the following. Spin up a set of Haiku 5.5 delegates to look at pull requests that have had activity in the last 24 hours, do a brief audit of these PRs for mergeability, value, novelty, and other insights that I might wanna know.

If there's any that look mergeable, have Opus 5.5 and 6.1 Soul delegates take a look and verify, and then come back to me with a short list of eight or less PRs that you think are worth merging or taking over to get landed. Any confusion about what I'm looking for here? Ask if so. Otherwise, do a test run before we set up the scheduled task. And you can bet your butt, that's exactly what it did. It started a test with those Haiku delegates. It came back with all of the things that they found. They had these two, or they had Opus 5.5 and 6.1 Soul review these 12 PRs. And finally, at the end here, I got my list of things that it thought I should go and merge.

I said, "This looks good," set it with a schedule, and it wrote this prompt that it reruns every night for me. It even has things that kind of feel like code, like specific commands it should run and things it can do to avoid hitting my limits, and rate limits specifically, on GitHub, which is a thing I'm fighting actively. I find myself hitting the GitHub rate limits even more than my agent limits at this point. To each their own, but I hit those a lot. The main point I'm trying to make here is that Markdown can be used as the workflow itself. I wrote a prompt, the model adjusted the prompt after noticing certain things that were and weren't working.

It created this flow that auto-executes at 9:00 p.m. and makes my life easier and helps me land more code. There's another underlying piece here that I really wanna make sure you understand, though. The idea that we shouldn't be avoiding tedious stuff. We should be seeking it. Historically, as engineers, we have always tried to avoid the tedious stuff, but if the tedious thing was important enough, we would write a bunch of code to make it go away. Great engineers hate tedium, and that's what makes them great engineers, because when they hate something that's tedious, they'll either avoid it or they will write a solution to never think about it again. We gotta get over that now, because tedious stuff that we've historically avoided, like reviewing every single PR by hand, that tedious stuff is what agents were built for.

They love it. If the task is so boring that you feel your eyes glazing over as you do it, that is incredible work for your agents to do, and you should be doing 10 times more of it using your agents. I could never even come close to reviewing all the PRs that we are getting, but it doesn't matter because I've built systems and workflows with my agents to bring the important things up so that I can focus my attention on the things that aren't tedious, and in my case, are more fr- fun, but also a bit more scary. And you can build workflows for all sorts of different things that you do every day.

For example, I have very specific ways I like pull requests to be written. I want them to clearly state what the problem is and then simply describe the solution that was chosen. And I found that agents get very verbose and gross when they file pull requests. So I made my own file PR skill for filing concise PRs. Use whenever the user asks to file, open, or create a PR. Also note that my skills almost never have the restriction that they can only be invoked by the human. I don't want user-invoked skills. There's a bunch of weird implementation details there. I don't care. I want my skills to be clear when the agent should or shouldn't use them, and I let the agent choose when.

In this case, I want it to use the skill whenever I am filing or dealing with pull requests. So it starts very simply with making sure that there isn't already a PR for this, because it has made mistakes with that before. I then say, "PR titles are often commit messages, so follow the repo's title conventions. Look at recently merged PRs and Git history for examples. Prefer a concise, human-readable title that explains why the change matters." So a bad one would be, "Perf server: Negotiate per-message deflate on the WebSocket." I have no idea what the fuck this means when I read it. But a good example would be, "Perf server: Cut WebSocket frame size by 70%+ with gzipping."

Believe it or not, these are real examples that I had. It actually wrote this commit message, and it pissed me off so much that I opened up VS Code, and I wrote a skill to prevent it from ever happening again. And after spending two minutes writing this Markdown file, I have had all of the branch names, PR titles, commit messages, and all of that be so much better. And agents are so good with examples like this too. If you have a thing you don't like that your agent did, you can encode that with a skill and steer the model to go there when it's a thing that it is about to do, and it will see the bad example, which is what it would have done, and it'll see the good example, which is what you want, and it will work.

It works unreasonably well. I also have a similar thing for the PR description. The bad example was, "Removed implicit workspace carryover." I don't know what the hell it means by this, so I wrote a better example. "My new work tree default was ignored when starting new threads on existing work trees. Super unintuitive. Now my-- or now your preferences should always apply." There you go. As you start to build your workflows, one of the important things I push is this idea of prompting wider. There's two different directions you can go with your prompts. You can have them go deeper, where the model will go super analyze something. Maybe it's like rewriting a function in Rust or something like that.

That is depth. The model is going deeper and solving harder and harder problems. There are limits to how deep the agents can go. They're much farther than I ever would have expected, but that's not what I wanna talk about. There's plenty of other lessons that you're gonna hear for that. I wanna talk about the idea of prompting wider, expanding the start points and end points of where the prompt goes. Back in the day, we used to just auto-complete, and then we moved to Command K and making fixed changes, then we moved to the agent and telling it which files to go make changes in. I remember how crazy it was when Cursor added the change where the agent had a list of the files that were open in your currently open tabs so that it knew which files were there without having to do something custom for it.

All of these are expanding the width of how we use these things, because you have to do less before you bring in the agent, and more importantly, the agent can go further before it needs you again. If you are still telling the agent which file to edit and then verifying each changed line before getting into a PR, you need this part more than anyone, and you should probably send this to your team members as well if they are stuck in that space, because I now can bring the agent in as soon as I know a problem exists. I can literally send my agent a screenshot of a DM I got from somebody complaining about a bug, and by the time I check the thread again, there's a pull request up, ready to go, with a video showing exactly what was wrong and a video confirming the fix actually works.

That is width of the prompts. I'm bringing the agent in earlier, and it's able to go longer before it needs me again. And a lot of the workflows I'm building are in order to enable that. I don't want the agent to bother me until it's done everything it can to verify the changes are good. Then it can bring me in and ask me to take it one last look, give it thumbs up, and then finally hit merge. Sometimes I go even further, though, and that's what this skill is for. This one's called the Full Send. I have the description. It's very simple. Only trigger if the user requests full send. If the user triggered this, it's 'cause they are not watching the thread, and they want you to complete the work end-to-end autonomously.

Your updates and your final message will go unread long after you stop. You own the work from its current state to a merged PR. And I have steps it should follow. First, it should make the change, then it should prove the change, prove that it actually was able to get the thing done. Then it should get feedback using the sole loop skill. It's another important piece here. My skills are all composed. They can stack on each other where it makes sense to. You can tell your agents in one skill to call another one. It's all a graph. The agents are very good at calling things from other things. And once you realize that Markdown is kind of just a program at this point, you can have your program call another program the same way we would back in the Unix terminal days.

And once you build the right chunks, which for me are the sole loop skill, my file PR skill, my babysit PR skill, my comment format skill, my debug and process changes skills, my verify changes skills. Some of these are repo-specific. A lot of them are general for me. These skills are the building blocks that these higher-level workflow skills can hook into. And you'll see here, this one hooks into sole loop, file PR, babysit, watch pull request, my file upload skill. This one's really important because GitHub, up until recently, wouldn't let you upload files via the CLI, which was obnoxious. I've seen so many times where somebody's changes added a giant video file to the repo because the agent wanted to include it in the PR description.

So I have a custom file upload skill and tool I built in order to make that workflow easier, because I wanna see the video in the PR, but I don't want it committing the fricking video to my repo. And obviously, not everyone can use a skill like Full Send, where the model's autonomously merging the changes so that I never see it, because, uh, one of the features in T3 code is that once a change is merged, the thread will auto-archive itself, because why do you need it, the change merged? So when I use Full Send, I'm mentally prepared to never see the thread again unless it asks me a question. But that doesn't always work, and I was addicted to this skill.

It became my favorite thing to use, so I ended up making an adjacent version called Full Stop. Full Stop is very similar. The difference is, it does everything up until the merge button can be pressed, and then it tells me, "Hey, Theo, time to come in and take a look at this." Everything else is effectively the same, pretty much the same flow. I just wanted it to go as far as possible and not bother me until it thinks the code is ready to merge. So I've created this hierarchy here, effectively, where I have the skills the repo provides, the skills that I provide, like the building block skills. Then I have a workflow set on top, where I have the specific way I want it to resolve an issue, whether it's Full Send or Full Stop.

Then above that, I have the prompt I send, which is what details the problem and which of those paths I want it to go down. So when I see a bug that's a really simple, small thing, like the CSS isn't aligned properly, I take a screenshot of it, I hand it to the agent, I say, "Fix it," full send, and then the bug will be fixed by the next build. If I notice something a bit hairier, like the logic for how data is getting to the harness from my UI, or that the database isn't persisting something properly, there's like a memory leak, then I will send as much info as I know with full stop, saying, "Go explore this to the best of your ability and come back to me when you think you have a solution."

And sometimes I just wanna go back and forth with the model to figure out what I want and how we should implement it. That's when things like Matt Pocock's grilling skill come into play. I'll be real with y'all, I think I have two times more skills than I probably should here. I was playing with a lot of the P-Stack and Matt skills. They're really good. You should definitely explore them, but you should also not be that scared to delete skills when you're not using them that much or if they're doing things you don't want. And of course, you can ask your agent which skills are being invoked where, find the history of how often these skills are being pulled in, and how often I end up merging the change after the skill is pulled in to figure out which ones are and aren't actually helping you.

So how do you decide which skills should be global, which skills should be one harness, and which skills should go in the repo? Generally speaking, if the skill is useful in more than one repo, it should probably be in your globals. If the point of the skill is to keep you and your coworkers from making dumb mistakes, then it goes in the repo. One of the skills I have found the most value in is a really simple building block. It's my PR comment skill. The point of this skill is mostly to make sure my agents call out that they are an agent leaving a comment on my behalf instead of it just leaving a bunch of comments and not clarifying that it was Claude or Codex, not me.

So I made this to make it very clear when an agent is responding on my behalf. This was great. It was so great that I would get really annoyed when I saw other people contributing comments and PRs and not indicating if it was a human or a bot that did it. So I took this skill and I put it in the repo, and now every time somebody's agent leaves a comment in the repo, I know what model they used, what harness they used, and if it was them or not. And if the comment doesn't have a callout like this, either it was a human who left it or they are using a really bad harness that couldn't find the skill in the repo.

Either way, I can now treat it differently. So a really simple way of thinking about this is that the point of a repo-specific skill is to prevent bad behavior that other contributors could hit, whether it is a thing the model's confused by that you can't fix with code or it is a specific thing that people are doing that is making your life as a maintainer harder, or even just as a coworker or collaborator. Workflow skills can be useful for complex enough repos, but generally speaking, I try to keep my workflow skills slightly higher level to be useful outside of one specific repo. And you can take these base skills, these building blocks, and combine them into workflow-style skills that lets you take advantage of all these pieces you've built and encode flows that will make you more effective at delivering software the way you and your team actually want.

Did you notice how little we talked about the code itself in this? There's a reason. The code just isn't flexible enough. If you build out all these workflows to be really specific ways that things are executed in your harnesses, then you're not taking advantage of how powerful in general these models and harnesses can be. All of the skills I just showed work great in every harness I use. They work great with every modern model that I touch. They let me switch between different tools and solutions without changing the way that I work while still taking as much advantage as possible of what those things provide. You can use this for every side too, from how it should start the work to how it should triage the things it's gonna change, to how it verifies the work that it does, to how it gets it reviewed by other agents, to how it tests in a real browser.

You can do all of these things by writing in Markdown exactly what you want the model to do, and if it doesn't do quite what you want, ask it why and adjust accordingly. This is why this is the last lesson I'm doing, 'cause it pulls together everything we've talked about, from how the LLM sees the world, to how the context that it uses is built, to how you can control that context and manage it alongside the harness and the knowledge systems to make the model more effective. This all comes together with the flows that you'll use to make the models deliver the code the way that you want to. I wanna say that you've built all the skills you need now, but we're about to go build a bunch of skills with a bunch of awesome additional instructors who are gonna show you how to take these key pieces and push them really far in real-world work every day.

With this, I'm signing off, but I'm sure the next instructors will have even more useful skills to build with you. Pun intended. [static crackles]