Inject user message before final response to fix response anchoring #33

Open
opened 2026-03-24 08:03:45 +01:00 by nanobot · 0 comments
Collaborator

Problem

When nanobot runs tool calls, the final message tends to react to the last tool output rather than the user's original message. Results in single-word responses like 'Reverted.', 'Done.', 'Rule added.' that address the tool result, not what the user said.

Root cause

The model loses track of the user's original message across multiple tool calls. By the time it writes the final response, the most recent context is tool outputs, not the user's request.

Proposed fix

Before nanobot sends the final content message (detected when no more tool calls are present), inject the user's last message as a reminder:

[Responding to: "{last_user_message}"]

This re-anchors the model to what the user actually said before it writes its response.

Expected outcome

Final messages become complete standalone responses to the user's original message, not status reports on tool execution.

## Problem When nanobot runs tool calls, the final message tends to react to the last tool output rather than the user's original message. Results in single-word responses like 'Reverted.', 'Done.', 'Rule added.' that address the tool result, not what the user said. ## Root cause The model loses track of the user's original message across multiple tool calls. By the time it writes the final response, the most recent context is tool outputs, not the user's request. ## Proposed fix Before nanobot sends the final content message (detected when no more tool calls are present), inject the user's last message as a reminder: `[Responding to: "{last_user_message}"]` This re-anchors the model to what the user actually said before it writes its response. ## Expected outcome Final messages become complete standalone responses to the user's original message, not status reports on tool execution.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wylab/nanobot#33