Internal R&D•Systems Architecture

AI Sales Assistant & Chatbot

An AI sales assistant chatbot built with Google Gemini and serverless cloud functions. It uses static vector RAG and multi-turn context, and connects lead workflows to HubSpot CRM and Slack.

In-Memory
Local Vector Cache
Precomputed offline embeddings
Context-Aware
Query Synthesis
Pronoun & multi-turn resolution
0 Tokens
Embedding Boot Overhead
Zero remote vector DB roundtrips
Connected
HubSpot CRM & Slack
Lead workflow integrations

Serverless RAG & Tool Execution Pipeline

Incoming client chat queries stream over Serverless Cloud Functions into memory. The precomputed vector cache computes semantic cosine distance locally in-memory without remote vector database roundtrips. Extracted engineering context and persistent client entity state are injected into Google Gemini, with lead workflows connected to HubSpot CRM and Slack.

1. Client Interaction

SSE chunk streaming with visualViewport keyboard anchoring.

2. Static Vector RAG

Precomputed vector cache loads in <2ms with zero cold start.

3. Entity Memory

Tracks client requirements in secure session storage across extended dialogue.

4. Reasoning Engine & Tools

Streams responses while progressively executing structured tool calls.

5. Real-Time Slack Dispatch

Posts formatted Block Kit cards with project details and budget.

Zero Cold-Start Static Vector RAG

  • Build-Time Vector Precomputation: Encodes domain engineering dossiers and service specifications offline, serializing dense vector embeddings directly into bundled application assets.
  • In-Memory Vector Retrieval: Loads precomputed vector arrays synchronously into serverless container memory during cold boot, bypassing remote vector DB roundtrips entirely.
  • Zero Runtime Embedding Costs: Knowledge base lookup incurs zero embedding API token consumption on startup, eliminating external rate limit risks during traffic spikes.
  • Threshold-Gated Vector Filtering: Evaluates incoming query embeddings against local vector spaces using cosine similarity thresholds, selecting the most relevant technical context to ground responses.

Contextual Multi-Turn Query Synthesis

  • Pronoun Blindspot Resolution: Automatically detects concise queries or referential pronouns ("it", "that", "they") in follow-up user messages.
  • Prior Context Concatenation: Seamlessly merges immediate prior user context into vector lookups, preventing semantic drift during back-and-forth technical Q&A.
  • Adaptive Precision Lift: Significantly boosts vector retrieval confidence on follow-up questions, ensuring the exact technical architecture chunk ranks as the top match.

Dual-Layer Entity State Memory

  • Decoupled State Architecture: Separates the sliding conversational transcript from persistent client entity state stored securely in dedicated session metadata.
  • Context Amnesia Prevention: Client requirements, target timelines, and budgets survive indefinitely even if initial introductory messages scroll past the active history window.
  • Dynamic Prompt Injection: Automatically injects verified client memory into system instructions on every turn under strict guidelines to avoid redundant intake questions.

Native Autonomous Tool Calling

  • Piecewise Parameter Assembly: Evaluates dialogue turns progressively, aggregating client name, email, project scope, budget, and timeline across multiple messages.
  • Atomic Record Deduplication: Writes captured leads directly to an isolated persistent store with upsert merging, cleanly updating existing profiles instead of creating fragmented duplicates.
  • Synchronous Follow-Up Streaming: Feeds function execution responses back into the model context, allowing the assistant to thank the user and continue the consultation naturally.

HubSpot CRM & Slack Integrations

  • CRM Lead Workflow: Connects captured sales leads to HubSpot CRM.
  • Slack Notifications: Dispatches formatted lead details to the engineering channel through Slack webhooks.
  • Follow-Up Updates: Sends Slack notifications when prospective clients add project information later in the conversation.
  • Defensive Text Sanitization: Sanitizes incoming payload structures against formatting exploits or markup anomalies before outbound webhook dispatch.

Enterprise Guardrails & Access Governance

  • Input Validation Boundaries: Isolates inbound conversational payloads within strict formatting envelopes, enforcing defensive structural parsing across all client interactions.
  • Jailbreak & Prompt Tampering Defenses: Proactively defers adversarial prompt manipulation and unauthorized role reassignment before reaching inference loops.
Execution Artifact · Slack Block Kit Payload
Live Webhook Output
AI
Cubog Lead BotAPP · Today at 4:45 PM
🚀 New Lead Captured via Cubog AI Chat!
Client NameSarah Vance
Emailsarah.vance@example.com
TimelineQ1 Target Launch
BudgetMilestone-Based / Custom Scope
“Looking to build a cross-platform telemedicine app in React Native with WebRTC video calling and HealthKit integration.”
Verified Client Lead · Dispatched to Team Slack
RAG Pipeline · Multi-Turn Query Synthesis
Contextual Match
1. Raw User Follow-Up Turn
“"What brokers does it connect to?"”
⚠️ Ambiguity: Isolated pronoun "it" lacks semantic target for vector retrieval.
2. Synthesized Vector Lookup (Prior Context + Query)
“"Tell me about the options trading engine. What brokers does it connect to?"”
✓ High-Confidence Match: Accurately ranks Interactive Brokers & Alpaca adapters.
Live Demonstration

Experience the Assistant in Real Time

Test the autonomous sales consultant using the live widget in the bottom-right corner, or get in touch to discuss building custom agentic workflows for your engineering stack.

Book Discovery Call
Cubog SoftwareCubog Software

Miami software engineering company and consultancy. Building production-grade web, mobile, and backend systems.

© 2026 Cubog Software. All rights reserved.