正在打开每日关注
正在打开每日关注
用触发器与停止条件区分四类 Claude Code 循环,帮助选择合适的自动化强度。
🚨 Anthropic's Claude Code team just laid out the 4 loops you can actually build with Claude, and each one hands off a different piece of the decision-making to the agent. "Loop engineering" gets used loosely enough right now that it's worth being precise about what actually changes between these four setups: what starts the cycle, and what decides when it stops. Here's the breakdown: 🔹 Turn-based: you prompt, Claude acts and checks its own work, then hands the result back. This is the loop running under almost every message you send, whether you've named it or not. 🔹 Goal-based (/goal): you define a measurable finish line up front. An evaluator model checks your condition every time Claude tries to stop, and sends it back to work if the bar hasn't been cleared. 🔹 Time-based (/loop, /schedule): a timer replaces the prompt. /loop re-runs a check on an interval but stops if your machine does. /schedule moves that same idea to the cloud, so it runs independent of your session. 🔹 Proactive: /schedule, /goal, and a workflow stacked together, triggered by an event with no one prompting in the moment. Each item gets resolved on its own goal; the routine keeps running until someone turns it off. The nuance worth sitting with: goal-based loops only work when the bar is genuinely measurable, and proactive loops are the easiest of the four to get wrong at scale before you've watched them run on a handful of cases. Most tasks are still better off as a turn-based loop than a heavier setup you don't need yet. If you're building with Claude Code, the useful move isn't picking the most advanced primitive. It's matching the primitive to whether the task has a real finish line or is genuinely ongoing. We broke down all four with examples and a decision framework for choosing between /goal and /loop specifically - full post on the blog, link in the comments. #ClaudeCode #AIAgents #AgenticAI #LLMEngineering #AIEngineering #DeveloperTools
是什么 这条内容把 Claude Code 的循环机制按两个轴拆开:谁触发下一轮,以及谁决定结束。Turn-based 是默认的人机往返;Goal-based 用 /goal 绑定可测量目标;Time-based 用 /loop 或 /schedule 按时间重新执行;Proactive 则把事件、目标、调度与 workflow 组合起来,让任务在无人即时提示时持续处理。
核心设计 它的价值不在“循环越自动越先进”,而在于把控制权明确分配给提示者、计时器、评估模型和取消操作。尤其是 Goal-based:Agent 每次准备停止时由 evaluator 检查条件,未达标就继续迭代;Time-based 关注固定间隔的检查与动作,/schedule 还能脱离本机或会话运行。
关键洞察 选择原语应先判断任务有没有真实、可验证的终点:代码测试达标、队列项目清零适合目标循环;定时巡检适合时间循环;持续接收新事件并自动处理,才值得升级为主动循环。多数一次性任务仍以 Turn-based 最稳妥,先观察少量案例,再增加自动化层级。
边界与风险 目标若不可量化,评估模型就无法可靠判停;目标、触发器或取消条件设计不清,会造成无效迭代、资源消耗和误操作。主动循环在规模化前尤其需要小样本验证、明确退出机制与人工复核边界。