跳到主内容
精选85Hacker News Best(web_list)技巧与观点

理解成为AI时代新瓶颈:三种高效理解Agent代码的技巧

理解成为AI时代新瓶颈

原文
推荐理由

做AI工程的同学必看,这篇演讲给出了三种可落地的理解Agent代码的方法,还附了技能链接,赶紧试试用测验和微世界来提升你的代码审查效率。

July 2026

2026年7月

Understanding is the new bottleneck

理解是新的瓶颈

This is a written version of a talk I gave at the AI Engineer conference in July 2026, also shared as a tweet thread.

这是我在2026年7月AI工程师会议上演讲的文字版,也以推文串形式分享过。

Hot take: I think it's still important to understand the code that our agents write!

大胆断言:我认为理解我们的代理编写的代码仍然很重要!

In this talk I'll explain why that's the case, and show some ideas for how to efficiently understand code. Alright, let's dive in.

在本次演讲中,我将解释为什么如此,并展示一些高效理解代码的想法。好了,让我们开始吧。

Agents are writing more and more code for us, and we all know it's getting harder to keep up.

代理正在为我们编写越来越多的代码,我们都知道跟上节奏越来越难。

But the good news is: there are many ways to understand code! Reading diffs line by line is not the only way.

但好消息是:理解代码的方法有很多!逐行阅读差异并不是唯一的方法。

Most of this talk will be about techniques I have found helpful to understand systems my agents are building:

本次演讲的大部分内容将围绕我发现有助于理解我的代理正在构建的系统的技巧展开:

  • Code explainer docs
  • Quizzes to check my understanding
  • Micro-worlds that I can play with to understand the system
  • 代码解释文档
  • 用于检查我理解的测验
  • 我可以用来理解系统的微型世界

But first we have to ask a more basic question…

但首先我们必须问一个更基本的问题……

Why understand?

为什么要理解?

Why? Why understand?

为什么?为什么要理解?

Aren't we supposed to be taking ourselves out of the loop now, and letting the agents loop themselves? As the agents get smarter, doesn't it become less important for us to be in the details?

我们现在不是应该把自己从循环中抽离出来,让代理自己循环吗?随着代理变得越来越聪明,我们深入细节的重要性不就应该降低吗?

I think many people — even those who are pro-understanding — have a slightly incorrect answer to this question!

我认为很多人——即使是那些支持理解的人——对这个问题的回答都有些不太正确!

One possible answer: we understand to verify. We check the agent's work, we see if it's correct.

一个可能的答案:我们理解是为了验证。我们检查代理的工作,看看它是否正确。

Correct can mean many things: does it match the spec, is it well architected… but it's fundamentally a thumbs-up / thumbs-down question.

正确可能意味着很多事情:是否符合规格,架构是否良好……但本质上这是一个赞成/反对的问题。

Here's the thing: the agents are getting better and better at verifying their own work. And this is good! I like it when my agent doesn't make mistakes.

问题是:代理在验证自己的工作方面变得越来越好。这是好事!我喜欢我的代理不犯错。

But hmm. Where does that leave us humans?

但是,嗯。那我们人类的位置在哪里?

That's where another answer comes in: we can understand to participate.

这时另一个答案出现了:我们理解是为了参与。

You can learn what the agent is doing to make sure you can be an active participant in the creative process. Here's why this matters…

你可以了解代理在做什么,以确保你能积极参与创作过程。这就是为什么这很重要……

It's never just one loop! A project is many, many loops with the agent.

这绝不仅仅是一个循环!一个项目是与代理进行的许多许多循环。

And the understanding you have of the system is part of your ability to come up with the next idea to evolve it.

你对系统的理解是你提出下一个想法来发展它的能力的一部分。

You need a rich set of concepts in your mind to think creatively and fluently about how to move something forward. If you're lacking that fluency, your ability to participate in the project is meaningfully limited.

你的脑海中需要丰富的概念,才能创造性地、流畅地思考如何推进某件事。如果你缺乏这种流畅性,你参与项目的能力就会受到严重限制。

By the way, this relates closely to the idea of cognitive debt, popularized by Margaret Storey and Simon Willison.

顺便说一句,这与认知债务的概念密切相关,该概念由Margaret Storey和Simon Willison推广。

It's like tech debt: you can get away with not understanding what's going on in the short term, but it'll bite you eventually.

就像技术债务一样:短期内你可能不会因为不理解而受影响,但最终它会让你付出代价。

OK, so fine, understanding matters.

好吧,所以理解很重要。

But this raises the next question: how? How do we build this human understanding when we're working with AI and moving fast?

但这引出了下一个问题:如何做到?当我们与AI合作并快速前进时,我们如何建立这种人类理解?

Well, turns out this is not the first time anyone has ever thought about how to communicate understanding. I think we can look to education as an inspiration. Can we steal the best ideas ever invented for education and apply them to this problem?

其实,这并不是人类第一次思考如何传达理解。我认为我们可以从教育中汲取灵感。我们能借鉴教育领域有史以来最好的想法,并将其应用于这个问题吗?

Technique 1: Explanations

技巧一:解释

Today I want to share three techniques that show how we can attempt this.

今天我想分享三种技巧,展示我们如何尝试做到这一点。

First: explanations. What makes a good explanation?

第一:解释。什么才是好的解释?

Whenever an agent finishes some work, it's an opportunity for an explanation — an artifact.

每当一个代理完成某项工作时,都是一个解释的机会——一个产物。

Most naively, we can read a code diff: the raw material that changed.

最天真的做法是阅读代码差异:即发生变化的原始材料。

But what if we ask:

但如果我们问:

What would the best explanation be? If you had a team — human or AI — that really sweat the details of explaining something well to you, how would that feel?

最好的解释会是什么样的?如果你有一个团队——无论是人类还是AI——真正费尽心思把某件事解释清楚,那会是什么感觉?

Here's one answer. I made a skill called /explain-diff, which I use every day and many coworkers have found valuable.

这里有一个答案。我制作了一个名为/explain-diff的技能,我每天都使用它,许多同事也认为它很有价值。

It outputs thoughtfully structured code explainers as HTML, markdown, or Notion docs. Notion is a good place for collaborating on and discussing these explainers as a team. (Disclaimer: I work at Notion so I'm biased.)

它会输出结构清晰的代码解释器,格式为HTML、Markdown或Notion文档。Notion是团队协作和讨论这些解释的好地方。(免责声明:我在Notion工作,所以我有偏见。)

Let's see what's in one of these explainers, using an example of editing the perspective of a video game.

让我们看看其中一个解释器里有什么,以编辑视频游戏视角为例。

First principle: teach me background info!

第一原则:先教我背景信息!

Before we even get to what changed, help me understand what was already there. In this case, teach me about the game engine.

在讨论变化之前,先帮助我理解已有的内容。在这个例子中,教我关于游戏引擎的知识。

Second principle: intuition before details.

第二原则:先直觉后细节。

Before any code, it states the goal — “make the garden feel three-dimensional with 2D drawing tricks” — and explains related concepts, like what isometric projection is.

在展示任何代码之前,它先说明目标——“用2D绘图技巧让花园感觉有三维感”——并解释相关概念,比如什么是等距投影。

All of this builds my intuition for the essence of the change. It's catching me up as the human so I can be an equal participant in understanding.

所有这些都建立了我对变化本质的直觉。它让我这个人类跟上进度,以便我能平等地参与理解。

You can also build intuition with interactive figures.

你还可以通过交互式图形来建立直觉。

Here I'm understanding the isometric perspective by dragging rocks around the garden and watching their coordinates move.

在这里,我通过拖动花园中的岩石并观察它们的坐标变化来理解等距视角。

(This is using a new feature Notion just shipped: you can now embed interactive HTML inside pages.)

(这使用了 Notion 刚推出的新功能:你现在可以在页面中嵌入交互式 HTML。)

We finally get to the code. But a typical diff is a pile of files edited in alphabetical order with no explanation.

我们终于要讲到代码了。但典型的 diff 是按字母顺序排列的一堆文件,没有任何解释。

A “literate diff” as I call it is structured as prose — walking through the changes in a sensible order, with surrounding explanation and embedded code snippets. Faster to review than a raw diff.

我称之为“文学式 diff”的结构是散文式的——以合理的顺序讲解改动,并附有解释和嵌入的代码片段。比原始 diff 更容易审查。

The end result of all of this is a nice explainer packet. I still read the code diff but I always read this first.

这一切的最终结果是一份漂亮的解释文档。我仍然会阅读代码 diff,但我总是先读这份文档。

Sometimes I'll print these out and take them to the café — less distracting.

有时我会把这些打印出来,带到咖啡馆去——这样更不容易分心。

It's beautifully ironic: AI turns an interactive activity into a static paper report I can focus on deeply :)

这真是绝妙的讽刺:AI 把互动活动变成了一份静态的纸质报告,让我能深入专注 :)

There's only one problem: reading is hard work 😅

只有一个问题:阅读是件苦差事 😅

As Andy Matuschak says: “books don't work”! It's too easy to fool yourself into thinking you did the reading when you really didn't retain or understand.

正如 Andy Matuschak 所说:“书籍不起作用”!你很容易自欺欺人地以为自己读过了,但实际上并没有记住或理解。

How do we fix this? I took inspiration from Andy and Michael Nielsen's work on embedding spaced repetition quizzes in essays.

我们如何解决这个问题?我从 Andy 和 Michael Nielsen 在文章中嵌入间隔重复测验的工作中获得了灵感。

I do something similar with my code explainers now. At the bottom of an explainer there's an interactive quiz — five questions about the change — and I try to answer them.

现在我在代码解释中也做了类似的事情。在解释文档的底部有一个交互式测验——关于改动的五个问题——我会尝试回答它们。

My rule: I won't send code to others until I can pass the quiz, and I do the same when reviewing others' code.

我的规则是:在我通过测验之前,我不会把代码发送给别人;在审查别人的代码时,我也会这样做。

A quiz is a speed regulator. Working with AI, it's easy for the loop to run faster than the speed of human understanding.

测验是一种速度调节器。使用 AI 时,循环很容易运行得比人类理解的速度更快。

The quiz is a counterbalancing force: I mechanically ask “do I actually understand?” so that I can remain a full creative participant.

测验是一种平衡力量:我机械地问自己“我真的理解了吗?”,这样我才能保持作为完全创造性参与者的状态。

OK, so that's explain-diff. Here's the skill if you want it: two variants that output either HTML or a Notion page.

好了,这就是 explain-diff。如果你想要这个技能,这里有两个变体:输出 HTML 或 Notion 页面。

Technique 2: Micro-worlds

技巧 2:微世界

Next idea: micro-worlds. This one's inspired by the visionary educator Seymour Papert.

下一个想法:微世界。这个灵感来自富有远见的教育家 Seymour Papert。

Papert had this beautiful idea he called living in Mathland: if you want to learn math, live in Mathland — just like if you want to learn French, you go live in France. Could we build an environment where children learn math naturally, as a consequence of their curiosity?

Papert 有一个美好的想法,他称之为“生活在数学国”:如果你想学数学,就生活在数学国——就像如果你想学法语,就去法国生活一样。我们能否构建一个环境,让孩子们出于好奇心自然地学习数学?

So how do we apply that to code? Can we make worlds you inhabit and naturally intuit how the system works and how it's changing?

那么我们如何将其应用到代码中呢?我们能否创造一些世界,让你身处其中,自然地直觉理解系统是如何运作的,以及它是如何变化的?

Last year I was coding a Prolog interpreter and struggling to intuit what was happening inside.

去年我在编写一个 Prolog 解释器,并努力直觉理解内部发生的事情。

I worked with an agent to build this debugger, which let me step through the execution of my logic language — scrub through time, see what's on the stack and which rules are evaluated at each step. I could even leave comments for myself (“nice, we correctly applied that rule”).

我和一个代理一起构建了这个调试器,它让我能够逐步执行我的逻辑语言——像回放一样浏览时间,查看栈上的内容以及每一步评估了哪些规则。我甚至还可以给自己留注释(“很好,我们正确应用了那条规则”)。

There's a big difference between making a tool for me to debug and letting the agent debug — doing it myself is how I develop understanding along the way.

为我制作一个调试工具和让代理进行调试之间有很大区别——自己动手调试是我在过程中加深理解的方式。

Another example. I was migrating my personal website from one framework to another, and Claude wrote a script that did it. But it was very hard to review: I wasn't familiar with the new framework, and all I could say was “I guess that looks about right.”

另一个例子。我正在将我的个人网站从一个框架迁移到另一个框架,Claude 写了一个脚本来完成迁移。但审查起来非常困难:我对新框架不熟悉,我只能说“我觉得看起来差不多”。

So I asked Claude to make me a video game — a command center where I do the port myself, step by step, watching the visible effects and the file tree evolve. It produced a UI where I click buttons to run the port step by step, with my old site and new site running side by side.

所以我让 Claude 给我做了一个视频游戏——一个指挥中心,让我自己一步一步地进行迁移,观察可见的效果和文件树的演变。它生成了一个界面,我点击按钮逐步运行迁移,同时并排显示我的旧网站和新网站。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

另一事件,读法相近