📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

My AI Coding Workflow for Production Rust

Jeremy Chone18:26

Transcription

Okay, so today I'm going to show you how I code with AI now. I generate about 90% of my code this way, but through a rather unique workflow. Control first, magic second. For me, collaborating with AI is all about good engineering. I focus on flattening the complexity curve so I can maximize good code generation and avoid bad code proliferation. A little bit more work upstream and much better quality downstream.

So, the point here is I have the AI pack key. And in fact, we're going to develop AI pack a key with AI pack and pro coder. AI pack is a runtime that allows to run, build, and share AI packs. An AI pack is one or more agents. So, that is a way it works. And one of the pack is a pro coder. So, you go to your terminal and then we're going to do AIP install pro at coder. I already have it installed, obviously. So, that will install the pro coder. And then I can do a AIP run pro at coder in the root of the project. And I already kind of created the file, but that will create a dot AI pack over there. And then below that, I'm going to have the prompt. And that I'm going to have the pro coder. It created this file here, the prompt files. And that is a parametric prompt. That allows me now to give the parameters that I want the pro coder to have. And so right now, for example, I want I'd like to use my rust annex best practices. And so you do AIP install pro at rust annex. So, that is the knowledge is static.

Then, you have the context gloves. And so the context gloves here is the files that I'm working on. So, now this one is I'm going to give all of the source here, all of my source files. I'm going to give also the readme. And in fact, I'm going to give probably something like that. So, I don't want to go through the root here. And that is the only thing that it can see as file contents. It won't be able to see anything else. Okay? So, I don't need that and I don't need that. And now in the file structure, I'm going to mimic that. And sometime I can do a little bit wider. So, for example, here I might do test data. So, like this, sometimes the AI will be able to say, "Hey, you are missing this file." This is just the file path. That will send the file path and the content when it gets selected. So, right mode two, we can turn it to false. And then the magic is the auto context. And we're going to enable it. We can put it as a comment this one out. And that we're going to use flash. So, I have flash and we use everything. I mean, we can use any model we want. And the routing is by the name or we can actually do something like a name space like that. That will work as well. So, we have the model for the auto context. And I'm going to explain that later. And then we have this dep chart business, which is we're going to leave it like this. And then the main model we're going to use GPT. GPT 5.4 is pretty good. The Opus 4.6 is very good, but it's more expensive. So, the 5.4 is a very cost effective. So, I'm going to do that.

And now I'm going to ask a question, for example, to say, "If I want to change the sequel light table for the pin table, what file should I change?" And so we're going to do that. Now we're going to go back there. And now we're going to press run. So, what that is doing now is you can see all of the run that you're doing is a terminal UI, yes. And it's running in parallel here. And we're doing a code map. So, in fact here, we're going through all the files that I've changed since last time. And we're going to put it under that guy. It's a code map here, context code map. And we also have knowledge code map. And that allows us here now with all of this summary and everything. And we have the hash such as we don't ask the AI twice when the file didn't change. But we have the summary, when to use, and the public function, and the public type. Such as some of these files here, for example, this one will export these two guys. And that is a Lua file. So, even Lua will work. It doesn't matter because it's the AI that does that. And it's relatively cheap. And because AI pack run in concurrency here, I can have concurrency to 16. Usually, by the way, I put concurrency to 32. And that will all go like like a blast. And now the auto context is is to say, "Hey, I had 388 files. But now with your question, it's only these two files." And it's going that. It's actually these two files. Click here, the name is a little bit of a weird name, but that is where I create my sequel light schema. So, in fact, I didn't do an AST, I didn't do a tree sitter or whatever. I just go through each files and I created that.

Now, let's say that we actually want to recreate the code map from scratch, just to see. So, we have about 400 files, about 60,000 line of code. So, we're going to go crazy and we're going to delete that file. We're going to use flash for now. We're going to test the new GPT 5.4 mini later. That would be cool. And right now, what we're going to do is just remove the prompt. So, the prompt is in between these two guys such as it just do the code map. So, now we're going to go back to our terminal. And now we're going to press R. And that is going to do all of these files and send them and one by one in parallel with 32 concurrency will index them into our code map. So, new line JSON and then it combine them. So, that is super cool because we see that in 20 seconds we did about 10 minutes of work, which is pretty cool. We can see all of the file here and we can click on each of the file if you want. We can go here and we see all of the files here. That is how the thing works. Yellow is sent to the AI, green is done, and gray is not sent yet. So, we're going to see that and we're in a 46.7 second for 25 minutes of work. That's pretty cool. And then that's it. It's going to be closed. We're about at one box, 1.3 dollars. That's not too bad cuz the quality after is through the roof. And then that's it. So, the auto context here didn't do anything because it went no prompt. But the code map was done. So, the auto context is a sub agent that calls a sub agent, which is a code map. Okay. Now, just being silly here, we are at 1.3 dollars and we did one minute of work in total was 29 minutes.

So, now let's go the new guy, which is the mini. So, that is an alias that will go to that guy, GPT 5.4 mini. We can put the full name, but I like to use aliases. And usually AI pack points to the latest one. So, we save and then we go back there. And you guessed it, we remove that guy. Go back on this guy, 1.3, 29 minutes. We're going to see. Boom. And then we're going to see much faster. I mean, if you see that. So, that is super cool. Now we're going to have to test the quality because the the reason why it goes faster is because they have less reasoning. We can see here all of that. And we are at 1.50 cents. So, now we have done that in 37 seconds compared to flash, which was one minute. The total was 29 minutes. Then this guy was 10 minutes. That's pretty cool. 50 cents. And then this guy was at 1.3. So, assuming that GPT mini will be as good here and that we need to test more a little bit, but that would be the new winner of the day. But it doesn't matter because the beautiful thing is when there's a new winner, guess what? We put it back to flash for flash four. And no harm done. And HQ, if one day our friend here is updating this one right now, we don't recommend that. The 4.5 is not good at all. It's fast, but bad. So, it's a waste of time. Okay.

So, that is pretty cool. So, now we're going to go back to our previous state, which is going to be our flash and with our prompt like that. Okay. And now I can change. So, for example, I want to say, "Hey, I want to do some work on this data model." That it will do that. Now, the other way that I'm working as well is that we have these things, which is the dev kind of sub agent. So, those are sub agents in don't realize it, but you can actually have your own sub agents. And you just call sub agents. And then you can put a name here. And in this case, you will do a pro at coder {slash} auto context. That will be the one that I'm using that. That is just sugar coding. It's actually adding that behind the scenes. So, it's it's very modular. You can have your own sub agents. And now I have a sub agent, which is dev. And the dev put a dep chat such as I can chat in the file because but the way that I like to code is I like everything into files. I like terminal, but I like all my things, even my prompt to be in files. So, this is why my coder prompt is actually a file. And so in fact, what I've done here is you can see that I have a workbench. So, I have this concept of workbench now. And a workbench is like a topic. It's like a feature or something that I want to implement. And I can point this dep chat or plan either true. And in this case, the dep chat will be this file, yes. And that's fine. And so that was the chat that I did before. I don't know what it was about, but it was TUI pass highlight. Oh, yes. Positive model. So, there was an issue here, I think. So, I I asked the AI to capture the issues that I was talking about, finding the wrong code. And then once I have that, I was like, "Hey, everything is in dep chat. Can you implement it now?" So, it's different than many workflows here. And the fact that other people has a workflow that work for them is great. And this is awesome. For me, 90% of my code is generated by AI. But engineering is still engineering. I want my dep chat. I want my plan. I want to review it. And it's not prompt and pray or prompt and approve approve approve reject. It's more I work with AI to find what I want. And often I also create what I call the spec. Yes, I have a spec code here for the things on my system that I should spec that are a little bit more complicated. And so I spend time with AI to have AI writing that with the code and to iterate on it. And so that is a whole kind of a spec driven kind of things. And in a way, a dep chat is almost like a disposable or ephemeral spec or at least brainstorming to a spec. And often then I can say, "Hey, now that we have the spec, create the plan." And then here I have a whole plan rules here. It's actually what I did over there. And then that will take everything into do, will put it in current, and then will end up in in done. So, the done will get bigger bigger. And then and then everything will get picked up out of to do. And that is a plan rules. And we might have a also a riff workflow here. And so the point is that it's not one way that change everything. It's to say, you know, you want to have a file-based model such as you can have your best practices. And the best practices is not encoded into a tool or into a even a skill or whatever. Yeah, you you can write your own markdown to guide the tool you want. And that is many ways what I've done with the plan rules. Yeah, the plan rules explains the stuff that could be called a skill. If I were good in marketing, I would call that a skill. And then, that will explain how to do the stuff. But at the end of the day, you know, we can call it the way we want and it's cute, but it's just a way to guide the AI to behave in a certain way. And that is just files. We want files. Whatever us coder, everything is files, yeah.

So, my point here is that now what I've done is I wanted to have a specific path over there. And that is what I call workbench. So, what I did here is I have this and this is very cool feature in this sub agent, which is a dev chat and the dev plan. Where you can give a folder. And then this folder will create a blank dev chat, which is just that. And then you can ask to do the same. So, for example here, what I want in AI pack is right now I have two tables for my pins, you know, the things that you see here. You know, this is what I call pins. And do I have a print? I don't know if I have prints. I don't have print because this one are pretty clean. But usually I have prints as well. And it's actually here I realize that I forgot I want this one to be in the record. And well, actually we're going to do that now. So, now what we're going to do is to say, "We want the records and the pins up there, but we also want" and this is something, you know, when we have this guy here and that guy here is the output and the input. I also want them in record. So, I have a log where I log like little stuff and I think I put everything in in log, but now I want them in record here. So, what I'm going to say here is like in the dev chat, it told me these kind of things. And then you can see that because I put in you content and this workbench is not part of my contest gloves. So, it will only be in the context when I put it there and it will only be the dev chat and the plans and everything. So, it's is actually very narrow the way to work. So, my point is to say that now our concept, which is unified content. So, my goal is to work into a unified content thing such as when I repeat content is stored only once in the sequel light and then we have the idea and everything. It's kind of a not copy on right, but almost. So, the thing that I want now is to say, "Hey, you know, what? The AI and then the output stuff, I want them to be in the record as well." So, we're going to do that. So, I say, "Do not update any code files because we're brainstorming right now. Just read and update the chat." I don't say where the chat is because that is going to be put there. He will know where it is. And I don't want to say dev chat MD because sometimes if you use a lazy model, it's going to create a dev chat at the root even if you see the one on top. So, I say dev chat. Fine. Okay, I can do that. Now, what I'm going to say to say, "We captured the requirement to move the pin and the print into a new table, record." We say correct. However, I also want to move the log input and output. So, I'm going to focus on this input and output right now. And then later I will refactor this guy. And so, this is one of the thing here for me. And again, if Claude works for you, use Claude. This video is not for everybody. But for me, the problem here is I don't want to let AI into say, "Oh, AI is going to think and resolve everything." I want to like work with AI. 90% will be written by AI. Before I had a keyboard and now I have AI, it doesn't matter. But the point is the engineering is still me and in collaboration with AI now. I don't want to be alone anymore. But it's not something that I want to fully delegate and it's not a not yet problem. Yeah, everybody say not yet, not yet, not yet. No, it's you want to be part of the conversation of how you shape your product. Yeah, whatever it is. So, that is what we're doing.

So, now what we're going to do is to say, "However, I also want to move log inputs to the code table and get rid of the in out table." Capture this new requirement. And ask question if any. So, it goes back here auto context. So, auto context the code map is already done on my 400 files or whatever. And then it does this and this looks super cool and I can even see the files that it found, which I'm super happy. And this stuff has been much better than what I thought. And then it goes there. And then when I click on dev, look, he added the workbench here on context globe post. There's a reason why it's post because that is friendly to caching. So, that's pretty cool. Now, go back there and it's going to say something like that. And so, I can click here. There's a little integration with your editor. And then, yeah, added a request. That's good. User ask, keep that. It's cool. It's cool. Uh at a minimum, the kind of appear to be pin printer. Yeah, that's perfect. This is what I want. Good. That's good. It's good. So, that that is awesome because I forgot what they were there and it's telling me, yeah. So, I have the sys. So, this one I wanted more kind of a transient guy and this is the key guy. So, often sometime I go with that and sometime when it's simple, it's going to be enough and I say, "All right, we've decided everything and you can call it."

Now, on this one is a bigger beast here. It's going to be a sporty one. So, is I'm going to ask to create a plan. I don't do always a plan. And that is the beauty again of the code up prompt, yeah. Because in the code up prompt, if I don't do plan like this, if I comment this one out, guess what? It doesn't see this file. It's not a thing. And it's not like the AI can ask it if you ping pong, you know, you can play ping pong as long as you want. I mean, good luck, yeah. You won't get it. So, the point is that now I have the things where I have full control of what I want. And so, right now I can turn it off the plan and then after I can turn it on and say, "Hey, this is a big beast, create a plan." And then it will create a plan. And then I can run the plan. Then I will answer all of these questions. I will do an answer here. Should input in record use the same content plus optional display as current in out, meaning the record should likely, yeah, need a display column. This is super cool. I didn't think about it. And I had that in the in and out. And I am going to say yes. And that mean that what I store in the display is what I display in the TUI, but the content might be bigger. Now, this guy for input. So, that is what I will do, yeah. Now, because I GPT GPT likes to do these kind of things. Yeah, open question over there and then at the end it's going to do going to answer them back or take the assumption, which is pretty cool because this way if you did not answer, if you were lazy, you go there. But those are very important discussion here. And even here I'm like there's so much stuff that goes to my head. And this was so cool that AI has that. And I will go one by one. I'm not going to do that live because I already gave a lot of information. But this is my workflow. So, what I will do is once I answer that, I will go back here. And I will go here and it will say, "Now that we have decided" I will make sure that I have the plan. "Decided what to do in the dev chat, you can create the plan to do" just to make sure that it doesn't stuff following plan rules. Okay? And I'm going to say, "Just create plan to do. No, not implement." I think for now. Usually it will do it. GPT sometime is overzealous. Codex was horrible. The 5.3 Codex is the next version of GPT. So, this is aliases that will map to 5.4 and on the latest when you update things. But you can put full names like that. You can put that if you want, but don't because in fact it was fine-tuned for the tooling Codex and and it doesn't follow instruction well. It's it's really not good. So, and then now I'm much happier. And then when this one doesn't do well, I do it with But again, you do GPT on this guy. In fact, let me show you. I'm going to run it. So, again, the auto context takes sometimes 17 seconds, but the value is through the roof. Like for example, we take 1.8 megabyte, 65 kilobyte. That's life is good. So, now up workbench and it created this guy. Click on it. And then usually what I will do is I go back here. And then I say, "Following plan rules, implement next step." And then it will do the stuff. And sometime I use even flash here, the latest flash three, which is actually pretty cool on on many things. So, anyway, that is the way that I use the AI. Hopefully that was helpful. Until next one. Happy coding.