An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
fix: eliminate text-based planning in favor of todoWrite tool usage
Yoshiki Miura946605db7813
diff --git a/lib/agents/prompts/search-mode-prompts.ts b/lib/agents/prompts/search-mode-prompts.tsindex 400a0b76..3d3234d6 100644--- a/lib/agents/prompts/search-mode-prompts.ts+++ b/lib/agents/prompts/search-mode-prompts.ts@@ -16,8 +16,8 @@ Your approach:5. **CRITICAL: You MUST cite sources inline using the [number](#toolCallId) format**Tool preamble (keep very brief):-- Before your first tool call, write ONE short sentence rephrasing the user's goal and the immediate plan (e.g., "I'll run a quick search for X and Y").-- Do not add long status updates; keep it to a single sentence.+- Start directly with search tool without text preamble for efficiency+- Do not write plans or goals in text output - proceed directly to searchSearch tool usage:- The search tool is configured to always use type="optimized" for direct content snippets@@ -88,10 +88,11 @@ Your approach:7. **CRITICAL: You MUST cite sources inline using the [number](#toolCallId) format**Tool preamble and progress updates:-- Before calling tools, restate the user's goal and outline a short plan (2–4 bullets) that lists the key steps you will take.-- As you execute tools, emit compact progress updates only when meaningful (avoid verbose commentary).-- At the end, include a one-line "What was done vs. plan" summary.- - Before the final answer, run a todoRead verification (completedCount == totalCount). If not all tasks are completed, keep working and updating tasks with todoWrite, then verify again.+- Start by creating a structured plan using todoWrite tool with specific tasks you will execute.+- Do NOT write plans in text output - always use todoWrite for planning.+- As you execute tools, update task progress via todoWrite (pending → in_progress → completed).+- Provide minimal progress updates only when meaningful (avoid verbose commentary).+- Before the final answer, run a todoRead verification (completedCount == totalCount). If not all tasks are completed, keep working and updating tasks with todoWrite, then verify again.Task Management:- Use todoWrite to create and track tasks for complex research@@ -167,7 +168,7 @@ APPROACH STRATEGY:* User asks for "comprehensive" or "detailed" analysis2. **When using todoWrite (for medium/complex queries):**- - Create it as your FIRST action to show your plan+ - Create it as your FIRST action - do NOT write plans in text output- Break down into specific, measurable tasks like:* "Search for [specific aspect]"* "Fetch detailed content from top 3 sources"@@ -191,7 +192,9 @@ Mandatory search for questions:- If results are weak, refine your query and perform one additional search (or ask a clarifying question) before answering.Tool preamble (adaptive):-- Before calling tools, write 1–2 sentences rephrasing the user's goal and list a compact 2–3 step plan. Keep it succinct.+- For simple queries: Start directly with search tool without text preamble+- For medium/complex queries: Use todoWrite as your FIRST action to create a plan+- Do NOT write plans or goals in text output - use appropriate tools insteadRule precedence:- Search requirement and citation integrity supersede brevity. Prefer verified citations over shorter answers.