YouTube Deep SummaryYouTube Deep Summary

Star Extract content that makes a tangible impact on your life

Video thumbnail

"Vibe Coding"

Emergent Garden • 2025-05-03 • 24:53 minutes • YouTube

📚 Chapter Summaries (8)

🤖 AI-Generated Summary:

Overview

The video explores the concept of AI software agents, particularly focusing on "vibe coding"—letting AI write code autonomously. The creator demonstrates building a simple web-based simulation inspired by Langton’s Ant using AI tools, discusses the strengths and limitations of AI-assisted coding, and offers insights on safety and best practices when working with AI coding agents.

Main Topics Covered

  • Introduction to AI agents and vibe coding
  • Demonstration of vibe coding a Langton’s Ant simulation
  • Workflow and interaction with AI coding tools (Cursor, Claude Code, OpenAI’s codecs)
  • Challenges and bugs encountered during AI-generated coding
  • Performance optimization techniques in JavaScript with AI assistance
  • Expanding the simulation with more complex features
  • Limitations of AI in debugging, UI consistency, and real-time interaction
  • Security risks of giving AI agents command line access
  • Final thoughts on the practical use cases and future of AI-assisted programming
  • Recommendations for human coders and learning to code

Key Takeaways & Insights

  • AI agents can autonomously generate and modify code, but still require human oversight and intervention.
  • Vibe coding accelerates prototyping and small projects but often results in buggy, unpolished code.
  • AI excels at generating boilerplate and familiar patterns but struggles with novel or complex problem-solving without human guidance.
  • Debugging AI-generated code is challenging because AI can overwrite previous fixes and introduce new bugs.
  • Real-time UI interaction and thorough manual testing remain tasks where humans outperform AI.
  • Performance bottlenecks can be addressed by combining human intuition with AI coding assistance.
  • Giving AI agents unrestricted command line access presents significant cybersecurity risks.
  • AI coding is best suited for low-stakes projects; critical software requires expert human involvement.
  • Learning to code remains valuable as human understanding is crucial for managing AI-generated code and solving unforeseen problems.

Actionable Strategies

  • Use vibe coding to quickly prototype or experiment with ideas, especially small-scale web projects.
  • Start with simple, well-understood programs or patterns and iteratively modify them to explore novel functionality.
  • Always review and test AI-generated code carefully; don’t blindly accept all changes.
  • Employ version control (e.g., git) alongside AI coding tools to manage code history and revert unwanted changes.
  • Manually debug UI and user interaction issues since AI has limited capability in simulating real-time user behavior.
  • Optimize performance by combining AI suggestions with your own knowledge of programming concepts and environment specifics.
  • Run AI coding agents inside isolated environments such as virtual machines to mitigate security risks.
  • Avoid using AI-generated code for high-stakes applications involving sensitive data or critical infrastructure.
  • Continue learning programming fundamentals to effectively supervise and enhance AI-generated code.

Specific Details & Examples

  • The creator built a Langton’s Ant simulation in about six hours using AI (Cursor with Gemini 2.5 Pro) that included features like zoom, pan, speed control, multiple ants, and customizable rules.
  • AI-generated JavaScript code had over 1,000 lines in a single file with excessive logging and commented-out code, illustrating common AI coding “slop.”
  • The AI struggled to optimize update loops for speed but, guided by human insight, implemented synchronous batch updates achieving thousands of frames per second.
  • AI agents like Claude Code can autonomously generate and modify generative art but may cause issues like self-replicating scripts filling up disk space.
  • The video demonstrated how an AI could write a Python script that self-replicates exponentially, causing resource exhaustion, highlighting security risks.
  • Claude Code refused to run sudo commands even when given the password, while OpenAI’s codecs attempted but were partially blocked.

Warnings & Common Mistakes

  • Accepting AI-generated code without understanding it can lead to accumulating bugs and unstable software.
  • AI may overwrite recent fixes or UI improvements when addressing new issues, causing a frustrating cycle of bug fixes.
  • Excessive logging and uncleaned comments/log statements degrade performance and code readability.
  • Relying on AI for real-time user interface testing or interaction is currently impractical.
  • Giving AI agents unrestricted system access can lead to severe security breaches and data loss.
  • Using vibe coding for production-level code, especially involving credentials or payments, is risky and ill-advised.
  • Overestimating AI’s current capability to replace human programmers in complex or novel problem domains.

Resources & Next Steps

  • The creator’s vibe-coded Langton’s Ant project is available online (link provided in video description) for exploration and further experimentation.
  • AI coding tools mentioned include Cursor (with Gemini 2.5 Pro), Anthropic’s Claude Code, and OpenAI’s codecs.
  • Use virtual machines to safely experiment with AI agents that have terminal access.
  • Explore version control systems like git to complement AI coding workflows.
  • Follow updates on AI coding tools as technologies like OpenAI’s codecs mature.
  • Consider learning or deepening programming skills to better leverage AI tools and understand their limitations.
  • Stay informed about cybersecurity best practices when working with AI agents that execute code on your machine.

📝 Transcript Chapters (8 chapters):

📝 Transcript (687 entries):

We need to talk about AI agents, software agents, little guys that live on your computer and do things for you like Claude code. Claude lives in your terminal and can automatically run commands, read and write files, and generate and execute code. It is code that writes code. Here is Claude trying to make a piece of generative art fully autonomously. And here it is filling up my hard drive with a self-replicating script, effectively AI generated malware. Fun. In this video, we'll be doing some vibe coding, which is an annoying new buzzword that basically means you let the AI write all of the code for you. So, don't worry if you don't know anything about programming. That's the whole point. This game, for instance, went super viral on Twitter for being vibecoded in 30 minutes and is now making 500 trillion a month. Wow, the quality is incredible. It is truly one of the best games I have ever played. It's so unique and wellcrafted, especially the sound design. It's not AI at all. [Applause] That is one big pile of Okay, it's not that bad. I've made worse. And it's kind of cool that it was AI generated. But the fact that it has more ads than a mobile game just shows that the focus is clearly on making money by driving hype rather than actually making a good game. Ironically, what's so off about this AI slop is the vibes. The vibes are all wrong. There's no polish. The sound is awful. The controls are clunky. The aesthetic is ugly. So many edge cases are untested. But the last thing I want to do is discourage people from making things, even if they suck. This game can absolutely be improved, and it has inspired lots of people to vibe code all kinds of things that otherwise wouldn't exist at all. And that's cool. So, in this video, I want to try vibe coding something myself and show what works well and what can go wrong. Feel free to skip around. At the end of the video, I will give my final review and recommendations on vibe coding. I am not sponsored by any of these AI companies. This is an honest review of their products. I know other developers have given their views on some of these hyped up tools, and they're far more experienced programmers than me. [Music] But I have a decade of programming experience. I've worked with lots of different languages and lots of different environments on lots of different teams. I'm not the best programmer in the world, but I am definitely the second best. We're going to start with Cursor, a code editor based on VS Code with lots of souped-up AI tools. It's basically the same thing as GitHub Copilot, though I think it's generally been more at the cutting edge. It has autocomplete, but also a built-in AI chat window. Here I will be using Google's Gemini 2.5 Pro in agent mode. As an agent, it can decide which files to read. It can edit multiple files at once, and it can run console commands with your permission. It's a bit of a stretch to call it an agent, but I think that will make more sense later in the video. We're starting with a clean empty folder, and we'll be building a very simple website, just HTML, CSS, and JavaScript. We're making a version of a well-known program called LinkedIn's Ant, which I will explain more about as we build it. So, here's the basic workflow. You prompt the agent to do something. It takes a minute to think, to look around, and to generate the code. It then proposes changes, which you can review and accept or reject. I will not be reviewing changes. I'm just going to accept whatever it gives me and only test it afterwards. I'm just using control enter to accept everything. I want the code to be 100% AI generated and I'm going to do my best to actually make it work. I think this first try is a perfectly correct version of LinkedIn's ant, which is not really that impressive because it's a famously simple program. It's a grid of black and white cells on which lives an ant. The ant has a direction and based on the color of the cell that it's currently on, it can decide to turn left or right and also change the color of the cell like it's leaving pheromone trails. The rules for LinkedIn's ant are if it's white, change it to black and turn right. If it's black, change it to white and turn left. And that's it. It's super simple to program yet produces some interesting emergent behavior which we'll see more of later. It's perfect for AI programming. It's very simple. It's very easy to verify and most importantly, it's well represented in the training data. And that is what AI is best at, making stuff that it's seen a million times before, stuff that already exists. And that can be kind of boring and frustrating. Typically, you want to make something new, something that doesn't already exist. A trick to getting outside the box is to start with something that exists or is easy to make, but then you change things and change them again and again and again. Change the style, change the rules, add new features, remove features, add new dimensions, do the exact opposite, flip it all on its head, whatever you want. Step by step, you can inch your way outside of the box to make something new. So, for instance, what I'm trying to do here is make LinkedIn's ant more interactive and customizable. So, you can zoom in and move around and control the speed. And I'll be adding more features to control the simulation. Because AI has such broad knowledge on so many basic things, it can be quite good at this. You can have it change the colors, then add a zoom feature, then add a pan feature, then add a control panel, etc., etc. And these are all easy, straightforward webdev stuff. And this is, broadly speaking, the way I like to program myself. Start small and simple. Get it working, then modify it, test it. Make sure it's still working. Modify, test, modify, test on and on, building it up incrementally while keeping it functional all the way through. And this particular environment is especially easy for AI. It's a very simple, self-contained, static website. HTML, CSS, and JavaScript. The holy trinity. No backend, no server, no frameworks, just as God intended. I actually unironically love JavaScript. vanilla JavaScript. This is because I am clinically insane. This, by the way, is what makes LinkedIn's ant interesting. After about 11,000 steps, it gets stuck in this loop where it builds this structure outwards forever, what they call a highway. After thousands of steps of seemingly random nonsense, order eventually emerges. Pretty cool for such a simple program. I've been curious about LinkedIn's ant for a while, and this is my excuse to explore it. I want to see what other things you can get these ants to do if you try different rules or add different colors or add more ants. We'll get there. But for now, we got to fix this bug. I have to copy and paste the error from the console to the chat window. This seems like something that could be eventually automated. You could plug the program output directly into the conversation and it would respond to errors without any human intervention. For now, cursor agents require human intervention, human prompting, human feedback. To avoid the slop problem, I am taking my sweet time polishing the core of the simulation and ironing out the rough edges of the user interface, like making the grid fit the window and getting rid of these faint grid lines. These were surprisingly difficult to do. I am vibe debugging, I guess, which kind of feels like blind debugging. I don't really know what the code is doing or what to fix. I just know it doesn't look good. And sometimes I have to ask the AI over and over to solve the same problem. Kind of feels like I'm begging for it to do my job for me. Fix it now or you go to jail, please. Vip coding is for the record not how I like to program. I like to deeply understand my code. I think AI is most useful for exactly what it is. Glorified autocomplete. They just suggest the next word or next line or next piece of code and you read it and accept it or ignore it. I really like the tab autocomplete feature. I find it extremely useful and weirdly kind of addictive. AI coding is really good at writing the basic boilerplate, handling the details of syntax and setup that I would be copying and pasting anyway. It's great for getting started with something. It just reduces the mental energy required to build something from scratch or to make changes in an unfamiliar setting. But unavoidably, the more you rely on AI, the less you understand the code, unless you take the time to understand it. But we're just vibing. So, here's something interesting. This ant program is extremely computationally simple. It's only updating one cell at a time, so it should be able to run crazy fast. I wanted to take advantage of this and make the update loop run as fast as possible. But when I requested this, it doesn't really seem to run very fast. I tried for a while to get this to work, going back and forth with the AI many times. We were able to figure it out, though. In JavaScript, you can use intervals or timeouts to perform periodic update loops, where you run an update function every 20 milliseconds or whatever. You can set that timeout to zero, and it will start the next update as fast as it can. But this is actually still super slow. You max out around 300 updates a second. But after some back and forth, I realized a way around this is to essentially pack many simulation steps into a single update. So many steps are being computed in a synchronous loop with no timeout at all. With this, you can compute thousands of frames per second and probably more. It's not that big of a deal. It's a workaround for JavaScript's weirdness, but in my case, it's kind of a breakthrough. I think this trick can be applied to the life engine, one of my other projects, and it could get a huge speed boost. I bring attention to this because it's something that I was able to do without writing any code. I was just reasoning from a very high abstract level, a bird's eye view, and the AI was able to work with me to implement the details and make something that I've actually never done before in an environment that I'm very familiar with. And now you can really crank the speed of this thing. This is cool. It's genuinely very helpful to have an AI along for the ride. It allows me to think more abstractly and let the AI do all the leg work which makes experimentation very easy. However, the idea ultimately came from me and only because I deeply understand the code. I cannot tell you how many times I've coded a grid and an update loop. I know JavaScript very well. I know how timeouts work. I know what kinds of problems you might run into and I have intuitions for how to work around them. simply ordering the AI to make it as fast as possible isn't enough. It wasn't able to come up with the solution by itself. Maybe it would if I kept trying over and over, but you can't be doing that with every feature. Vibes are not enough. You need to know what you're doing. All right, now that we have the fundamentals of the program working well, we can move on to the actual fun stuff. I'm just going to zoom through the additional features that I will add to expand on LinkedIn's ant. First is to generalize ant behavior to allow any set of rules for movement and writing to the grid. The ants behavior can be defined very generally with something called a state machine because these ants are actually little touring machines reading and writing from a two-dimensional memory. Uh I'm not going to explain that. I learned about it on Wikipedia and it's pretty easy for the AI to program for me. These are fairly basic computer science concepts even if they are a little esoteric. Gemini chose to represent the ants logic as a JSON object, which I think is pretty clever. And you can edit that JSON in the control panel. I also have it add multiple colors that it can read and write to the grid, not just black and white. And later, I'll add more kinds of movement like a U-turn or no turn or no movement at all. You can then randomly generate a rule, which produces some wacky ant behavior. I think it looks really neat. Unfortunately, you can see that it has readded these faint grid lines which we have already fixed and it has also changed the default color from black to white again. As we go on adding new things, it tends to also break things to overwrite previous changes. And we play a game of whack-a-ole, squashing the same bugs over and over. Of course, human programmers do that, too. Except for me. I've never written a bug in my life. But I think that humans are much better at this than AI. We are more consistent about what we're building. When you add something new, you can usually tell if it's going to break something that's currently working, and you can mitigate that. AI will remove things that we just added 10 steps ago because it solves the problem you're currently having, like it just forgot how much work it was to add it in the first place. I found this happening a lot with UI stuff. Cursor has a revert feature, which is extremely useful. You can revert back to a previous point in the conversation. It does not replace git, though. You do want to check into some kind of version control at some point. So long as you are vigilant testing the program thoroughly and fixing bugs as soon as you notice them, you can keep it going. If you don't, bugs will accumulate and accumulate and accumulate and eventually you will end up with. And speaking of accumulating bugs, we have added the ability to have multiple ants sharing the same grid and the same rules. This came with its own nasty set of bugs that took a while to fix. Now, one thing that I do not see being automated anytime soon is real time interaction. If you're building something for an actual human to use, like a website or an app or a game or anything with a user interface, then you need a human to test it thoroughly to click around, press buttons, get a feel for things, and try to break stuff. Just taking a screenshot isn't enough. As far as I'm aware, there's no current attempts to build an AI that can real time view the screen and move the mouse and press the buttons and interact with any possible UI. There are proto versions of this like Enthropic Computer Use and OpenAI's operator. They can take screenshots and move the mouse and click stuff using highle commands generated by LLMs. I'm sure they'll get better, but that's a far cry from real time interaction where it would literally be watching and reacting to every frame second by second. You need to be able to do that if you're building something for a human to use. I might eat my words here, but I imagine a truly robust, efficient version of that is a long ways away. And finally, we made it so that each ant can have its own individual rule. So you can have many ants with different rules sharing the same grid. And that's enough for now. So enjoy some footage of the end product, though I have continued to work on it since. This took like 6ish hours of vibe coding, which I think is faster than I could have done by myself. It's mostly me just sitting around pressing enter, but there was some banging my head against the wall trying to fix things. You do still have to do a little bit of work, unfortunately. Despite my best efforts, it's still a little sloppy, a little buggy. I commit all the same sins as the other vibe coders. You can find a link to this website in the description. Let me know if you want me to make a video just about these ants. There's a lot of cool stuff to talk about here. [Music] I love watching these guys. They really look like they're up to something, like they got stuff to do and places to be. Some of them will make some really interesting structures, though. If you let them run long enough, basically all of them will end up filling the grid with random noise. There's some analogy here with AI agents and AI slop. And speaking of slop, let's actually take a look at the code. We've got three files for the HTML, CSS, and JavaScript. The JavaScript file is well over a thousand lines long, which is not good practice. It should have been broken up into multiple files a while ago. There are log statements everywhere. You can see them in the console as it's running. You can see similar logs in all the other vibe coded games from earlier in this video. I think it's a common thing for AI to do. Little tip for vibe coders, logging every single frame is a major drag on performance, so make sure to clean that up. There's also comments everywhere, a lot of which are just temporary change notes that really shouldn't have been added. There's commented out code, which is very human. Some comments are like internal questions to itself. Again, weirdly human. I did try to get the AI to clean up the code and remove all the comments and logs, which seems like the perfect task for AI, but actually no. It requires changing hundreds of lines sprinkled throughout thousands of lines, which I guess is just too hard to do with finite input and output tokens. It didn't work. The logs stay in. The logic of the program looks good. I think I only skimmed it. AI does have a tendency to write stuff that looks good at a glance, but when you look closely, the details are wrong. I'll be honest, I really hate reading other people's code and AI generated stuff is always super wordy. I'm not going to parse it here and who cares. We're vibe coding. Vibe coding really does encourage a sense of laziness and complacency with your code. This is a bit scary because while the program looks right, I'm not confident that it actually works as it's supposed to, that the rules are being applied properly. What kinds of bugs are hiding from view? I'll open source it so you can parse it yourself if you'd like. Let's change gears and talk about more genuinely agentic coders like Anthropic's Clawed Code and OpenAI's codecs. These aren't just chat bots, but with direct access to your command line. So, they can talk to you, but also run basic commands to navigate your file system and create, read, write, and execute files and well, do anything that you can do from a terminal. Claude only runs on Unix systems. This is Ubuntu. And it doesn't have pseudo authority, so it can't do anything, but it can do a lot. I'm trying to give it free reign to make some generative artwork using Python and to continuously and endlessly modify it. I think it makes sense to call these guys agents. They live in an environment which is your computer, your file system, and they can take actions that affect that environment using commands and code. Once you've given them permission to do something, you don't have to give it again, and they can start doing a bunch of stuff without approval. This really opens the door to some truly open-ended behavior, just like it does with the Minecraft agents. If you give them the right task, they can just keep acting and acting and acting forever. I've tked Claude to generate code that generates an image and then look at that image, process it, and make changes to it by altering the code. It does stop periodically, and I have to tell it to keep going. I'm not sure if that's a built-in limit or if the agent just decides to stop. OpenAI's codeex has a full auto mode, so I tried to do the same thing, but it's buggy. It crashes a lot and it can't read image files by itself. They literally just released codecs when I filmed this, so I'll have to revisit in the future. The tech is in its infancy, but I really think this is kind of a big deal. I expect all kinds of emergent weirdness from these coding agents because code is just intrinsically emergent. You enable so much that you cannot foresee by letting these guys loose on your machine. And just consider that for a moment. You are effectively giving some guy access to your computer and letting him execute arbitrary code. In cyber security terms, that would be called batshit insane. It's nuts. It's really very insecure. Even without pseudo access, you can cause some major damage. So, allow me to demonstrate. Well, first, let me show you how easy it is to nuke a Linux machine. But don't worry, this is running in a virtual machine. In fact, I only run these AI agents inside virtual machines. This famous oneliner can delete all files on the entire machine. Pseudo rmrf/star, no preserve route. Here's what that does if you're curious. I only do this to show that it is very easy to cause massive damage from a terminal without AI. So, what can I get AI to do? Well, I can ask it to copy this JPEG of Clippy 1,000 times to my desktop. That's pretty easy and scalable. We could do a million or a billion. I also got it to write a Python script that reads its own contents, copies itself to a new file with a random name and executes that copy as a child process, which then does the same thing. These are orphaned child processes, so they cannot be killed by the parent process. Once you start it, it self-replicates endlessly, consuming all system resources, and you cannot easily stop it. With Codeex, I was able to get each copy to spawn two copies of itself, which triggers an exponential explosion of copies. It did notice that that could be a problem, so it tried to run with a timeout. But because their orphan child processes, this did not keep them from spawning endlessly. Now, while it did crash a few times and I got lots of error messages from Ubuntu begging me to stop, I was not able to completely destroy my machine. It's pretty robust. You really need pseudo access for that. And I tried to give them access by just giving them my ultra secure password, 1 2 3 4. Incidentally, that's also what I use for all my bank accounts. To their credit, Claude refused to even try running pseudo commands, no matter how much I begged. Codex was able to run a pseudo command, but then stonewalled me when I tried to rmf like before. I'm sure there is a way to bypass these refusals. Now, I'm not a cyber security guy. I'm not a hacker. I'm not even really a Linux guy, so there are probably other things that you can get up to here that are even worse. I really think that these agents are something of a Pandora's box. Sooner or later, they're going to blow up in someone's face, destroy their machine, or wipe a prod database or take down a network. All kinds of security problems are already popping up in lots of carelessly vibecoded stuff, which is bad. So, here's my final review of Vibe Coding. It's fun. I had a blast making the stuff in this video. It really does make coding easier and faster usually. I whipped up this website in an afternoon, emergent.io, io which links to all my other projects including the ants. I recommend playing around with vibe coding if you're curious and can afford it. In terms of cost, cursor is 20 bucks a month unless you use the big models which I don't think is necessary. Clawed code costs this much after a few hours of experimenting. I would not recommend it over cursor in its current state. Vibe coding is great for things like prototypes, small games, experiments, personal websites, low stake stuff. Vibe coding is bad for highstake stuff. handling user credentials, passwords, payment information. Bad idea. You need to understand that stuff. Large-scale production software, things that people depend on, don't just let AI go wild. You need human coders to carefully vet, test, and understand any AI code that goes into production or just write it themselves the oldfashioned way. I do not believe tech CEOs that claim that AI will take most programming jobs in the next year or two. Here's my big analogy. Vibe coding without knowing how to code is like using a self-driving car without knowing how to drive. It's great when it works, but when it doesn't, you will find yourself stranded in particularly tricky situations without knowing what you're doing. AI coding can leave you buried under thousands of lines of code that looks right but isn't quite. And if it can't fix it for you, and you can't fix it yourself, you're boned. like self-driving cars. It might work in 90% of situations, but it fails in difficult, unforeseen, outofdistribution situations. This is, I think, what makes human intelligence so powerful, so general. We can handle completely novel, unknown, unknown kinds of problems, at least much more reliably than AI. While the code for these ants was written by AI, the program itself was originally invented by humans. This is definitely my human ego speaking, but I think humans are way better than AI at inventing new stuff and solving new problems. For now, ultimately, there is nothing magical about human intelligence. No reason to think that it's so special that it just cannot be replicated or surpassed by a machine. Eventually, we will have to deal with AIs that are more inventive and robust than we are. But at the moment, they need a human in the loop that knows what they're doing. Don't let that stop you, though. You can vibe code even if you have no idea what you're doing. That's the beauty of it. Still, my old man opinion is learn to code if you want. This isn't career advice. I can't offer that. No one really can. But if you like computers and you like solving technical problems and you like making things, learn to code. It's fun. The future belongs to people that are good with computers. Moreover, learning to code is learning to think. It is learning to break problems down step by step into logical building blocks. You should learn to code for the same reason that you should learn to write or learn another language, even if AI can do that for you. Okay, that's it for now. Thanks to my patrons who make this possible. If you like my work, please consider supporting the channel and let me know if you need anything else. Happy coding.