Kairos AI
Elite AI assistant for developers, security engineers, and builders. Live Python, RAG indexing, multiβmodel, cloud sync, and a premium chat experience.
System Overview
Kairos is a featureβrich, privacyβfirst AI chat interface built for developers who need realβtime code execution, projectβaware context (RAG), and full control over LLM providers. It runs entirely in the browser (with optional Firebase sync) and supports localβonly workflows.
Instant Responses
Streaming markdown, low latency with Groq, Gemini, OpenRouter.
LocalβFirst RAG
Index your codebase β embeddings stored in IndexedDB, no external vector DB required.
Cloud Sync
Firestore chat history, pinned conversations, crossβdevice sync (optional).
Architecture Overview
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Kairos AI (Browser) β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β UI: c.html + modular CSS (tailwind + custom glass) β β βββ Markdown renderer (marked + highlight.js) β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β Core Logic (Vanilla JS) β β βββ Multiβprovider router: Groq, OpenRouter, Gemini β β βββ Streaming response + abort controller β β βββ Inline edit / regenerate / voice (TTS) β β βββ Template suggestions (/ slash) β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β Python Sandbox (Pyodide Worker) β β βββ Lazy load (first run) β β βββ Queue + abort + timeout (30s) β β βββ Output capture, save to chat β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β RAG Pipeline β β βββ Folder/file upload β tokenβaware chunker (500 tok) β β βββ Embedding worker (Transformers.js / MiniLM) β β βββ IndexedDB vector store (cosine + keyword hybrid) β β βββ Auto context injection into user prompts β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β Storage Layers β β βββ localStorage: API keys, preferences, templates β β βββ IndexedDB: RAG embeddings (per user) β β βββ Firestore: chat history, title, pin, public status β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Core Capabilities
Switch between 10+ models: Llama 3.3, Gemini 2.5 Flash, Qwen 3β32B, Nemotron, GPTβOSS, Kimi K2 β all free tiers.
Run any Python snippet directly in chat, view output, stop execution, and save output back to conversation.
Drop folders / files, index code chunks with embeddings, and ask questions with full file context.
Edit your previous messages β messages after that point are removed and AI regenerates.
Textβtoβspeech (Web Speech API) for AI responses, pause/resume, copy message text.
Type / to access saved prompt templates (customizable via Template Manager).
Set tone, code style, security focus β dynamic system prompt applied live.
Replace builtβin keys via Settings popup, stored locally.
Tech Stack
| Category | Technologies |
|---|---|
| Frontend | HTML5, Tailwind CSS, Vanilla JS, Marked, Highlight.js, Lottie, AOS |
| LLM Providers | Groq (Llama 3.3-70B, Mixtral), OpenRouter (Qwen, Nemotron), Google Gemini (2.5 Flash, FlashβLite) |
| Python Runtime | Pyodide (WebAssembly), custom worker with abort/timeout |
| Embedding & RAG | Transformers.js (Xenova/all-MiniLM-L6-v2), IndexedDB, hybrid search (cosine + keyword) |
| Database & Sync | Firebase Auth + Firestore (chat history), localStorage (prefs/keys/templates) |
| DevOps | Service Worker (offline first), Vercel/Netlify ready |
Quick Setup
1. Clone & serve
git clone https://github.com/thekaifansari01/kairos.ai
cd kairos.ai
python -m http.server 8000 # or npx serve2. Open browser β http://localhost:8000/c.html
3. Optional: Configure Firebase (chat sync) β edit js/modules/auth/firebase.js
4. Override API keys via Settings (βοΈ) β builtβin keys work but rateβlimited.
π Python Interpreter
Every code block with language python gets a Run button. Execution happens inside a Web Worker (Pyodide) β completely sandboxed, no server required.
- Lazy loading: Pyodide loads only when first Python code runs.
- Queue + abort: run multiple snippets, stop longβrunning code with Stop.
- Timeout protection: 30s max execution, autoβterminate.
- Save output: click π Save output to add result as assistant message.
- Limitations: threading, socket, multiprocessing not supported (Pyodide constraints).
print("Hello, local AI!")
for i in range(3): print(i)
π RAG β Code Indexing
Kairos can index your entire project (source code, configs, markdown) and inject relevant chunks into the LLM context automatically.
- Drop folder / files via the Index Manager (database icon in navbar).
- Files are chunked tokenβaware (max 500 tokens, overlap 50).
- Embeddings generated using
all-MiniLM-L6-v2(Transformers.js) β runs locally in a worker. - Stored in IndexedDB (perβuser when logged in, else global guest DB).
- During chat, the system performs hybrid search (cosine + keyword) and prepends relevant code snippets to your prompt.
- Manage indexed files: delete individual files or clear entire index.
π€ MultiβModel & Context Management
Click the model indicator (topβright navbar) or the + button near input to switch models. Supported providers:
| Provider | Models (Free) |
|---|---|
| Groq | Llama 3.3-70B, Llama 3.1-8B, Mixtral 8x7B, Gemma2 9B, Qwen 3-32B, GPTβOSS 120B |
| Google Gemini | Gemini 2.5 Flash, Gemini 2.5 FlashβLite, Gemini 3.1 FlashβLite Preview |
| OpenRouter | NVIDIA Nemotronβ3 Super, Qwen 3β80B, many more via same API key |
Tokenβaware context truncation: system respects model limits, drops oldest messages when needed. Streaming with markdown + syntax highlighting.
π Templates & Slash Commands
Type / anywhere in the input field β a dropdown appears with your saved prompt templates. Navigate with β/β, select with β΅ or Tab. Templates are stored in localStorage and sync across devices via preferences (if signed in).
Click the button in navbar β create, edit, delete templates. Each template has a name and content (markdown supported).
βοΈ Cloud Sync & Guest Mode
- Sign in with Google (sidebar footer) β conversations saved to Firestore.
- Chats are automatically titled (AI generated using Groq Qwen 32B), pinnable, searchable, and grouped by date.
- Public/private toggle per conversation (anyone with link can view if public).
- Guest mode works without login β history stored only in browser memory (not persistent across sessions).
- Clear all chats / delete individual conversations β confirmation modals.
βοΈ Configuration & API Keys
All API keys are embedded by default for demo purposes (rateβlimited). To use your own:
- Click the Settings icon (βοΈ) in the floating navbar.
- Enter your Groq / OpenRouter / Gemini keys.
- Keys are saved to localStorage and applied immediately to the current session.
Advanced: Modify js/modules/core/config.js to change default model list or providers.
π Example Interactions
π Troubleshooting
Pyodide does not support native threads. Use
asyncio or restructure code.Make sure RAG is enabled (Index Manager toggle) and you have indexed at least one file. Check IndexedDB via browser dev tools.
Ensure Firebase config is correct. Try refreshing the page. Guest mode does not sync.
Web Speech API requires user interaction first (click any button). Also ensure no other tab is using microphone.