Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(opportunities): prevent prompt index leak in generated titles/descriptions (#442)
Maqbool Ahmedba89a840278c
diff --git a/server/src/lib/opportunity-generator.js b/server/src/lib/opportunity-generator.jsindex a3239396b..89321f027 100644--- a/server/src/lib/opportunity-generator.js+++ b/server/src/lib/opportunity-generator.js@@ -13,8 +13,16 @@ const opportunitySchema = z.object({opportunities: z.array(z.object({- title: z.string(),- description: z.string(),+ title: z+ .string()+ .describe(+ 'A specific, actionable content recommendation. Never reference prompts by their bracketed index like [0] or "Prompt 3" — name the topic or paraphrase the prompt text instead.',+ ),+ description: z+ .string()+ .describe(+ 'A 1-2 sentence explanation of why this action matters, referencing specific metrics. Never reference prompts by their bracketed index like [0] or "Prompt 3" — name the topic or paraphrase the prompt text instead.',+ ),type: z.enum(['owned', 'earned']),impact: z.enum(['high', 'medium', 'low']),relatedPromptIndex: z.number(),@@ -30,7 +38,8 @@ Rules:- Reference specific data points: volumes, visibility scores, competitor gaps.- Focus on content that will improve the brand's visibility in AI-generated answers.- Categorize as "owned" or "earned".-- Generate between 5 and 15 opportunities.`;+- Generate between 5 and 15 opportunities.+- The bracketed [N] indexes in the prompt data exist ONLY for the relatedPromptIndex field. NEVER mention an index like "[0]" or "Prompt 3" in titles or descriptions — refer to the prompt by quoting or paraphrasing its actual text/topic instead.`;function computeScore(volume, visibility, competitorGap, intent) {const weights = {diff --git a/server/src/workers/content-worker.js b/server/src/workers/content-worker.jsindex e01aa2795..6a9187e1e 100644--- a/server/src/workers/content-worker.js+++ b/server/src/workers/content-worker.js@@ -16,11 +16,13 @@ const opportunitySchema = z.object({z.object({title: z.string()- .describe('A specific, actionable content recommendation backed by the data provided'),+ .describe(+ 'A specific, actionable content recommendation backed by the data provided. Never reference prompts by their bracketed index like [0] or "Prompt 3" — name the topic or paraphrase the prompt text instead.',+ ),description: z.string().describe(- 'A 1-2 sentence explanation of why this action matters, referencing specific metrics',+ 'A 1-2 sentence explanation of why this action matters, referencing specific metrics. Never reference prompts by their bracketed index like [0] or "Prompt 3" — name the topic or paraphrase the prompt text instead.',),type: z.enum(['owned', 'earned'])@@ -48,7 +50,8 @@ Rules:- Categorize as "owned" (blog posts, landing pages, FAQ pages the brand controls) or "earned" (guest posts, PR, review sites).- Set impact based on: volume × (100 - current visibility) × competitor gap.- Generate between 5 and 15 opportunities depending on data richness.-- Do NOT repeat the same recommendation in different wording.`;+- Do NOT repeat the same recommendation in different wording.+- The bracketed [N] indexes in the prompt data exist ONLY for the relatedPromptIndex field. NEVER mention an index like "[0]" or "Prompt 3" in titles or descriptions — refer to the prompt by quoting or paraphrasing its actual text/topic instead.`;function computeOpportunityScore(volume, visibility, competitorGap, intent) {const intentWeights = {