Skip to content

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.

feat(action-center): write tasks in the brand's site type's terms (#1766)

Cihand624bfc64f35
diff --git a/docs/guides/action-center.mdx b/docs/guides/action-center.mdx
index 68ddc9942..8edcbf77d 100644
--- a/docs/guides/action-center.mdx
+++ b/docs/guides/action-center.mdx
@@ -104,7 +104,7 @@ From a task you can also:
- **Send to Content** — send a content task to Content as an opportunity, where a brief can be written for it.
- **Send to webhook** — post the task to the brand's webhook, for a workflow outside Ansvisor. The webhook is set up under **Content → Webhook Settings**, with the **Action Center task sent** event selected.
-Where AI task writing is on for your workspace, **Regenerate tasks** writes the action's tasks again from its evidence. Done, under-way and hand-added tasks stay. It uses your plan's monthly AI allowance. The AI also reads this brand's last three closed rounds of the same action: which tasks were done and what the result read, or why a round was dismissed. It builds on what improved results here and doesn't hand out again a task that was done without effect. Only this brand's own actions are read.
+Where AI task writing is on for your workspace, **Regenerate tasks** writes the action's tasks again from its evidence. It writes them in your brand's terms, by its **Site type** in the brand settings: product and category pages for an online shop, feature and comparison pages for B2B software, destination and help pages for a consumer service. Done, under-way and hand-added tasks stay. It uses your plan's monthly AI allowance. The AI also reads this brand's last three closed rounds of the same action: which tasks were done and what the result read, or why a round was dismissed. It builds on what improved results here and doesn't hand out again a task that was done without effect. Only this brand's own actions are read.
A task the AI writes without its **URL**, its **Change**, **Done when** or **How we check** doesn't reach your list. It waits on the **Needs review** tab, which admins and managers see, with what it misses. Click **Edit**, fill the missing fields and click **Approve** to add it after the action's other tasks, or **Dismiss** it.
diff --git a/server/src/lib/action-center/task-writer/index.js b/server/src/lib/action-center/task-writer/index.js
index 49e2e6008..ff1d8c8d4 100644
--- a/server/src/lib/action-center/task-writer/index.js
+++ b/server/src/lib/action-center/task-writer/index.js
@@ -24,6 +24,7 @@ import { resolveModel } from '../../ai-provider.js';
import { withRetry } from '../../retry.js';
import { generationCostUsd } from '../../improve-cost.js';
import { PlanLimitError, reserveAiBudget } from '../../plan-guard.js';
+import { siteTypeOf } from '../../content-page-types.js';
import { loadDefinitions } from '../definitions/index.js';
import { getTask } from '../tasks/registry.js';
import { IMPROVE_ACTION_KIND } from '../from-prompt-improve.js';
@@ -120,7 +121,7 @@ async function loadAction(actionId) {
const [brandRes, domainsRes, signalsRes, definitions] = await Promise.all([
supabaseAdmin
.from('brands')
- .select('id, name, description, organization_id')
+ .select('id, name, description, organization_id, site_type, industry, shopping_mode_enabled')
.eq('id', action.brand_id)
.single(),
supabaseAdmin.from('brand_domains').select('domain').eq('brand_id', action.brand_id),
@@ -310,7 +311,17 @@ async function compose({ action, brand, domains, signals, name, trigger, userId,
}
const base = buildTaskWriterPrompt({
action: { name, category: action.category },
- brand: { name: brand.name, description: brand.description, domains },
+ brand: {
+ name: brand.name,
+ description: brand.description,
+ domains,
+ // The kind of site, chosen, detected or guessed: tasks speak its language.
+ siteType: siteTypeOf({
+ siteType: brand.site_type,
+ industry: brand.industry,
+ shoppingModeEnabled: brand.shopping_mode_enabled,
+ }),
+ },
evidence: shown,
history,
});
diff --git a/server/src/lib/action-center/task-writer/index.test.js b/server/src/lib/action-center/task-writer/index.test.js
index 5ebebec8e..893a56f07 100644
--- a/server/src/lib/action-center/task-writer/index.test.js
+++ b/server/src/lib/action-center/task-writer/index.test.js
@@ -455,6 +455,25 @@ describe('writeTasksForAction', () => {
expect(generateObject.mock.calls[0][0].prompt).not.toContain('Earlier rounds');
});
+ it("tells the model the brand's kind of site and its page types, chosen or guessed", async () => {
+ db.brands[0] = { ...db.brands[0], site_type: 'ecommerce' };
+ generateObject.mockResolvedValueOnce(answer([task()]));
+ await writeTasksForAction('a1', { dryRun: true });
+ const { prompt, system } = generateObject.mock.calls[0][0];
+ expect(prompt).toContain(
+ 'Site type: E-commerce (an online shop selling products). Its page types: product page, category page, collection page, buying guide,',
+ );
+ expect(system).toContain("Name pages and content the way the brand's kind of site does");
+
+ // None chosen: the guess, from Shopping mode or the industry, else B2B.
+ db.brands[0] = { ...db.brands[0], site_type: null, industry: 'Travel & Hospitality' };
+ generateObject.mockResolvedValueOnce(answer([task()]));
+ await writeTasksForAction('a1', { dryRun: true });
+ expect(generateObject.mock.calls[1][0].prompt).toContain(
+ 'Site type: B2C (a service for consumers). Its page types: destination page, itinerary,',
+ );
+ });
+
it('calls no model when the signals name nothing to work on', async () => {
db.signals[0].payload = {};
const result = await writeTasksForAction('a1', { trigger: 'regenerate' });
diff --git a/server/src/lib/action-center/task-writer/prompt.js b/server/src/lib/action-center/task-writer/prompt.js
index 088d6ea5e..c6d42eaaf 100644
--- a/server/src/lib/action-center/task-writer/prompt.js
+++ b/server/src/lib/action-center/task-writer/prompt.js
@@ -6,6 +6,7 @@
*/
import { z } from 'zod';
+import { SITE_PAGE_TYPES, SITE_TYPE_MEANINGS, SITE_TYPE_NAMES } from '../../content-page-types.js';
import { MAX_TASKS } from './quality.js';
/**
@@ -53,12 +54,23 @@ Rules:
- Do not write analysis tasks (analyze, identify, review, validate, measure, monitor): the product already did that work and shows it to the user.
- refs lists the evidence refs the task rests on (e.g. "page:1", "domain:2"). Use only refs that exist. The title, Where or url must name the target itself: a page by its URL or path, a domain or competitor by name, a prompt by quoting it.
- Use only facts from the evidence. No placeholders, no generic SEO advice.
+- Name pages and content the way the brand's kind of site does (its site type and page types below): a category page or a buying guide for an online shop, a feature or comparison page for B2B software, a destination or help page for a consumer service.
- Write in English. At most ${MAX_TASKS} tasks.`;
+/**
+ * The brand's kind of site and the pages it writes, for the prompt; null for
+ * a type it doesn't know (an older caller without one).
+ */
+function siteTypeLine(siteType) {
+ if (!SITE_PAGE_TYPES[siteType]) return null;
+ const pages = SITE_PAGE_TYPES[siteType].map((type) => type.replace(/_/g, ' ')).join(', ');
+ return `Site type: ${SITE_TYPE_NAMES[siteType]} (${SITE_TYPE_MEANINGS[siteType]}). Its page types: ${pages}.`;
+}
+
/**
* @param {{
* action: { name: string, category: string, title?: string },
- * brand: { name: string, description?: string | null, domains: string[] },
+ * brand: { name: string, description?: string | null, domains: string[], siteType?: string },
* evidence: object,
* history?: object[],
* }} input evidence as `evidenceForPrompt` gives it; history as `loadPastRounds` does
@@ -67,6 +79,7 @@ export function buildTaskWriterPrompt({ action, brand, evidence, history = [] })
const prompt = [
`Brand: ${brand.name}${brand.domains.length ? ` (${brand.domains.join(', ')})` : ''}`,
brand.description ? `About the brand: ${brand.description}` : null,
+ siteTypeLine(brand.siteType),
`Action: ${action.name} (category: ${action.category})`,
'',
'Evidence (JSON):',