Files
nexus/wiki/concepts/Agent-Build-Gate.md
2026-04-22 19:20:32 +08:00

2.1 KiB
Raw Blame History

title, type, tags, last_updated
title type tags last_updated
Agent-Build-Gate concept
2026-04-22

Overview

Agent 执行构建任务前的条件检查机制——只有通过门控条件的 Agent 才允许进入实际代码编写阶段。通过在 Agent 的 instructions 中嵌入 pre-gate 规则实现自动化门控,是 Pre-Build Validation 的技术实现机制。

Implementation Pattern

OpenClaw Agent 的 instructions 中嵌入规则:

Before starting any new project, feature, or tool, always run idea_check first.

Rules:
- If reality_signal > 70: STOP. Report top 3 competitors.
  Ask me if I want to proceed, pivot, or abandon.
- If reality_signal 30-70: Show me results and pivot_hints.
  Suggest a niche angle that existing projects don't cover.
- If reality_signal < 30: Proceed to build.
  Mention that the space is open.
- Always show the reality_signal score and top competitors before writing any code.

How It Works

  1. 用户向 Agent 发送构建指令(如"build me a CLI tool for AI code review"
  2. Agent 自动调用 idea_check() 工具(而非立即开始写代码)
  3. 获取 reality_signal 和竞品信息
  4. 根据阈值执行对应规则STOP / 展示建议 / 直接构建)
  5. 只有在 reality_signal < 30 或用户明确授权的情况下Agent 才进入代码编写阶段

Advantages over Manual Gate

  • 自动化无需人工触发Agent 自动执行检查
  • 强制化Agent 指令层面嵌入,无法绕过(除非修改 instructions
  • 上下文保持:检查结果和 Agent 对话上下文共存,无需额外工具切换
  • 持续生效:每次新的构建指令都会自动触发,无需重复提醒