Plan mode proposes, and you decide whether to carry it out
`plan_submit` records an ordered set of steps and ends the turn. Offered in Plan mode and nowhere else: it stops the reply, and a model in Auto mode proposing a plan instead of doing the work would be obeying the wrong instinct at the worst moment. The plan is stored on the message rather than parsed back out of the prose, so the button sends exactly what was proposed. It gets one more request to say what it proposed and why -- a bubble containing only a card reads as though the model had nothing to add -- but with the tools withdrawn, so "one more round" cannot become three rounds of it changing its mind about a plan somebody is being asked to approve. Carrying it out switches to Edit, never Auto. The plan was written under a mode where every command stopped for approval, and a button that also removed the asking is not the button anybody pressed. It goes back quoted and attributed, not stated: a plan whose text came out of a file the model read must not arrive in the most trusted role in the transcript wearing the reader's authority. Also closes the rewind gap. Editing or regenerating a turn rewinds the transcript and not the machine, so `rewound_at` is stamped and the harness says so. Nothing tries to undo anything out there -- the project directory is somebody's real working tree, and deleting their work to match a rewound transcript would be far worse than the inconsistency. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,10 @@ class Generation:
|
||||
# A model that fills its own context with build logs has no room left to
|
||||
# answer with.
|
||||
output_bytes: int = 0
|
||||
# A plan proposed in Plan mode: {"title": str, "steps": [str, ...]}. Ends
|
||||
# the reply and is written onto the message, so the Execute button sends
|
||||
# exactly what was proposed rather than something parsed back out of prose.
|
||||
plan: dict | None = None
|
||||
|
||||
def touch(self) -> None:
|
||||
self.version += 1
|
||||
@@ -440,10 +444,21 @@ async def _run(generation: Generation) -> None:
|
||||
generation.tool_events.append(outcome.event)
|
||||
generation.output_bytes += len(outcome.content)
|
||||
messages.append(tools_service.tool_turn(call, outcome.content))
|
||||
if outcome.event.get("plan"):
|
||||
generation.plan = outcome.event["plan"]
|
||||
generation.touch()
|
||||
|
||||
payload = {**payload, "messages": messages}
|
||||
|
||||
# A plan ends the turn. One more request so the model can say what
|
||||
# it proposed and why -- a bubble containing only a card reads as
|
||||
# though it had nothing to add -- but with the tools withdrawn, so
|
||||
# "one more round" cannot become three rounds of it changing its
|
||||
# mind about a plan the reader is being asked to approve.
|
||||
if generation.plan is not None:
|
||||
offered = []
|
||||
payload.pop("tools", None)
|
||||
|
||||
for kind, piece in splitter.flush():
|
||||
(generation.reasoning if kind == REASONING else generation.content).append(piece)
|
||||
generation.touch()
|
||||
@@ -963,6 +978,7 @@ def _persist(generation: Generation, title: str, elapsed: float) -> None:
|
||||
message.reasoning = generation.thinking
|
||||
message.reasoning_ms = generation.reasoning_ms
|
||||
message.tool_calls_json = generation.tool_events
|
||||
message.plan_json = generation.plan or {}
|
||||
message.usage_json = metrics_service.to_json(
|
||||
metrics_service.from_generation(generation)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user