 What's up, engineers? Andy Dev Dan here. Cursor has been absolutely popping off in the tech ecosphere. This is due to the new multi-file editing composer feature. We covered this in the previous video. I'm a huge fan of Cursor, but the truth is Cursor is a closed source commercial application and putting all your eggs in one basket this early in the generative AI age is a mistake. On the channel, we've been benefiting from AI coding and multi-file editing for over a year now, all thanks to the original LLM-based AI coding tool, AIDR. This is a coding tool that, as you'll see in this video, typically outperforms Cursor while giving you more control over the AI coding process. Not to mention, Ader is completely free with tons of LLM providers and Paul, the engineer that built Ader, puts out some incredible blogs to keep you updated on AI coding. So in this video, I want to show you another option outside of cursor to help you diversify your AI coding tools and we're going to look at Ader by making a change to a brand new Mermaid AI agent that I'm building that can help you build diagrams faster than ever. If you don't know what Mermaid is, it is an awesome text-based diagramming and charting tool. You can basically pass in simple blocks of text and get out node edge-based diagrams. Let's dive in by first showing off how our mermaid diagram AI agent works. So the mermaid agent is really simple. You run a command, you ask for the diagram that you're looking for, you specify an output image, and then optionally you can pass in a input file that the mermaid agent then reads, generates diagrams, and then you can on a loop improve the diagram let me just show you what that looks like i'll open up the terminal and i'm going to run this command so i'm just going to go ahead and kick this off and then we'll walk through exactly what's going on here so you can see the diagrams getting generated there and now we have this image fully generated so let's go ahead and just dissect that prompt a little bit right so we're using typer so i I have this function called meriter. And then we have this prompt, right? Flowchart explaining why communication via diagramming is so important for engineering great products. And then I say include things like time saved, faster iteration, increased trust, and more. Then I specify the output file. So based on that, we got this really, really cool diagram. The cool part about this tool is we can continue to iterate. So I'm running the iterate command and I can just say add additional nodes group by benefit. Okay. And so now with this human in a loop pattern, we're going to loop and hopefully we'll have our elements combined together. It's kind of squished. So let's go ahead and clean this up a little bit. I'll say drop subgraphs and make diagram LR. So now we're gonna make it run left to right. Awesome, so it looks pretty good, right? We can see that our benefits of diagramming are grouped together by time saved, clear communication, team alignment. And then the last thing I want to do here is I want every single node to go into engineering grade products. So I'm just going to go ahead and add that as a final prompt, right? Create an edge between the last nodes and engineering grade products. So we're going to ask that for that last change there. And we should get a full perfect. We should get a diagram generated there, right? This is a killer use case for generative AI. When you combine it with a fantastic text based tool like mermaid, you can rapidly iterate on asset generation. So if we go ahead and look at the generated output file, you can see this is awesome. But inside of our code base here, we're only saving the last generated file. So our task here today is going to be to take this file, move it into the output directory. You can see we have a couple other items generated here. And we also want to save all the previous iterations of this file getting generated right so let's go ahead and just make a couple tweaks to this code base let's get into the AI coding of this I have a couple key pieces of value I'm going to share with you here one of the great parts about AIDR is that it runs right in the terminal so all I'm going to do is type AIDR no auto commits We're going to run with dash dash sonnet. So you can see here we're running sonnet with the diff edit format. We have infinite output and in this code base we have 19 files. Let's go ahead and add files to our context window. To do that I'll type slash add and if we look at the code base here I want everything under source mermaid agent so I'll literally just type source mermaid agent slash star now you can see I have every single file in that directory I have all my python files so now if I type slash tokens you can see exactly how much every single run costs and you can see all the files in your context window so So this is fantastic. Let's go ahead and just ask the code base. Let's ask Ader. Let's ask our LLM what changes we need to make in order to move our generated image into the output directory. We also want to add the iteration number and save that as well. Go back in the terminal. I'll clear and I'll just type slash ask in what function are we saving the mermaid diagram images and so with all the context of the code base call 3.5 running on ader has shown us exactly where this is there's a function called mm and we have this save image locally if we go ahead and search all hop to this you can see that we just have this simple save command. It's just saving the file name that gets passed in, right? And the MM just builds the image based on the graph that gets generated by our LLM. And then we just save that image, right? So fairly simple. Let's go ahead and ask for the changes we'll need to move this to the output directory, right? And I'm being super verbose here, right? Just because we're walking this through and I wanna share how I think about AI coding with you. But normally, I would like, I already know where this code is. I don't need to ask. I would just go ahead and prompt it. Although I do want to highlight something here that we'll talk about in a second. Building up these conversations with AIDR with the slash ask command is super, super important. And you'll see why in a second here. So I'll go ahead and type slash ask. And we reuse existing functionality to save that file to the output dir. Okay, so as you can see here, there's this build file path utilities function, and we can go ahead and just grab this, right? And search all. So you can see here, we already have this pattern set up of using the build file path to write to our output directory, right? So it works just like this, right? We have this function, we have this simple constant that gets combined with the file name and make sure that the directory exists, right? So simple enough. So this is really cool, right? And our AI coding assistant picked up on this. And now we can do something really, really cool. So before I mentioned that, you know, normally you can just type the changes that you want. I've been using this pattern of running the slash ask command to have more conversations with your AI coding assistant. And then after you know the changes it's going to make, then you say, go ahead, make the changes. So that's literally what we're going to do here. Go ahead and make that change. So you can see there, we got the import and we have the update using the new output path. So go ahead and close this. Let's open up that file. We go to the mermaid.py. Our save image locally is now going to first run the build file path from our utils. So really simple. I just want to walk through that so you can see exactly how AIDR using the ask command can build this up for us. So that's a simple change. That looks good. Before we go ahead and run the example, let's go ahead and get that second change in there, right? So ask draft the change needed every iter file in our mer iter function. And I'll say every iter mermaid chart. Okay, and I'll run that. Sometimes when you run these changes and you run your ai coding prompts it changes too much and it makes mistakes and it does things wrong by running the ask command you can ask for a full-on draft you can see the reasoning behind your ai coding assistant and then you can say make these tweaks or go ahead and implement that so overall that looks good but all i wanted to do is save the new output file name and i basically only want this right so we're going to iterate while we're running this while true and we can go ahead and just take a look at this code in the main file here so you can see we have this loop during our main iter call and all we want to do is update to make sure that saves a new file in the output directory, right? You know, I'm just going to highlight this and only implement this portion. I'm just going to paste that in. Okay. So let's go ahead and see how it's done there. So now we have iteration count. We now have the initial output file. That's good. So that's getting saved. And then we should see our file getting incremented here, right? Exactly like what we were looking for. We have the iteration count and then we're saving this in a loop. Awesome. So this looks right. Let's go ahead and what we'll do is we'll open up a new terminal. We'll go full screen here and now let's go ahead and iterate on a pie chart. Let's use a pie chart as an example, right? This is one of the cool parts about Mermaid. There are varieties of charts you can build. So if we look at our readme, we'll have an example here of a pie chart. Where's that pie chart? There it is. So I'm just going to copy this command here, paste this and go ahead and update to use the mer-iter command. Okay, so our Membrane AI agent is going to go ahead and create this pie chart for us. Awesome. So you can see that looks great. It's iterating right now. So what I'm going to do is ask for a change I'll say you know coding testing documentation meetings go ahead and add a new activity here we're going to say add new pie slice mastering AI coding with nd dev dan go ahead and get that slice added there all right so this looks great let's go ahead and check our files so if we open this up you can see we created this under an additional intercession that's fine but if we look at these images we can see we have time spent on project tasks and then we have that additional you know five percent uh mastering ai coding with any data by the way if you're interested in the intersection of ai coding and ai agents definitely drop a like and consider subscribing to the channel. The way I see it, the world of generative AI is extraordinarily simple. You're either learning and using gen AI tech like AIDER, Cursor, and tools like our Mermaid AI agent, or you're getting left behind fast. On the channel, AI coding and agentics is our bread and butter. Here, we spot trends before they happen we extract value we learn and we move on don't fall behind and join the journey so let's keep going here let's go ahead and do something bigger if we go up to the top level here collapse all of our code you can see here we have two commands we have mer and then we have mer iter so we've been working on mer iter we you know created this additional session directory it made that change for us that's awesome i'm going to go ahead and create one more command here i want this bulk command and what this is going to do is basically create five versions of a flow chart right so sometimes you're not sure what you're looking for and you just want you know n iterations of it so all we should need to do here is pass in an additional dash c flag and that should do the trick for us. We're going to use our favorite open source free AI coding tool, Ader, and we're just going to ask for this change. Let's hop back to the terminal. I'll go ahead and clear the chat and I'll also clear all of our files. I'm going to go slash add. I'm going to add the readme and then I'll say, you know, add. Of course, we're going to need the main and let's go ahead and add our mermaid agent. And let's go ahead and add our mermaid call as well. And that should be good. So with these files, we can go ahead and type slash tokens to see what our context window is like that looks good and now let's go ahead and request a change so read read me and let's build out our new mer bulk command but add another dash C, create n versions of our diagram. I also forgot to add our type file. So I'm just going to copy this command and then I'll add our typings file here. This has all the types, all the pydantic types for this code. So you can see here we have a couple of different types. For every function, I have this, you know, one-shot mermaid params and then our iterate mermaid params. This is what gets passed in and created on the top of the method. So this gets passed into this actual functionality. So I'm going to say that. So I'll paste this back in and then I'll say create a new param type for this method and let's call it bulk mermaid params. Okay. So I'm going to go ahead and let AIDR make these multi-file changes for us automatically. I'm hoping in just one shot without having to do anything here, it's going to make all these changes for us. Let's go ahead and see if AIDR and Sonic 3.5 can one-shot this new feature. All right, nice. So we got a little anthropic server error, but this is awesome. So it's going through, it's making those changes, it added the type, it added the new command, it's importing it, it's updating the Mermaid agent to make these changes, and now it wants to know if we need to create this input file.txt i'm not sure what this is let's go ahead and hit yes we'll see what that looks like in the end so all right so let's go ahead and hop back to our editor and now we should be able to look through all of our commands here so we can see we have our new merb balk command and you know what i'm not even going to look at this code right we can see we have our new mer balk command and you know what? Not even going to look at this code, right? We can kind of see that it looks like it's in the right form. All I'm gonna do is rerun a prompt. So I'm just gonna go ahead and copy this. So you can see here, we have the prompts. So this is a flow chart of the setup instructions. We're gonna call this setup diagram.png. We're loading our.readme. So literally this readme file right here, right? And then we're going to say dash C5. And that's the new flag that we have right here. And it's going to be the count. And so let's just go ahead and run this. Let's see if AIDR did this all for us in one shot. shot okay so interesting results there um it looks like it did generate a couple different versions. We have install UV, install dependencies. And before we look through these diagrams, you can see here that that's exactly what our setup instructions look like, right? We're using UV, the brand new hyperfast Python dependency manager. You use UV sync to download all the requirements, set up the open AI key, and we have a couple optional setups. And then we have just running our commands, right? So if we look at the diagrams, these look really great, right? So we have install UV, install dependencies, setup key, run single, run interactive, and then we have our brand new run bulk, right? So this was one version. We can go ahead and close this. We have another version right here. This also looks good. Has an additional done node. Some of the node titles are a little simpler. Looks good also. This one's really interesting, right? So this is the power of generating multiple versions, right? You might want something more verbose like this. So we have start, install UV, install dependencies with UV sync. Nice. I like the additional detail there. And then we have set up open AI key as MVAR. Awesome. Then we have this optional decision diagram. This is really cool. You know, we can also in this code base set up Anthropic, Vertex or Grok. And then we have run a single generation. And then if we want the interactive generation, you know, we want our MER-ITR. So we also have that as an option and then we have just a simpler version here right so just top to bottom option only set the other keys and then we can run single run interactive or run bulk so it actually looked like this this did work perfectly in a single shot right i won't bother you with going through the code but uh you know we can see that um aider generated all this in one shot. If we look back at this run, it needed to edit three files to make this happen, right? And we could also see, which I really love, you can see we sent 18K tokens, received 1K, that costs 7 cents total, session total is 30 cents. Really, really nice to see those metrics right at the top here. As we discuss on the channel all the time, the cost of LLMs is going to zero. The context window is going to 150, 100 million and beyond. A really interesting post just came out backing that we have 100 million context token long window with this company called the Magic Team, which they're new on my radar. Apparently they've been teaming up with Google Cloud to crack the 100 million token contacts. We'll be keeping an eye on this on the channel. You know, if we hop back here, we can see that, you know, across three files, Ader and Claude 3.5 Sonnet just nailed everything that needed to happen to generate this change. And we even got, you know, this, the mermaid bulk params, which is exactly what we asked for. If we open up our typings file, we can see we have bulk mermaid params right here. And it looks perfect, right? We got the prompt output input count. And this is really awesome to see. So big shout out to Ader. This is a fantastic tool. I wanted to share this with you because I don't want you to be locked into the closed source tools. Like I mentioned, I love Cursor. I use Cursor, but I also love AIDER and use AIDER. This one's free. It's open source. It's a lot more customizable. Paul also has some really, really killer insights and some incredible benchmarks. So, you know, if you check out the AIDER LLM leaderboards, a large portion of the AI coding ecosystem looks at this web page right here to know what is the performance of this new model on real code bases using AIDER, right? So this is really cool. You can see Cloud 3.5 Sonnet, as we've been saying on the channel. It is the best AI coding assistant, large language model by far, hands down. This is the benchmark to look at. Paul, with his work on AIDR, is just the leader here in the AI coding space. I would love to see Cursor put out some benchmarks like this, where they compare and use their tool, their prompts, to create some concise benchmarks for us to understand and internalize how they see model performance with their tool. So anyway, tons of value here. Definitely check out AIDR as an alternative to Cursor. As I've mentioned in the past, I go back and forth between these tools. But when I'm coding deeply, when I'm working fast, there is just no more precise tool than AIDR. You come in, you can check your token usage, you can add and remove files, you can add and remove files, you can add directories. Huge fan of this. It's a lot simpler. AIDR really leans on the power of the LLM and the simplicity of a just a really clean AI coding architecture. So anyway, that's the Mermaid Diagram AI agent. This is going to be in the description for you. Feel free to check this out. Regardless of how you generate your diagrams, I highly recommend you dig into some type of gen AI tool like this. Even if you just go for, you know, right for the simple cloud or chat GPT interface, generating diagrams on the fly is so, so important. So valuable as an engineer, right? And if you are a mid senior plus level engineer, you know that communicating the value of your work is incredibly important. And creating diagrams helps you do that in a faster, more concise way. So that's the power of an AI agent like this. Just being able to generate diagrams on the fly, iterate on them, and having a quick iteration human-in-the-loop pattern to do that will help you generate these diagrams faster, which will help you communicate your ideas faster for both your personal and career work. Definitely spend time, communicate your ideas well, use diagrams to help you do that, and use Gen AI to help you build your diagrams to help you drive that effort forward. Again, I'm a huge fan of Cursor. I use it, but it's important to diversify. It's just too early in the AI coding game and the generative AI age to be committing and putting all your eggs into one basket, into one tool. I like to stay close to the prompt, stay close to the metal, stay close to the tooling, and tools like AIDR allow you to do that. We've been at this for longer than a year and a half, almost two years now. And we are just scratching the surface of what's possible with these incredible AI coding tools and with generative AI. If you want to stay up to date and catch these trends before they happen, join the journey. Drop the like, drop the sub, and I'll see you in the next one.
Cursor is great BUT Aider is the OG AI Coding King (Mermaid Diagram AI Agent)
🔥 Why Aider? Simple - Because Aider is THE Original LLM-based AI coding tool. 

🍓 AIDER
https://aider.chat/

🖼️ Mermaid JS AI Agent
https://github.com/disler/mermaid-js-ai-agent

🔐 Great builder.io article on Cursor, OSS, and Lock-in
https://www.builder.io/blog/oss-consequences

💻 Our Cursor Composer Breakdown
https://youtu.be/V9_RzjqCXP8

⏰ Aider Review 1 YEAR Ago
https://youtu.be/MPYFPvxfGZs

Unlike Cursor, Aider is open-source and completely free, offering you more control and customization over your AI coding process. 
With support from multiple LLM providers and incredible insights from its creator, Paul, Aider is designed to keep you ahead of the AI Coding curve.

🥚🥚🐣 Don't put all your eggs in one basket - explore the benefits of open-source AI coding tools like Aider. Whether you're a seasoned dev or just starting out, this video will show you how to:

- Use Aider's terminal-based interface for precise control over your AI coding process
- Implement the "Ask - Draft - Change" pattern for more accurate code modifications
- Develop new features for our Mermaid JS Diagramming AI Agent with minimal manual input, leveraging Aider's advanced AI coding capabilities
 
🎥 In This Video:

- Discover why Aider, the original LM-based AI coding tool, often outperforms Cursor.
- Learn how to leverage Aider's multi-file editing capabilities to enhance your coding efficiency.
- See a live demo of building a Mermaid AI Agent to create stunning diagrams effortlessly.
Understand the importance of diversifying your AI coding tools in the rapidly evolving generative AI landscape.

🛠️ Key Topics:
AI Coding: Experience the power of AI in coding with Aider.
Multi-File Editing: Seamlessly edit multiple files with ease.
Diagram AI Agent: Use Mermaid.js + Generative AI to generate and iterate on diagrams quickly.
Human-in-the-Loop: Enhance your agentic coding with iterative feedback and adjustments.
Open Source: Enjoy the freedom and flexibility of an open-source AI Coding tool, AIDER.

🌟 Stay ahead in the world of AI programming and AI software engineering by subscribing to our channel. 

Stay focused and keep building.

📖 Chapters:
00:00 Cursor Pop off BUT BEWARE
00:30 Aider - The Original LM-based AI Coding Tool
01:27 Mermaid Diagram AI Agent
04:10 AI Coding with Aider
11:35 Multi-File AI Coding with Aider
17:45 Cheaper LLMs and 100m context window is coming
18:50 Aider gives you incredible AI Coding Insights

#aicoding #programming #aiprogramming