DreamCoder: coding harness and IDE from the author of Mastering Emacs
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
DreamCoder: coding harness and IDE from the author of Mastering Emacs
It’s been a little bit quiet around these parts; sorry about that. I’ve been really busy for the past fifteen months with a major project that I am finally ready to formally release. So I’d like to talk about that project, and also a potted history of AI and Emacs. It’s called DreamCoder, an AI coding harness that is very different from the ones you’re probably familiar with already.
这段时间这里稍微有些安静,抱歉。过去十五个月里,我一直忙于一个重大项目,现在终于准备好正式发布了。因此,我想谈谈这个项目,以及人工智能和 Emacs 的简要历史。它叫 DreamCoder,是一个与你可能已经熟悉的那些工具截然不同的 AI 编程辅助工具。
I installed Claude Code a few days after its first release some time in May 2025. I put some coins in the slot machine and I put it to work building a complex piece of enterprise middleware I’d built several times in my career. Wow.. watching this thing chomp its way through the project with that chaotic, early Sonnet energy. It was far, far from perfect; it required a lot of human steering, input and correction, but the speed advantage was undeniable, and seeing it jump between disparate programming languages, frameworks and theoretical and practical programming from one turn to the next was just such a sight to behold.
2025 年 5 月某个时候,在 Claude Code 发布几天后,我安装了它。我往“老虎机”里投了些硬币,让它开始构建我职业生涯中曾多次开发过的一套复杂的企业级中间件。哇……看着它以那种混乱的、早期的 Sonnet 模型能量在项目中横冲直撞,真是令人惊叹。它远非完美,需要大量的人工引导、输入和修正,但其速度优势是不可否认的,而且看着它在不同的编程语言、框架以及理论与实践编程之间来回切换,这种景象实在令人大开眼界。
One thing that struck me with Claude Code is that it was the first terminal application I’d used in a long time. I found it an odd choice for a coding agent; then everyone else copied them and made their own terminal coding agents. Why on earth do I have to stare at a shoe rack-sized terminal window to do this? Sure there are GUI versions also; but the terminal interface remains the primary modality for most of these tools. Most GUIs, and most harnesses now have them also, are second-class citizens. And they all look the same. A boring sidebar with chat headings and a chat pane is what most of them look like. But a serious coder needs more than that. Even a casual user will bristle when they try to copy and paste multi-line text in a terminal.
Claude Code 给我的一个深刻印象是,它是我很久以来使用的第一个终端应用程序。我觉得把它作为编程代理的选择很奇怪;后来其他人都效仿他们,制作了自己的终端编程代理。我到底为什么要盯着一个鞋架大小的终端窗口来做这件事?当然也有 GUI 版本,但终端界面仍然是大多数此类工具的主要交互方式。大多数 GUI(现在大多数辅助工具也都有了)都是二等公民。而且它们看起来都一样:一个带有聊天标题和聊天面板的无聊侧边栏。但严肃的程序员需要的不止于此。即使是普通用户,在尝试在终端中复制和粘贴多行文本时也会感到烦躁。
So in May 2025 I decreed that I would build a better harness, and surely now that I have AI this should not take more than 2 or 3 months to build. And so, after 15 months of work, and endless UI and backend iterations, culminating in a successful beta test, I am now ready to release DreamCoder, which is I think the acme of what a coding harness should be. DreamCoder is a frontier coding harness with a tiling window manager that runs in your browser on all 3 platforms.
因此,在 2025 年 5 月,我决定构建一个更好的辅助工具,心想既然有了 AI,这应该用不了两三个月就能完成。于是,经过 15 个月的工作,以及无数次的 UI 和后端迭代,最终完成了成功的 Beta 测试,我现在准备发布 DreamCoder 了。我认为这就是编程辅助工具应有的巅峰之作。DreamCoder 是一款前沿的编程辅助工具,带有平铺式窗口管理器,可在所有三个平台的浏览器中运行。
Before I get into the meat and potatoes of all of that, I want to talk about AI history and Emacs’s role in it. Let’s roll back time to the 1950s. Past Emacs and LISP, if you did not know, both have a special place in the annals of AI history. John McCarthy was an AI researcher at MIT, and in the 1950s he set out to create the Advice Taker, a piece of software that envelops a framework for what a basic human should know that he called commonsense reasoning using “mathematical logic”.
在深入探讨这些核心内容之前,我想谈谈 AI 的历史以及 Emacs 在其中的角色。让我们回到 20 世纪 50 年代。如果你不知道的话,Emacs 和 LISP 在 AI 历史中都占有特殊地位。约翰·麦卡锡(John McCarthy)是麻省理工学院的一名 AI 研究员,他在 20 世纪 50 年代着手创建“建议者”(Advice Taker),这是一款软件,它包含了一个框架,用于定义一个基本人类应该知道的知识,他称之为使用“数理逻辑”的常识推理。
His postulation was that if we can express with symbolic precision all the aspects of what constitutes humanity like ordinary facts about life, that we can set in motion the rudiments of AI. In the 50s there was little in the way of computer software that could do this. To formalize such a system you need a lot of data, rigorously formatted, and a method of manipulating the data. The data and code itself may intertwine recursively, and so an ordinary programming language would not work.
他的假设是,如果我们能以符号精度表达构成人类的所有方面,比如关于生活的普通事实,我们就能启动 AI 的雏形。在 50 年代,几乎没有什么计算机软件能做到这一点。要将这样的系统形式化,你需要大量经过严格格式化的数据,以及一种操作这些数据的方法。数据和代码本身可能会递归地交织在一起,因此普通的编程语言无法胜任。
To help him achieve this, McCarthy created the LISt Processing (LISP) language made up of two facets: M-expressions, a functional language in the vein of Algol; and S-expressions, designed for symbolic data representation, and never intended as a method of writing code. S-expressions were dolled up with parentheses. M-expressions meanwhile used square brackets to visually separate the two. Uniquely, the language specification had an eval feature that would prove that the language is also a universal Turing machine… if only McCarthy had the means to do so.
为了帮助他实现这一目标,麦卡锡创建了列表处理语言(LISP),它由两个方面组成:M-表达式(一种类似于 Algol 的函数式语言)和 S-表达式(旨在用于符号数据表示,从未打算作为编写代码的方法)。S-表达式用括号装饰,而 M-表达式则使用方括号在视觉上将两者区分开来。独特的是,该语言规范具有一个 eval 功能,可以证明该语言也是一台通用图灵机……如果麦卡锡当时有条件实现的话。
It was theoretical because McCarthy lacked, in time, staff and money, what he needed build this recursive evaluator that can take as input its own world state and evaluate it alongside new expressions, a fact made even more apparent by the sheer complexity of his M-expression language and the limited resources he had at the time. Steve Russell who worked with him proved him wrong the way most young people do: by just doing it. Russell wrote the first LISP Interpreter with a working eval function, but M-expressions got sidelined; the imperative, procedural nature of programming got squished into S-expressions instead.
这在当时只是理论上的,因为麦卡锡缺乏时间、人员和资金来构建这个递归求值器,它能够将自身的世界状态作为输入,并将其与新表达式一起求值。由于他的 M-表达式语言极其复杂,且当时资源有限,这一事实显得尤为明显。与他共事的史蒂夫·拉塞尔(Steve Russell)以大多数年轻人惯用的方式证明了他错了:直接动手做。拉塞尔编写了第一个带有有效 eval 函数的 LISP 解释器,但 M-表达式被搁置了;编程的命令式、过程式本质反而被压缩进了 S-表达式中。
They had to hand roll the language on paper then punch it into cards and then batch run them. Eliding M-expressions was a simple matter of pragmatism. And so LISP was born. And through several accidents of history, M-expressions never gained traction. M-expressions live on in Wolfram’s Mathematica, but few other places. Much later, McCarthy eventually conceded that, “One can even conjecture that LISP owes its survival specifically to the fact that its programs are lists, which everyone, including me, has regarded as a disadvantage.”
他们必须在纸上手写语言,然后将其打孔到卡片上,再进行批处理运行。省略 M-表达式纯粹是出于实用主义。于是 LISP 诞生了。由于历史的种种偶然,M-表达式从未流行起来。M-表达式在 Wolfram 的 Mathematica 中得以留存,但在其他地方很少见。很久以后,麦卡锡最终承认:“人们甚至可以推测,LISP 之所以能存活下来,正是因为它将程序视为列表,而这在包括我在内的所有人看来,一直被视为一个缺点。”
S-expressions were always intended as the storage format with a bridge language to manipulate them. But by pushing evaluation into the same symbolic representation format as the data, we have what we call LISP today. That is why LISP is so unique. Consider a simple calculator. (+ 2 2) can simultaneously represent an expression that we want to compute, two plus two, or perhaps a ledger of record of a calculation we have already done.
S-表达式最初一直被设计为存储格式,并配有一种桥接语言来操作它们。但通过将求值过程推入与数据相同的符号表示格式中,我们得到了今天所说的 LISP。这就是 LISP 如此独特的原因。考虑一个简单的计算器。(+ 2 2)可以同时表示我们想要计算的表达式(二加二),或者可能是一个我们已经完成的计算记录账本。
McCarthy never built the Advice Taker in its purest form. He and his team ran into many philosophical, mathematical and computational walls that kept them occupied for a long time. The idea behind the Advice Taker was simple. If you want to go somewhere in your car, you can symbolically express this by building a chain of narrative facts – kinda like a flowchart, but as small snippets of rules and facts, not as one grand design. The system would automatically resolve ambiguities, and all the logician had to do was capture the microcosm of the world he wished to represent: (at me home) (walkable home car) (
麦卡锡从未以最纯粹的形式构建出“建议者”。他和他的团队遇到了许多哲学、数学和计算上的障碍,这些障碍让他们忙碌了很长时间。“建议者”背后的想法很简单。如果你想开车去某个地方,你可以通过建立一系列叙述性事实来符号化地表达这一点——有点像流程图,但不是作为一个宏大的设计,而是作为规则和事实的小片段。系统会自动解决歧义,逻辑学家所要做的只是捕捉他希望表示的世界的微观世界:(我在家)(家到车可步行)(