[FEAT] Make the plan mutable — replace create_plan with an idempotent update_plan
enhancementagentspriority:high
## Summary
The plan is created once at t=0 and frozen for the rest of the run. Real tasks invalidate their plan by the second step; the agent has no way to record what it learned.
## Location
- `swarms/structs/autonomous_loop_utils.py:148` — `create_plan` schema
- `swarms/agents/autonomous_loop.py:955` — `_create_plan_tool`
- `swarms/agents/autonomous_loop.py:~300` — planning phase runs once, then `plan_created = True`
## Details
`_create_plan_tool` unconditionally replaces `autonomous_subtasks` and is only reachable from the planning phase, which exits as soon as a plan exists. During execution the model can mark subtasks done or failed, but cannot:
- add a subtask for work it discovered (a missing dependency, a required migration)
- split a subtask that turned out to be three
- drop a subtask that turned out to be unnecessary
- correct a dependency it got wrong
Its only escape valves are to cram unplanned work into an unrelated subtask, or to fail the subtask. Both are worse than replanning.
A continuously-rewritten todo list is the core of how Claude Code stays coherent on long tasks — the value is in the rewriting, not in the initial plan.
## Proposal
- Register `create_plan` (or a new `update_plan`) as an **execution-phase** tool as well.
- Make `_create_plan_tool` idempotent: merge incoming steps by `step_id`, preserving the status/summary of any step already `completed` or `failed`, adding new ones as `pending`, and removing only steps still `pending`.
- Validate `dependencies` against known `step_id`s on every update (see the dependency bug).
- Show a plan diff in the panel rather than the full plan, so the user can see what changed.
## Related
Pairs with the verification-field proposal — a mutable plan is where verification results land.
Priority: P0
---
Part of a review of the `max_loops="auto"` autonomous loop.
0 条评论