如果你在2025年说自己是"Vibe Coding",大家会觉得你很酷——跟着感觉走,描述需求让AI写代码,像指挥家一样挥洒自如。但到了2026年夏天,真正在生产环境里用AI写代码的工程师们开始承认一个尴尬的事实:Vibe Coding写demo很爽,写生产系统很痛。
你花在审查AI产出、纠正偏差、处理幻觉、对齐需求上的时间,有时候比自己写代码还多。AI像一匹脱缰的野马——能力很强,但方向感和边界感极差。HashiCorp联合创始人、Terraform缔造者Mitchell Hashimoto在2月5日的一篇博客里给这个问题起了个名字:Harness Engineering(驾驭工程)。六天后,OpenAI在他们的百万行代码实验报告里直接使用了这个术语。8月4日,InfoQ中文发布专题长文,标志着这个概念正式进入主流技术视野。
为什么需要"缰绳"?AI编程的三重失控
Harness的英文原意是马具——缰绳、马鞍、马镫。不是把马绑死不让它跑,而是给它方向和约束,让它的力量用在正确的路上。
为什么AI编程需要缰绳?因为过去一年半的生产实践暴露了三重失控。
第一重:方向失控。你让AI写一个用户认证模块,它可能自作主张加了一堆你不需要的第三方登录、OAuth集成、权限系统,把简单问题复杂化。你说"加个排序功能",它可能重写了整个数据访问层。Vibe Coding时代的Prompt是模糊的、自然语言的,AI的理解也是模糊的、发散的。
第二重:质量失控。AI生成的代码能跑起来,但边界条件处理得一塌糊涂:空指针、并发问题、SQL注入、资源泄漏、错误吞掉。这些问题在Code Review阶段很难全部发现,上线后就是生产事故。更麻烦的是,AI写的代码风格不统一、注释缺失、命名混乱,后续维护的人看得头大。
第三重:权限失控。这是最危险的。当AI Agent拥有文件系统访问权、数据库写入权、部署权限时,一个误解的指令就可能酿成大祸——删库、泄露密钥、把测试数据推到生产环境。2025年下半年到2026年初发生的多起AI编程事故,本质上都是权限缰绳没有勒紧。
Harness Engineering的核心思想很简单:不要试图让AI变成完美的程序员,而是建立一套工程化的"马具系统"来驾驭AI的能力。
Harness的四件套:从Prompt到工程系统
Harness不是一个工具,而是一套工程方法论。InfoQ的文章和社区讨论中,逐渐浮现出四个核心组件。
第一是结构化约束。从自然语言Prompt转向结构化的任务描述——明确输入输出格式、明确边界条件、明确禁止操作、明确验收标准。把"帮我写个API"变成"在src/api/下创建user.ts,使用现有中间件authMiddleware,只实现GET和POST,不允许删除数据,单元测试覆盖率不低于80%"。这本质上是把产品经理的需求文档思维应用到AI编程上。
第二是沙箱和权限围栏。给AI Agent最小必要权限:文件系统访问限制在特定目录、数据库只给只读权限或测试库权限、部署操作必须人工确认。就像马不能随便跑上高速公路,AI不能随便操作生产环境。
第三是自动化验证闭环。AI写完代码不是结束,而是开始——自动跑lint、自动跑单元测试、自动跑类型检查、自动跑安全扫描,任何一关不通过就打回让AI修正。Hashimoto在博客里提到他的工作流:AI写完代码,他先看测试结果而不是代码本身。测试全绿再看代码,测试红了直接打回。
第四是人机协作的交接点设计。明确哪些决策AI可以自主做、哪些必须人来拍板。架构设计、技术选型、数据模型变更、生产部署——这些高风险决策点必须有人在环(human-in-the-loop)。变量命名、代码格式化、简单函数实现——这些低风险决策可以让AI自主完成。
"Vibe Coding是'你说我写'的浪漫想象,Harness Engineering是'你写我查、你错我拦'的工程现实。"—— InfoQ技术编辑
从Vibe Coding到Harness Engineering,不是AI编程能力退步了,而是它进入了生产环境后必须面对的工程化成熟。就像早期的汽车没有安全带、没有ABS、没有转向灯,能开但很危险;等汽车普及了,这些安全装置就成了标配。AI编程正在经历同样的过程。
值得注意的是,Harness Engineering的提出者不是学术研究者,而是Hashimoto这样创造过Terraform这类世界级基础设施工具的实战派工程师。这本身就说明问题:AI编程的瓶颈已经从"AI能不能写代码"转向了"我们能不能安全、可靠、可重复地用AI写代码"。
当你下次让AI写代码的时候,别光顾着Vibe——记得给它套上Harness。
明天见。
If you said you were "Vibe Coding" in 2025, people thought you were cool — going with the flow, describing what you wanted and letting AI write the code, conducting like a maestro. But by summer 2026, engineers actually using AI to write code in production are admitting an uncomfortable truth: Vibe Coding is great for demos and painful for production systems.
The time you spend reviewing AI output, correcting deviations, handling hallucinations, and aligning with requirements sometimes exceeds the time you'd spend writing the code yourself. AI is like a wild horse — immensely powerful, but with terrible sense of direction and boundaries. Mitchell Hashimoto, co-founder of HashiCorp and creator of Terraform, gave this problem a name in a February 5 blog post: Harness Engineering. Six days later, OpenAI used the term in their million-lines-of-code experiment report. On August 4, InfoQ China published a feature article, marking the concept's formal entry into mainstream technical discourse.
Why Reins? Three Levels of AI Coding Loss of Control
Harness, in its original sense, means horse tack — reins, saddle, stirrups. Not tying the horse down so it can't run, but giving it direction and constraints so its power goes where it should.
Why does AI coding need reins? Because a year and a half of production practice has exposed three levels of loss of control.
The first: directional loss of control. You ask AI to write a user authentication module and it unilaterally adds a bunch of third-party logins, OAuth integrations, and permission systems you never asked for, overcomplicating a simple problem. You say "add sorting" and it rewrites the entire data access layer. Prompts in the Vibe Coding era are vague, natural language; AI's interpretation is similarly vague and divergent.
The second: quality loss of control. AI-generated code runs, but handles edge cases atrociously: null pointers, concurrency issues, SQL injection, resource leaks, swallowed errors. These problems are hard to catch entirely in code review, and they become production incidents after deployment. Worse, AI-written code has inconsistent style, missing comments, and chaotic naming — a maintenance nightmare for whoever comes after.
The third: permission loss of control. This is the most dangerous. When an AI Agent has filesystem access, database write permissions, and deployment privileges, one misinterpreted command can spell disaster — dropping databases, leaking keys, pushing test data to production. Multiple AI coding incidents from late 2025 through early 2026 were essentially failures to tighten permission reins.
Harness Engineering's core idea is simple: stop trying to make AI a perfect programmer; instead, build an engineered "tack system" to steer AI's capabilities.
The Four-Piece Harness: From Prompts to Engineering Systems
Harness isn't a tool — it's an engineering methodology. From InfoQ's article and community discussion, four core components are emerging.
First, structured constraints. Shifting from natural language prompts to structured task descriptions — specifying input/output formats, boundary conditions, forbidden operations, acceptance criteria. Turning "write me an API" into "create user.ts under src/api/, use existing authMiddleware, implement only GET and POST, no data deletion allowed, unit test coverage no less than 80%." This is essentially applying product manager requirements-document thinking to AI coding.
Second, sandboxes and permission fences. Give AI Agents least-privilege access: filesystem restricted to specific directories, databases with read-only or test-environment permissions, deployment actions requiring human confirmation. Just as horses shouldn't wander onto highways, AI shouldn't freely operate in production environments.
Third, automated verification loops. AI finishing code isn't the end — it's the beginning. Auto-run lint, auto-run unit tests, auto-run type checking, auto-run security scans; fail any gate and send it back for correction. Hashimoto mentioned in his post that his workflow is: after AI writes code, he checks test results before looking at the code itself. Green tests, then review code; red tests, straight back to AI.
Fourth, designing human-AI handoff points. Explicitly define which decisions AI can make autonomously and which require human sign-off. Architecture design, technology selection, data model changes, production deployments — these high-risk decisions must have human-in-the-loop. Variable naming, code formatting, simple function implementations — these low-risk decisions can be left to AI.
"Vibe Coding is the romantic fantasy of 'you say it, I write it'; Harness Engineering is the engineering reality of 'you write it, I check it; you mess up, I stop you.'"— InfoQ technical editor
The shift from Vibe Coding to Harness Engineering doesn't mean AI coding has regressed — it's the engineering maturation that necessarily comes when AI coding enters production environments. Early automobiles had no seatbelts, no ABS, no turn signals; they drove but were dangerous. When cars became mainstream, those safety features became standard. AI coding is going through the same process.
Notably, Harness Engineering wasn't coined by an academic researcher but by a hands-on engineer like Hashimoto, who created world-class infrastructure tools like Terraform. That in itself makes the point: AI coding's bottleneck has shifted from "can AI write code" to "can we use AI to write code safely, reliably, and repeatably."
Next time you ask AI to write code, don't just Vibe — remember to put on the Harness.
See you tomorrow.
Harness Engineering · Vibe Coding · Mitchell Hashimoto · Terraform · AI编程 · Agent缰绳 · 工程范式 · 沙箱权限 · 自动化验证 · 人机协作
Harness Engineering · Vibe Coding · Mitchell Hashimoto · Terraform · AI coding · Agent reins · engineering paradigm · sandbox permissions · automated verification · human-AI collaboration