Skip to content

Conversation

@ngoiyaeric
Copy link
Collaborator

@ngoiyaeric ngoiyaeric commented Nov 22, 2025

User description

This pull request addresses the issue of the system not returning up-to-date information and not prioritizing truthfulness, as reported by the user. \n\nChanges in writer.tsx:\n- The system prompt for the writer agent is updated with Truthfulness and Aggregation Directives.\n- It explicitly instructs the model to Prioritize Truth and not decline to answer factual questions based on policy concerns, but to present facts from credible sources.\n- It emphasizes Timeliness by instructing the model to prioritize information with the most recent timestamps.\n- It promotes Knowledge Aggregation from all available tools and sources.


PR Type

Enhancement


Description

  • Enhanced writer agent system prompt to prioritize truthfulness and accuracy

  • Added explicit directives for knowledge aggregation from all available sources

  • Implemented timeliness requirement to use most recent information timestamps

  • Restructured prompt with numbered directives for clarity and emphasis


Diagram Walkthrough

flowchart LR
  A["Writer Agent System Prompt"] -->|Add Truthfulness Directive| B["Prioritize Accurate Information"]
  A -->|Add Aggregation Directive| C["Combine All Sources"]
  A -->|Add Timeliness Directive| D["Use Recent Timestamps"]
  B --> E["Enhanced Response Quality"]
  C --> E
  D --> E
Loading

File Walkthrough

Relevant files
Enhancement
writer.tsx
Enhance system prompt with truthfulness and timeliness directives

lib/agents/writer.tsx

  • Updated default_system_prompt to emphasize truthfulness as primary
    goal
  • Added numbered directives section with 5 key principles for the writer
    agent
  • Introduced explicit requirement to prioritize information with recent
    timestamps
  • Restructured prompt formatting for better clarity and emphasis on
    critical guidelines
+10/-6   

Summary by CodeRabbit

  • New Features
    • AI writer now generates more comprehensive responses with enhanced source aggregation, explicit citations, improved Markdown formatting, and prioritized truthfulness and timeliness across all available sources.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Nov 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
qcx Error Error Nov 27, 2025 4:27am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Walkthrough

The writer function in lib/agents/writer.tsx is updated to accept a new dynamicSystemPrompt parameter, enabling runtime customization of system prompts. The default system prompt is replaced with a more comprehensive directive that emphasizes truthfulness, timeliness, comprehensive source aggregation, explicit URL citations, and Markdown formatting requirements.

Changes

Cohort / File(s) Summary
Writer Agent System Prompt Enhancement
lib/agents/writer.tsx
Added dynamicSystemPrompt: string parameter to writer function; replaced default system prompt with richer directive-driven content emphasizing truthfulness, up-to-date information, comprehensive source aggregation, explicit citations, and Markdown formatting; implemented conditional logic to use dynamic prompt when provided, otherwise fall back to new default

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Writer Function
    participant LLM
    participant Response Handler

    Caller->>Writer Function: invoke(dynamicSystemPrompt?, ...)
    
    rect rgb(200, 220, 240)
    Note over Writer Function: Select System Prompt
    alt dynamicSystemPrompt provided & non-empty
        Writer Function->>Writer Function: use dynamicSystemPrompt
    else
        Writer Function->>Writer Function: use default enhanced prompt
    end
    end
    
    Writer Function->>LLM: call(systemPrompt, ...)
    LLM-->>Response Handler: stream response
    Response Handler->>Response Handler: assemble chunks
    Response Handler-->>Caller: return assembled response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring attention:

  • Verify the new default system prompt content aligns with intended agent behavior and output quality standards
  • Confirm the conditional logic correctly prioritizes the dynamic prompt over the default
  • Check that the new prompt directives (truthfulness, source aggregation, URL citations, Markdown formatting) are appropriately comprehensive
  • Validate backward compatibility if this function is called from multiple locations without the new parameter

Possibly related PRs

Suggested labels

Review effort 3/5

Suggested reviewers

  • CharlieHelps

Poem

🐰 Whiskers twitch with writerly glee,
Dynamic prompts set writers free!
Truth and citations now take flight,
Each word crafted with utmost might. ✨📝

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main objective of the changeset—updating the system prompt to prioritize truthfulness and up-to-date information, which is the primary change made to the writer agent.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-truthfulness-and-timeliness

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status:
Syntax naming bug: The variable declaration for default_system_prompt is malformed and missing an assignment
operator and backtick string, harming readability and intent.

Referred Code
  const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.

	    **Truthfulness and Aggregation Directives:**
	    1.  **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
	    2.  **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
	    3.  **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
	    4.  **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
	    5.  **Format:** Always answer in Markdown format. Links and images must follow the correct format.
	        - Link format: [link text](url)
	        - Image format: ![alt text](url)
    There are also some proconfigured example queires. 

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No audit logs: The new prompt text adds behavior but does not include any logging of critical actions,
making it unclear whether relevant events are audited.

Referred Code
  const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.

	    **Truthfulness and Aggregation Directives:**
	    1.  **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
	    2.  **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
	    3.  **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
	    4.  **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
	    5.  **Format:** Always answer in Markdown format. Links and images must follow the correct format.
	        - Link format: [link text](url)
	        - Image format: ![alt text](url)
    There are also some proconfigured example queires. 
    When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'
    `;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing guards: The changes add new behavior without adding checks for null/empty dynamicSystemPrompt or
handling malformed prompt construction errors.

Referred Code
  const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.

	    **Truthfulness and Aggregation Directives:**
	    1.  **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
	    2.  **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
	    3.  **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
	    4.  **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
	    5.  **Format:** Always answer in Markdown format. Links and images must follow the correct format.
	        - Link format: [link text](url)
	        - Image format: ![alt text](url)
    There are also some proconfigured example queires. 
    When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'
    `;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Unvalidated inputs: The updated prompt directs aggregation from external tools but adds no validation or
sanitization for external content used to form responses.

Referred Code
**Truthfulness and Aggregation Directives:**
1.  **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
2.  **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
3.  **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
4.  **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
5.  **Format:** Always answer in Markdown format. Links and images must follow the correct format.
    - Link format: [link text](url)
    - Image format: ![alt text](url)

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

The new default system prompt introduces a syntax-breaking change: default_system_prompt is no longer assigned a string, which will prevent the code from compiling or running. The prompt also includes a directive to ignore policy-based refusals, which can conflict with higher-level safety or governance requirements. Finally, the updated wording loosens the previous strict grounding to tool outputs, which may undermine efforts to minimize hallucinations unless intentionally desired.

Summary of changes
  • Replaced the previous default system prompt string for the writer agent with a new, more detailed set of Truthfulness and Aggregation Directives.
  • New prompt emphasizes truthfulness, timeliness (most recent information), aggregation across all tools, unbiased tone, and Markdown formatting with proper link/image syntax.
  • The rest of the writer function logic (selection between dynamic and default system prompt, streaming, etc.) remains unchanged.

Comment on lines +22 to +31
const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.

**Truthfulness and Aggregation Directives:**
1. **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
2. **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
3. **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
4. **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
5. **Format:** Always answer in Markdown format. Links and images must follow the correct format.
- Link format: [link text](url)
- Image format: ![alt text](url)

Choose a reason for hiding this comment

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

The new default_system_prompt declaration is syntactically invalid as shown: it is missing the = and backticks for a template/string literal. This will break compilation/runtime and prevent the writer agent from working at all. It also appears to have introduced raw Markdown formatting into the TSX file without being wrapped as a string. You need to keep the const default_system_prompt = \ ...` form (or equivalent) so the prompt is a valid JavaScript string.

Suggestion

Restore default_system_prompt as a valid string assignment while preserving your new content, for example:

  const default_system_prompt = `As a professional writer, your job is to generate a comprehensive, informative, and truthful answer. Your response must be grounded in the most up-to-date information available from the provided search results (URL and content) and other tools.

  Truthfulness and Aggregation Directives:
  1. Prioritize Truth: Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
  2. Knowledge Aggregation: Aggregate and synthesize information from all provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
  3. Timeliness: Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
  4. Tone and Citation: Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
  5. Format: Always answer in Markdown format. Links and images must follow the correct format.
     - Link format: [link text](url)
     - Image format: ![alt text](url)

  There are also some preconfigured example queries.
  When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'`;

Adjust wording/indentation as needed, but keep it as a single template string assigned to the const. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.

Comment on lines +24 to +27
**Truthfulness and Aggregation Directives:**
1. **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
2. **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
3. **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.

Choose a reason for hiding this comment

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

The new directive "Do not decline to answer factual questions based on policy concerns" conflicts with typical safety and policy requirements that may still need to be enforced at a higher level. Embedding a hard override of policy into an agent prompt can make the system harder to maintain or integrate with future safety layers. Consider rephrasing to prioritize truth while still allowing higher-level safeguards to operate.

Suggestion

Soften the instruction to respect broader system policies while still emphasizing truthfulness, e.g.:

1. Prioritize Truth: Your primary goal is to convey accurate, verifiable information based on credible sources. When safety or policy constraints apply, still provide as much factual, policy-compliant information and context as possible instead of unnecessarily refusing to answer.

This preserves the intent without directly instructing the model to ignore policy. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.

Comment on lines +22 to +27
const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.

**Truthfulness and Aggregation Directives:**
1. **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
2. **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
3. **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.

Choose a reason for hiding this comment

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

The updated prompt drops some explicit constraints present in the previous version, such as "You must only use information from the provided search results" and explicit mention of combining search and Mapbox results. If the system design relies on strict grounding to tool outputs, the new wording "and other tools" is looser and may encourage hallucinated content depending on how the model interprets it.

Suggestion

Consider explicitly retaining the grounding constraint to reduce hallucinations, for example:

Your response must be grounded exclusively in information from the provided tools and data sources (search results, Mapbox results, and any other tool outputs). Do not fabricate facts or rely on unstated background knowledge; if the tools do not provide sufficient information, state that clearly.

This keeps the new truthfulness/timeliness directives while preserving strong grounding. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.

@charliecreates charliecreates bot removed the request for review from CharlieHelps November 22, 2025 12:23
@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix a critical syntax error

Fix the syntax of the default_system_prompt declaration by adding the missing
assignment operator (=) and opening backtick ( ).

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

-    const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.
+    const default_system_prompt = `As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.
 
 	    **Truthfulness and Aggregation Directives:**
 	    1.  **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
 	    2.  **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
 	    3.  **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
 	    4.  **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
 	    5.  **Format:** Always answer in Markdown format. Links and images must follow the correct format.
 	        - Link format: [link text](url)
 	        - Image format: ![alt text](url)
     There are also some proconfigured example queires. 
     When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'
     `;
  • Apply / Chat
Suggestion importance[1-10]: 10

__

Why: The suggestion correctly identifies and fixes a critical syntax error in the default_system_prompt declaration that would prevent the code from compiling and cause the application to crash.

High
General
Improve structure of hardcoded examples

Restructure the hardcoded example query into a "Specific Overrides" section
within the prompt, correct typos, and refine the instruction for better clarity
and maintainability.

lib/agents/writer.tsx [30-34]

         - Link format: [link text](url)
         - Image format: ![alt text](url)
-    There are also some proconfigured example queires. 
-    When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'
+
+        **Specific Overrides:**
+        - If the user asks 'What is a planet computer?', you must answer with the following text exactly: "A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet"
     `;
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion improves the clarity and structure of the system prompt by creating a dedicated section for overrides, correcting typos, and refining the instruction, which can lead to more reliable model behavior.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/agents/writer.tsx (1)

7-12: New dynamicSystemPrompt parameter may be a breaking API change

Adding dynamicSystemPrompt: string as the first parameter changes the public signature of writer. Any existing call sites that previously did:

writer(uiStream, streamText, messages)

will now fail to compile or, if using any, will pass the wrong argument in the dynamicSystemPrompt slot.

Consider either:

  • Making dynamicSystemPrompt optional with a default, or
  • Introducing an options object so you can evolve the API without positional breakage.

Example options‑object refactor:

-export async function writer(
-  dynamicSystemPrompt: string, // New parameter
-  uiStream: ReturnType<typeof createStreamableUI>,
-  streamText: ReturnType<typeof createStreamableValue<string>>,
-  messages: CoreMessage[]
-) {
+export interface WriterOptions {
+  dynamicSystemPrompt?: string;
+}
+
+export async function writer(
+  { dynamicSystemPrompt }: WriterOptions,
+  uiStream: ReturnType<typeof createStreamableUI>,
+  streamText: ReturnType<typeof createStreamableValue<string>>,
+  messages: CoreMessage[]
+) {

If you’d rather keep the positional API, please double‑check all call sites are updated accordingly.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13b890e and dabfbcb.

📒 Files selected for processing (1)
  • lib/agents/writer.tsx (1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
lib/agents/writer.tsx

[error] 22-22: Const declarations must have an initialized value.

This variable needs to be initialized.

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: expected , but instead found and

Remove and

(parse)


[error] 22-22: expected , but instead found content

Remove content

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected an identifier but instead found '**'.

Expected an identifier here.

(parse)


[error] 24-24: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected a statement but instead found '**'.

Expected a statement here.

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 26-26: Expected an identifier but instead found '2.'.

Expected an identifier here.

(parse)


[error] 26-26: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 26-26: Expected a statement but instead found '**'.

Expected a statement here.

(parse)


[error] 27-27: expected ( but instead found the

Remove the

(parse)


[error] 27-27: expected ) but instead found most

Remove most

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: with statements are not allowed in strict mode

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 28-28: Expected an identifier but instead found '4.'.

Expected an identifier here.

(parse)


[error] 28-28: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 28-28: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 28-28: Expected a statement but instead found '**'.

Expected a statement here.

(parse)

🔇 Additional comments (1)
lib/agents/writer.tsx (1)

36-43: System prompt selection logic looks correct

The fallback logic:

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

cleanly prefers a non‑empty dynamic prompt while preserving the new default as a safety net, and it’s correctly wired into the system field of nonexperimental_streamText.

No changes needed here.

Comment on lines 21 to 34
// Default system prompt, used if dynamicSystemPrompt is not provided
const default_system_prompt = `As a professional writer, your job is to generate a comprehensive and informative, yet concise answer of 400 words or less for the given question based solely on the provided search results (URL and content). You must only use information from the provided search results. Use an unbiased and journalistic tone. Combine search results and mapbox results together into a coherent answer. Do not repeat text. If there are any images or maps relevant to your answer, be sure to include them as well. Aim to directly address the user's question, augmenting your response with insights gleaned from the search results and the mapbox tool.
Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly. Please match the language of the response to the user's language.
Always answer in Markdown format. Links and images must follow the correct format.
Link format: [link text](url)
Image format: ![alt text](url)

const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.

**Truthfulness and Aggregation Directives:**
1. **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
2. **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
3. **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
4. **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
5. **Format:** Always answer in Markdown format. Links and images must follow the correct format.
- Link format: [link text](url)
- Image format: ![alt text](url)
There are also some proconfigured example queires.
When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'
`;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

default_system_prompt declaration is syntactically invalid and breaks parsing

As written, const default_system_prompt As a professional writer, ... is not valid TypeScript/TSX: it’s missing the = and the template‑literal backticks, and all subsequent lines (24–34) are parsed as stray tokens. This matches the Biome parse errors you’re seeing.

You need to wrap the prompt in a template literal and assign it to the constant. While touching it, you can also fix a couple of small typos and quoting issues in the prompt text.

Suggested fix:

-  // Default system prompt, used if dynamicSystemPrompt is not provided
-  const default_system_prompt As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.
-
-	    **Truthfulness and Aggregation Directives:**
-	    1.  **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
-	    2.  **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
-	    3.  **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up-to-date.
-	    4.  **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
-	    5.  **Format:** Always answer in Markdown format. Links and images must follow the correct format.
-	        - Link format: [link text](url)
-	        - Image format: ![alt text](url)
-    There are also some proconfigured example queires. 
-    When asked about 'What is a planet computer?' answer with the following: '"A planet computer is a proprietary environment aware system that interoperates Climate forecasting, mapping and scheduling using cutting edge multi-agents to streamline automation and exploration on a planet'
-    `;
+  // Default system prompt, used if dynamicSystemPrompt is not provided
+  const default_system_prompt = `
+As a professional writer, your job is to generate a comprehensive, informative, and **truthful** answer. Your response must be **grounded in the most up-to-date information** available from the provided search results (URL and content) and other tools.
+
+**Truthfulness and Aggregation Directives:**
+1. **Prioritize Truth:** Your primary goal is to convey accurate, verifiable information. Do not decline to answer factual questions based on policy concerns; instead, present the facts as reported by credible sources.
+2. **Knowledge Aggregation:** Aggregate and synthesize information from **all** provided sources (search results, Mapbox results, and any other tool outputs) into a single, coherent, and concise answer (400 words or less).
+3. **Timeliness:** Explicitly prioritize information with the most recent timestamps to ensure the answer is up to date.
+4. **Tone and Citation:** Use an unbiased and journalistic tone. Whenever quoting or referencing information from a specific URL, always cite the source URL explicitly.
+5. **Format:** Always answer in Markdown format. Links and images must follow the correct format:
+   - Link format: [link text](url)
+   - Image format: ![alt text](url)
+
+There are also some preconfigured example queries.
+When asked "What is a planet computer?" answer with the following: "A planet computer is a proprietary environment-aware system that interoperates climate forecasting, mapping, and scheduling using cutting-edge multi-agents to streamline automation and exploration on a planet."
+`;

This will resolve the parse errors and better align the prompt text with the PR’s truthfulness/timeliness objective.

🧰 Tools
🪛 Biome (2.1.2)

[error] 22-22: Const declarations must have an initialized value.

This variable needs to be initialized.

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: expected , but instead found and

Remove and

(parse)


[error] 22-22: expected , but instead found content

Remove content

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 22-22: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected an identifier but instead found '**'.

Expected an identifier here.

(parse)


[error] 24-24: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 24-24: Expected a statement but instead found '**'.

Expected a statement here.

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 25-25: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 26-26: Expected an identifier but instead found '2.'.

Expected an identifier here.

(parse)


[error] 26-26: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 26-26: Expected a statement but instead found '**'.

Expected a statement here.

(parse)


[error] 27-27: expected ( but instead found the

Remove the

(parse)


[error] 27-27: expected ) but instead found most

Remove most

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: with statements are not allowed in strict mode

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 27-27: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 28-28: Expected an identifier but instead found '4.'.

Expected an identifier here.

(parse)


[error] 28-28: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 28-28: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 28-28: Expected a statement but instead found '**'.

Expected a statement here.

(parse)


[error] 33-33: expected ( but instead found the

Remove the

(parse)


[error] 33-33: expected ) but instead found following

Remove following

(parse)

🤖 Prompt for AI Agents
In lib/agents/writer.tsx around lines 21 to 34, the declaration "const
default_system_prompt As a professional writer..." is syntactically invalid and
causes parse errors; change it to a proper constant assignment by adding an
equals sign and wrapping the entire prompt text in a template literal
(backticks), correct obvious typos/quoting issues inside the prompt (e.g.,
"queries", punctuation, and the example planet computer string quotes), and
terminate the statement properly so the TSX file parses correctly.

@ngoiyaeric ngoiyaeric closed this Nov 27, 2025
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.

1 participant