Latest / AI Fire Daily / #251 Neil: Automate Your Code With This AI Team That Fixes Bugs While You Sleep
Transcript
- 0:00I spent the better part of last week just copying
- 0:02code snippets out of my IDE, pacing them into
- 0:05a chat window, waiting, and then carefully pacing
- 0:09the fix back in. It's so tedious, right? And
- 0:11it's fundamentally slow. Yeah. That realization,
- 0:14that friction, is the critical shift. We're still
- 0:17treating these incredible models like, you know,
- 0:20glorified chatbots. When they could be working
- 0:22directly in the project, autonomously. Exactly.
- 0:25We need to move beyond being the middleman. So
- 0:27this deep dive is about taking these technical
- 0:31guides we have, these blueprints, and forging
- 0:34them into a real strategy. The goal is to build
- 0:36an autonomous, multi -agent AI coding team. Our
- 0:40mission today for you is to extract the concrete
- 0:43tools, the specific GitHub workflows, and the
- 0:47crucial security measures you need to deploy
- 0:48a genuine 2 .0 .4 .7 development team. A team
- 0:51that lives inside your GitHub repository. And
- 0:53fixes issues while you're sleeping. OK, let's
- 0:55unpack this core idea first. Why bother with
- 0:58three different AI agents? Why not just use one
- 1:00massive model and prompt it to do everything?
- 1:03Isn't that just adding complexity? That's a great
- 1:05question, and it gets right to the heart of the
- 1:07architecture. The future here isn't one monolithic
- 1:11brain. It's a coordinated, specialized system.
- 1:16Think of it like a digital team. You want specific
- 1:19outputs for specific tasks, and different models
- 1:22give you different trade -offs. Speed, cost,
- 1:25and most importantly, control. Control being
- 1:28the kicker. Yes. Just like in a human team, you
- 1:31wouldn't hire your most creative architect to
- 1:34do a rigid, repetitive security audit. So we
- 1:36categorize them. So tell us what the lineup.
- 1:38Who's on the team? First up, we have the hybrid
- 1:40worker. We use Claude code for this. This is
- 1:43your best reasoning engine. It's great for complex
- 1:45logic, but, and this is key, human approval is
- 1:48required before it merges anything. So you're
- 1:50always in the loop. Safety first. Got it. Then
- 1:53you have the strict worker. For this, OpenAI
- 1:55Codex is ideal. This is where predictability
- 1:57is everything. Boring, repeatable tasks. Exactly.
- 2:01Writing unit tests, updating redomies, generating
- 2:04basic documentation. It has to follow a rigid,
- 2:07predictable process. And finally, the one that
- 2:08sounds the most fun. That's the fast worker.
- 2:11We use the cursor CLI for this. This is for complete
- 2:15autonomy. Full speed. It edits files, saves changes,
- 2:20and submits a pull request without you ever having
- 2:23to check in. Pure velocity. Pure velocity. So
- 2:26how does organizing them into these specialized
- 2:28roles actually improve efficiency over just using
- 2:32a single powerful model? Specialized roles give
- 2:35you precise control over the output. You can
- 2:37optimize for speed or rigidity as needed. Now,
- 2:40to make this system work, you need a foundation.
- 2:43If the agents are the workers, GitHub Actions
- 2:45is the robotic manager that tells them when to
- 2:49show up. Let's define that, Jorgan, quickly.
- 2:51GitHub Actions are basically a robotic butler
- 2:53for your code. Yeah, that's a great way to put
- 2:55it. They just follow a recipe when a specific
- 2:57event happens, like someone posting a comment.
- 2:59And that recipe needs three critical parts. First,
- 3:02the trigger. This is the magic word, maybe at
- 3:05CloudFix or at CursorFix, that you type as a
- 3:07comment on a GitHub issue. That wakes the bot
- 3:09up. Wakes the right bot up. Second, and this
- 3:12is crucial for security, is the runner. You're
- 3:14not running this on your laptop. GitHub gives
- 3:17you a temporary computer, a virtual machine,
- 3:19that spins up securely, does the work, and then
- 3:22just deletes itself. And the third part is the
- 3:24script itself, the workflow file. The recipe.
- 3:27It's a YAML text file that details all the steps.
- 3:30Read the comment, check who the user is, wake
- 3:32up the AI, send the code, save the changes. It's
- 3:35the conductor. Beyond security, What's the practical
- 3:39advantage of using a temporary GitHub runner
- 3:41instead of running these tasks locally? It prevents
- 3:44complex resource -intensive operations from slowing
- 3:47down your own computer. Okay, let's dive into
- 3:50method one, the safest approach, the hybrid model
- 3:53using Claude. The key here is that approval is
- 3:57always required. The human stays firmly in the
- 3:59loop. And that safety starts with permissions.
- 4:01It's non -negotiable. The first line of defense
- 4:03in that workflow file is a guest list, a defined
- 4:06list of authorized GitHub usernames. If anyone
- 4:08else tries to trigger the bot, the action just
- 4:10fails. Okay, so once you've secured who can use
- 4:12it, how do you instruct the bot without rewriting
- 4:15a huge prompt every single time? You definitely
- 4:17don't want to do that. You save a standard set
- 4:19of instructions in an instructions .md file.
- 4:22This tells Claude its role may be expert senior
- 4:25software engineer, and sets expectations for
- 4:28its tone. But just instructions for its personality
- 4:31isn't enough for code style, right? No, because
- 4:33the AI is only as good as the context you give
- 4:36it. And the critical trick here, and this is
- 4:38a constant battle, I still wrestle with prompt
- 4:41drift myself, is using an agents .md file in
- 4:45the repository. Tell me more about that specific
- 4:48file. That file is your project style guide,
- 4:50but for machines, it details your coding rules,
- 4:53always use TypeScript, indent with two spaces,
- 4:56all functions must be camel case. And every bot
- 4:59reads this first? Every single AI bot, no matter
- 5:02the model, is instructed to read that file first.
- 5:04This guarantees consistency. It stops the bots
- 5:07from contradicting each other's style. So what's
- 5:09the outcome of this hybrid approach? Claude reads
- 5:12the issue, reads the context, reads the style
- 5:14guide, creates a new Git branch with the fix,
- 5:17and then it comments back on the original issue
- 5:19with a clickable link to open the pull request
- 5:21for your final human review. So if the AI is
- 5:24so smart, why is using agents .md so crucial
- 5:27instead of just telling it the style once in
- 5:29a prompt? Contextual documentation ensures every
- 5:33bot consistently adheres to project standards.
- 5:35And that moves us to method two. strict and deterministic
- 5:39using OpenAI Codex. Here, the focus shifts to
- 5:42total uncompromising control. The AI only outputs
- 5:46text. The workflow controls everything else.
- 5:48I want to pause on that word, deterministic.
- 5:51That means predictable. Can AI -generated code
- 5:54really be deterministic, or does that just mean
- 5:56the process around the code is rigid? It's the
- 5:58latter. The process is absolutely rigid. The
- 6:01YAML file dictates everything. The branch name,
- 6:03the commit message where the file is saved, opening
- 6:05the PR. The AI's only job is to fill in the blanks
- 6:09with code. So you're just focusing its execution?
- 6:11Entirely. And the perfect use case for this is?
- 6:13Unit tests. Unit tests. It's boring, necessary
- 6:16work. A human doesn't want to spend two hours
- 6:18writing jest tests for every edge case. You set
- 6:21the AI's role to QA engineer, specify the framework,
- 6:24and demand exhaustive coverage. And what's the
- 6:27key to making sure the AI stays in that rigid
- 6:29lane? The prompt has to be explicit. It must
- 6:31include output. Only the code. Do not talk to
- 6:35me. Do not explain anything. Just the text. And
- 6:38the workflow script just grabs that raw output.
- 6:41Exactly. Captures that raw code and saves it
- 6:44directly into the right file like my -function
- 6:46.test .js before pushing it. No explanation needed.
- 6:50No conversation. So does this deterministic setup
- 6:53fundamentally limit the AI's ability to reason?
- 6:56Or does it just focus its execution? It focuses
- 6:59the execution, ensuring the output aligns perfectly
- 7:02with predictable file structures. Okay, now for
- 7:04maximum speed, this is method three, autonomous
- 7:07speed with the cursor CLI. This is where we run
- 7:10it in what's called headless mode. Right. Headless
- 7:12mode is just jargon for running a tool in the
- 7:14background without a user interface. It's perfect
- 7:16for an automated GitHub runner. We install the
- 7:18cursor CLI, and suddenly the AI has access to
- 7:21the command line. And because it has terminal
- 7:23access, you can skip a lot of the complex YAML
- 7:26scripting we needed for codecs. You just give
- 7:28it the do everything prompt. Precisely. You're
- 7:31basically telling the AI to manage the whole
- 7:33Git process itself. The prompt literally says
- 7:36things like, create a new branch called feature
- 7:396, update the CSS file, verify the changes, commit
- 7:44them, and then use gapr create to open a pull
- 7:47request. So that's the power analogy here. You
- 7:50type in cursor fix, close your laptop, go make
- 7:52a coffee. And the PR is waiting for you when
- 7:54you get back. It's tireless, instantaneous development.
- 7:58Whoa. Just imagine scaling this across an entire
- 8:01company to handle thousands of repo updates instantly
- 8:04after a big security vulnerability is found.
- 8:07Humans can't match that speed. It's a different
- 8:09scale of maintenance. So since this is the fastest,
- 8:12most autonomous method, what practical steps
- 8:14should a manager take to audit its output effectively?
- 8:17Auditing is managed by integrating immediate
- 8:19automated security checks before the PR is even
- 8:22created. Before we move on, let's take a quick
- 8:24break. Welcome back to Deep Dive. We've talked
- 8:28about speed and autonomy, but when you give a
- 8:30machine that much power, security has to be the
- 8:32very next thought. Absolutely. If this AI team
- 8:34is working 24 -7, we need a security guard watching
- 8:37over them. And that guard is a tool like SonarCube.
- 8:40Exactly. It acts like an advanced spell checker
- 8:43for your code, finding bugs and critical security
- 8:45risks like SQL injection vulnerabilities. The
- 8:48key is integrating this scan before the code
- 8:51ever gets to a human reviewer. This is where
- 8:53the workflow gets really smart. The process is
- 8:56simple. AI writes the code, SonarKrub scans it,
- 9:00and if a security issue is found, SonarKrub immediately
- 9:03tells the AI that wrote it. to try again. It
- 9:05creates a self -correction loop. Right. The AI
- 9:08fixes the security issue on the spot, using that
- 9:10feedback, and only then is the pull request created.
- 9:14This means the code reaching a human is already
- 9:16pre -vetted and cleaner. It cuts down on so much
- 9:20wasted time. That dramatically improves the quality
- 9:22upstream. And my favorite concept from these
- 9:24guides has to be the triangle strategy. Making
- 9:26the agents check each other's work? It's AI peer
- 9:29review. It's formalized AI peer review. So if
- 9:32cursor writes the code, you immediately trigger
- 9:34Claude to review it, but with a different specialized
- 9:37prompt. You tell Claude its role is a strict
- 9:39senior tech lead. And the review prompt is the
- 9:43key here. You can't just say, look for errors.
- 9:45No, you have to give it critical evaluation criteria.
- 9:48Tell it to look for performance bottlenecks,
- 9:51like nested loops inside other loops, or check
- 9:54for obscure violations of your naming conventions.
- 9:56I saw a perfect example of this. An AI updated
- 10:00a config file correctly. But the reviewer, AI,
- 10:04the strict tech lead, commented that the main
- 10:06README file hadn't been updated to reflect the
- 10:09change. It found a communication gap a human
- 10:12might have easily missed. When you're using this
- 10:14triangle strategy, how do you stop the reviewer
- 10:17AI from just agreeing with the first AI to save
- 10:21time? This strict senior tech lead prompt enforces
- 10:24constructive but critical evaluation criteria,
- 10:27like performance metrics. It forces an adversarial
- 10:29role. This whole setup can sound complex, but
- 10:32the sources really emphasize you don't need to
- 10:34deploy all three bots at once. No, you start
- 10:36small. And we have a simple checklist for getting
- 10:38started. Okay, what's first? First, prepare your
- 10:41API keys. Claude, OpenAI, Cursor. A useful tip
- 10:45here is to use the Claude setup token command,
- 10:48which can tap into your monthly subscriptions
- 10:50and potentially save on costs. Second, and this
- 10:53is an absolute necessity, add those keys as secrets
- 10:56in your GitHub repository settings. Never, ever
- 11:00paste your keys directly into code files. Huge
- 11:04security failure waiting to happen. Right. And
- 11:06third. Start with the safest method. Create one
- 11:10simple hybrid workflow with Claude. Get that
- 11:13YAML file running requiring manual approval for
- 11:15everything until you've built up trust in the
- 11:17system. Finally, let's talk about common pitfalls.
- 11:20I learned some of these the hard way. The first
- 11:22is the infinite loop. Yes, a classic automation
- 11:25trap. You have to make sure the AI doesn't trigger
- 11:27itself. How does that happen? Well, if your workflow
- 11:30triggers on a new comment and the AI posts a
- 11:32comment like, I fixed it, that could trigger
- 11:34the workflow again. So you have to filter that
- 11:36out. Exactly. You check who the actor, the user
- 11:38of the comment is. If it's the bot, you break
- 11:40the loop. The second mistake is ignoring context.
- 11:44If you don't spend time writing a solidagents
- 11:46.md file, the AI is just going to guess at your
- 11:49project's style, and it will probably guess wrong.
- 11:52And finally, cost management. This is critical.
- 11:55Tokens are like water from a tap. Start with
- 11:58small, specific tasks like fix this one function
- 12:01in this one file. Don't say rewrite my entire
- 12:04app. You will get a very large bill if you do
- 12:06that. Be surgical in your requests. So what does
- 12:09this all mean for you, the listener? The core
- 12:11lesson here is this fundamental shift in your
- 12:14role. You go from user to manager. You aren't
- 12:16replacing yourself. You're directing a team of
- 12:19fast, tireless workers who handle the typing,
- 12:22the coding, the testing, even the first round
- 12:23of security checks, you get to focus on architecture
- 12:26and strategy. It really transforms the definition
- 12:28of a developer. Building this 2047 autonomous
- 12:32dev team feels like science fiction, but it's
- 12:34really just connecting existing tools through
- 12:37smart, repeatable workflows. And it leaves you
- 12:39with a really interesting question to think about.
- 12:41If these autonomous AI systems, driven by strict
- 12:44templates and validators like SonarKweeb, increasingly
- 12:47write and review our code based on fixed rules,
- 12:50will this ultimate focus on efficiency lead to
- 12:52a global homogenization of programming style?
- 12:55Will the unique creative quirks that human architects
- 12:58bring to software eventually fade away in favor
- 13:01of perfect, predictable, and maybe identical
- 13:04structure? Something to consider as you start
- 13:05building your own digital team.