Skip to content

Neuro Persona#107

Open
yashjcodes wants to merge 2 commits intoLamatic:mainfrom
yashjcodes:main
Open

Neuro Persona#107
yashjcodes wants to merge 2 commits intoLamatic:mainfrom
yashjcodes:main

Conversation

@yashjcodes
Copy link
Copy Markdown

@yashjcodes yashjcodes commented Mar 26, 2026

What This Kit Does

Neuro Persona is a multi-personality AI chatbot that allows users to interact with famous personalities from history, politics, business, and pop culture. Instead of generic responses, the agent adapts tone, thinking style, and opinions based on the selected personality.

Users simply choose or type a personality (e.g., Elon Musk, Steve Jobs, Krishna, Chanakya), ask a question, and the agent responds as if that person is answering—using their mindset, communication style, and known beliefs.

The system uses structured prompts, contextual grounding, and memory to ensure responses feel authentic, opinionated, and consistent.

Core Functionality
Accepts user query + selected personality
Applies persona conditioning layer (tone, beliefs, communication style)
Generates responses aligned with that personality’s thinking
Maintains conversational memory for continuity
Allows dynamic switching between personalities in real-time
Architecture Overview
Persona Engine
Maps each personality to:
Thinking style
Communication tone
Core beliefs & biases
Uses prompt engineering to enforce behavioral consistency
Response Generation
Uses LLM (via OpenRouter / Gemini)
Injects:
Personality context
User query
Conversation history
Memory Layer (Optional)
Stores past conversations
Enables contextual follow-ups
Can be backed by vector DB (e.g., Weaviate via Lamatic)
Flows
Chat Flow
Input: { personality, user_query }
Steps:
Load persona profile
Inject system prompt with personality traits
Retrieve past conversation (if enabled)
Generate response
Store interaction in memory
Frontend Features
Dark-themed, immersive UI
Personality input / selector
Chat interface styled like “talking to a real person”
Typing + thinking states
Local session persistence
Optional voice / sound effects
Providers & Prerequisites
Lamatic.ai → orchestration + optional memory
OpenRouter / Gemini → LLM responses
(Optional) Weaviate → vector memory for conversations
How to Run Locally
cd kits/agentic/neura-persona
npm install
cp .env.example .env.local

Add API keys

npm run dev
Project Structure
kits/
└── agentic/
└── NeuroPersona/
├── app/
├── components/
├── flows/
├── lib/
├── public/
├── .env.example
├── config.json
└── README.md
Key Features
Multi-personality simulation
Real-time conversational switching
Personality-consistent responses
Scalable persona system (add unlimited personalities)
RAG-ready architecture for deeper realism
Use Cases
Learn from historical figures
Simulate mentorship from industry leaders
Explore different perspectives on one problem
Fun & engaging AI conversations
Deployment
Fully compatible with Vercel deployment
Works end-to-end with environment configuration
Summary

Neura Persona transforms traditional chatbots into interactive personality simulations, letting users think, learn, and explore ideas through the lens of the world’s most influential figures.
Screenshot 2026-03-26 164050
Screenshot 2026-03-26 164023

Changes

  • Added Neuro Persona Kit: New multi-personality AI chatbot allowing users to interact with simulated famous personalities (e.g., Elon Musk, Einstein, Shakespeare, Steve Jobs)

    • Full Next.js app with dark-themed UI and personality selection interface
    • Chat interface supporting persona-aligned response generation via LLM
    • Features: persona conditioning layer, conversational memory, dynamic persona switching, suggestion prompts
  • Core Components:

    • Persona Engine for tone/beliefs/communication style mapping
    • Multi-step orchestration workflow (step1, step2A, step2B, step2C, step3)
    • UI state management for user/assistant messages with typing/thinking states
    • References/sources sidebar with discovered links
    • URL-based autostart support with local session persistence
  • Infrastructure:

    • Integrations: Lamatic.ai orchestration, OpenRouter/Gemini LLM, optional Weaviate for vector memory
    • Vercel-deployable Next.js application
    • Component library with UI kit included
  • Removed: kits/agentic/deep-search/app/page.tsx (586 lines) — functionality integrated into NeuroPersona architecture

File changes: +1196 / -586 (net: +610)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

📝 Walkthrough

Walkthrough

The pull request migrates the deep-search agentic chat component to a new NeuroPersona component. The replacement adds personality selection functionality and augmented query building while maintaining the core multi-step pipeline orchestration, message management, and reference display behavior.

Changes

Cohort / File(s) Summary
Component Migration
kits/agentic/deep-search/app/page.tsx (removed), kits/agentic/NeuroPersona/app/page.tsx (added)
Replaced agentic chat component with NeuroPersona variant. New component introduces personality picker (free-text or preset chips), augmented query building with persona instructions, and enhanced UI staging (personality → initial chat → active chat). Retains multi-step orchestration (step1, step2A, step2B, step2C, step3), progressive message updates with typewriter effect, link aggregation for consulting pills and references sidebar, auto-scroll behavior, and URL parameter-based auto-start with cleanup.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Neuro Persona' refers to the main feature added in this PR but lacks specificity about the change itself. Consider a more descriptive title such as 'Add Neuro Persona multi-personality chatbot UI' to better convey what was implemented.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
kits/agentic/NeuroPersona/app/page.tsx (1)

922-923: Use lucide-react for the remaining UI glyphs.

The close affordance and suggestion arrow are still hard-coded as / , so this page mixes raw glyphs with the shared icon set already used elsewhere in the kit.

As per coding guidelines, "Use lucide-react for icons throughout kits".

Also applies to: 1007-1008


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3865ebda-c68b-4ebb-8186-b907af232e00

📥 Commits

Reviewing files that changed from the base of the PR and between 4e2f140 and 92f8f94.

⛔ Files ignored due to path filters (3)
  • kits/agentic/NeuroPersona/app/icon.png is excluded by !**/*.png
  • kits/agentic/NeuroPersona/public/lamatic-logo.png is excluded by !**/*.png
  • kits/agentic/NeuroPersona/public/placeholder.svg is excluded by !**/*.svg
📒 Files selected for processing (122)
  • kits/agentic/NeuroPersona/.env.example
  • kits/agentic/NeuroPersona/.gitignore
  • kits/agentic/NeuroPersona/.npmrc
  • kits/agentic/NeuroPersona/LICENSE
  • kits/agentic/NeuroPersona/README.md
  • kits/agentic/NeuroPersona/actions/orchestrate.ts
  • kits/agentic/NeuroPersona/app/globals.css
  • kits/agentic/NeuroPersona/app/layout.tsx
  • kits/agentic/NeuroPersona/app/page.tsx
  • kits/agentic/NeuroPersona/components.json
  • kits/agentic/NeuroPersona/components/theme-provider.tsx
  • kits/agentic/NeuroPersona/components/ui/accordion.tsx
  • kits/agentic/NeuroPersona/components/ui/alert-dialog.tsx
  • kits/agentic/NeuroPersona/components/ui/alert.tsx
  • kits/agentic/NeuroPersona/components/ui/aspect-ratio.tsx
  • kits/agentic/NeuroPersona/components/ui/avatar.tsx
  • kits/agentic/NeuroPersona/components/ui/badge.tsx
  • kits/agentic/NeuroPersona/components/ui/breadcrumb.tsx
  • kits/agentic/NeuroPersona/components/ui/button.tsx
  • kits/agentic/NeuroPersona/components/ui/calendar.tsx
  • kits/agentic/NeuroPersona/components/ui/card.tsx
  • kits/agentic/NeuroPersona/components/ui/carousel.tsx
  • kits/agentic/NeuroPersona/components/ui/chart.tsx
  • kits/agentic/NeuroPersona/components/ui/checkbox.tsx
  • kits/agentic/NeuroPersona/components/ui/collapsible.tsx
  • kits/agentic/NeuroPersona/components/ui/command.tsx
  • kits/agentic/NeuroPersona/components/ui/context-menu.tsx
  • kits/agentic/NeuroPersona/components/ui/dialog.tsx
  • kits/agentic/NeuroPersona/components/ui/drawer.tsx
  • kits/agentic/NeuroPersona/components/ui/dropdown-menu.tsx
  • kits/agentic/NeuroPersona/components/ui/form.tsx
  • kits/agentic/NeuroPersona/components/ui/hover-card.tsx
  • kits/agentic/NeuroPersona/components/ui/input-otp.tsx
  • kits/agentic/NeuroPersona/components/ui/input.tsx
  • kits/agentic/NeuroPersona/components/ui/label.tsx
  • kits/agentic/NeuroPersona/components/ui/menubar.tsx
  • kits/agentic/NeuroPersona/components/ui/navigation-menu.tsx
  • kits/agentic/NeuroPersona/components/ui/pagination.tsx
  • kits/agentic/NeuroPersona/components/ui/popover.tsx
  • kits/agentic/NeuroPersona/components/ui/progress.tsx
  • kits/agentic/NeuroPersona/components/ui/radio-group.tsx
  • kits/agentic/NeuroPersona/components/ui/resizable.tsx
  • kits/agentic/NeuroPersona/components/ui/scroll-area.tsx
  • kits/agentic/NeuroPersona/components/ui/select.tsx
  • kits/agentic/NeuroPersona/components/ui/separator.tsx
  • kits/agentic/NeuroPersona/components/ui/sheet.tsx
  • kits/agentic/NeuroPersona/components/ui/sidebar.tsx
  • kits/agentic/NeuroPersona/components/ui/skeleton.tsx
  • kits/agentic/NeuroPersona/components/ui/slider.tsx
  • kits/agentic/NeuroPersona/components/ui/sonner.tsx
  • kits/agentic/NeuroPersona/components/ui/switch.tsx
  • kits/agentic/NeuroPersona/components/ui/table.tsx
  • kits/agentic/NeuroPersona/components/ui/tabs.tsx
  • kits/agentic/NeuroPersona/components/ui/textarea.tsx
  • kits/agentic/NeuroPersona/components/ui/toast.tsx
  • kits/agentic/NeuroPersona/components/ui/toaster.tsx
  • kits/agentic/NeuroPersona/components/ui/toggle-group.tsx
  • kits/agentic/NeuroPersona/components/ui/toggle.tsx
  • kits/agentic/NeuroPersona/components/ui/tooltip.tsx
  • kits/agentic/NeuroPersona/components/ui/use-mobile.tsx
  • kits/agentic/NeuroPersona/components/ui/use-toast.ts
  • kits/agentic/NeuroPersona/config.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-data-source/README.md
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-data-source/config.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-data-source/inputs.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-data-source/meta.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-final/README.md
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-final/config.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-final/inputs.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-final/meta.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-generate-steps/README.md
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-generate-steps/config.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-generate-steps/inputs.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-generate-steps/meta.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-search-web/README.md
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-search-web/config.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-search-web/inputs.json
  • kits/agentic/NeuroPersona/flows/agentic-reasoning-search-web/meta.json
  • kits/agentic/NeuroPersona/flows/crawling-indexation/README.md
  • kits/agentic/NeuroPersona/flows/crawling-indexation/config.json
  • kits/agentic/NeuroPersona/flows/crawling-indexation/inputs.json
  • kits/agentic/NeuroPersona/flows/crawling-indexation/meta.json
  • kits/agentic/NeuroPersona/flows/gdrive/README.md
  • kits/agentic/NeuroPersona/flows/gdrive/config.json
  • kits/agentic/NeuroPersona/flows/gdrive/inputs.json
  • kits/agentic/NeuroPersona/flows/gdrive/meta.json
  • kits/agentic/NeuroPersona/flows/gsheet/README.md
  • kits/agentic/NeuroPersona/flows/gsheet/config.json
  • kits/agentic/NeuroPersona/flows/gsheet/inputs.json
  • kits/agentic/NeuroPersona/flows/gsheet/meta.json
  • kits/agentic/NeuroPersona/flows/onedrive/README.md
  • kits/agentic/NeuroPersona/flows/onedrive/config.json
  • kits/agentic/NeuroPersona/flows/onedrive/inputs.json
  • kits/agentic/NeuroPersona/flows/onedrive/meta.json
  • kits/agentic/NeuroPersona/flows/postgres/README.md
  • kits/agentic/NeuroPersona/flows/postgres/config.json
  • kits/agentic/NeuroPersona/flows/postgres/inputs.json
  • kits/agentic/NeuroPersona/flows/postgres/meta.json
  • kits/agentic/NeuroPersona/flows/s3/README.md
  • kits/agentic/NeuroPersona/flows/s3/config.json
  • kits/agentic/NeuroPersona/flows/s3/inputs.json
  • kits/agentic/NeuroPersona/flows/s3/meta.json
  • kits/agentic/NeuroPersona/flows/scraping-indexation/README.md
  • kits/agentic/NeuroPersona/flows/scraping-indexation/config.json
  • kits/agentic/NeuroPersona/flows/scraping-indexation/inputs.json
  • kits/agentic/NeuroPersona/flows/scraping-indexation/meta.json
  • kits/agentic/NeuroPersona/flows/sharepoint/README.md
  • kits/agentic/NeuroPersona/flows/sharepoint/config.json
  • kits/agentic/NeuroPersona/flows/sharepoint/inputs.json
  • kits/agentic/NeuroPersona/flows/sharepoint/meta.json
  • kits/agentic/NeuroPersona/hooks/use-mobile.ts
  • kits/agentic/NeuroPersona/hooks/use-toast.ts
  • kits/agentic/NeuroPersona/lib/lamatic-client.ts
  • kits/agentic/NeuroPersona/lib/utils.ts
  • kits/agentic/NeuroPersona/next.config.mjs
  • kits/agentic/NeuroPersona/orchestrate.js
  • kits/agentic/NeuroPersona/package.json
  • kits/agentic/NeuroPersona/postcss.config.mjs
  • kits/agentic/NeuroPersona/scripts/deploy.sh
  • kits/agentic/NeuroPersona/styles/globals.css
  • kits/agentic/NeuroPersona/tsconfig.json
  • kits/agentic/deep-search/app/page.tsx
💤 Files with no reviewable changes (1)
  • kits/agentic/deep-search/app/page.tsx

Comment on lines +103 to +105
const [showAuthModal, setShowAuthModal] = useState(false)
const [pendingQuery, setPendingQuery] = useState<string>("")
const hasTrackedRef = useRef(false)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Invalidate in-flight runs when the persona changes.

handlePersonalityReset() only clears local state. The awaited branches in handleSubmit() still update whichever assistant message is last, so an older run can repopulate a cleared chat or show the previous persona's answer under a newly selected one.

Suggested guard
+ const activeRequestIdRef = useRef(0)
+
  const handlePersonalityReset = () => {
+   activeRequestIdRef.current += 1
    setSelectedPersonality("")
    setPersonalityInput("")
    setPersonalityConfirmed(false)
    setMessages([])
    setInput("")
  }

  const handleSubmit = async (query: string) => {
    if (!query.trim() || isLoading) return
+   const requestId = ++activeRequestIdRef.current

    ...
-   setMessages((prev) => {
+   setMessages((prev) => {
+     if (activeRequestIdRef.current !== requestId) return prev
      const updated = [...prev]
      ...
      return updated
    })

    ...
  } finally {
-   setIsLoading(false)
+   if (activeRequestIdRef.current === requestId) {
+     setIsLoading(false)
+   }
  }

Also applies to: 157-163, 170-315

Comment on lines +136 to +148
useEffect(() => {
if (typeof window === "undefined") return
const url = new URL(window.location.href)
const autostart = url.searchParams.get("autostart")
const q = url.searchParams.get("query")
if (autostart === "1" && q && !isLoading && messages.length === 0) {
handleSubmit(q)
url.searchParams.delete("autostart")
url.searchParams.delete("query")
window.history.replaceState({}, "", url.toString())
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Gate URL autostart on a confirmed persona.

This effect calls handleSubmit(q) before any persona has been selected. Because the active chat is also gated on personalityConfirmed, the request runs in the background while the picker stays visible, and the URL params are removed immediately so the user cannot retry after choosing a persona.

Comment on lines +246 to +250
const step2CResult = await orchestratePipelineStep(augmentedQuery, history, "step2C", results)
if (step2CResult.success && step2CResult.data && Object.keys(step2CResult.data).length > 0) {
results.step2C = step2CResult.data
if (step2CResult.data?.links) allLinks.push(...step2CResult.data.links)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

step2C is wired here, but the backend flow config does not define it.

kits/agentic/NeuroPersona/orchestrate.js currently defines step1, step2A, step2B, and step3, not step2C. This branch therefore never contributes data, and the missing research leg is silently treated as healthy even though step3 still depends on it.

Comment on lines +1087 to +1101
{searchLinks.map((link, li) => (
<button
key={li}
onClick={() => window.open(link, "_blank")}
className="link-pill"
>
<img
src={getFaviconUrl(link) || "/placeholder.svg"}
alt=""
onError={(e) => { e.currentTarget.src = "/placeholder.svg?height=12&width=12" }}
/>
<span style={{ maxWidth: '96px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
{extractDomain(link)}
</span>
</button>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Validate orchestration-provided URLs before rendering them as links.

These values come from model/search output, but they are exposed directly as clickable pills/cards. A malicious javascript: or data: URL would still be surfaced to the user, and the pill path currently skips the safer anchor semantics you already use for the reference cards.

Suggested hardening
- {searchLinks.map((link, li) => (
-   <button
-     key={li}
-     onClick={() => window.open(link, "_blank")}
-     className="link-pill"
-   >
+ {searchLinks.filter(isSafeExternalUrl).map((link, li) => (
+   <a
+     key={li}
+     href={link}
+     target="_blank"
+     rel="noopener noreferrer"
+     className="link-pill"
+   >
      ...
-   </button>
+   </a>
  ))}
...
- {nextMessage.references.map((ref, ri) => (
+ {nextMessage.references.filter(isSafeExternalUrl).map((ref, ri) => (
    <a key={ri} href={ref} target="_blank" rel="noopener noreferrer" className="ref-card">

Add a small isSafeExternalUrl() helper nearby that only allows http: and https:.

Also applies to: 1144-1156

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants