多年来,人工智能一直坐在你的编辑器旁,猜测你接下来要写什么。你写下一行,它建议下一行。你仍然掌控着架构、调试和语法。那种模式已经结束了。
我们正在迈向“意图驱动开发”(Intent-Driven Development)。你不再需要编写循环和条件语句,而是描述你想要的结果。智能体(Agent)会吸收该目标,规划步骤,编写代码,运行测试,并在你看到结果之前自行修复错误。键盘不再是首要工具,清晰的思维才是。
行级编码时代的终结
旧的工作流迫使你将每一个意图转化为编译器能理解的具体语言。你脑中持有业务需求,然后手动将其拆解为函数、导入、错误处理和测试用例。意图驱动开发消除了这种转换层。
假设你需要集成一个支付 Webhook。以前,你需要编写路由处理程序、解析负载、验证签名、在事务中更新数据库,并排队发送收据邮件。现在,你只需描述需求:“验证传入的 Stripe webhook,以幂等方式记录事件,并触发收据流程。如果数据库写入失败,请回滚。”智能体会编写处理程序,选择解析策略,构建重试逻辑,并生成测试。你的角色从作者转变为导演。
这之所以可行,是因为智能体并不仅仅停留在生成阶段。它会进入一个循环。
智能体循环内部
核心工作不再是人类的打字或手动调试,而是生成与验证之间紧密的循环。智能体生成代码,在你的测试套件中执行,读取输出,并自行修复失败之处。缺失的导入、类型不匹配、失败的断言——智能体会看到堆栈跟踪(stack trace),编辑文件,然后重新运行套件。你并不在这个循环中,这个循环是以机器的速度运行的。
只有当循环本身崩溃时,你才会介入。也许智能体无法解决两个依赖项之间的冲突,或者它不断生成通过了单元测试但违反了更高层业务规则的代码。这些边界正是人类判断力仍然发挥作用的地方。
你的真实工作:约束设计者与边缘情况猎手
如果机器编写了函数,那你还剩下什么工作?两件事,而且这两件事比编写语法更难。
首先,你要编写约束条件来确保智能体不偏离轨道。智能体拥有广泛的知识,但并不了解你的特定环境。你必须告诉它:“仅使用内部计费 API,绝不要记录原始卡片令牌,并将响应延迟保持在 200 毫秒以下。”这些边界并非随手写的提示词(prompts),而是决定成败的规范。
其次,你要捕捉那 10% 智能体失败的情况。智能体能很好地处理常规路径,但在微妙的竞态条件(race conditions)、模糊的业务逻辑边缘情况以及训练数据中固有的安全假设面前,它们会栽跟头。你的优势在于发现 Webhook 处理程序与退款定时任务(cron job)之间的竞态冲突,或者识别出生成的重试逻辑可能会导致重复扣款。机器解决标准问题,你捕捉危险的异常。
用验证框架取代代码审查
当一个智能体能在通宵之间生成五十个文件时,你无法通过扫视 diff 来判断它们“看起来是否正确”。这种工作量使得人工肉眼检查变得不可能。你需要一个能在代码到达你手中之前就捕捉错误的验证框架(Verification Harness)。
这个框架建立在三大支柱之上。
持久化执行(Durable execution)。 智能体任务的运行时间往往超过单个请求的超时时间。如果某个步骤因为临时的网络波动而失败,框架会暂停、重试并恢复,而不会损坏状态。工作能够从中断中幸存下来。
结构化输出(Structured outputs)。 与其寄希望于智能体返回一个格式良好的配置文件,不如预先强制执行契约。像 JSON Schema 这样的工具可以立即验证输出。如果智能体遗漏了必需字段或使用了错误的数据类型,框架会在代码触及你的代码库之前将其拒绝。
动态护栏(Dynamic guardrails)。 智能体不应拥有读取密钥或写入生产数据库的自由权限。框架会动态控制权限,对智能体进行沙箱化处理,使其只能接触指定的测试数据库和内部端点。你不是在审查每一行代码,你是在审计围绕智能体的围栏。
When the Code Works but the Product Fails
Here is the paradox. The harness catches bad code. It cannot catch bad intent.
If your specification says, “Send a welcome email to every new user,” the agent will write clean, tested code that sends that email. It will not know you meant, “Send the welcome email only if the user verified their address, opted into marketing, and signed up during business hours in their local timezone.” The code is technically flawless and commercially dangerous.
The real risk in Intent-Driven Development is ambiguous specification. Unclear intent produces software that solves the wrong problem with textbook elegance. This is why you must treat your specifications as real assets. Version them. Review them with stakeholders. Validate them against actual workflows before the agent starts building. A prompt scribbled into a chat box is not a specification. It is a liability.
Engineering Judgment Moves Upstream
Engineering judgment is not disappearing. It is migrating to a higher altitude.
You no longer spend mental energy on how to iterate a map or structure a class hierarchy. You spend it on what the system must do under failure, what data it must never expose, and which invariants must hold across distributed services. The craft of coding is becoming the craft of requirements.
This means your specifications need the same rigor you once applied to your code. Name your constraints precisely. Define the failure modes explicitly. State the business rules as clearly as you once declared your types. The agent will handle the implementation. You must guarantee that the implementation is worth building.
Move your quality bar from the pull request to the prompt. Build the harness first. Write the specification second. Then let the machine handle the syntax while you focus on whether the problem is defined correctly and the boundaries are drawn safely.
If you want to explore the ideas behind this shift in more depth, the original discussion on Intent-Driven Development is available here. For ongoing conversations around AI-native engineering, you can also join the GyaanSetu community.
