Skip to content

Conversation

@ngoiyaeric
Copy link
Collaborator

@ngoiyaeric ngoiyaeric commented Aug 14, 2025

User description

… provide more comprehensive and complete responses.

Specifically, I will now aim to:

  • Provide more detailed answers.
  • Conduct more thorough research.
  • Be more cautious about proceeding if I don't have enough information from you.

Please note: I wasn't able to test these changes by running the application, as the build process was blocked by missing environment variables.


PR Type

Enhancement


Description

  • Enhanced AI agent prompts for more thorough research

  • Added comprehensive response guidelines across agents

  • Improved decision-making logic for information gathering

  • Strengthened writer agent with detailed analysis requirements


Diagram Walkthrough

flowchart LR
  A["User Query"] --> B["Task Manager"]
  B --> C["Enhanced Decision Logic"]
  C --> D["Researcher Agent"]
  D --> E["Thorough Research"]
  E --> F["Writer Agent"]
  F --> G["Comprehensive Response"]
Loading

File Walkthrough

Relevant files
Enhancement
researcher.tsx
Enhanced research thoroughness directive                                 

lib/agents/researcher.tsx

  • Added directive for thorough and comprehensive research
  • Emphasized deep and wide-ranging information gathering
  • Instructed against settling for superficial answers
+2/-0     
task-manager.tsx
Improved decision-making for information requests               

lib/agents/task-manager.tsx

  • Added guidance to prefer "inquire" over "proceed" when uncertain
  • Enhanced decision-making logic for information gathering
+1/-0     
writer.tsx
Comprehensive writer agent prompt enhancement                       

lib/agents/writer.tsx

  • Expanded system prompt with detailed responsibilities
  • Added comprehensive analysis and synthesis requirements
  • Enhanced guidelines for thorough question addressing
  • Restructured prompt for better clarity and organization
+17/-6   

Summary by CodeRabbit

  • New Features

    • Option to supply a custom system prompt for the writing assistant.
  • Behavior Changes

    • Research responses are deeper, broader, cite tool sources when used, and match the user’s language.
    • Writing assistant now emphasizes step-by-step analysis and synthesis, can include images via Markdown, and no longer enforces a 400-word limit.
    • Task manager now prefers asking for clarification over proceeding with incomplete information.

… provide more comprehensive and complete responses.

Specifically, I will now aim to:
- Provide more detailed answers.
- Conduct more thorough research.
- Be more cautious about proceeding if I don't have enough information from you.

Please note: I wasn't able to test these changes by running the application, as the build process was blocked by missing environment variables.
@vercel
Copy link

vercel bot commented Aug 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
qcx Ready Preview Comment Aug 14, 2025 5:08am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

Walkthrough

Updates default system prompts for researcher and task-manager agents; adds a new dynamicSystemPrompt parameter and replaces the writer agent’s default prompt with a more detailed instruction set. No control-flow, streaming logic, or error-handling changes besides the writer function signature update.

Changes

Cohort / File(s) Summary
Researcher & Task-manager prompt edits
lib/agents/researcher.tsx, lib/agents/task-manager.tsx
Researcher: appends lines to the default system prompt requiring deep, wide-ranging research, cite tool sources when used, and match response language. Task-manager: appends sentence preferring “inquire” over proceeding when information is insufficient. No API or control-flow changes.
Writer API signature & prompt overhaul
lib/agents/writer.tsx
Adds dynamicSystemPrompt: string parameter to exported writer function and selects it when provided. Replaces the writer default system prompt with detailed stepwise guidance (analysis → synthesis → final answer), removes 400-word limit, adds citation and image-in-Markdown instructions, and enforces language matching. Streaming flow unchanged.

Sequence Diagram(s)

sequenceDiagram
  actor Caller
  participant Writer as writer(dynamicSystemPrompt, uiStream, streamText, messages)
  participant Model

  Caller->>Writer: Call writer(messages, dynamicSystemPrompt?)
  alt dynamicSystemPrompt provided
    Writer->>Writer: systemToUse = dynamicSystemPrompt
  else
    Writer->>Writer: systemToUse = defaultWriterPrompt
  end
  Writer->>Model: Send systemToUse + messages (streaming)
  Model-->>Writer: Streamed tokens
  Writer-->>Caller: UI stream + text stream
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble notes beneath the moonlit log,
New prompts sharpened, hopping through the fog.
Writer listens, researcher digs deep,
Task-manager asks before the leap.
A twitch, a hop — revisions snug as a hug. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97b72c7 and 08367c8.

📒 Files selected for processing (1)
  • lib/agents/writer.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/agents/writer.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improve-prompting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qodo-merge-pro
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Over-inquiring Bias

The instruction to always prefer "inquire" when in doubt may cause excessive clarification requests and degrade UX. Consider clearer criteria or thresholds to avoid unnecessary prompts for well-scoped queries.

When in doubt, it is always better to "inquire" for more information than to "proceed" with incomplete information.
Make your choice wisely to ensure that you fulfill your mission as a web researcher effectively and deliver the most valuable assistance to the user.
Source Exclusivity vs. Completeness

The writer is constrained to use only provided search results while being asked to "fully resolve" queries. This tension can lead to incomplete answers if results are sparse; consider guidance for acknowledging gaps or requesting more research.

  const default_system_prompt = `As a professional writer, your primary goal is to provide a comprehensive and informative answer to the user's question, based exclusively on the provided search results (URL and content).

Your responsibilities include:
- Thoroughly analyze the user's question to understand the core information being sought.
- Carefully review the provided search results, extracting all relevant facts, data, and perspectives.
- Synthesize the information from multiple sources into a coherent, well-structured, and easy-to-understand response.
- Maintain an unbiased and journalistic tone throughout your writing.
- Ensure that your answer directly addresses all parts of the user's question, providing a complete and satisfying response.
- Cite the source URL whenever you quote or reference information from a specific search result.
- If the search results include relevant images, incorporate them into your response using Markdown format.
- Match the language of your response to the user's language.

Your final output should be a detailed and well-supported answer that fully resolves the user's query, leaving no stone unturned.
Please use Markdown format for your response.
- Link format: [link text](url)
- Image format: ![alt text](url)
`;
Geospatial Tool Mandate

The hard MUST for geospatial queries could misroute simple factual questions (e.g., definitions or historical facts about places) through the map tool unnecessarily; clarify when traditional search is preferable.

- **For any questions involving locations, places, addresses, geographical features, finding businesses or points of interest, distances between locations, or directions: You MUST use the 'geospatialQueryTool'. This tool will process the query, and relevant information will often be displayed or updated on the user's map automatically.**
  Examples of queries for 'geospatialQueryTool':
    - "Where is the Louvre Museum?"
    - "Show me cafes near the current map center."
    - "How far is it from New York City to Los Angeles?"
    - "What are some parks in San Francisco?"
  When you use 'geospatialQueryTool', you don't need to describe how the map will change; simply provide your textual answer based on the query, and trust the map will update appropriately.

@codiumai-pr-agent-free
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Word Limit Removal

The original writer prompt had a 400-word limit constraint that has been removed in the new version. This change should be validated to ensure it aligns with application requirements and doesn't lead to excessively long responses.

  const default_system_prompt = `As a professional writer, your primary goal is to provide a comprehensive and informative answer to the user's question, based exclusively on the provided search results (URL and content).

Your responsibilities include:
- Thoroughly analyze the user's question to understand the core information being sought.
- Carefully review the provided search results, extracting all relevant facts, data, and perspectives.
- Synthesize the information from multiple sources into a coherent, well-structured, and easy-to-understand response.
- Maintain an unbiased and journalistic tone throughout your writing.
- Ensure that your answer directly addresses all parts of the user's question, providing a complete and satisfying response.
- Cite the source URL whenever you quote or reference information from a specific search result.
- If the search results include relevant images, incorporate them into your response using Markdown format.
- Match the language of your response to the user's language.

Your final output should be a detailed and well-supported answer that fully resolves the user's query, leaving no stone unturned.
Please use Markdown format for your response.
- Link format: [link text](url)
- Image format: ![alt text](url)
`;
Decision Logic Change

The added preference for "inquire" over "proceed" changes the default behavior of the task manager. This could potentially increase the frequency of user prompts, which should be validated against the intended user experience.

When in doubt, it is always better to "inquire" for more information than to "proceed" with incomplete information.
Make your choice wisely to ensure that you fulfill your mission as a web researcher effectively and deliver the most valuable assistance to the user.

@codiumai-pr-agent-free
Copy link
Contributor

codiumai-pr-agent-free bot commented Aug 14, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Balance inquiry vs. proceeding guidance

The current directive is too absolute and could lead to excessive questioning
for simple queries. Provide balanced guidance with specific scenarios when
proceeding might be appropriate despite some uncertainty.

lib/agents/task-manager.tsx [17]

-When in doubt, it is always better to "inquire" for more information than to "proceed" with incomplete information.
+When in doubt about critical aspects of the query (such as user preferences, specific requirements, or ambiguous terms), it is better to "inquire" for clarification. However, for factual queries with minor ambiguities that can be addressed through comprehensive research, you may "proceed" while noting assumptions in your response.
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: This suggestion refines the absolute rule added in the PR, providing more nuanced guidance that prevents excessive inquiries and likely improves the user experience.

Medium
Add specific research strategies

The instruction is too vague and lacks specific guidance on how to conduct
"thorough research". Add concrete strategies and examples of what constitutes
deep research to make the directive actionable for the AI.

lib/agents/researcher.tsx [46]

-Your primary objective is to conduct thorough and comprehensive research to gather all the necessary information to fully answer the user's query. Do not settle for superficial answers. Your research should be deep and wide-ranging, covering all aspects of the user's question.
+Your primary objective is to conduct thorough and comprehensive research to fully answer the user's query. This means:
+1. Exploring multiple reliable sources to verify information
+2. Investigating different perspectives on the topic
+3. Gathering specific data, statistics, and examples when relevant
+4. Identifying and addressing potential sub-questions implied by the main query
+Do not settle for superficial answers or single-source information.
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion enhances the PR's new instruction by providing specific, actionable strategies for "thorough research", which improves the clarity and effectiveness of the prompt.

Low
  • Update

@qodo-merge-pro
Copy link
Contributor

qodo-merge-pro bot commented Aug 14, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Risk of hallucinated sources

The new prompts push for “thorough” and “comprehensive” answers without
reinforcing guardrails against inventing facts or URLs, especially in
researcher/task-manager flows that may proceed without verifiable tool outputs.
Strengthen all system prompts to require explicit source attribution for any
factual claim, forbid unverifiable assertions, and instruct agents to state
uncertainty or request more info when sources are insufficient, preventing
confident but ungrounded responses.

Examples:

lib/agents/researcher.tsx [46-49]
Your primary objective is to conduct thorough and comprehensive research to gather all the necessary information to fully answer the user's query. Do not settle for superficial answers. Your research should be deep and wide-ranging, covering all aspects of the user's question.

Always aim to directly address the user's question. If using information from a tool (like web search), cite the source URL.
Match the language of your response to the user's language.`;
lib/agents/writer.tsx [22-34]
const default_system_prompt = `As a professional writer, your primary goal is to provide a comprehensive and informative answer to the user's question, based exclusively on the provided search results (URL and content).

Your responsibilities include:
- Thoroughly analyze the user's question to understand the core information being sought.
- Carefully review the provided search results, extracting all relevant facts, data, and perspectives.
- Synthesize the information from multiple sources into a coherent, well-structured, and easy-to-understand response.
...
- Ensure that your answer directly addresses all parts of the user's question, providing a complete and satisfying response.
- Cite the source URL whenever you quote or reference information from a specific search result.
...

 ... (clipped 1 lines)

Solution Walkthrough:

Before:

// In researcher agent prompt
Your primary objective is to conduct thorough and comprehensive research...
Do not settle for superficial answers.
...
If using information from a tool (like web search), cite the source URL.

After:

// In researcher agent prompt
Your primary objective is to conduct thorough research based *only* on verifiable tool outputs.
...
For every factual claim you make, you MUST cite the source URL.
Do not make assertions that are not directly supported by the provided sources.
If sources are insufficient to provide a comprehensive answer, state what is missing and why you cannot fully answer.
Suggestion importance[1-10]: 9

__

Why: This suggestion addresses a critical risk of hallucination, which is heightened by the PR's push for "comprehensive" responses, and proposes robust, system-wide guardrails.

High
General
Reinstate concise length limit

The prompt removes the previous explicit 400-word cap, which can lead to overly
long outputs and token overruns. Reintroduce a clear length guideline and
instruct to prioritize the most relevant points to keep responses concise.

lib/agents/writer.tsx [22-38]

 const default_system_prompt = `As a professional writer, your primary goal is to provide a comprehensive and informative answer to the user's question, based exclusively on the provided search results (URL and content).
 
 Your responsibilities include:
 - Thoroughly analyze the user's question to understand the core information being sought.
 - Carefully review the provided search results, extracting all relevant facts, data, and perspectives.
 - Synthesize the information from multiple sources into a coherent, well-structured, and easy-to-understand response.
 - Maintain an unbiased and journalistic tone throughout your writing.
 - Ensure that your answer directly addresses all parts of the user's question, providing a complete and satisfying response.
 - Cite the source URL whenever you quote or reference information from a specific search result.
 - If the search results include relevant images, incorporate them into your response using Markdown format.
 - Match the language of your response to the user's language.
 
-Your final output should be a detailed and well-supported answer that fully resolves the user's query, leaving no stone unturned.
+Your final output should fully resolve the user's query while remaining concise. Aim for 400 words or less unless the user explicitly requests more; prioritize the most relevant points and avoid repetition.
 Please use Markdown format for your response.
 - Link format: [link text](url)
 - Image format: ![alt text](url)
 `;
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly notes that the PR removed a word limit, which could lead to overly long responses. Reinstating a guideline for conciseness is a valuable improvement for managing output length and cost.

Medium
Prevent runaway thoroughness

This directive may encourage excessive tool calls and very long outputs, risking
latency and token limits. Add a constraint to balance thoroughness with
efficiency, capping depth/length and stopping once the question is fully
answered.

lib/agents/researcher.tsx [46]

-Your primary objective is to conduct thorough and comprehensive research to gather all the necessary information to fully answer the user's query. Do not settle for superficial answers. Your research should be deep and wide-ranging, covering all aspects of the user's question.
+Your primary objective is to conduct thorough and comprehensive research to gather the necessary information to fully answer the user's query. Balance depth with efficiency: avoid redundant exploration, stop once the question is fully answered, and keep responses concise and focused.
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the new instruction for "thorough and comprehensive research" could lead to inefficiency and adds a reasonable constraint to balance thoroughness with conciseness, improving the agent's performance.

Low
Avoid over-inquiring by default

This blanket rule can cause unnecessary user prompts and stall flows for
straightforward queries. Qualify the fallback to "inquire" with a
confidence/clarity check to avoid excessive interruptions.

lib/agents/task-manager.tsx [17]

-When in doubt, it is always better to "inquire" for more information than to "proceed" with incomplete information.
+When in doubt, prefer to "inquire" only if the query lacks essential details that materially affect the answer; otherwise, "proceed" with reasonable assumptions and state them explicitly.
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion provides a useful refinement to the new rule, preventing the agent from asking for more information unnecessarily, which improves the user experience by avoiding needless interruptions for straightforward queries.

Low
  • More

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (3)
lib/agents/researcher.tsx (2)

14-21: Breaking API change to researcher(...) will likely break all call-sites

You added a new first parameter (dynamicSystemPrompt) and shifted the rest, which is a breaking change. Any existing calls using the original signature will now compile or run incorrectly. Recommend keeping backward compatibility by moving dynamicSystemPrompt to the end as an optional parameter.

Apply this diff to restore compatibility:

-export async function researcher(
-  dynamicSystemPrompt: string, // New parameter
-  uiStream: ReturnType<typeof createStreamableUI>,
-  streamText: ReturnType<typeof createStreamableValue<string>>,
-  messages: CoreMessage[],
-  // mcp: any, // Removed mcp parameter
-  useSpecificModel?: boolean
-) {
+export async function researcher(
+  uiStream: ReturnType<typeof createStreamableUI>,
+  streamText: ReturnType<typeof createStreamableValue<string>>,
+  messages: CoreMessage[],
+  // mcp: any, // Removed mcp parameter
+  useSpecificModel?: boolean,
+  dynamicSystemPrompt?: string
+) {

51-51: Guard against runtime TypeError on .trim()

If a non-string accidentally reaches dynamicSystemPrompt (e.g., from legacy call sites), calling .trim() will throw. Guard with a typeof check.

-     const systemToUse = dynamicSystemPrompt && dynamicSystemPrompt.trim() !== '' ? dynamicSystemPrompt : default_system_prompt;
+     const systemToUse =
+       typeof dynamicSystemPrompt === 'string' && dynamicSystemPrompt.trim() !== ''
+         ? dynamicSystemPrompt
+         : default_system_prompt;
lib/agents/writer.tsx (1)

7-12: Breaking API change to writer(...) — keep backward compatibility

Moving dynamicSystemPrompt to the first parameter breaks existing call sites. Recommend making it an optional last parameter to preserve the original signature.

-export async function writer(
-  dynamicSystemPrompt: string, // New parameter
-  uiStream: ReturnType<typeof createStreamableUI>,
-  streamText: ReturnType<typeof createStreamableValue<string>>,
-  messages: CoreMessage[]
-) {
+export async function writer(
+  uiStream: ReturnType<typeof createStreamableUI>,
+  streamText: ReturnType<typeof createStreamableValue<string>>,
+  messages: CoreMessage[],
+  dynamicSystemPrompt?: string
+) {
🧹 Nitpick comments (2)
lib/agents/researcher.tsx (1)

53-64: Harden stream initialization with try/catch

nonexperimental_streamText can throw before the event stream begins. Fail gracefully and avoid leaving the UI in a loading state.

-     const result = await nonexperimental_streamText({
-       model: getModel() as LanguageModel,
-       maxTokens: 2500,
-       system: systemToUse, // Use the dynamic or default system prompt
-       messages,
-       tools: getTools({
-      uiStream,
-      fullResponse,
-      // mcp // mcp parameter is no longer passed to getTools
-    })
-  })
+     let result
+     try {
+       result = await nonexperimental_streamText({
+         model: getModel() as LanguageModel,
+         maxTokens: 2500,
+         system: systemToUse, // Use the dynamic or default system prompt
+         messages,
+         tools: getTools({
+           uiStream,
+           fullResponse
+         })
+       })
+     } catch (e) {
+       hasError = true
+       uiStream.update(null)
+       const msg = 'Error initializing the model request.'
+       fullResponse += `\n${msg}`
+       streamText.update(fullResponse)
+       return { result: null as any, fullResponse, hasError, toolResponses: [] }
+     }
lib/agents/writer.tsx (1)

22-38: Prompt constraint could over-restrict the writer

The writer doesn’t have tool access and relies on upstream-provided results via messages. If those are incomplete, “based exclusively on the provided search results” may force low-value answers. Suggest allowing the writer to explicitly call out missing info and recommend another research pass.

 const default_system_prompt = `As a professional writer, your primary goal is to provide a comprehensive and informative answer to the user's question, based exclusively on the provided search results (URL and content).

 Your responsibilities include:
@@
 - If the search results include relevant images, incorporate them into your response using Markdown format.
 - Match the language of your response to the user's language.
 
+If the provided search results are incomplete or insufficient to fully answer the user's question, explicitly state what is missing and recommend running another research pass to fill the gaps.
+
 Your final output should be a detailed and well-supported answer that fully resolves the user's query, leaving no stone unturned.
 Please use Markdown format for your response.
 - Link format: [link text](url)
 - Image format: ![alt text](url)
 `;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcf317f and 97b72c7.

📒 Files selected for processing (3)
  • lib/agents/researcher.tsx (1 hunks)
  • lib/agents/task-manager.tsx (1 hunks)
  • lib/agents/writer.tsx (1 hunks)
🔇 Additional comments (5)
lib/agents/task-manager.tsx (1)

17-17: Reinforcing “inquire” bias in the system prompt — LGTM

Clear, concise guidance that aligns with the PR goal of being cautious with insufficient info.

lib/agents/researcher.tsx (3)

46-47: Depth-oriented research guidance — LGTM

The additions strengthen completeness and reduce superficial outputs while staying consistent with tool usage guidance.


14-21: PR summary inconsistency: researcher signature was changed

The current code introduces a new parameter to researcher, but the AI summary claims no public signature changes for this file.


14-21: researcher(...) call sites verified — no changes needed

rg shows only the function definition and one call site; the call in app/actions.tsx was updated to the new parameter order and no longer passes mcp, which matches the signature in lib/agents/researcher.tsx.

  • lib/agents/researcher.tsx — updated signature (dynamicSystemPrompt, uiStream, streamText, messages, useSpecificModel?)
  • app/actions.tsx (≈lines 147–151) — call updated:
    const { fullResponse, hasError, toolResponses } = await researcher(
    currentSystemPrompt,
    uiStream,
    streamText,
    messages,
    // mcp, // mcp instance is no longer passed down
    )
lib/agents/writer.tsx (1)

7-12: No action needed — all writer(...) call sites updated

Found only the function definition and a single call site; the call already passes 4 args matching the new signature.

  • lib/agents/writer.tsx — definition (new 4-arg signature)
  • app/actions.tsx:192 — caller: writer(currentSystemPrompt, uiStream, streamText, latestMessages)

- Image format: ![alt text](url)
`;

const systemToUse = dynamicSystemPrompt && dynamicSystemPrompt.trim() !== '' ? dynamicSystemPrompt : default_system_prompt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Guard against non-string dynamicSystemPrompt

This prevents .trim() from throwing if a legacy call passes a non-string by mistake.

-  const systemToUse = dynamicSystemPrompt && dynamicSystemPrompt.trim() !== '' ? dynamicSystemPrompt : default_system_prompt;
+  const systemToUse =
+    typeof dynamicSystemPrompt === 'string' && dynamicSystemPrompt.trim() !== ''
+      ? dynamicSystemPrompt
+      : default_system_prompt;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const systemToUse = dynamicSystemPrompt && dynamicSystemPrompt.trim() !== '' ? dynamicSystemPrompt : default_system_prompt;
const systemToUse =
typeof dynamicSystemPrompt === 'string' && dynamicSystemPrompt.trim() !== ''
? dynamicSystemPrompt
: default_system_prompt;
🤖 Prompt for AI Agents
In lib/agents/writer.tsx around line 40, the current ternary calls
dynamicSystemPrompt.trim() which will throw if dynamicSystemPrompt is not a
string; update the conditional to first ensure dynamicSystemPrompt is a string
(e.g. typeof dynamicSystemPrompt === 'string') before calling .trim(), and only
use dynamicSystemPrompt when that check passes and the trimmed value is
non-empty, otherwise fall back to default_system_prompt.

… over including images.

Previously, I would sometimes output only images. This change ensures that my primary goal is the textual response, and I will only include images if they are highly relevant and add significant value.

Note: I wasn't able to test these changes by running the application, as the build process was blocked by missing environment variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants