logicspike/docs

AI Brain

Phase 1: Discovery & User Journeys — AI Brain

Last Updated: 2026-04-03 Status: Draft


1. Context & Goal

The AI Brain is a cross-product intelligence layer that sits across every LogicSpike service. It enables business owners to interact with their entire business through natural language — asking questions, requesting actions, receiving proactive insights, and having the platform learn and mature alongside their business.

The Problem: Today, a seller must navigate multiple dashboards, read raw analytics, and manually connect dots across blog, content, chat, and billing. There is no unified intelligence layer.

The Solution: A single AI agent (accessed via a copilot chat in the dashboard) that has full context across all products, remembers past interactions, learns what works for each business, and proactively surfaces insights.

1.1 System Flow Overview


2. Actors

Actor Description
Business Owner (Seller) Primary user. Interacts with AI Copilot via natural language in the seller dashboard. Wants to grow their business without becoming a data analyst.
Team Member Has limited permissions. Can use the copilot for their scoped tasks (e.g., a writer asking "What should I write about next?").
AI Router Agent Internal. Classifies user intent and delegates to the correct specialist agent. Uses a fast, cheap model (haiku-class).
Specialist Agent Internal. Domain expert (blog, content, analytics, chat). Has deep system prompts and scoped tools for its domain.
Insight Engine Internal. Runs on cron triggers (every 6 hours). Scans tenant data for anomalies, patterns, and opportunities. Generates proactive insight cards.
Memory System Internal. Persists preferences, facts, patterns, and episodes. Provides context to agents and matures over time.

3. Core User Journeys

Journey A: First Conversation — Onboarding the AI

Persona: Priya, a bakery owner in Mumbai. She just subscribed to LogicSpike Pro and has a blog with 15 published posts. She opens the AI Copilot for the first time.

Goal: The AI should introduce itself, understand her business, and prove its value immediately.

Step 1: Trigger

Priya clicks the "AI Copilot" tab in the seller dashboard for the first time.

Step 2: AI Greeting & Context Scan

The AI Brain automatically scans available tenant context:

  • Blog: 15 posts, 3 categories (recipes, bakery news, tutorials)
  • Content Engine: No social accounts connected
  • Chat Engine: Not set up
  • Plan: Pro (5000 AI interactions/month)

AI Response:

"Hi Priya! I'm your AI copilot for LogicSpike. I can see you've built a solid blog with 15 posts across recipes, bakery news, and tutorials. Your recipe posts are getting the most traffic — nice! I noticed you haven't connected any social accounts yet. Want me to help you get more readers by setting up content scheduling?"

Step 3: Preference Learning

Priya replies: "I don't want to deal with social media right now. Just help me with my blog."

Backend Operations:

  1. Extract preference: { type: "preference", content: "Focus on blog only, not interested in social media currently", entity: "content-engine", importance: 0.8 }
  2. Store in ai_memory with embedding
  3. Future interactions will not suggest social media unless Priya asks

AI Response:

"Got it — blog focus only. I'll keep my suggestions there. A few things I can help with: writing ideas based on what's working, SEO improvements, publish scheduling, and traffic analysis. Just ask me anything."

Step 4: Outcome

  • AI has baseline context (15 posts, 3 categories, Pro plan)
  • One preference stored (blog-only focus)
  • Priya feels understood, not overwhelmed

Journey B: Diagnostic Query — "Why Did My Traffic Drop?"

Persona: Priya, 3 weeks into using the AI. She notices her blog views are down.

Goal: The AI should diagnose the issue using cross-product data, not just give generic advice.

Step 1: Trigger

Priya types: "My blog traffic dropped a lot this week. What happened?"

Step 2: Intent Classification (Router Agent)

{
  "intent": "analytics_diagnosis",
  "services": ["blog"],
  "entities": ["traffic", "blog"],
  "time_scope": "recent",
  "specialist": "analytics"
}

Cost: ~50 tokens, ~100ms

Step 3: Lazy Context Assembly

Only relevant data is pulled (in parallel):

  • Blog analytics: views per day (last 30 days)
  • Recent publish history: dates and titles
  • Memories linked to "blog" and "traffic" entities
  • Tenant profile: bakery, recipes niche

NOT pulled: Chat engine stats, billing info, media uploads, content calendar

Step 4: Analytics Specialist Diagnosis

The specialist agent receives compressed context (~2500 tokens) and reasons:

  1. Traffic was steady at ~120 views/day for 2 weeks
  2. Dropped to ~45 views/day this week
  3. Priya published 3 posts/week for 3 weeks, then 0 posts this week
  4. Top post ("Chocolate Truffle Recipe") is losing search ranking (declining daily)

AI Response:

"I found the issue — you published 3 posts per week for the last 3 weeks, then nothing this week. Your traffic correlates strongly with publish frequency. Also, your top post 'Chocolate Truffle Recipe' is losing momentum — it's been declining ~8% daily.

My recommendation:

  1. Publish at least 2 posts this week to recover momentum
  2. Update 'Chocolate Truffle Recipe' with fresh content to boost it

Want me to suggest topics for your next 2 posts?"

Step 5: Decision Logging

{
  "decision_id": "dec_abc123",
  "action": "diagnosed_traffic_drop",
  "reasoning": "publish_gap_correlation + top_post_decay",
  "suggested_actions": ["publish_2_posts", "update_top_post"],
  "awaiting_outcome": true
}

Step 6: Outcome Tracking

  • If Priya publishes 2 posts and traffic recovers → reinforce pattern: "publish frequency directly impacts traffic for this tenant"
  • If traffic doesn't recover → the diagnosis was incomplete, need deeper analysis next time

Journey C: Action Execution — "Schedule Posts for Next Week"

Persona: Priya, following up on Journey B's recommendation.

Goal: The AI should take concrete action, not just advise.

Step 1: Trigger

Priya types: "Yes, suggest 2 topics and schedule them for Monday and Thursday"

Step 2: Intent Classification

{
  "intent": "content_creation",
  "services": ["blog"],
  "entities": ["posts", "schedule"],
  "specialist": "blog",
  "action_required": true
}

Step 3: Blog Specialist Generates Topics

Using context: bakery niche, recipe posts perform best, chocolate truffle is top post, Priya's writing style from past posts.

AI Response:

"Based on what works for your audience, here are 2 topics:

  1. Monday: '5 Easy Diwali Sweet Recipes for Home Bakers' — seasonal + recipe format (your best combo)
  2. Thursday: 'The Secret to Perfect Chocolate Ganache' — related to your top post, will cross-link for SEO boost

Should I create draft outlines for both and schedule them?"

Step 4: User Approves

Priya: "Perfect, do it"

Step 5: Tool Execution

The blog specialist calls two tools:

  1. blog.create_draft → Creates draft post with AI-generated outline for "5 Easy Diwali Sweet Recipes for Home Bakers", scheduled for Monday
  2. blog.create_draft → Creates draft post with AI-generated outline for "The Secret to Perfect Chocolate Ganache", scheduled for Thursday

Backend Operations:

  • Two blog posts created in blog_posts table with status draft and scheduled_at timestamps
  • Decision logged: action: "created_2_scheduled_drafts"
  • Memory updated: "Priya prefers AI to suggest topics and schedule, not just advise"

AI Response:

"Done! I've created 2 draft outlines in your blog:

  • 'Diwali Sweet Recipes' — scheduled for Monday 9:00 AM
  • 'Perfect Chocolate Ganache' — scheduled for Thursday 9:00 AM

You can edit the drafts anytime in your blog dashboard. I'll check back after they publish to see how they perform."


Journey D: Proactive Insight — AI Initiates Contact

Persona: Priya, 2 months into using LogicSpike. The AI has accumulated significant memory about her business.

Goal: The AI surfaces insights without being asked — this is the "run my business" experience.

Step 1: Trigger (Cron — Insight Engine)

The insight engine runs every 6 hours. For Priya's tenant, it detects:

  • Her blog post "Diwali Sweet Recipes" got 3x more views than average
  • 40% of chatbot conversations this week asked about "eggless cake recipes" — a topic she hasn't covered
  • Her publish schedule has been consistent (the AI's earlier recommendation worked)

Step 2: Insight Card Generation

[
  {
    "type": "opportunity",
    "priority": "high",
    "title": "Your audience wants eggless cake recipes",
    "body": "40% of chatbot questions this week were about eggless cakes. You don't have a blog post on this yet — this is a content gap with proven demand.",
    "suggested_action": "create_blog_post",
    "action_params": { "topic": "eggless cake recipes" }
  },
  {
    "type": "win",
    "priority": "medium",
    "title": "Diwali Sweet Recipes is a hit!",
    "body": "Your Diwali post got 340 views — 3x your average. Seasonal + recipe content is your winning formula.",
    "suggested_action": null
  }
]

Step 3: Dashboard Notification

Priya sees a notification badge on the AI Copilot tab. When she opens it:

💡 New Insight: Your audience wants eggless cake recipes 40% of chatbot questions this week were about eggless cakes. You don't have a blog post on this yet. [Write This Post] ← one-click action

Step 4: One-Click Action

Priya clicks "Write This Post". The AI creates a draft with:

  • Title optimized based on her best-performing post patterns
  • Outline structured like her other recipe posts
  • SEO metadata pre-filled
  • Scheduled for her best-performing publish day (Monday)

Step 5: Outcome

  • Cross-product insight (chatbot data → blog action) — only possible because the AI Brain spans all services
  • Memory updated: pattern: "seasonal recipe content gets 3x engagement for this tenant"
  • This pattern will influence future suggestions

Journey E: Memory Maturity — AI Gets Smarter Over Time

Persona: Priya, 6 months in. The AI Brain has processed ~500 interactions and tracked ~50 decision outcomes.

Goal: Demonstrate how accumulated memory produces noticeably better assistance.

Step 1: Month 1 vs Month 6 Comparison

Month 1 — Generic:

Priya: "What should I write about?" AI: "Here are some popular food blog topics: meal prep, restaurant reviews, healthy eating tips..."

Month 6 — Personalized:

Priya: "What should I write about?" AI: "Based on your data: recipe posts get 2.8x more views than news posts. Your audience engages most with seasonal content (Diwali post: 340 views, Holi post: 290 views). Raksha Bandhan is in 3 weeks — a sweet recipes post would likely perform well. Your eggless content also has a 40% higher completion rate. I'd suggest: 'Easy Eggless Raksha Bandhan Sweets'. Want me to draft it?"

Step 2: What Changed

The AI has accumulated:

Memory Type Count Example
Preferences 12 "Focus on blog, not social media"
Patterns 8 "Recipe posts get 2.8x more views"
Facts 15 "Business is a bakery in Mumbai"
Episodes 45 "Suggested Diwali post → 340 views (success)"
Entity Links 30 blog → traffic → recipe → seasonal

Step 3: The Maturity Loop


Journey F: Team Member Using the Copilot

Persona: Rahul, a content writer hired by Priya. He has writer role with scoped permissions.

Goal: The AI respects permission boundaries while still being helpful.

Step 1: Trigger

Rahul types: "What's our revenue this month?"

Step 2: Permission Check

The AI checks Rahul's permissions via core-access:

  • blog.read
  • blog.write
  • billing.read
  • analytics.revenue

AI Response:

"I can't share revenue data — that requires billing access which your role doesn't include. But I can help you with blog content! Want me to suggest your next article based on what's performing well?"

Step 3: Scoped Assistance

Rahul: "Sure, what should I write?"

The AI uses the same memory and patterns but only accesses blog tools, not billing or analytics revenue data. It can still tell Rahul which content formats work best.

AI Response:

"Your team's recipe posts consistently outperform other categories by 2.8x. The audience also loves seasonal content. I'd suggest writing an 'Eggless Monsoon Chai Cake' recipe — it combines your two best-performing formats. Want an outline?"


Journey G: Business Autopilot — "Run My Content Calendar"

Persona: Priya, 4 months in. She trusts the AI and wants to automate her content workflow.

Goal: The AI manages her blog publishing schedule autonomously, with approval checkpoints.

Step 1: Trigger

Priya types: "Can you handle my blog calendar for the next month? I want to publish 3 times a week."

Step 2: AI Creates a Plan

Using accumulated memory (best topics, optimal days, seasonal events, audience preferences), the AI generates a 4-week content calendar:

AI Response:

"Here's your 4-week plan — 12 posts, 3/week (Mon, Wed, Fri at 9 AM IST):

Week 1:

  • Mon: 'Monsoon Special: Crispy Pakora Variations'
  • Wed: 'How to Store Homemade Sweets for 2 Weeks'
  • Fri: 'Behind the Scenes: A Day at Our Bakery'

Week 2:

  • Mon: '5 Eggless Cake Recipes That Actually Taste Amazing'
  • Wed: 'The Science of Perfect Bread Rising'
  • Fri: 'Customer Spotlight: Wedding Cake Stories'

(... weeks 3-4 ...)

I've mixed recipe posts (your top performer), behind-the-scenes (growing format), and educational content. Want me to create all drafts and schedule them? You can review and edit each one before publish."

Step 3: Approval & Execution

Priya: "Love it. Create all the drafts."

Backend Operations:

  1. 12 calls to blog.create_draft with AI-generated outlines
  2. Each post scheduled with status: "draft" and scheduled_at timestamp
  3. Memory: "Priya approved full-month autopilot — she trusts the AI for topic selection and scheduling"
  4. Insight engine will track performance of each post and refine future calendars

4. Edge Cases & Error Paths

Scenario AI Behavior
User asks about a service they haven't set up "You haven't set up the chat engine yet. Want me to walk you through it?" — suggest onboarding, don't error
User hits plan limit (e.g., Free plan, 50 interactions) "You've used 48 of 50 AI interactions this month. I'll keep helping — just letting you know you're close to the limit. Upgrade to Starter for 500/month."
LLM provider is down (OpenAI outage) Router automatically falls back to next provider (Claude → Gemini). If all fail: "I'm having trouble thinking right now — my AI providers are experiencing issues. Try again in a few minutes."
User asks the AI to do something destructive "I can delete all your draft posts, but this can't be undone. Are you sure? Type 'confirm delete' to proceed." — always confirm destructive actions
User gives contradictory preferences "Last time you said you wanted blog-only focus, but now you're asking about social scheduling. Should I update my understanding? I'm happy to help with social too."
Memory retrieves stale/wrong context Agent checks freshness: if memory is >30 days old and contradicts current data, discard memory and use live data. Log the stale memory for pruning.
Multi-language input Detect language on first message (franc). Respond in the same language. Knowledge retrieval uses English embeddings with cross-translation.
User asks something completely outside LogicSpike "I'm focused on helping you run your business on LogicSpike — I can't help with general questions like that. But I'm great at blog strategy, content planning, and analytics!"

5. Success Metrics

Metric Target (Month 1) Target (Month 6)
First response latency (time to first token) < 300ms < 250ms
Task completion rate (user's goal achieved) > 60% > 85%
Action acceptance rate (user approves suggested action) > 40% > 70%
Return rate (users who come back to copilot daily) > 20% > 50%
Proactive insight click-through > 15% > 30%
Memory-assisted responses (used stored context) > 30% > 80%
Escalation rate (user rephrases / gives up) < 30% < 10%
AI Brain