Files
myWiki/raw/articles/prompt-to-loop-engineering-2026.md

109 lines
5.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "AI 开发范式演进:从 Prompt Engineering 到 Loop Engineering (Raw)"
source: https://mp.weixin.qq.com/s/hcgKahtQRE2QqI6xplv2Rg
author: 邱汉宸(东南大学、阿里淘天)
platform: Datawhale
date: 2026-06-29
---
# AI 开发范式演进:从 Prompt Engineering 到 Loop Engineering
## 引言
2023 年是大语言模型落地应用的早期阶段,"年薪百万的提示词工程师"刷屏。工业界核心精力投射于提示词工程方法论侧经历系统化演进Zero-shot → Few-shot → Chain-of-Thought → Tree-of-Thought
转折在 20252026 年,三句话引爆 AI 社区:
1. "I really like the term 'context engineering' over prompt engineering." — Tobi Lütke
2. "You shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents." — Peter Steinberger
3. "I don't prompt Claude anymore. I have loops running. My job is to write loops." — Boris Cherny
核心命题:人类从 Agent 循环的内部走向外部,从执行者变成设计者。
## 四次浪潮
### 1. Prompt Engineering
- 方法论Zero-shot/Few-shot, Instruction Prompting, APE 自动 Prompt 搜索
- Prompt Engineering ≠ Blind Promptingtrial-and-error 无测试)
- 声明式框架DSPy, APE — 开发者声明输入输出签名,优化器自动搜索最优 Prompt
- 瓶颈:上下文窗口限制、缺乏记忆与工具调用、维护成百上千条模板的技术债务
### 2. Context Engineering
- 三套方法论MVCMinimum Viable Context、GraphRAG、Just-in-Time 检索
- 三种故障模式Context Starvation / Context Overflow / Context Rot
- 隐式维度提示词缓存Prompt Caching+ 前缀匹配不变性Prefix Matching Invariant
- "从静到动"分层排列:工具定义 → 系统提示 → 历史对话 → 动态消息
- 缓存经济学N>3 即可净收益(首次 100%,后续 20%
- Anthropic Skills 采用 Just-in-Time 设计哲学
### 3. Harness Engineering
- 公式Agent = Model + Harness
- 四大支柱:环境资产与工具集 / 控制与编排逻辑 / 规则中间件Hooks/ 运行时可观测性
- 信任边界:物理基础设施 → 安全沙箱 → Agent Harness → 运行时 → 模型
- DataTalks.Club 事故Claude Code 执行 terraform destroy 抹除生产数据库
- 八条非妥协原则:
1. Model proposes — Harness executes
2. Every call returns a result
3. Risk changes the process
4. Draft 与 Commit 分离
5. Context is assembled, not dumped
6. Long tasks have budgets
7. Skills & Connectors 渐进式披露
8. Recurring failures become Harness features
- CodeRabbit 分层拦截流水线:确定性规则层 → 策略网关层 → AI 审查层 → 人类终审
- Skill Issue 框架Agent 表现不佳 → 排查 Harness 代码
- Terminal Bench 2.0:不改模型,仅改写 Harness → 排名 30 → 前五
### 4. Loop Engineering
- 公式Loop = Cron + 决策器
- 哲学机制Mechanism与策略Policy分离
- 三级成熟度Open Loop → Closed Loop → Review Loop
- 五件套 + 一个记忆Automations / Worktrees / Skills / Connectors (MCP) / Sub-agents / State 文件
- Loop Contract 六维约束TRIGGER / SCOPE / ACTION / BUDGET / STOP / REPORT
- 安全机制熔断器Circuit Breaker+ 看门狗Watchdog
- 自主闭环流水线AI 编码 → 沙箱测试 → 日志回灌 → AI 修复 → CI 绿标 → 自动发起 PR
## 嵌套关系
Prompt ⊂ Context ⊂ Harness ⊂ Loop
## 早期 vs 当前
- 早期Output = f(Prompt, Context) — 可靠性取决于输入质量
- 当前Success = g(Loop(State, Harness, Model)) — 取决于循环深度和验证器严密性
## Loop Engineering 的影响
1. 为缓解幻觉提供可工程化的收敛路径Text → Code → Execute → Read Result → Self-correct
2. 自动化控制范式升级(容错、自愈、动态自适应)
3. 基础设施产品原语化HaaS
## Loop Designer 角色
1. 定义终止边界Goal & Verifier 设计)
2. 维护工具链与领域资产Tooling & Skill 配置)
3. 设计安全断路器Human-in-the-Loop & Budget Guard
## 参考资料
[1] Lilian Weng. Prompt Engineering. 2023.
[2] Mitchell Hashimoto. Prompt Engineering vs. Blind Prompting. 2023.
[3] Lilian Weng. LLM Powered Autonomous Agents. 2023.
[4] Tobi Lütke. Context engineering over prompt engineering. 2025.
[5] Michael Hunger. Why AI teams are moving from prompt engineering to context engineering. 2026.
[6] Tomás Murúa. Context engineering vs. prompt engineering. 2026.
[7] Vivek Trivedy. The Anatomy of an Agent Harness. 2026.
[8] Sergio Paniego & Aritra Roy Gosthipaty. Harness, Scaffold, and the AI Agent Terms Worth Getting Right. 2026.
[9] Tort Mario. AI Agent Best Practices: Production-Ready Harness Engineering. 2026.
[10] Addy Osmani. Agent Harness Engineering. 2026.
[11] Peter Steinberger. You shouldn't be prompting coding agents anymore. 2026.
[12] Yash Thakker. Loop Engineering: How to Design Coding Agent Loops That Run While You Sleep. 2026.
[13] Addy Osmani. Loop Engineering. 2026.
[14] Sydney Runkle. The Art of Loop Engineering. 2026.
[15] Stanford NLP. DSPy: Programming not prompting Foundation Models. 2024.
[16] Anthropic. Prompt Caching. 2024.
[17] Gaurav Garg. Claude Code Deleted a 2.5-Year AWS Production Database: The Full Incident Report. 2025.
[18] Brandon Gubitosa. What is harness engineering for AI code review & oversight. 2026.
[19] Aliyun. Model Studio Context Cache. 2026.
[20] Geoffrey Huntley. Cursed: The unintended consequences of AI code generation. 2025.