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(content): let the Content Agent use a placeholder only for a missing fact (#1620)
Cihana2a6e820c39e
diff --git a/server/src/lib/content-agent.js b/server/src/lib/content-agent.jsindex 1d3a27a39..62557e798 100644--- a/server/src/lib/content-agent.js+++ b/server/src/lib/content-agent.js@@ -94,6 +94,15 @@ export const FANOUT_RULE = `- Fan-outs are the searches AI engines run for the p/** The links rule both agent prompts give the model: only the URLs listed, never invented. */export const LINK_RULE = `- Links: link only to a URL listed under the pages or sources you may link to, copied exactly, as <a href="URL">the words it explains</a>, in a replace's "after" or in an insert. Cite a source by linking the words it supports. Never invent a URL, never link a heading, and when no listed page fits, add no link.`;+/**+ * What a placeholder is for: each one holds a send to a CMS or an export+ * until the person fills it (CE-044, CE-057), so only for a fact they must+ * find. A page, a document or a competitor is written as words: the agent+ * wrote "[About]", "[OpenAI release notes]" and "[competitor]" where plain+ * words do, and a page waited on six.+ */+export const PLACEHOLDER_RULE = `- A placeholder in square brackets is only for a fact the person must find: a number, a price, a date, a person's name, a customer's name or a quote. Never put a page, a document, a link, a product, a brand, a company or a competitor in brackets: write it in plain words ("your About page", "OpenAI's release notes"), name the competitors given, or write "competitors". Each placeholder holds the page back until the person fills it, so write as few as the facts need.`;+/** What the agent may say of a source, and the names a list keeps (editor test 2026-10-25). */export const ATTRIBUTION_RULE = `- Never give a claim to a source that neither the page nor Your input gives ("According to X…", "X says…", "X found that…"): you don't see what a cited page or a link says. A link goes on the words it explains, never as a source for a claim. Keep every name a list has (products, brands, people): never drop one.`;@@ -183,6 +192,7 @@ ${LINK_RULE}${FANOUT_RULE}- Never change a passage marked LOCKED: AI assistants quote its wording today. You may insert after it.- Use only facts from the page, the brand and your data. Never invent numbers, prices, dates, names, sources or quotes. When a rule needs a fact you don't have, write a placeholder in square brackets, e.g. [figure, source, year].+${PLACEHOLDER_RULE}${SOURCES_RULE}${ATTRIBUTION_RULE}- Keep the page's voice and change as little as each rule needs. At most ${MAX_AGENT_SUGGESTIONS} suggestions.diff --git a/server/src/lib/content-rewrite.js b/server/src/lib/content-rewrite.jsindex 60ed6f3b2..3658e2b8c 100644--- a/server/src/lib/content-rewrite.js+++ b/server/src/lib/content-rewrite.js@@ -1,7 +1,7 @@import { randomBytes } from 'crypto';import * as cheerio from 'cheerio';import { z } from 'zod';-import { HEADING_LIMITS, passageKey } from './content-agent.js';+import { HEADING_LIMITS, PLACEHOLDER_RULE, passageKey } from './content-agent.js';import { linkKey } from './content-links.js';import { sourcesField } from './content-sources.js';import { textLength } from './page-content.js';@@ -61,6 +61,7 @@ export const REWRITE_SYSTEM_PROMPT = `You are the Content Agent for Answer EnginHow to rewrite:- Meet every rule listed, and the writer's own rules. Aim at the Length given: the page's whole text, kept blocks included, within 20% of it. When the page is too long, cut repetition, filler and the least useful parts first, and keep its answers, facts and data.- Keep the page's facts and voice. Use only facts from the page, the brand, the brief and your data. Never invent numbers, prices, dates, names, customers, sources or quotes; when the page needs a fact you don't have, write a placeholder in square brackets, e.g. [figure, source, year]. A number that isn't in them becomes a placeholder.+${PLACEHOLDER_RULE}- Put the numbers (S1, S2…) of the data the page uses in "sources".- Never give a claim to a source that neither the page nor Your input gives ("According to X…", "X says…"): you don't see what a cited page or a link says. Keep every name the page has (a product, a brand, a person) where it lists or claims it.- One H1, the page's title, first. Sections are H2s; questions and sub-sections are H3s.diff --git a/server/src/lib/content-writer.js b/server/src/lib/content-writer.jsindex 6cd9570c2..832fbcdaa 100644--- a/server/src/lib/content-writer.js+++ b/server/src/lib/content-writer.js@@ -13,6 +13,7 @@ import {HEADING_RULE,LINK_RULE,MAX_AGENT_SUGGESTIONS,+ PLACEHOLDER_RULE,draftPassages,hasOpenSuggestions,keepSuggestions,@@ -175,6 +176,7 @@ How to write:- Follow every rule listed, and the writer's own rules.- For each fan-out a rule names, use its words, not questions of your own: a section heading for fanoutH2, an FAQ question ending in "?" for fanoutFaq.- Use only facts from the brand, the brief and your data. Never invent numbers, prices, dates, names, customers, sources or quotes. When the page needs a fact you don't have, write a placeholder in square brackets, e.g. [price], [figure, source, year]. A number that isn't in them becomes a placeholder.+${PLACEHOLDER_RULE}- Plain text in every field: no HTML, no Markdown.- Write in the language asked for.`;@@ -209,6 +211,7 @@ ${FANOUT_RULE}- Never change a passage marked LOCKED: AI assistants quote its wording today. You may insert after it.- Put the keys of the rules a change meets in "rules" (none when it meets none).- Use only facts from the page, the brand and your data. Never invent numbers, prices, dates, names, sources or quotes; write a placeholder in square brackets instead, e.g. [figure, source, year].+${PLACEHOLDER_RULE}${SOURCES_RULE}${ATTRIBUTION_RULE}- Keep the page's voice. The most useful changes first, at most ${MAX_AGENT_SUGGESTIONS}.diff --git a/server/src/lib/content-writer.test.js b/server/src/lib/content-writer.test.jsindex 97332c6e1..ae5c3f17e 100644--- a/server/src/lib/content-writer.test.js+++ b/server/src/lib/content-writer.test.js@@ -109,7 +109,11 @@ const { WRITING_GUARDRAIL } = await import('./content-brief.js');const { REWRITE_SYSTEM_PROMPT } = await import('./content-rewrite.js');const { NAME_PLACEHOLDER, QUOTE_PLACEHOLDER, knownPeople } = await import('./content-people.js');const { textLength } = await import('./content-rewrite.js');-const { passageKey } = await import('./content-agent.js');+const {+ PLACEHOLDER_RULE,+ SYSTEM_PROMPT: AGENT_SYSTEM_PROMPT,+ passageKey,+} = await import('./content-agent.js');const { PlanLimitError } = await import('./plan-guard.js');// The real hold: self-hosted here, so it reserves nothing and writes each charge.const realGuard = await vi.importActual('./plan-guard.js');@@ -1231,6 +1235,20 @@ describe('the brief rules (2026) in the Content Agent', () => {},};+ it('keeps placeholders for facts the person must find, never a page, a document or a competitor', () => {+ // A page waited on "[About]", "[OpenAI release notes]" and "[competitor]".+ for (const prompt of [+ writeSystemPrompt(),+ suggestSystemPrompt(),+ rewriteSystemPrompt(),+ AGENT_SYSTEM_PROMPT,+ ]) {+ expect(prompt).toContain(PLACEHOLDER_RULE);+ }+ expect(PLACEHOLDER_RULE).toContain('Never put a page, a document, a link');+ expect(PLACEHOLDER_RULE).toContain('"OpenAI\'s release notes"');+ });+it('asks as before while they are off: the same prompts, the brief as version 1', () => {expect(writeSystemPrompt()).toBe(WRITE_SYSTEM_PROMPT);expect(rewriteSystemPrompt()).toBe(REWRITE_SYSTEM_PROMPT);