From 12937cb2c1f0730231f577ace46036e8bcb6b8e7 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 27 Apr 2026 22:46:48 +0200 Subject: [PATCH] feat: improve brain prompt to aggressively prioritize scrolling over backing out when trapped --- GramAddict/core/navigation/brain.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/GramAddict/core/navigation/brain.py b/GramAddict/core/navigation/brain.py index b83b57b..f2ed9fa 100644 --- a/GramAddict/core/navigation/brain.py +++ b/GramAddict/core/navigation/brain.py @@ -16,7 +16,7 @@ def ask_brain_for_action( cfg = Config() url = getattr(cfg.args, "ai_model_url", "http://localhost:11434/api/generate") if hasattr(cfg, "args") else "http://localhost:11434/api/generate" - model = getattr(cfg.args, "ai_model", "llama3") if hasattr(cfg, "args") else "llama3" + model = getattr(cfg.args, "ai_model", "qwen3.5:latest") if hasattr(cfg, "args") else "qwen3.5:latest" prompt = ( f"You are an autonomous Instagram agent. Your ultimate goal is: '{goal}'.\n" @@ -29,10 +29,11 @@ def ask_brain_for_action( prompt += f"Context: {context}\n" prompt += ( - "Based on this, which of the available actions should you take next to make progress towards your goal? " - "If you need to find an element that is likely off-screen, choosing to scroll is a smart move. " - "If you are stuck, choosing to go back or to a main tab is acceptable to reset. " - "Reply ONLY with the exact string from the available actions list." + "CRITICAL INSTRUCTIONS:\n" + "1. If your goal requires an element (like 'following list') that you previously tried but failed to find, it is highly likely hidden off-screen.\n" + "2. If you haven't scrolled yet, you MUST choose to 'scroll down' or 'scroll up' to reveal more of the screen.\n" + "3. Only choose 'press back' or 'tap home tab' if you are completely trapped or in the wrong section entirely.\n" + "4. DO NOT hallucinate actions. Reply ONLY with the exact string from the available actions list." ) try: