+
{slide.label}
>
diff --git a/lib/agents/resolution-search.tsx b/lib/agents/resolution-search.tsx
index 9985712d..997f2730 100644
--- a/lib/agents/resolution-search.tsx
+++ b/lib/agents/resolution-search.tsx
@@ -117,7 +117,8 @@ Please incorporate this recent news context into your analysis where relevant.`
${drawnFeatures && drawnFeatures.length > 0 ? `**User-Drawn Features:**
The user has drawn the following features on the map for your reference:
${drawnFeatures.map(f => `- ${f.type} (${f.measurement}): ${JSON.stringify(f.geometry)}`).join('\n')}
-Use these user-drawn areas/lines as primary areas of interest for your analysis.` : ''}
+Use these user-drawn areas/lines as primary areas of interest for your analysis.
+IMPORTANT: In your summary, explicitly state what features you are analyzing and why.` : ''}
**Analysis Requirements:**
@@ -128,6 +129,11 @@ Use these user-drawn areas/lines as primary areas of interest for your analysis.
5. **COG Applicability:** Determine if this location would benefit from Cloud Optimized GeoTIFF (COG) analysis for high-precision temporal or spectral data.
6. **News Integration:** Reference any recent news or events that may be relevant to the current state of the location.
7. **Structured Output:** Return your findings in a structured JSON format including summary, geoJson (if any), news context, and any extracted coordinates or COG information. Use the provided schema.
+8. **Contextual Labeling:** Generate descriptive labels for the map images that reflect the analysis focus. If user-drawn features are present, reference them in the labels. For example:
+ - If analyzing a drawn polygon: "Analysis of drawn area: [feature type]"
+ - If analyzing a specific location: "[Location name] satellite view"
+ - If general analysis: "[Primary feature type] analysis"
+ Provide these in the mapboxImageLabel, googleImageLabel, and analysisFocus fields.
Your analysis should be based on the visual information in the image, the temporal context provided, and your general knowledge. Do not attempt to access external websites or perform web searches beyond what has been provided.
diff --git a/lib/schema/resolution-search.ts b/lib/schema/resolution-search.ts
index e7908abd..acfc03e3 100644
--- a/lib/schema/resolution-search.ts
+++ b/lib/schema/resolution-search.ts
@@ -35,7 +35,12 @@ export const resolutionSearchSchema = z.object({
title: z.string(),
summary: z.string(),
relevance: z.string()
- })).optional().describe('List of recent news items relevant to the location.')
+ })).optional().describe('List of recent news items relevant to the location.'),
+
+ // New fields for contextual labels
+ mapboxImageLabel: z.string().optional().describe('A contextual label describing what the Mapbox image shows, based on the analysis focus.'),
+ googleImageLabel: z.string().optional().describe('A contextual label describing what the Google Satellite image shows, based on the analysis focus.'),
+ analysisFocus: z.string().optional().describe('A brief phrase describing the primary focus of the analysis (e.g., "Urban infrastructure analysis", "Forest coverage assessment").')
})
export type ResolutionSearch = z.infer
;
diff --git a/server.log b/server.log
index 41e8e758..466a0f68 100644
--- a/server.log
+++ b/server.log
@@ -5,13 +5,66 @@ $ next dev --turbo
- Environments: .env
✓ Starting...
- ✓ Compiled middleware in 433ms
- ✓ Ready in 1802ms
+Attention: Next.js now collects completely anonymous telemetry regarding usage.
+This information is used to shape Next.js' roadmap and prioritize features.
+You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
+https://nextjs.org/telemetry
+
+ ✓ Compiled middleware in 363ms
+ ✓ Ready in 1710ms
○ Compiling / ...
- ✓ Compiled / in 27.9s
+ ✓ Compiled / in 29.3s
Chat DB actions loaded. Ensure getCurrentUserId() is correctly implemented for server-side usage if applicable.
- GET / 200 in 30481ms
- HEAD / 200 in 1010ms
- GET / 200 in 986ms
- GET / 200 in 1129ms
-[?25h
+ GET / 200 in 34985ms
+ GET / 200 in 35005ms
+ GET / 200 in 1472ms
+ GET / 200 in 2734ms
+ GET / 200 in 1145ms
+ GET / 200 in 1843ms
+ GET / 200 in 1137ms
+ GET / 200 in 1370ms
+ GET / 200 in 1107ms
+ GET / 200 in 1355ms
+ HEAD / 200 in 995ms
+ GET / 200 in 1896ms
+ GET / 200 in 1894ms
+ GET / 200 in 2017ms
+ GET / 200 in 2021ms
+ GET / 200 in 2087ms
+ GET / 200 in 2246ms
+ GET / 200 in 2268ms
+ GET / 200 in 2245ms
+[Auth] Supabase URL or Anon Key is not set for server-side auth.
+ POST / 200 in 1605ms
+ GET / 200 in 1178ms
+ GET / 200 in 2469ms
+ GET / 200 in 2179ms
+ GET / 200 in 2328ms
+ GET / 200 in 1137ms
+[Auth] Supabase URL or Anon Key is not set for server-side auth.
+ POST / 200 in 2000ms
+[Auth] Supabase URL or Anon Key is not set for server-side auth.
+ POST / 200 in 1989ms
+ GET / 200 in 1181ms
+[Auth] Supabase URL or Anon Key is not set for server-side auth.
+ POST / 200 in 1073ms
+ GET / 200 in 1048ms
+ GET / 200 in 1104ms
+[Auth] Supabase URL or Anon Key is not set for server-side auth.
+ POST / 200 in 1055ms
+ ✓ Compiled middleware in 2ms
+ ○ Compiling /test-carousel ...
+ ✓ Compiled /test-carousel in 6.1s
+ ⨯ Error: `useUIState` must be used inside an provider.
+ at ResolutionCarousel (components/resolution-carousel.tsx:39:35)
+ 37 | }: ResolutionCarouselProps) {
+ 38 | const actions = useActions() as any
+> 39 | const [, setMessages] = useUIState()
+ | ^
+ 40 | const [isAnalyzing, setIsAnalyzing] = React.useState(false)
+ 41 |
+ 42 | const handleQCXAnalysis = async () => { {
+ digest: '3019542783'
+}
+ GET /test-carousel 500 in 7348ms
+ ✓ Compiled middleware in 38ms
From 5116616281890dc1980b8e922efef929cdbdaba1 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Mon, 8 Jun 2026 12:49:29 +0000
Subject: [PATCH 2/3] docs: improve system prompt for resolution search
contextual accuracy
- Added critical guidelines to prevent generic or random labels.
- Instructed AI to prioritize user-drawn features and avoid hallucinated GeoJSON.
- Enhanced contextual labeling requirements to be highly specific.
Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
---
lib/agents/resolution-search.tsx | 14 +++++++++-----
server.log | 1 +
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/agents/resolution-search.tsx b/lib/agents/resolution-search.tsx
index 997f2730..d3c3d9ed 100644
--- a/lib/agents/resolution-search.tsx
+++ b/lib/agents/resolution-search.tsx
@@ -101,6 +101,11 @@ export async function resolutionSearch(messages: CoreMessage[], timezone: string
const systemPrompt = `
As a geospatial analyst, your task is to analyze the provided satellite image of a geographic location.
+**CRITICAL GUIDELINES:**
+- **ACCURACY:** Your analysis must be grounded strictly in the visual evidence of the image. Avoid hallucinations or "random" classifications.
+- **CONTEXT:** Prioritize any user-drawn features as the primary subjects of analysis.
+- **RELEVANCE:** Only generate GeoJSON features for identifiable landmarks or land cover types that are clearly visible and relevant to the user's query or the drawn features.
+
**Temporal Context:**
The current local time at this location is ${localTime} (timezone: ${timezone}).
This temporal information is important for understanding the current state and any time-sensitive features visible in the image.
@@ -129,11 +134,10 @@ IMPORTANT: In your summary, explicitly state what features you are analyzing and
5. **COG Applicability:** Determine if this location would benefit from Cloud Optimized GeoTIFF (COG) analysis for high-precision temporal or spectral data.
6. **News Integration:** Reference any recent news or events that may be relevant to the current state of the location.
7. **Structured Output:** Return your findings in a structured JSON format including summary, geoJson (if any), news context, and any extracted coordinates or COG information. Use the provided schema.
-8. **Contextual Labeling:** Generate descriptive labels for the map images that reflect the analysis focus. If user-drawn features are present, reference them in the labels. For example:
- - If analyzing a drawn polygon: "Analysis of drawn area: [feature type]"
- - If analyzing a specific location: "[Location name] satellite view"
- - If general analysis: "[Primary feature type] analysis"
- Provide these in the mapboxImageLabel, googleImageLabel, and analysisFocus fields.
+8. **Contextual Labeling:** Generate highly specific, descriptive labels for the map images that reflect the primary analysis focus. Avoid generic labels like "Mapbox" or "Google".
+ - If user-drawn features are present, the labels MUST reference them (e.g., "Analysis of drawn ${drawnFeatures?.[0]?.type || 'area'}: [feature type]").
+ - If a specific location is known, include it (e.g., "[${locationName}] satellite view - [Focus Area]").
+ - The 'analysisFocus' field should capture the specific theme of this analysis (e.g., "Coastal erosion assessment", "Industrial zone monitoring").
Your analysis should be based on the visual information in the image, the temporal context provided, and your general knowledge. Do not attempt to access external websites or perform web searches beyond what has been provided.
diff --git a/server.log b/server.log
index 466a0f68..b541de30 100644
--- a/server.log
+++ b/server.log
@@ -68,3 +68,4 @@ Chat DB actions loaded. Ensure getCurrentUserId() is correctly implemented for s
}
GET /test-carousel 500 in 7348ms
✓ Compiled middleware in 38ms
+ ✓ Compiled in 1094ms
From b81de8d8924ed377a8bd32c26b76e6e906dabf72 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Mon, 8 Jun 2026 13:19:31 +0000
Subject: [PATCH 3/3] feat: refine resolution search accuracy and contextual
alignment
- Updated `resolutionSearchSchema` to require high-confidence and relevant GeoJSON features.
- Enhanced `resolutionSearch` agent system prompt with critical guidelines to avoid generic/random labels and hallucinations.
- Added strict contextual alignment instructions for user-drawn features.
Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
---
lib/agents/resolution-search.tsx | 11 ++++++-----
lib/schema/resolution-search.ts | 2 +-
server.log | 2 ++
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/agents/resolution-search.tsx b/lib/agents/resolution-search.tsx
index d3c3d9ed..a49d39e7 100644
--- a/lib/agents/resolution-search.tsx
+++ b/lib/agents/resolution-search.tsx
@@ -102,9 +102,10 @@ export async function resolutionSearch(messages: CoreMessage[], timezone: string
As a geospatial analyst, your task is to analyze the provided satellite image of a geographic location.
**CRITICAL GUIDELINES:**
-- **ACCURACY:** Your analysis must be grounded strictly in the visual evidence of the image. Avoid hallucinations or "random" classifications.
-- **CONTEXT:** Prioritize any user-drawn features as the primary subjects of analysis.
-- **RELEVANCE:** Only generate GeoJSON features for identifiable landmarks or land cover types that are clearly visible and relevant to the user's query or the drawn features.
+1. **ACCURACY & CONFIDENCE:** Your analysis MUST be grounded strictly in the visual evidence of the image. Do NOT generate GeoJSON features (points, polygons) for landmarks or features that you are not 100% confident in. If you are unsure, omit the GeoJSON feature entirely.
+2. **STRICT CONTEXTUAL ALIGNMENT:** Prioritize the user's intent and any user-drawn features as the primary subjects of analysis. Do NOT provide "general" points of interest unless they directly relate to the analysis focus or the user's query.
+3. **NO RANDOM OVERLAYS:** Ensure that any boxes or markers you generate are accurately placed within the spatial context of the image and clearly correspond to real objects visible in the satellite view. Avoid "random" or disconnected labeling.
+4. **SUPPRESSION OF NOISE:** It is better to return fewer, accurate results than many low-confidence or out-of-context features.
**Temporal Context:**
The current local time at this location is ${localTime} (timezone: ${timezone}).
@@ -123,12 +124,12 @@ ${drawnFeatures && drawnFeatures.length > 0 ? `**User-Drawn Features:**
The user has drawn the following features on the map for your reference:
${drawnFeatures.map(f => `- ${f.type} (${f.measurement}): ${JSON.stringify(f.geometry)}`).join('\n')}
Use these user-drawn areas/lines as primary areas of interest for your analysis.
-IMPORTANT: In your summary, explicitly state what features you are analyzing and why.` : ''}
+IMPORTANT: In your summary, explicitly state what features you are analyzing and why. Any GeoJSON you generate should strictly align with or augment these drawn areas.` : ''}
**Analysis Requirements:**
1. **Land Feature Classification:** Identify and describe the different types of land cover visible in the image (e.g., urban areas, forests, water bodies, agricultural fields).
-2. **Points of Interest (POI):** Detect and name any significant landmarks, infrastructure (e.g., bridges, major roads), or notable buildings.
+2. **Points of Interest (POI):** Detect and name any significant landmarks, infrastructure (e.g., bridges, major roads), or notable buildings ONLY if they are clearly visible.
3. **Temporal Analysis:** Consider how the time of day and season might affect what's visible in the image.
4. **Coordinate Extraction:** If possible, confirm or refine the geocoordinates (latitude/longitude) of the center of the image.
5. **COG Applicability:** Determine if this location would benefit from Cloud Optimized GeoTIFF (COG) analysis for high-precision temporal or spectral data.
diff --git a/lib/schema/resolution-search.ts b/lib/schema/resolution-search.ts
index acfc03e3..9ce44e41 100644
--- a/lib/schema/resolution-search.ts
+++ b/lib/schema/resolution-search.ts
@@ -21,7 +21,7 @@ export const resolutionSearchSchema = z.object({
name: z.string().describe('Name of the feature or point of interest'),
description: z.string().optional().describe('Description of the feature')
}))
- }).optional().describe('A collection of points of interest and classified land features to be overlaid on the map.'),
+ }).optional().describe('A collection of HIGH-CONFIDENCE points of interest and classified land features to be overlaid on the map. ONLY include features that are clearly identifiable and highly relevant to the analysis focus or user-drawn areas.'),
// Flattened top-level fields for better xAI compatibility
extractedLatitude: z.number().optional().describe('The extracted latitude of the center of the image.'),
diff --git a/server.log b/server.log
index b541de30..dadf006e 100644
--- a/server.log
+++ b/server.log
@@ -69,3 +69,5 @@ Chat DB actions loaded. Ensure getCurrentUserId() is correctly implemented for s
GET /test-carousel 500 in 7348ms
✓ Compiled middleware in 38ms
✓ Compiled in 1094ms
+ ✓ Compiled in 1332ms
+ ✓ Compiled in 215ms