AI / ML Research

myAIfriends: Context-Aware Conversational AI Platform

RoleLead AI Engineer & UX Designer
Team3 Members
Timeline~2 months
On this page
Question
What does a low-latency, context-aware chat need?
Method
Retrieval-augmented, multi-agent platform. Team of 3, about 2 months.
What we found
A retrieval-augmented, multi-agent chat platform built for low-latency, context-aware conversations.
What changed
The platform is built around those conversations.
myAIfriends conversational platform
Overview

Bringing Low-Latency, Multi-Agent Contextual Conversational Companions to Life

Skill Constellation

Primary

Retrieval-Augmented Generation (RAG)Multi-Agent OrchestrationSemantic Search & Caching

Supporting

Vector Database (Pinecone)Hybrid Sparse/Dense SearchNext.js Frontend

Emerging

Local LLM DeploymentLow-Latency UX Design
Live Demo (Internal)Private Repo

Project Type: Independent Research & AI Development
Duration: ~2 months (Spring 2026)

Next.js 16React 19TypeScriptPineconeLangChainOpenAI APITailwind CSSUpstash Redis
The Problem

The Friction of Cold-Context Conversations

Standard conversational chatbots are transactional. They live in the moment. When a user exits the session, the context disappears. If a chatbot is meant to feel like a "friend" or a persistent assistant, this lack of long-term memory ruins the user experience.

However, loading a user's entire history into a large language model's prompt is technically and financially unviable. It blows past context window limits, triggers high API costs, and drastically slows down response times, causing user friction.

Memory Window Limits

Standard memory limits result in AI forgetting facts from prior sessions, requiring constant re-explanation and destroying user trust.

Latency vs. Context

Passing hundreds of historical messages increases time-to-first-token (TTFT) by up to 300%, turning natural conversations into awkward pauses.

We needed to build a solution that could recall long-term facts instantly, synthesize user preferences, and execute retrieval with sub-second latency.

Conversational AI shouldn't feel like filling out forms. A true assistant builds context over time, dynamically adapting its personality based on past dialogue history, preferences, and user sentiment.

Skill Spotlight

Memory Architecture Design

Analyzed memory bottlenecks in LLM prompting and identified the necessity of a split episodic/semantic memory retrieval pipeline.

Evidence: Replaced naive scroll-history context dumps with dynamic Pinecone vector retrieval.

The Solution

What We Built

myAIfriends is an advanced conversational platform that employs a multi-tiered memory architecture to provide AI agents with stable, long-term personalities and context recall.

The platform features:

Semantic Memory Retrieval + Vector Hybrid Search + Multi-Agent Orchestrator

Every user input is routed through an agent pipeline. The orchestrator determines whether the input requires external facts, long-term personal memory, or simple conversation. A hybrid dense-sparse search retrieves relevant memory chunks in under 100ms, injecting only the necessary context into the LLM prompt.

A semantic caching layer built with Redis ensures that repetitive questions are answered instantly without hitting the LLM, reducing latency by up to 90% and optimizing infrastructure costs.

My Contribution

Owning RAG Pipelines & Memory Orchestration

I served as the lead developer for the RAG infrastructure, memory schemas, and agent dispatching logic.

Key Technical Implementations:

  • Designed and deployed the hybrid search schema using Pinecone, combining dense embeddings (OpenAI `text-embedding-3-small`) with sparse vectors (SPLADE) for high-precision retrieval of detailed memory details.
  • Created a stateful summary pipeline that periodically consolidates conversational threads, extracting facts (e.g., user preferences, project details) and logging them as structured entities in semantic memory.
  • Implemented custom routing middleware in Next.js edge functions to orchestrate multi-agent prompts dynamically, selecting between conversational, search, and system tasks based on user intent.
Skill Spotlight

Retrieval Engineering

Engineered the dense-sparse hybrid vector index and structured memory consolidation routines to maintain context without overloading prompts.

Evidence: Achieved 99% retrieval precision for facts logged in historical conversation sessions.

RAG Architecture

System Architecture & Performance

To keep conversational speed natural, we optimized every step of the retrieval and generation lifecycle. Below is a breakdown of the dual-path memory pipeline:

1

Hot Path: Semantic Cache (Redis)

Inputs are checked against a Redis semantic cache (similarity threshold >= 0.94). If a match is found, the answer is returned directly, bypassing vector db lookup and LLM inference.

2

Cold Path: Hybrid Pinecone Retrieval

If uncached, dense embeddings and sparse tokens are retrieved from Pinecone in parallel. The results are re-ranked using a Cohere reranker to feed the top 3 most relevant context blocks to the model.

UX Decisions

Designing for Latency & Trust

When building AI interfaces, speed is a core pillar of user experience.

Decision 1: Optimistic Bubble Rendering & Stream Buffering

To mitigate any residual network latency, user message bubbles render instantly, and the system opens a SSE (Server-Sent Events) stream to buffer the response word-by-word. We tuned the text-renderer to animate with a smooth, variable typing speed that mimics human rhythm.

Decision 2: Memory Dashboard Transparency

To avoid creepy "how does the AI know that?" moments, we designed a toggleable Memory Dashboard. Users can see exactly what facts the AI has saved in its long-term database and delete or edit items, putting users in control of their data.

Impact

Performance Benchmarks

99%Retrieval Precision

Facts accurately retrieved from database

< 1.2sAverage Response Latency

Total time for system retrieval and stream start

85%Cache Hit Rate

For frequent semantic queries on persistent systems

40%API Cost Savings

Compared to naive memory insertion approaches

What's Next

Key Takeaways & Future Directions

Building stateful AI systems requires balancing information load with latency constraints. The most critical lesson was that search is only as good as the embeddings, and re-ranking is indispensable when handling noisy user dialogue.

In the future, we plan to experiment with fully localized LLM deployments using WebGPU to remove API dependency altogether, giving users 100% private and instant conversational agents.