Skip to content

feat(assistant): in-product conversational AI assistant — chat with your dashboard, with charts #94

Closed

Description

@gkhngyk

Epic — large, multi-part feature. Not a good-first-issue. Should land after the MCP read-tool surface is solid (see Dependencies).

What

An in-dashboard conversational AI assistant — chat with your dashboard about visibility trends, competitor moves, and content gaps without leaving the page (roadmap item from the README's "What's next").

It should be agentic (calls tools to pull the user's real data, never makes numbers up) and able to render charts/visualizations in its answers — e.g. "compare the last 30 days" returns a trend chart, "who's gaining share of voice?" returns a bar chart — not just prose.

Why

The dashboard already holds rich AI-search data; today users have to navigate pages and read charts themselves. A grounded chat that answers in plain language and draws the relevant chart turns analysis into a conversation — a strong differentiator and retention driver. Modern assistants present visuals, so chart output is part of the bar, not a nice-to-have.

How it fits the codebase

The assistant is essentially an agent over the existing tool/data layer + a chat UI + chart rendering — it should compose what we already have, not build a parallel stack:

  • Tools = the MCP data layer. The read functions in web/src/lib/mcp/data.ts (brands, visibility summary, prompts, topics, content opportunities) are the assistant's tools. Call them server-side; reuse the org/brand ownership scoping already in web/src/lib/mcp-auth.ts.
  • Agent loop: the backend already uses the Vercel AI SDK — use it for tool-calling + streaming.
  • Charts: tools return chart-ready structured data; the client renders with the existing Recharts components on the Insights page (insights/_charts.tsx). The model selects the chart type / returns a small spec (type + series); we render it with our components — the model does not draw images.
  • Analyst behavior: the Anthropic Skills (ansvisor-aeo-coach) AEO knowledge can inform the assistant's system prompt.

Dependencies & sequencing

Phased plan (suggested)

  1. Tool readiness — confirm/extend the MCP data layer for the assistant's needs, incl. chart-shaped time-series data (builds on perf(insights): speed up the dashboard insights page (DB-side aggregation + cache with invalidation) #93).
  2. Agent + chat UI (text-only) — a chat panel in the dashboard; AI SDK agent loop calling the tools; streamed answers grounded strictly in the user's own data; brand/org scoped.
  3. Chart rendering — agent returns a chart spec (type + series); render with Recharts (trend / bar / comparison).
  4. Polish — suggested starter prompts, conversation history, and guardrails (answer only from the user's data; an LLM cost/rate guard).

Cross-cutting requirements

  • Grounded only in the user's own data — answers come from tool calls scoped to the user's org/brand (reuse the mcp-auth scoping); no fabricated numbers, never another org's data.
  • i18n — the dashboard ships 13 languages (next-intl); the assistant should reply in the user's locale.
  • LLM provider — reuse the project's multi-provider setup (OpenAI / Anthropic / Google / …); self-hosted instances use their own keys (BYO). Don't hardcode a provider.
  • Cost & gating — LLM calls cost money: add a cost/rate guard, and in cloud gate the feature behind a plan flag (there's no ai_assistant feature in config/plans.ts yet — add one). Self-hosted stays unlocked like other features.
  • Empty / new-brand state — handle brands with little or no tracking data gracefully (say so, suggest running tracking) instead of erroring or hallucinating.

Current MCP read surface (web/src/lib/mcp/data.ts): list_brands, get_visibility_summary, list_topics, list_prompts, list_content_opportunities, get_content_opportunity. The assistant additionally needs visibility time-series (for trend charts), competitors, and citations read tools — not present yet, so building them is part of "Tool readiness".

Acceptance criteria

  • A chat panel inside the dashboard answers questions about the brand's AI-search performance with streamed, data-grounded replies.
  • Every answer is backed by real tool calls scoped to the user's org/brand — numbers match the dashboard; no cross-org leakage.
  • Visualization questions (e.g. "compare the last 30 days", "top competitors by share of voice") render a chart via the existing Recharts components, not just text.
  • Replies follow the user's locale.
  • LLM usage is gated (plan feature in cloud / BYO key self-hosted) and has a cost/rate guard.
  • Brands with no/low data are handled gracefully.
  • Existing MCP tools are reused, not forked — no regressions.

Out of scope (for now)

  • Write actions from chat (trigger tracking, generate briefs) — later, via the existing tools.
  • Voice input, cross-brand analysis, scheduled digests.
  • A new charting library — reuse Recharts.

Notes

This issue captures the plan; implementation should wait on the MCP tool surface and #93. Happy to split into sub-issues per phase once we start.

Activity

  1. added
    enhancement
    help wanted
    on May 25, 2026
  2. self-assigned this
    on May 29, 2026
  3. gkhngyk commented on Jun 2, 2026

    @gkhngyk
    ContributorAuthor

    Closing as functionally complete. The epic shipped across four phases plus a polish layer:

    Phase 1 — Tool readiness

    Phase 2 — Agent + chat UI

    Phase 3 — Chart rendering

    Phase 4 — Polish

    Acceptance, item by item

    • Chat panel answers questions with streamed, data-grounded replies
    • Every answer backed by real tool calls scoped to org/brand
    • Visualization questions render charts via Recharts (not just text)
    • LLM usage gated (cloud BYOK / self-host env)
    • Existing MCP tools reused, not forked
    • Locale-following replies — explicitly deferred. Claude Sonnet 4.6 already adapts to the input language; the dashboard itself is single-locale today. Will revisit when we ship a second locale.
    • Empty-state for brands with no data — the system prompt instructs the agent to acknowledge tool gaps and we haven't seen hallucinations from new brands in practice. If a real failure mode surfaces, we'll open a small follow-up.

    Open follow-ups (independent, not gating this epic)

    These are standalone MCP tool additions and will be picked up individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions