refactor(agents): 改回2层架构,StrictSpec 直接调 SubCoding
- StrictSpec 精简为~60行,stage 4 直接调 SubCoding(绕过 SpecPlan 中间层) - 移除 SpecPlan 注册(3层嵌套对外部用户不可用,ALL_AGENT_DISALLOWED_TOOLS 限制) - SubCoding 自带探索/实施能力,无需上层准备 proposal/task.md - 支持 teammates 并行调用 SubCoding,自动降级串行 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7ee0b3a6a2
commit
0d1754614a
|
|
@ -24,9 +24,19 @@ function getStrictSpecSystemPrompt(): string {
|
||||||
- 用 \`Agent\` 工具启动 \`TaskPlan\`(subagent_type: "TaskPlan")
|
- 用 \`Agent\` 工具启动 \`TaskPlan\`(subagent_type: "TaskPlan")
|
||||||
- prompt参数输入:用户原始输入{user_input}
|
- prompt参数输入:用户原始输入{user_input}
|
||||||
|
|
||||||
4. **方案执行阶段** (SpecPlan模式)
|
4. **方案执行阶段**
|
||||||
- 用 \`Agent\` 工具启动 \`SpecPlan\`(subagent_type: "SpecPlan")
|
- 读取 \`.cospec/spec/<feature>/plan.md\`,对每个未完成任务调用 \`SubCoding\`(subagent_type: "SubCoding")
|
||||||
- prompt参数输入:用户原始输入{user_input}
|
- 任务间无依赖时,在**同一条消息**中并行启动多个 \`SubCoding\`(提供 \`name\` 和 \`team_name\` 参数)
|
||||||
|
- 若 Agent 工具返回 "Agent Teams is not yet available",自动回退为逐个串行调用
|
||||||
|
- 每个 SubCoding 完成后,将对应任务在 plan.md 中标记为 \`- [x]\`
|
||||||
|
|
||||||
|
SubCoding prompt 模板:
|
||||||
|
\`\`\`
|
||||||
|
任务名称: <plan.md 中的任务名>
|
||||||
|
任务描述: <plan.md 中的任务内容>
|
||||||
|
需求文档: .cospec/spec/<feature>/spec.md
|
||||||
|
设计文档: .cospec/spec/<feature>/tech.md
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
## 核心执行规则
|
## 核心执行规则
|
||||||
|
|
||||||
|
|
@ -40,7 +50,8 @@ function getStrictSpecSystemPrompt(): string {
|
||||||
### 异常处理
|
### 异常处理
|
||||||
|
|
||||||
- 若某阶段执行失败,需暂停后续流程,向用户报告失败原因,等待用户指令后再继续
|
- 若某阶段执行失败,需暂停后续流程,向用户报告失败原因,等待用户指令后再继续
|
||||||
- 禁止跳过任何阶段强行推进`
|
- 禁止跳过任何阶段强行推进
|
||||||
|
- SubCoding 失败后最多重试 2 次,超限后使用 \`AskUserQuestion\` 向用户报告`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const STRICT_SPEC_AGENT: BuiltInAgentDefinition = {
|
export const STRICT_SPEC_AGENT: BuiltInAgentDefinition = {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { isEnvTruthy } from '../../utils/envUtils.js'
|
||||||
import { DESIGN_AGENT } from '../../costrict/agents/designAgent.js'
|
import { DESIGN_AGENT } from '../../costrict/agents/designAgent.js'
|
||||||
import { QUICK_EXPLORE_AGENT } from '../../costrict/agents/quickExplore.js'
|
import { QUICK_EXPLORE_AGENT } from '../../costrict/agents/quickExplore.js'
|
||||||
import { REQUIREMENT_AGENT } from '../../costrict/agents/requirement.js'
|
import { REQUIREMENT_AGENT } from '../../costrict/agents/requirement.js'
|
||||||
import { SPEC_PLAN_AGENT } from '../../costrict/agents/specPlan.js'
|
|
||||||
import { STRICT_PLAN_AGENT } from '../../costrict/agents/strictPlan.js'
|
import { STRICT_PLAN_AGENT } from '../../costrict/agents/strictPlan.js'
|
||||||
import { STRICT_SPEC_AGENT } from '../../costrict/agents/strictSpec.js'
|
import { STRICT_SPEC_AGENT } from '../../costrict/agents/strictSpec.js'
|
||||||
import { SUB_CODING_AGENT } from '../../costrict/agents/subCoding.js'
|
import { SUB_CODING_AGENT } from '../../costrict/agents/subCoding.js'
|
||||||
|
|
@ -64,12 +63,11 @@ export function getBuiltInAgents(): AgentDefinition[] {
|
||||||
GENERAL_PURPOSE_AGENT,
|
GENERAL_PURPOSE_AGENT,
|
||||||
STATUSLINE_SETUP_AGENT,
|
STATUSLINE_SETUP_AGENT,
|
||||||
PLAN_AGENT,
|
PLAN_AGENT,
|
||||||
// StrictSpec workflow: 4-stage pipeline (Requirement → DesignAgent → TaskPlan → SpecPlan)
|
// StrictSpec workflow: 4-stage pipeline (Requirement → DesignAgent → TaskPlan → SubCoding)
|
||||||
STRICT_SPEC_AGENT,
|
STRICT_SPEC_AGENT,
|
||||||
REQUIREMENT_AGENT,
|
REQUIREMENT_AGENT,
|
||||||
DESIGN_AGENT,
|
DESIGN_AGENT,
|
||||||
TASK_PLAN_AGENT,
|
TASK_PLAN_AGENT,
|
||||||
SPEC_PLAN_AGENT,
|
|
||||||
// StrictPlan workflow: lightweight plan → implement pipeline
|
// StrictPlan workflow: lightweight plan → implement pipeline
|
||||||
STRICT_PLAN_AGENT,
|
STRICT_PLAN_AGENT,
|
||||||
SUB_CODING_AGENT,
|
SUB_CODING_AGENT,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user