fix(agent): prevent stuck loop by adding action history to LLM prompt
The UI agent had no memory of previous actions — each step was a fresh single-shot LLM call. After typing and sending a message, the LLM saw an empty text field and retyped the message in a loop. - Add RECENT_ACTIONS (last 5 actions with text/result) to user prompt - Add chat app completion detection rule to dynamic prompt - Add send-success hints for WhatsApp and Messages apps - Add git convention to CLAUDE.md (no co-author lines)
This commit is contained in:
@@ -327,6 +327,8 @@ RULES:
|
||||
- If SCREEN_CHANGE says "NOT changed", your last action had no effect — change strategy.
|
||||
- Do NOT repeat an action that already failed.
|
||||
- Say "done" as soon as the goal is achieved.
|
||||
- CHECK RECENT_ACTIONS before every step: if you already typed text and tapped send, do NOT type it again.
|
||||
- CHAT APP COMPLETION: After typing a message and tapping send in a chat app (WhatsApp, Messages, etc.), if the text field is now EMPTY and your message text appears in the conversation above, the message was SENT SUCCESSFULLY. Say "done" immediately.
|
||||
- COPY-PASTE: Use clipboard_set with text from SCREEN_CONTEXT (most reliable), then paste. Or just type directly.`;
|
||||
|
||||
if (isStuck) {
|
||||
|
||||
Reference in New Issue
Block a user