goal-plan
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoal Plan
目标计划
Create and execute intelligent plans using Goal-Oriented Action Planning (GOAP).
使用目标导向行动计划(GOAP)创建并执行智能计划。
When to use
适用场景
When you have a complex objective that requires multiple steps, has dependencies between steps, and may need adaptive replanning as conditions change.
当你有一个复杂目标,需要多个步骤、步骤间存在依赖关系,且可能需要根据条件变化进行自适应重规划时。
Steps
步骤
- Define goal state — what does "done" look like? List concrete success criteria
- Assess current state — what's true now? What assets, code, infrastructure exist?
- Identify gap — what must change between current and goal state?
- Inventory actions — list available actions with:
- Preconditions (what must be true before this action)
- Effects (what becomes true after this action)
- Cost estimate (time, complexity, risk)
- Generate plan — find the optimal action sequence using A* through the state space
- Record trajectory — call to begin tracking
mcp__claude-flow__hooks_intelligence_trajectory-start - Create tasks — call for each action in the plan
mcp__claude-flow__task_create - Execute — work through tasks in dependency order:
- Before each action: verify preconditions still hold
- After each action: verify effects achieved
- Record each step via
mcp__claude-flow__hooks_intelligence_trajectory-step
- Monitor & replan — if an action fails or produces unexpected results:
- Reassess current state
- Recalculate optimal path from new state
- Update remaining tasks
- Complete trajectory — call
mcp__claude-flow__hooks_intelligence_trajectory-end - Store successful plan — call with namespace
mcp__claude-flow__memory_storegoap-plans
- 定义目标状态 — “完成”是什么样子?列出具体的成功标准
- 评估当前状态 — 目前的实际情况是什么?已有的资产、代码、基础设施有哪些?
- 识别差距 — 当前状态与目标状态之间需要做出哪些改变?
- 盘点可用行动 — 列出所有可用行动,包含:
- 前置条件(执行此行动前必须满足的条件)
- 效果(执行此行动后会达成的结果)
- 成本估算(时间、复杂度、风险)
- 生成计划 — 通过状态空间中的A*算法找到最优行动序列
- 记录轨迹 — 调用开始追踪
mcp__claude-flow__hooks_intelligence_trajectory-start - 创建任务 — 为计划中的每个行动调用
mcp__claude-flow__task_create - 执行计划 — 按照依赖顺序完成任务:
- 执行每个行动前:验证前置条件是否仍然满足
- 执行每个行动后:验证是否达成预期效果
- 通过记录每个步骤
mcp__claude-flow__hooks_intelligence_trajectory-step
- 监控与重规划 — 如果某个行动失败或产生意外结果:
- 重新评估当前状态
- 从新状态重新计算最优路径
- 更新剩余任务
- 完成轨迹记录 — 调用
mcp__claude-flow__hooks_intelligence_trajectory-end - 存储成功计划 — 使用命名空间调用
goap-plansmcp__claude-flow__memory_store
Plan output format
计划输出格式
Goal: [concrete objective]
Current State: [key facts]
Plan Cost: [estimated effort]
Steps:
1. [action] — precondition: [X], effect: [Y], cost: [Z]
2. [action] — precondition: [Y], effect: [W], cost: [Z]
...
Risk Factors: [what could force a replan]
Fallback: [alternative approach if primary path fails]Goal: [concrete objective]
Current State: [key facts]
Plan Cost: [estimated effort]
Steps:
1. [action] — precondition: [X], effect: [Y], cost: [Z]
2. [action] — precondition: [Y], effect: [W], cost: [Z]
...
Risk Factors: [what could force a replan]
Fallback: [alternative approach if primary path fails]Replanning triggers
重规划触发条件
- Action fails (precondition no longer met)
- Unexpected side effects detected
- New information changes goal definition
- Cost exceeds threshold
- External dependency becomes unavailable
- 行动失败(前置条件不再满足)
- 检测到意外副作用
- 新信息改变了目标定义
- 成本超出阈值
- 外部依赖不可用