Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/agents/writer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ export async function writer(
uiStream.append(answerSection)

// 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.
Comment on lines +24 to +27

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

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.

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)
Comment on lines +22 to +31

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.

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'
`;
Comment on lines 21 to 34
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.

Expand Down