--- title: "Agent-Build-Gate" type: concept tags: [] last_updated: 2026-04-22 --- ## Overview Agent 执行构建任务前的条件检查机制——只有通过门控条件的 Agent 才允许进入实际代码编写阶段。通过在 Agent 的 instructions 中嵌入 pre-gate 规则实现自动化门控,是 [[Pre-Build Validation]] 的技术实现机制。 ## Implementation Pattern 在 [[OpenClaw]] Agent 的 instructions 中嵌入规则: ```text 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 才进入代码编写阶段 ## Relationship to Related Concepts - [[Pre-Build Validation]] ← Agent-Build-Gate 是其技术实现 - [[idea-reality-mcp]] ← 提供 `idea_check()` 工具 - [[Reality-Signal]] ← Gate 的判断依据 - [[Pivot-Strategy]] ← Gate 触发 STOP 时的后续建议 - [[OpenClaw]] ← 当前唯一支持此模式的 Agent 框架 ## Advantages over Manual Gate - **自动化**:无需人工触发,Agent 自动执行检查 - **强制化**:Agent 指令层面嵌入,无法绕过(除非修改 instructions) - **上下文保持**:检查结果和 Agent 对话上下文共存,无需额外工具切换 - **持续生效**:每次新的构建指令都会自动触发,无需重复提醒 ## Related - [[Pre-Build Validation]] - [[idea-reality-mcp]] - [[Reality-Signal]] - [[Pivot-Strategy]] - [[OpenClaw]] - [[Competition-Analysis]]