back to index

To the moon! Navigating deep context in legacy code with Augment Agent — Forrest Brazeal, Matt Ball


Whisper Transcript | Transcript Only Page

00:00:15.000 | Welcome, everyone.
00:00:16.000 | Thank you so much for coming.
00:00:17.000 | My name is Forrest.
00:00:19.000 | This is Matt.
00:00:20.000 | And we're going to be talking to you today
00:00:22.000 | about Augment Agent and specifically legacy code,
00:00:25.000 | how we get the most out of gnarly legacy code bases using an AI agent.
00:00:30.000 | So I do not work for Augment Code.
00:00:33.000 | I am a friend and partner of Augment Code.
00:00:35.000 | So I hope to put this talk together.
00:00:36.000 | Matt is from Augment Code.
00:00:37.000 | So he's going to be your best person to come to
00:00:39.000 | with your most detailed technical questions after the session.
00:00:42.000 | Matt, anything you want to say about yourself?
00:00:44.000 | Yeah, I was once a software engineer
00:00:47.000 | and then got into the developer tool space.
00:00:49.000 | I was at Postman for a number of years
00:00:52.000 | and then got really excited by the AI boom.
00:00:55.000 | So I've been at Augment for the last two years or so.
00:00:58.000 | I'm a solutions architect.
00:01:00.000 | Fantastic.
00:01:01.000 | All right, so just a quick roadmap of where we're going.
00:01:03.000 | We're going to talk a little bit about Augment Agent.
00:01:05.000 | Uh-oh, do we not have them?
00:01:07.000 | I see someone pointing.
00:01:09.000 | We good now?
00:01:10.000 | Okay, fantastic.
00:01:11.000 | So we've got Augment Agent.
00:01:12.000 | We're going to talk a little bit about the Apollo 11 guidance computer
00:01:15.000 | and then we're going to show you some really interesting things
00:01:17.000 | you can do with that code base and Augment Agent.
00:01:20.000 | So Augment is the product we're going to be using today.
00:01:24.000 | You do not need your laptop out to follow along with this session.
00:01:27.000 | We will do it all in front of your eyes.
00:01:28.000 | But if you want, you can sign up.
00:01:30.000 | There's a free trial at AugmentCode.com.
00:01:32.000 | And Matt will tell you a little bit about the most important features of Augment Code.
00:01:37.000 | Yeah.
00:01:38.000 | Number one is our context engine.
00:01:40.000 | So we really identified early on that in order to get high-quality outputs from any of the models,
00:01:47.000 | they require high-quality input.
00:01:49.000 | Doing that for code bases is not necessarily straightforward.
00:01:53.000 | It's not just like text.
00:01:55.000 | So this is something that we've seen in the market.
00:02:00.000 | A lot of folks think that there's a way to do this.
00:02:03.000 | We spent two years building a proprietary system that can lift the right knowledge from code base
00:02:08.000 | and pass it over to the models.
00:02:09.000 | And we think that results in high-quality outputs and more accurate understanding.
00:02:14.000 | We're a plug-in to existing IDEs.
00:02:16.000 | We see in a lot of enterprise that if you've got a 10-year-old Java code base,
00:02:20.000 | you're using IntelliJ, you don't want to have to switch.
00:02:22.000 | And then from day zero, because we were targeting enterprise,
00:02:26.000 | we've focused a lot of security capabilities.
00:02:29.000 | So we have things that are unique to us versus any other vendor,
00:02:32.000 | like customer-managed encryption keys.
00:02:34.000 | We have ISO 42001, which is a new AI ISO standard.
00:02:39.000 | So we really wanted to laser in on providing security over what is a very important asset in your code base.
00:02:48.000 | Awesome.
00:02:49.000 | And then we've got a couple of tools we'll be referring to today.
00:02:51.000 | mainly the chat and agent modes of augment code.
00:02:54.000 | And when would you use each of those, Matt?
00:02:56.000 | Yeah, chat is great for kind of simple back-and-forth question-and-answer
00:03:00.000 | or when you want to leverage a little bit more control over the models
00:03:04.000 | and you just want to go one turn at a time.
00:03:07.000 | Obviously, we see that agents can integrate into other tools,
00:03:11.000 | are much more capable of larger, more complex tasks.
00:03:14.000 | And then remote agents are great when you actually want to close the lid on your machine
00:03:18.000 | and allow them to continue to run in the background and in parallel.
00:03:22.000 | Yes, we did a workshop on Tuesday that involved a contest component.
00:03:26.000 | And I had someone come up to me afterwards saying,
00:03:28.000 | I don't understand how the winners were so fast at submitting their solutions
00:03:31.000 | because we had eight or nine problems we were doing.
00:03:33.000 | And it's possible some of them were using remote agent to do some of those tasks in parallel.
00:03:37.000 | So it can come in handy for that as well.
00:03:39.000 | All right. So we're going to be talking today about the Apollo 11 mission in 1969.
00:03:45.000 | I think most of us are familiar with this, the first time humans landed on the moon.
00:03:48.000 | There were three astronauts in that capsule, Neil Armstrong, Buzz Aldrin, and Michael Collins.
00:03:53.000 | But sometimes people say there was a fourth astronaut on the Apollo 11 mission.
00:03:57.000 | Does anyone know what that astronaut was?
00:04:00.000 | Yeah, the Apollo guidance computer or the AGC.
00:04:04.000 | And the main things to know about the AGC.
00:04:06.000 | So this is used to land the lunar module.
00:04:08.000 | If you've ever seen that picture of Margaret Hamilton with like that giant stack of papers with the code on it,
00:04:12.000 | that was the source code for the Apollo guidance computer.
00:04:15.000 | It was one giant monolithic source file developed over a period of several years at MIT in the 1960s.
00:04:21.000 | It was written in assembly language.
00:04:23.000 | Who here has written assembly at some point in their lives?
00:04:25.000 | Put your hand down if it was in college.
00:04:27.000 | All right. So keep your hand up if it was in production in some capacity.
00:04:30.000 | Yeah, exactly. That's what I thought.
00:04:32.000 | All right. So not a lot of us are going to be able to look at assembly code
00:04:35.000 | and be able to tell you confidently what it does on first glance.
00:04:38.000 | I certainly can. I haven't written much assembly since I was in computer systems 201.
00:04:42.000 | All right. So in some ways, this is the ultimate legacy code base.
00:04:46.000 | It is on GitHub. You can check it out yourself if you want. It's easy to find.
00:04:49.000 | We are going to try to navigate it well enough to see if we can understand it and land the lunar module ourselves.
00:04:54.000 | And Augment Agent is going to help us do that.
00:04:57.000 | So the first thing you want to do anytime you pop open a large legacy code base is you want to see if you can get your head around it, right?
00:05:03.000 | Someone put a lot of their time and mental energy into putting this code base together, and you've got to catch up with them.
00:05:08.000 | That historically has been a long process. It's been a fraught process. It's been an imprecise process.
00:05:13.000 | And AI agents such as Augment Code can help a lot with that.
00:05:16.000 | So let's look at a specific example, and I'm choosing the 1201 and 1202 program alarms.
00:05:22.000 | If you're an Apollo 11 history buff, you know about these because during the final descent onto the surface of the moon,
00:05:28.000 | the astronauts called to Houston and said, "Hey, we're getting this alarm. It's a 1202. Give us a reading on the 1202 program alarm."
00:05:35.000 | This alarm went off five times as the lunar module, the Eagle, was making its descent onto the lunar surface.
00:05:42.000 | And there was a question for a moment about whether the landing would need to be aborted.
00:05:45.000 | And finally, Houston said, "No, you're okay. You can continue."
00:05:48.000 | So our question is, could we determine that for ourselves, right?
00:05:52.000 | If you were given the Apollo guidance computer source code, would you be as confident as Houston was to say,
00:05:56.000 | "No, this is not a problem. It's going to affect the success or stability of the mission."
00:06:00.000 | So the way I would do this is I'm going to pop open. I've got VS code up here.
00:06:03.000 | And I've got a slightly modified version of the Apollo 11 code base just to orient you.
00:06:09.000 | It looks like this, all right? This is their version of assembly code.
00:06:13.000 | It's truly just a bunch of two-word commands saying, "Move this piece of data into this register."
00:06:17.000 | So it's not fantastically readable.
00:06:21.000 | And even if you did like a grep and looked for 1201 or 1202, it's not going to tell you what the value of those alarms actually is.
00:06:28.000 | So I can go to augment chat and I can say, "What does the 1202 program alarm do?"
00:06:37.000 | And let's see what it tells me. Generating our response.
00:06:42.000 | All right. And so it's going to take a minute to turn on that.
00:06:45.000 | And it's going to come back to me with a number of pieces of information, both from the code base itself.
00:06:49.000 | And it will also be able to call out to the web and it'll be able to look there.
00:06:53.000 | One of the things I think is interesting about using a chat mode like this is it's kind of similar to calling back to mission control in Houston.
00:07:00.000 | And if you were to plug in like, you know, some MCP servers to this, right?
00:07:04.000 | There's a, it gives you an even, an even larger mission control element to work with.
00:07:08.000 | Okay. So it's, it's actually reading this file for us.
00:07:11.000 | So the ACG executive scheduler system runs out of available core sets.
00:07:16.000 | All right. And it shows us where that happens.
00:07:18.000 | Look, there's octal value 1202 right there.
00:07:21.000 | It explains the number of registers there are.
00:07:23.000 | It explains the, yeah, along with 1201 no vac areas.
00:07:26.000 | So it pulled both of these and look, it went out to the web and it's giving us the context of what actually caused the error.
00:07:31.000 | It was an external radar system being left on.
00:07:34.000 | And the Apollo 11 computer was smart enough then to offload some low priority tasks so that it could continue executing mission control, mission critical components inside the computer.
00:07:44.000 | That's why they were able to land.
00:07:46.000 | Uh, so yeah.
00:07:47.000 | And then there's your little TLDR.
00:07:49.000 | 1202 means the computer's trying to do two things at once and has run out of memory to track all the concurrent jobs.
00:07:54.000 | How long would it have taken you to figure that out on your own reading through that code base, right?
00:07:58.000 | I can tell you would have taken me more than the 30 seconds we've been talking here.
00:08:01.000 | So that's pretty cool to see.
00:08:04.000 | All right.
00:08:05.000 | The second thing I want to do is do a little bit of code modernization here.
00:08:08.000 | Now, when the lunar module actually landed on the surface,
00:08:11.000 | Neil Armstrong used a routine in the lunar landing guidance equations file called P65.
00:08:18.000 | And that was kind of like a manual override mode.
00:08:21.000 | They didn't really trust the computer enough to let it land the Eagle all by itself.
00:08:25.000 | Neil Armstrong kind of had a thumb on the controls throughout that process.
00:08:29.000 | There is also a routine in that file, as I discovered, called P66.
00:08:34.000 | Sorry, he used P66.
00:08:35.000 | We're going to use P65.
00:08:36.000 | P65 is full automatic.
00:08:37.000 | That's where you just let the lunar module land by itself.
00:08:40.000 | It turns out that augment agent has a thing called auto mode.
00:08:45.000 | I'm going to show you what that looks like.
00:08:46.000 | So you see down on my chat here, I actually was on agent mode before.
00:08:52.000 | So we could have been in chat mode, but I can also be in agent mode.
00:08:55.000 | And this is going to, if I ask it to write some code for me or to run some code,
00:08:58.000 | it's not going to ask me for permission.
00:09:00.000 | It's not going to wait and have me click on something.
00:09:02.000 | It's just going to go do it.
00:09:03.000 | I could go get a, you know, a cup of coffee and I could let augment agent land on the moon for me.
00:09:07.000 | So what I'm going to do, I've added a couple of files to this code base.
00:09:12.000 | One is called simulator.py.
00:09:14.000 | I wrote a little simulator that expects a file to exist called descent.
00:09:19.000 | And it expects a class to exist in that file called lunar descent guidance that implements the P65 algorithm.
00:09:24.000 | That file is not written.
00:09:26.000 | I'm going to see if augment agent can write that file, run the simulator, and land on the moon without any human assistance whatsoever.
00:09:34.000 | Just like the actual P65 would have run.
00:09:36.000 | Should we give it a try?
00:09:38.000 | All right.
00:09:39.000 | So this is my favorite prompt to do this.
00:09:41.000 | It's just run simulator.py until it succeeds.
00:09:47.000 | Nice.
00:09:48.000 | Do not change simulator.py.
00:09:51.000 | All right.
00:09:52.000 | That's where it would try to get me, right?
00:09:54.000 | Okay.
00:09:55.000 | Let's see what happens.
00:09:56.000 | All right.
00:09:57.000 | So what's augment agent doing here?
00:10:00.000 | All right.
00:10:01.000 | It's going to run the simulator.py file and work through any issues.
00:10:03.000 | So, Matt, any comments you want to make about like how augment builds its plan for what it wants to run here?
00:10:08.000 | Yeah.
00:10:09.000 | So it's going to use code-based knowledge as a starting point to figure out, you know, how it should, what tools it should run, what commands might be important.
00:10:18.000 | And so from there it can start to understand what might be missing.
00:10:23.000 | And then typically you'll see the agent start to put together the framework of a plan as to how to solve this.
00:10:28.000 | So it might go and read individual files and just start to gather a better sense of what it's going to take to complete the task.
00:10:35.000 | So here it's realizing at this point that the file is missing and then it's going to start exploring the code base more generally with our context engine.
00:10:42.000 | So it can kind of grok some of that assembly code and start to think about what an implementation would look like.
00:10:49.000 | That's right and it's actually like it's running little terminal commands for us, right?
00:10:52.000 | And it's not waiting for us to intervene here.
00:10:54.000 | It's just doing it.
00:10:55.000 | All right.
00:10:56.000 | So it's mapped things out.
00:11:02.000 | All right.
00:11:02.000 | So there's a little test file in here.
00:11:04.000 | Oh, it already succeeded.
00:11:05.000 | Okay.
00:11:06.000 | It got ahead of me.
00:11:07.000 | So based on the test files, I can understand what the lunar descent guidance class should look like.
00:11:10.000 | So it created the missing descent.py file.
00:11:12.000 | Let's take a look at that and see.
00:11:13.000 | So there you go.
00:11:14.000 | So it wrote descent.py.
00:11:16.000 | It's an implementation of the P65 vertical descent guidance.
00:11:19.000 | So Augment has indexed this entire code base.
00:11:21.000 | It's able to go look at it.
00:11:22.000 | So it found, you know, where it is in the original source code.
00:11:25.000 | And then I got to tell you, it's easier for me to read Python than it is to read assembly code, right?
00:11:31.000 | But it's actually laying this out for us.
00:11:32.000 | So here's where the position and velocity are.
00:11:34.000 | It's got the desired velocity.
00:11:36.000 | It's got the gravity fields.
00:11:38.000 | And then it pulls the routine together.
00:11:40.000 | And it should actually have an algorithm in here called P65 guidance that implements this in Python.
00:11:46.000 | And so our final position as it ran this here.
00:11:49.000 | Let me go.
00:11:50.000 | Let me catch up with my chat.
00:11:53.000 | Yeah, and it ran the simulator.
00:11:56.000 | Final position, this number of meters, final vertical and horizontal velocity.
00:12:01.000 | And you can see that it landed, you know, within our zero to one meters that we would expect for our final simulation values.
00:12:08.000 | So, yay Augment Agent.
00:12:10.000 | Good job.
00:12:11.000 | It landed on the moon for us.
00:12:13.000 | Okay.
00:12:14.000 | Most of us are not landing on the moon as part of our day job.
00:12:16.000 | So is this a parlor trick?
00:12:17.000 | Is there something we can actually learn here?
00:12:19.000 | So this is what I would take back to a legacy code base of mine based on what we've seen today.
00:12:24.000 | There's three basic steps.
00:12:25.000 | Number one, anytime you pull this open, you're going to try to use the agent to help you understand on your own what's going on in that code base.
00:12:31.000 | So Augment Agent will index it for you.
00:12:33.000 | You can ask questions in chat.
00:12:34.000 | You're going to be asking questions like, what does this code base actually do, right?
00:12:37.000 | What is this piece of the code?
00:12:39.000 | What does file XYZ do for me?
00:12:41.000 | Are there style or convention things going on here that I should be aware of?
00:12:44.000 | And then you can start writing some tests.
00:12:46.000 | So sometimes people ask, like, you know, if I am not sure I fully understand this code, am I going to know if the new code that I create is actually correct?
00:12:54.000 | So I think a blend of agent and chat mode are going to help you out a lot here.
00:12:58.000 | Use chat mode to predict what you think the code should do.
00:13:01.000 | So in the case of the P65 algorithm, you know, tell me what I think should happen when I run this lunar descent given these input parameters.
00:13:08.000 | And then have the agent mode write some tests to check that behavior.
00:13:10.000 | It's not always going to get it right.
00:13:12.000 | I had a case where it was working with the scheduler and it couldn't decide for itself whether priority level zero was the highest level or lowest level in the system.
00:13:20.000 | And you could convince it either way, like it's a classic thing an agent would struggle with.
00:13:24.000 | So take the time to go, you know, read yourself, right?
00:13:26.000 | Have it surface those pieces of the code for you.
00:13:29.000 | And then, you know, you're an engineer.
00:13:30.000 | You can apply your human ingenuity to it.
00:13:32.000 | And then modernize.
00:13:33.000 | Start converting small portions of the code in modular fashion to the desired language or, you know, style that you want.
00:13:39.000 | And apply those same tests to make sure that you're not getting far afield from what the actual functionality of the code should be.
00:13:46.000 | And that is not just a strategy for success landing the Apollo 11 guidance computer on the moon, but for working with your code as well.
00:13:54.000 | All right.
00:13:55.000 | Once again, you can try Augment Agent yourself for free at augmentcode.com.
00:13:59.000 | Bring your gnarliest legacy code bases and refactoring projects.
00:14:02.000 | I forget how many lines of code are in the Apollo guidance computer repo.
00:14:05.000 | It's thousands.
00:14:06.000 | I mean, that's reasonable for this, right?
00:14:09.000 | Yeah, that's pretty small fry when it comes to, like, enterprise projects these days.
00:14:13.000 | So, you know, the real world equivalent of this kind of thing might be, like, I've got a Java 8 project.
00:14:18.000 | I want to go to Java 17.
00:14:20.000 | That's really tedious, toilsome.
00:14:22.000 | How do I pass some of that over to AI?
00:14:25.000 | That's the, like, real world equivalent.
00:14:27.000 | That's right.
00:14:28.000 | And as you can see, it's pretty fast, too.
00:14:29.000 | And you can bring your Greenfield projects.
00:14:31.000 | There's no shame in that.
00:14:32.000 | But the legacy ones, I think, are a little bit more fun.
00:14:35.000 | That's all we've got.
00:14:36.000 | Yes, sir?
00:14:37.000 | What about things like checking for dependencies across, like, a large code base?
00:14:43.000 | It loves to do that.
00:14:44.000 | Yeah.
00:14:45.000 | And it can actually go back in.
00:14:47.000 | Yes, it can.
00:14:48.000 | And you actually, in 20 seconds, you actually saw a little bit of that here, right?
00:14:51.000 | Where it went through and, like, there were some missing files.
00:14:53.000 | It tried to run Python and said, oops, it's not installed.
00:14:56.000 | I'm going to use Python 3 instead, right?
00:14:57.000 | It's happy to do that.
00:14:58.000 | In 12 seconds.
00:14:59.000 | Go ahead, Drew.
00:15:00.000 | What you showed was test-driven development effectively.
00:15:04.000 | Could this improve the needle on whether that's a recommended practice or...?
00:15:08.000 | Yeah.
00:15:09.000 | Agents love to reason and iterate.
00:15:11.000 | So any way they can check their own result is very helpful.
00:15:14.000 | So tests are good for that.
00:15:15.000 | That's a great question.
00:15:16.000 | We are out of time.
00:15:17.000 | Thanks, everyone.
00:15:18.000 | We appreciate you.
00:15:19.000 | We'll be right back.