From 9a893c0f10377602a60767b0a1eefa964bb025f5 Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Fri, 15 May 2026 01:13:35 +0800 Subject: [PATCH] feat(long-task): make goal idempotent by removing up-front split planning - step_start: remove "Plan the split" instruction that encouraged users to write procedural steps inside the goal. The first step now only explores and starts the first chunk, leaving split decisions to runtime handoff hints. - step_middle: add "Follow the hint" as the first instruction so each step executes exactly what the previous step's next_step_hint asks for, making the goal itself stateless and safe to repeat. --- nanobot/templates/agent/long_task/step_middle.md | 7 ++++--- nanobot/templates/agent/long_task/step_start.md | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/nanobot/templates/agent/long_task/step_middle.md b/nanobot/templates/agent/long_task/step_middle.md index 2b7df9d45..faf791e19 100644 --- a/nanobot/templates/agent/long_task/step_middle.md +++ b/nanobot/templates/agent/long_task/step_middle.md @@ -31,8 +31,9 @@ You are one step in a chain working toward a goal. {% endif %} ## Instructions -1. **Check existing work**: Use the file list above — do NOT re-explore files already handled. -2. **Do the next chunk**: Make concrete progress. Write results to files. -3. **Handoff**: Call `handoff()` with your progress summary, files changed, and a hint for the next step. Call `complete()` only if the ENTIRE goal is achieved. +1. **Follow the hint**: Do exactly what the Suggested Next Step above asks for. +2. **Check existing work**: Use the file list above — do NOT re-explore files already handled. +3. **Do the next chunk**: Make concrete progress. Write results to files. +4. **Handoff**: Call `handoff()` with your progress summary, files changed, and a hint for the next step. Call `complete()` only if the ENTIRE goal is achieved. You have {{ budget }} tool calls total. Reserve the last 1-2 calls for `handoff()` or `complete()`. diff --git a/nanobot/templates/agent/long_task/step_start.md b/nanobot/templates/agent/long_task/step_start.md index ee234dd93..03b76e86c 100644 --- a/nanobot/templates/agent/long_task/step_start.md +++ b/nanobot/templates/agent/long_task/step_start.md @@ -7,12 +7,10 @@ You are the FIRST step in a meta-ReAct loop. Your job is NOT to finish the entir ## Instructions 1. **Explore**: Check the filesystem and any relevant state. Do NOT assume anything. -2. **Plan the split**: Explicitly decide how the goal will be divided across the remaining {{ max_steps - 1 }} steps. Write this plan down. -3. **Do ONE chunk**: Make concrete progress on ONLY the first chunk. Do NOT attempt to finish the entire goal now, even if you have enough tool calls. The meta-loop exists so later steps can review, correct, and refine your work. -4. **Handoff**: Call `handoff()` with: +2. **Start**: Make concrete progress on the FIRST chunk only. Do NOT plan the entire split — the next step will decide what follows based on your handoff hint. +3. **Handoff**: Call `handoff()` with: - A detailed summary of what you did - Files changed - - The explicit plan for the remaining steps - A clear hint for the next step You have {{ budget }} tool calls. Reserve the last 1-2 for `handoff()`.