推荐微信扫码登录以获得更好的体验!另:🎉建议更新到最新版,以体验新功能!🎉 版本更新记录→

所有代码都是“垃圾”?除了我的——如何让 AI 智能体写出高

字幕摘录

时间英文中文
0:12All right, so again, my name is Potato, I work on GraphBot at SpaceXSI.好吧,所以,再次,我的名字是马铃薯, 我在SpaceXI的GraphBot工作。
0:21And can I just get a quick show of hands?我能举一下手吗?
0:23How many of you have ever looked at code that somebody else wrote, and you thought, that's你们中有多少人看过别人写的代码,你以为,这就是
0:28all slop?都乱了?
0:31Well, I have too.我也一样
0:35But today I'm going to convince you that you can turn that slop into gold.但我今天要说服你 你可以把那破烂变成金子
0:42And so I did something crazy last month, and I shipped 3,000 ploy crests to production.于是我上个月做了一件疯狂的事, 我把3000个伎俩的花纹运到了生产厂。
0:48Now before Agents, we never really cared about volume, except for the outliers.现在在特工之前 我们从不关心体积 除了外面的人
0:54And at my previous company, we called these people coding machines, people like Brett在我之前的公司里,我们称这些人为编码机, 像Brett这样的人。
0:59Taylor, who famously rewrote all of Google Maps in a weekend, just an insanely productive泰勒,在周末重写了所有的谷歌地图, 是一个疯狂的产物
展开字幕全文(234 条)
序号英文中文
1All right, so again, my name is Potato, I work on GraphBot at SpaceXSI.好吧,所以,再次,我的名字是马铃薯, 我在SpaceXI的GraphBot工作。
2And can I just get a quick show of hands?我能举一下手吗?
3How many of you have ever looked at code that somebody else wrote, and you thought, that's你们中有多少人看过别人写的代码,你以为,这就是
4all slop?都乱了?
5Well, I have too.我也一样
6But today I'm going to convince you that you can turn that slop into gold.但我今天要说服你 你可以把那破烂变成金子
7And so I did something crazy last month, and I shipped 3,000 ploy crests to production.于是我上个月做了一件疯狂的事, 我把3000个伎俩的花纹运到了生产厂。
8Now before Agents, we never really cared about volume, except for the outliers.现在在特工之前 我们从不关心体积 除了外面的人
9And at my previous company, we called these people coding machines, people like Brett在我之前的公司里,我们称这些人为编码机, 像Brett这样的人。
10Taylor, who famously rewrote all of Google Maps in a weekend, just an insanely productive泰勒,在周末重写了所有的谷歌地图, 是一个疯狂的产物
11engineer.工程师
12And well, with Agents, anyone can now be a coding machine.有了特工 任何人都可以做编码机了
13And my thesis is that the job of the software engineer, the meta of being a software engineer,而我的论文是软件工程师的工作, 作为软件工程师的元件,
14is figuring out how to maintain or even improve the quality of your code, while massively正在想出如何维持甚至提高 代码的质量,同时大规模地
15increasing your productivity.提高你的生产力。
16To get there, some people like to call this a software factory.为了到达那里,有些人喜欢称这里为软件厂.
17But I like to keep it simple.但我喜欢保持简单。
18And I think of it as all about trust.我认为这是所有关于信任。
19Not blind trust, but investing in your Agents environment, so you can trust that your Agents不是盲目信任,而是投资你的代理环境, 所以你可以相信你的代理
20are going to do the right thing.会做正确的事情。
21Now, it takes quite a lot of effort to get there, and it took me six months to get to我花了六个月的时间才到
22a point where I could ship thousands of ploy crests, a lot of them in my sleep.我可以在梦里 运送上千只花招的山雀
23But it's certainly possible, and it will take you much less time than I did.但是这当然是可能的,而且你需要的时间比我少得多.
24So let's start by talking about how we move from a low trust environment to a high trust我们先谈谈我们如何从低信任环境走向高信任环境
25one.一个
26So this inverse pyramid is how I think about where to spend time on your Agents environment.所以这个反向金字塔 就是我如何思考 在哪里度过你的特工环境。
27The first two layers are deterministic, so using your code itself.前两层是决定性的 所以用你的代码本身
28So things like good API design, architecture, refactoring, or using lit rules, type systems,所以,像良好的API设计,建筑, 重构,或者使用点燃的规则,类型系统,
29compilers, or different kinds of testing.编译器,或不同种类的测试.
30And you can use both of these layers together to constrain what Agents can do and force你可以把这两层都用在一起 来限制特工们所能做的和强迫
31them to do the right thing by default.他们默认做正确的事情。
32Verification, both runtime and formal, are great tools to layer on to find bugs and check校验,无论是运行时间还是形式,都是用来分层查找错误和检查的伟大工具
33properties and the invariance in your system that you want to hold true, and also help属性和系统中您想要坚持真实的不常, 以及帮助
34you check whether or not the Agent understood your goals and your intent.你检查特工是否理解你的目的和意图
35And then finally, you want to layer with a little bit of pros, so things like rules,最后,你想用一些专业技术来分层, 所以像规则,
36skills, agents.md, things that require judgment.技术 特工 需要判断的东西
37But let's start with your code base.但从你的密码底部开始
38Agents generate their outputs based on their inputs, and so the quality of the input really代理商根据它们的投入产生产出,因此投入的质量确实
39matters, and it just so happens that your code base is one of the largest inputs.并且碰巧你的代码基础 是最大的输入之一。
40So whenever you're correcting your Agent, think about how you can make that a deterministic所以每当你纠正你的探员, 想想你如何使这个决定主义
41check instead of adding another line to your rules or your agents.md, because it's far检查而不是在你的规则或代理商中添加另一行,因为距离很远
42more reproducible when it's in code, and it lets you trust it more.更可复制的代码, 它让你更信任它。
43And the analogy that I like to use is that your code base is kind of like a garden.我喜欢的类比是 你的密码基础有点像花园
44Code used to arrive a few pull requests at a time, and I remember going into work in代码曾经一次到达几个拉请求, 我记得去工作
452024 and reviewing the three pull requests that my colleagues wrote, and today that number2024年和回顾我同事写的3个拉拉请求 今天这个数字
46is more like 300.差不多300块
47So every Engineer is now a team of hundreds or even thousands of Agents, and code is arriving现在每个工程师都是几百个甚至数千个特工的团队 密码已经到了
48so rapidly that it almost feels like a continuous stream, and it almost feels organic like a如此之快,它几乎感觉 像连续的溪流, 它几乎感觉有机 像一个
49living thing.活着的东西。
50And in this analogy, your code base, the constraints that you impose, the guardrails that you put在这个类比中,你的代码基础,你施加的限制, 你设置的护栏
51up are the concrete foundations that the new code that your Agents write grow around, just上面是你们特工们所写的新密码 成长的具体基础
52like the building in this picture.就像这张照片里的建筑
53And so in many ways, the job of being a software engineer is kind of becoming like gardening.因此,在许多方面,做一个软件工程师的工作 有点像园艺。
54Because code is the biggest input for Agents, it means that any workarounds, anti-patterns,因为代码是代理的最大输入, 这意味着任何工作绕圈, 反标,
55deprecated code, tech-dep, it's now likely to be just copied by the next Agent, since破解的代码,技术 -dep, 它现在可能只是复制 下一个代理,因为
56it looks like the established pattern in your code base.它看起来像是 既定的模式 在你的代码基础。
57And it's like you have some weeds or pests growing in your garden, and then they spread就像你在花园里种了些杂草或害虫 然后它们就扩散了
58everywhere before you know it.随处皆悉现前.
59So you want to make your code base as pristine as possible so that Agents are always copying所以,你想让你的代码基础 尽可能原始 这样特工总是复制
60the good stuff.好东西
61All right, let's look at some real examples.好吧,让我们看看一些真正的例子。
62So Dune is a client framework that we created for GraphBot to implement this idea for organic因此,Dune是一个客户端框架,我们为GraphBot创建了这个架构,以落实这个有机的想法。
63architecture.结构。
64It's not really that interesting technically.技术上来说,这不太有趣
65你可以把沙丘看成像Next.js的Electron Apps 但有趣的是
66part of Dune is that it has a lot of constraints and lit rules that we've encoded a lot of沙丘的一部分是,它有很多的限制 和点亮的规则,我们已经编码了很多
67the lessons that we've learned building desktop applications.我们学习到的桌面应用程序。
68And one such lesson is that anything that requires nuance to use well often leads to一个这样的教训是,任何需要细微使用才能很好地使用的东西往往导致
69s.
70Your classic example is UseEffect in React.您的经典例子是“ 反应中的使用效果 ” 。
71It has its use cases, but it's often misused.它有它的使用案例,但经常被滥用.
72Some people joke that you need a PhD to use UseEffect.有些人开玩笑说,你需要博士才能使用Uservice。
73And in other words, it really requires a lot of nuance to use well, and Agents are not换句话说,它真的需要很多细微 使用好,而特工们不是
74good at using it.擅长使用它。
75So our solution has been to just ban it in product code, and it's really only allowed所以我们的解决方法就是在产品代码中禁止它, 它实际上只有允许
76在Dune API的一些地方。
77And effectively, this problem has now been categorically eliminated, and we never need这个问题实际上已经彻底消除了 我们从不需要
78{\fn黑体\fs20\shad2\2aH82\3aH20\4aH33\fscx95\3cH592001\be1}在代码审查中再次抓住它
79Another interesting pattern that we use is context through directory structure.我们使用的另一个有趣的模式是通过目录结构的背景。
80So one anti-pattern that we saw with Cursor, which is an Electron app, is that Agents would我们用Cursor(一种电动软件)看到的一个反模型就是特工们
81often import main thread code into the renderer thread, which would cause long tasks and jank.常将主线程代码导入到渲染器线程中,这会造成长的任务和jank.
82So in GropAut and in Dune apps, we've made this very, very conventional.在GropAut和Dune应用软件中, 我们做了非常,非常常规的。
83We have these two top-level directories, literally called ElectronRenderer and ElectronMain,我们有这两份顶级目录, 字面上叫电源和电源
84and imports between them are forbidden or banned by our dependency graph analyzer and我们的依赖性图表分析器禁止或禁止它们之间的进口
85some lit rules.一些点燃的规则。
86And again, these are simple lit rules to set up, but it means one less thing that we need再说一遍,这些都是简单的点燃规则 来设定,但它意味着我们更需要一件事
87to review and think about during code review.在代码审查期间进行检讨和思考。
88And then one more surprising thing that I've seen is Agents using Markdown.还有一件令人惊讶的事是 特工用马克登
89So things like documentation, code comments, rules for skills, and they use this as a place因此,文件,代码评论, 规则技能, 他们使用这里作为一个地方
90to write down their justifications for not doing the right thing.写下他们不做正确事情的理由
91Or I don't know if you've ever seen this, but they'll over-rotate on some small correction或者我不知道你有没有看过, 但是他们会过度旋转 一些小修正
92that you made, and they treat it like a hard rule that can never be broken ever again.你做的, 他们把它当作一个艰难的规则 永远无法打破。
93And here's another example from Cursor.这里还有一个来自Cursor的例子.
94So Agents really loved using imperative timers, so things like setTimeout, requestAnimationFrame,所以特工们真的喜欢使用必须的定时器, 所以像设置时段,请求动画 框架,
95requestIdleCallback, and they were using these as quick fixes because they were really patching他们使用这些作为快速的解决方案 因为他们真的在补补
96over an architecture clash between VS Code's imperative style and React's declarative style.因为VS代码的必修风格和React的宣示风格之间发生了建筑冲突.
97So our choice of architecture actually made both the client and the Agent performance所以,我们选择的建筑 使客户和代理的表演
98much worse.更惨了
99And if you've ever done any performance work in JavaScript, you'll know that when you have如果你在JavaScript上做过任何表演, 你会知道,当你有
100tons of timers being rapidly created and destroyed, it causes a lot of major garbage collection,数吨计时器被迅速制造和摧毁, 导致大量的大垃圾收集,
101which causes a lot of lag and jang.这导致了很多的滞后和强。
102But the worst part is that Agents wrote a lot of code comments, like you can see in但最糟糕的是 特工写了很多代码评论 就像你看到的
103red here, explaining why this quick fix was justified.这里红色,解释为什么这个快速解决是正当的。
104And before you know it, we had timers spreading everywhere, and the performance of that really在你知道之前,我们有计时器 扩散到任何地方, 和表演真正的
105suffered.受苦受难.
106Now in Grokbot, we learned our lesson there, and we decided to just ban 99% of comments在Grokbot,我们在那里学到了教训, 我们决定只禁止99%的评论
107because they go stale easily, humans just really don't bother reading the comment slop因为他们很容易就僵化了 人类真的不会去读评论
108anyway, and again, it gives an Agent an escape hatch to justify not doing the right thing再说一次,它给了特工一个逃生舱门 以证明不做正确的事是正当的
109because it's hard.因为它很难。
110And the worst part about comments, though, is that they're not enforceable.评论中最糟糕的部分是,它们不能执行。
111So what seems well-intentioned, like I'm going to tell the next Agent not to do something,所以,什么看起来良好意向, 就像我要告诉下一个特工 不要做一些事情,
112never ends up actually being anything that you can trust.永远不会成为你能够信任的东西
113So in Grokbot and in Dune, we now have lint rules that give good and very helpful error所以在Grokbot和Dune, 我们现在有规则 给良好和非常有用的错误
114messages telling the Agent to fix the root cause, the real problem, rather than just消息告诉特工 解决根源, 真正的问题,而不是仅仅
115patch around it.绕着它
116And so our general principle is that every time we correct our Agents, it turns into所以我们的一般原则是 每次我们纠正我们的特工时
117one of these deterministic checks, or we think about how to categorically eliminate或者我们想怎样断然消除
118that problem in the code through better API design, through better architecture.通过更好的 API 设计, 通过更好的架构。
119And if you do this enough times, you'll find that you have just less things to look out如果你这样做足够多的时间, 你会发现 你只有更少的事情需要注意
120for in code view.用于代码视图。
121And at some point, you realize there's nothing left to review, and you can just let Agents在某个时候,你知道 没有什么可以审查的, 你可以让特工们
122merge most of their own pull requests.合并大部分自己的拉动请求.
123All right, moving on.好吧,继续前进。
124Verification is also a really big part of how we make our Agents more autonomous and核查也是我们如何使我们的代理人更加自主和更加独立的一个重大部分。
125also increase our confidence and trust in their work.也增加了我们对其工作的信心和信心。
126And our code review process has now really shrunk into looking at verification artifacts而我们的代码审查程序 现在真的缩水到 查看核查文物
127instead.相反。
128So things like videos, screenshots, diagrams, formal verification.所以,像视频,截图,图表, 正式核实。
129And the most basic example of this is runtime verification, which is just a fancy way of而最基本的例子就是运行时间核查,这只是一种花哨的方式
130giving your Agent a way to run the code for itself and use debugging tools that human让你的特工可以自行运行密码 并使用人类的调试工具
131开发者也使用,比如Chrome DevTools协议.
132In our runtime verification skills, we have this thing that we call a feature map.在我们的运行时间验证技能中,我们有这样的东西,我们称之为特征地图.
133And that's basically kind of like a sitemap of all of the features that are available这基本上就像一个网站地图 所有可用的特征
134in your application from the user's point of view.在应用程序中,从用户的角度。
135And so with this, Agents don't need to guess when you say the thingy in the left sidebar.这样,特工们就不用猜了,你说左侧的
136It gives you some shared vocabulary.它给你一些共享词汇。
137And we also make use of custom CLIs inside these skills so that Agents can reuse the我们还利用这些技能中的定制的CLI,使特工们能够重新使用
138CLI and the driver every time, which cuts down on token usage and is also testable.每一次CLI和驱动器都会减少象征性的使用,也可以测试.
139And then recently, we've also started looking at formal verification.最近,我们还开始研究正式核查。
140So we now use TLA plus to do some model checking of major user flows, such as notifications所以我们现在使用TLA+对主要用户流量做一些模型检查,如通知
141across multiple devices and platforms.跨越多个设备和平台。
142We use a lean as well for proving certain algorithms.我们用精度来证明某些算法
143For example, we wrote our own custom virtualization library.例如,我们自己写了自定义虚拟化库.
144And we use lean there to check that we don't have flickering or jittering problems.我们用倾斜来检查 我们没有闪烁或颤抖的问题。
145And we're still experimenting with this approach overall.我们还在全面试验这个方法。
146It seems very promising.看起来很有希望
147We've already found quite a few bugs with formal verification.我们已经找到很多有正式验证的漏洞
148But it's certainly not a silver bullet.但肯定不是银弹
149And we're treating it as another tool, another layer in our Agents environment.我们把它当作另一种工具, 是我们代理环境的另一层。
150And then this is a very fast video.然后这是非常快的视频。
151But another thing that we just started looking at is property-based testing as well for UIs.但我们刚刚开始研究的另一件事 也是基于地产的UI测试。
152So we use this library called Bombadil.所以我们用这个叫Bombadil的图书馆
153And this has also caught a few UI bugs for us already.而这也已经为我们捕获了一些UIbug。
154OK, so zooming out, I saw this tweet from Cindy.好了,放大,我看到辛迪的推特。
155And six months ago, she said that she was talking about not being able to trust her六个月前 她说她不能相信她
156Agents because of subtle bugs that were getting merged.特工们因为那些被合并的狡猾虫子
157And really, what was missing for her in being able to trust her Agents was the verification process.实际上,在她能够信任她的代理人时 所缺少的就是核查过程。
158And now, six months later, she says that 70% of her daily tokens go into verification.而现在,6个月后,她说, 她的每日代币的70% 进入核查。
159And I'd say that that tracks with what I see as well,而我会说,那些轨道 与我所看到的,
160that most of my token usage goes to verification.我大部分的象征用途都用于验证
161And if you really look closely at her process,如果你真的仔细观察她的过程
162none of these things here are new or novel techniques that we've never had before.这些东西都不是我们以前从未有过的新技巧或新技巧。
163These are just good software engineering tools,这些只是很好的软件工程工具,
164but ones that might have been prohibitively expensive to use before,但却是以前昂贵的,
165as they were hard to understand or write or maintain.因为他们很难理解、写作或维护。
166But Agents drastically cut this cost down.但特工们大幅削减了这笔费用。
167And really, we're entering a golden age of software testing and verification我们进入了一个软件测试和验证的黄金时代
168because Agents let us test everything to a much greater degree than used to be economical.因为特工们让我们测试一切 比以前更经济
169And then formal verification can also help you better reason about how your product should work然后正式的验证 也可以帮助你更好地解释你的产品应该如何工作
170and whether your Agents really understand your intent and goals.还有你的特工们是否真的理解你的意图和目标
171I made this new skill called State Chart in my plugin P-Stack,我用插件P -Stack制作的这个新技能叫做州图
172Potato Stack, which helps you visualize state machines from the user's point of view.土豆堆,帮助您从用户的角度来视觉状态机器.
173And I find this much easier to review alongside the videos and screenshots that we provide.我发现这比我们提供的视频和截图更容易审查。
174And so that's been great.因此,这是伟大的。
175Sorry for the flashbang.对不起,闪光灯。
176Okay, now let's look at what the promised land looks like.好吧,现在让我们看看 承诺的土地是什么样子。
177What do you get in return for all of this investment?这些投资你能得到什么回报?
178So on the GraphBot team, our velocity is taking off and rapidly increasing.因此,在GraphBot团队, 我们的速度正在起飞和迅速增加。
179And last month, our team shipped a ridiculous 11,000 pull requests to production,上个月 我们的团队运送了11000个拉拉请求
180which is a wild number.这是一个疯狂的数字。
181And our pace of releasing the client has also increased.我们释放客户的速度也加快了
182And we cut a new stable version about once a day.我们每天剪掉一个新的稳定版。
183And then the core team is also shipping much more.然后,核心团队 也运输更多。
184And we also have a lot more casual or drive-by contributors而且我们还有更多的临时或乘车贡献者
185who don't always have a lot of context, but they're also contributing.他们并不总是有很多背景,但他们也在作出贡献。
186And in October, we had about 227 people who contributed at least one pull request.在10月,我们有大约227人 至少提供了一个拉请求。
187So despite this velocity accelerating,所以尽管速度加快了
188you might be thinking to yourself, isn't this going to be chaos?你也许在想,这会不会是混乱?
189Isn't this going to be a bunch of flop?这难道不是一团糟吗?
190But actually, the number of PRs that get reverted但实际上, 公关数量被恢复
191has actually gotten lower on a relative basis and is steady at about half a percent.相对而言,实际下降,稳定在50%左右。
192But I think the really interesting thing about this shipping pace但是,我觉得真正有趣的事情 关于这种运输速度
193and this volume of pull requests is that the performance of GraphBot而拉动请求的量是 GraphBot 的性能
194has stayed not just stable, but has improved on multiple dimensions不仅保持稳定,而且在多个层面有所改进
195compared to when we launched.比起我们发射的时候
196So startup, typing, opening new chats, switching chats, all of this has gotten faster.因此,启动,打字, 打开新的聊天, 切换聊天, 所有这一切都得到了更快。
197And keep in mind, GraphBot is still an electron app for now.记住,GraphBot目前仍是电子应用.
198So there is a ceiling, right?所以有天花板,对不对?
199But it's already much faster than many other agent UIs out there.但是它已经比 许多其他UIs的代理快很多。
200And for an electron app with this high velocity对于一个电子应用 具有如此高的速度
201and this many people contributing, I'd say that's pretty good.这么多人的贡献, 我想这是相当不错的。
202So before you jump into building out a software factory所以,在你跳进 建造一个软件厂之前
203and automating everything that you can,使你所能达到的一切自动化,
204whenever you correct your agent, try and do it by improving your code base first.每当你纠正你的探员时 试着先改善你的密码基础
205Start with a lint rule to prevent new occurrences of anti-patterns以插图规则开始,防止出现新的反标
206and then clean up those old patterns as well.然后把这些旧的图案也清理干净
207And then make sure that your verification story is really strong.然后确定你的核查故事是真实的。
208A lot of this work is a prerequisite to automation anyway.其中许多工作是自动化的先决条件。
209And if your inner coding loop produces slop,如果你的内在编码循环产生slop,
210then automating that loop just produces more slop.然后使循环自动化 产生更多的斜坡。
211And you need to throw more and more and more tokens at the problem,并且你需要 扔越来越多的符号 对于问题,
212which we all know is very expensive.我们都知道它非常昂贵。
213And once you've made these investments into your code base,一旦你把这些投资 进入你的代码基础,
214static analysis, runtime and formal verification,静态分析、运行时间和正式核查,
215you'll start to find that many things become possible with these foundations你会发现,很多事情 成为可能的 这些基础
216and that you can really easily build your own factory on top of these foundations.并且你可以很容易地在这些地基上建造自己的工厂。
217And when you're ready, Grotbot is a great way to build that outer loop.等你准备好了 Grotbot是建立外环的好方法
218We have tons of connectors, routines that can kick off cursor,我们有很多连接器, 例行公事可以启动光标,
219cloud agents and projects which let you orchestrate云剂和项目 让你协调
220thousands of hundreds or even thousands of agents.数千甚至数千名特工
221And as a quick example, whenever we cut a new release now,简而言之,只要我们现在剪掉新版
222Grotbot will automatically spin up a new cursor project for usGrotbot 将自动为我们旋转一个新的光标项目
223that will fuzz the entire application, the entire build这将模糊整个应用程序,整个建筑
224and it will find bugs by running the app and using it like a real user.它会通过运行应用程序并像真正的用户一样使用它来发现错误.
225And then it's going to open fixed PRs for each of those bugs that it finds然后它将打开固定的公关 每一个它发现的bugs
226and it's going to auto merge it as crazy as that sounds.它会自动地合并起来 就像听起来那样疯狂
227And that's because our code base is good enough因为我们的密码已经足够了
228that pull requests tend to just be good by default.牵引请求往往只是 默认好。
229And most product code that we land no longer really requires deep human review.而我们着陆的大多数产品代码 都不再需要深入的人类审查。
230So when you have solid foundations and good organic architecture,所以当你有坚实的基础和良好的有机建筑
231you can turn slop into gold and you can ship with high velocity你可以把斜坡变成金子 以高速度飞船
232without compromising on quality.不损害质量。
233My name is Potato, also known as Lauren.我叫马铃薯 也叫劳伦
234Thanks to you again for listening to my talk.再次感谢你听我的演讲
该视频共有字幕 234 条。解锁更多字幕为会员功能,请移动到 价格