0:00 We review code for one reason, and that is to make sure 0:03 that the implementation matches the intent. 0:06 But what if we didn't need to review code? 0:09 And I'm not talking about like, 0:10 oh, let's just get AI to review our code for us. 0:13 I'm talking about what if we could just review the intent? 0:18 And once we get to that intent, the implementation, 0:21 we would be 100% certain that it would be correct. 0:25 That's what formal verification gives us. 0:27 Formal verification is not a new thing. 0:30 It's actually been around for 60 years, 0:32 but recent advancements in technology 0:35 actually makes this a tenable thing for us to accomplish. 0:39 So in this video, I'm going to tell you 0:40 what is formal verification, 0:42 and we're going to talk about what's standing between us 0:45 and being able to commit straight to main 0:47 without having to worry about PR review. 0:50 But first, why would I want to remove PR review? 0:52 This is a workflow that has been working really well 0:55 for us for a long time. 0:56 Well, the AMP editor and that team, 0:59 they are shipping like crazy 1:01 because they actually don't have PRs at all. 1:04 They commit straight to main and deploy. 1:06 And of course they are doing review 1:08 before they actually ship it out. 1:10 They are not doing formal verification 1:11 as far as I know in my conversations with them. 1:14 But I think that you and they 1:16 will be doing formal verification going forward. 1:19 And the reason is because agents write faster 1:22 than you could possibly read. 1:24 You cannot read those diffs 1:25 and I don't think that the solution 1:27 is just piling more tokens on the problem 1:30 because the thing is that I can actually have 1:32 like three different AI bots 1:34 and all three of those could find different things 1:37 on my PR and that's actually what I do right now. 1:40 I have three different bots that are reviewing my PRs. 1:43 But if I had a fourth one, guess what? 1:45 It's actually probably going to find other things 1:47 that the others didn't find. 1:49 So we have to get used to the idea 1:51 that we're shipping stuff that we could possibly 1:54 find other things to pick at, especially for the big PRs. 1:59 But if we could find a way to make it so that we 100% know that what was implemented is 2:05 what we intended, then we don't need to review it. 2:08 And this is what formal verification gives to us. 2:12 So let's talk about that. 2:13 So formal verification is the process where you write down exactly what your code should 2:17 do, then have a machine prove it does that for every possible input, not just the ones 2:23 you thought to test. 2:24 So you might think that this is kind of like, oh, it's just tests. 2:28 Like Kent, you're talking about doing test-driven development or something like that. 2:31 And it does kind of smack of that a little bit. 2:33 Like it is kind of similar, but the idea behind a proof is it's a mathematical concept that 2:40 can prove that every single input is covered. 2:44 You can hit 100% coverage and still ship a bug when we're talking about testing. 2:48 but with formal verification, you can actually 100% 2:52 mathematically verify that the code that you are looking at 2:56 actually implements the intent that it was built to solve. 3:00 The tricky thing is that a proof 3:01 only actually proves what you said. 3:03 So if you get the spec wrong, 3:04 then you're going to get like a green thumbs up, 3:08 but you're gonna ship the wrong thing anyway. 3:10 And so the spec actually becomes really critical 3:12 for you to review, but like it already was, right? 3:16 So even before the implementation you do want to review the spec to make sure that the plan is to actually build 3:23 What you expected because if it's not then you end up shipping the wrong thing or you waste all this time and effort 3:28 Building the wrong thing. And so this doesn't actually change anything. That's the status quo 3:33 And so what formal verification gives you is just going from spec to a perfect implementation 3:38 that perfectly and mathematically 3:42 Matches the spec and so I'm actually going to show you what this looks like from a practical scenario 3:46 from one of the tools that's starting to go in this direction and make this a practical thing 3:51 for us to actually do. But before we do that, let's hear a word from our sponsor. 3:55 As you've been adopting AI coding agents in your work, you've probably noticed a problem. Agents 4:00 open pull requests all day and every one of those is going to kick off the full CI pipeline so you 4:05 don't ship something to production that you don't know is working. But more AI code means more 4:11 commits and more commits means more CI and more CI means that you're waiting 4:16 longer for CI to finish so that you can actually continue to ship. So your CI has 4:20 become the bottleneck. That's what today's sponsor, Warp Build, is all about. 4:25 Warp Build gives you managed GitHub action runners that are twice as fast at 4:29 half the cost and switching is a one-line change. You update the runs on 4:33 config in your workflow and your jobs just get faster and cheaper. And you'd be 4:38 joining good company. You've got Comcast, Brain Trust, Raycast, and Trigger, all of 4:41 of these using and trusting Warp Build 4:44 with their CI pipelines. 4:45 And you get $50 in free credits 4:47 to try it on your own pipeline. 4:49 If your team's agents are shipping faster 4:51 than your CI can keep up, 4:53 then go to kcd.link/warpbuild. 4:56 So I've actually been talking to a lot of people 4:58 about formal verification recently. 5:00 I was at GitHub Universe and over there, 5:02 they're working on this PDD kit 5:04 inside of their Chopin product. 5:06 And I've talked with Lauren Tan over on the Grokbot team 5:09 and they're thinking about formal verification with Bend and let ThePrimeagen also made a video 5:15 about Bend and formal verification. So if you want to go a deep dive onto like what that actually 5:20 looks like from a code perspective, you can deep dive on Bend there. And I'm talking about this 5:26 all over the place at the events that I have been going to. Everybody is thinking about how do we 5:31 formally verify that the thing we intend is what actually gets built. And I was also talking about 5:37 this with my friend Tanner Linsley, who has somebody on his team working on oracles, which 5:43 is an implementation of formal verification. And so I ran an experiment on Kody to see if this 5:50 actually is something that would be useful in the context of Kody. So you can take a look at this 5:55 pull request and kind of judge for yourself what this looks like. But this is like a subset 5:59 implementation of the idea of formal verification. So if you look at this, it's like there's this 6:05 giant comment, this was all written by my agent, 6:08 that is kind of the spec, 6:09 and then here's an implementation of that spec. 6:12 And it goes through all of this, 6:13 we're going through the storage SQLite or SQL policy. 6:18 And inside of here, it's a whole bunch of different cases. 6:21 And the way that it ends up working 6:23 is this runs with Vitest and it runs 6:25 with just a ton of inputs to formally verify 6:29 that the storage SQLite matches all of the laws 6:33 that are written as a part of this spec. 6:36 And so the idea is that you can converse with your agent 6:39 about what the goals of this particular feature 6:44 or this change in the code base, what those things are, 6:47 and then it builds out the formal verification for you, 6:50 which is effectively a test that can verify 6:53 all of those product outcomes that you're looking for. 6:56 Now, there have been skeptics over the decades 6:59 of this formal verification idea, 7:01 And I think probably the biggest problem with all of this 7:05 is that the process of going from something 7:07 that is human readable into code is itself informal. 7:11 So meaning that like there's some lossiness there. 7:14 And the way that I think that this could really work, 7:17 and this is where I'm gonna issue a challenge to you. 7:19 I think that it would actually be really interesting 7:22 if instead we have the spec written as the actual code. 7:26 So like, this is the thing 7:28 that we're going to be verifying 7:29 and then go from that to the English spec. 7:32 And that English spec is the thing that we review. 7:35 And I think about it in this way. 7:37 Like if I was given a document that's written in Japanese, 7:40 it's something that I don't understand, 7:42 I can't read it myself, 7:43 but I can talk to my agent about it 7:46 and we can review and converse about that thing. 7:49 The agent can serve as the translation layer. 7:51 And yes, agents are non-deterministic, 7:53 but they do a pretty good job of communicating that intent 7:56 and making sure that I have alignment with it on my understanding of that document. 8:01 And so if maybe the spec is the thing that is really complicated to read, this is like the whole 8:07 criticism about formal verification is that those specs are basically really hard, those proofs are 8:13 really hard to read and understand. But if the agent can translate that into something that I 8:19 can understand in a conversation with it, then maybe we can feel a lot more confident that the 8:25 spec is actually the desired outcome. 8:28 And once we have that spec, 8:29 then we can go through and actually do the implementation 8:32 and know for certain that it at least matches the spec, 8:36 which we have a very high degree of certainty 8:40 is exactly what we intended to build. 8:42 So to be totally clear, 8:43 I haven't actually shipped anything like this yet myself. 8:46 So this video is more of a challenge 8:49 or something for you to think about. 8:51 Formal verification is going to be a thing 8:53 that everybody is talking about in the coming weeks and months. 8:57 And this is an opportunity for you to dive deep into the world of formal verification 9:02 so that we can just completely eliminate that process of PR review and get on board 9:08 with the idea that once we have made a product decision, that thing can go to production 9:13 without us having to go through all of the old process. 9:18 And in fact, here's my super, super spicy hot take. 9:21 Some of you are watching this right now 9:23 and you're saying, Kent, there's no way 9:25 that this is going to be a thing 9:27 because SOC 2 says that humans have to review the code. 9:31 You can't do that if you don't have PRs. 9:34 Well, here's my hot take. 9:37 I think that in the future we're actually going 9:40 to flip SOC 2 on its head. 9:42 And SOC 2 will actually say 9:43 that humans cannot look at the code. 9:46 Okay, maybe that's really hot. 9:47 Maybe it'll just simply eliminate the requirements 9:50 of humans looking at the code. 9:52 But here's what I mean by that. 9:54 If you think about self-driving cars, 9:56 like I think it's kind of insane 9:58 that we trust humans to drive cars 10:01 and we're gonna drive right alongside them. 10:03 And we're just hoping that the hundreds 10:05 of people we're driving around don't get distracted. 10:08 They do. 10:09 And that distraction doesn't impact us. 10:12 It often does. 10:13 And so eventually we're going to get to the point 10:16 where cars are much safer than humans. 10:18 They kind of already are. 10:19 but that it's going to be a mainstream thing 10:21 and then nobody is gonna want a human driving a car. 10:24 In fact, we'll say no, there will be laws against that. 10:27 You will not be allowed to drive a car on public roads. 10:30 And I know that some of you who really like driving 10:33 maybe feel a little bit sad about that, 10:34 but I promise you'll get used to it 10:36 and you'll be happier that people 10:38 aren't dying all over the place. 10:39 So it is safer to let the computer do it 10:41 and it's actually safer to not let the human do it. 10:45 And I think that we are eventually going to get 10:46 to that place with code. 10:47 and it will come down to making sure first that your idea is good but then 10:52 second that you're communicating what your idea is if effectively to the agent 10:57 and I actually think that the agents are going to get really really good at 10:59 pulling that intent out of us anyway but we do need to have some formal process 11:05 whereby we go from intent to an actual verification proof so that we don't end 11:11 up shipping something that doesn't match the intent so that's why I'm excited 11:14 about formal verification and eventually if you are living in a SOC 2 11:19 compliance world this will be a useful thing for you as well it will help it 11:24 like even in the context where you are manually reviewing the PRs it will make 11:29 the PRs much higher quality anyway so if you're in that situation don't just 11:33 ignore this in fact you should be looking into this see how you can take 11:37 advantage of the idea of formal verification in your work so that you 11:41 can make sure that what is built is exactly what you intended. So we're not 11:45 deleting all review. We're definitely going to be reviewing things, but we are 11:49 deleting the part where we review what the agent built. I think that that can 11:53 actually be solved and it doesn't require more tokens as the solution. We 11:57 can deterministically solve this with a 60 year old concept. This has been better 12:02 with Kent where you and I get better together. Please comment below with your 12:05 own hot takes and tell me why my hot take is wrong or if you agree with it. 12:10 share this with your friends and like and all of that good stuff. We'll see you 12:14 in the next one. Thank you so much for getting better with me.