DEV Community

Sachitt A V
Sachitt A V

Posted on

I Built a Local-First AI Operating System With 296,000 Lines of Code. Alone.

**No cloud. No API keys. No subscription. Just a laptop, an RTX 5070, and 30 days.**

---

Most AI products today are wrappers around OpenAI's API. I wanted to build something different -- an operating system where the AI runs on your own machine, generates 3D models from phone videos, has conversations through voice, and improves itself while you sleep.

I call it **CODA** -- Connected Operating System for Multimodal Intelligent Computing.

Here's what 296,000 lines of code looks like when one person builds it.

---

## The Problem I Was Solving

Every "AI assistant" today has the same three problems:

1. **It needs the internet.** No WiFi, no AI.
2. **Your data leaves your machine.** Every prompt, every voice command, every file -- sent to someone else's server.
3. **You're renting intelligence.** $20/month for ChatGPT, $100/month for Claude Teams, and you still don't own anything.

I wanted an AI that lives on my laptop. One I could train, modify, and break without asking permission.

---

## What CODA Actually Is

CODA is 25+ components that together form a complete AI operating system:
Enter fullscreen mode Exit fullscreen mode
```
BHAASM (2.2B neural brain)
    |
    +-> CODA OS (5 interfaces: desktop, mobile, web, Electron, Next.js)
    +-> CODA Forge (turn phone videos into 3D-printable human models)
    +-> CODA Genesis (generate images, videos, and 3D from text)
    +-> VIJAY (voice assistant with 33 tools, runs locally)
    +-> COSMIC (10 composable device projects)
    +-> Cloud GPU training (Kaggle, Modal, Colab, Lightning -- all free tiers)
```
Enter fullscreen mode Exit fullscreen mode
The key insight: **each component works standalone**. You can use just the 3D scanner, just the voice assistant, or just the neural brain. But when you connect them, something interesting happens.

---

## The Neural Brain: BHAASM

The core is a 2.2 billion parameter transformer I built from scratch. Not a fine-tuned LLaMA -- I mean from random weights to working model.

**Architecture:**
- **RoPE** (Rotary Position Embeddings) -- the model understands position in sequences
- **GQA** (Grouped Query Attention) -- efficient attention without wasting memory
- **SwiGLU** -- gated feed-forward that actually learns
- **MoE** (Mixture of Experts) -- 8 experts, top-2 routing, shared expert for common patterns
- **LoRA adapters** -- AGNI (creative), VEDA (analytical), Generation (prompt refinement)

The model trained on free cloud GPUs. Kaggle gives you 30 hours/week of T4 for free. Modal gives you $30/month of credits. I round-robined between them.

**Training stats:**
- Base: 1.1B TinyLlama, grown to 2.2B via depth-stacking
- Healed on 50K curated records (loss: 0.35 -> 0.008)
- AGNI adapter: creative task routing
- VEDA adapter: safety validation and analysis
- Generation adapter: prompt refinement for image/video/3D generation

---

## CODA Forge: Phone Video to 3D Model

This is the project I'm most proud of.

**The pipeline:**
1. Record yourself rotating 360 degrees with your phone
2. Feed the video into CODA Forge
3. Get a textured, watertight 3D model back

**17 stages:**
- Quality check (lighting, blur, motion)
- Frame extraction (adaptive sharpness selection)
- Temporal consistency (optical flow + landmark smoothing)
- Depth estimation (Depth Anything V2 or MiDaS)
- Scale estimation (automatic metric scale from body proportions)
- Camera calibration (chessboard + EXIF + fallback)
- COLMAP SfM (camera pose estimation)
- Neural reconstruction (ECON, PIFuHD, SMPL-X)
- Face reconstruction (MediaPipe + FLAME)
- Gaussian splatting (optional neural rendering)
- Mesh fusion (Poisson + alpha shape)
- Texture baking (xatlas UV + multi-view blending)
- Export (GLB, OBJ, STL -- 3D print ready)

**The output is a real, 3D-printable mesh.** Not a point cloud, not a depth map -- a watertight mesh with textures.

---

## VIJAY: Voice That Actually Works

Most voice assistants need the cloud. VIJAY runs locally:

- **VAD** (Voice Activity Detection) -- knows when you're speaking
- **Whisper** (STT) -- OpenAI's speech-to-text, running locally
- **Edge TTS** -- Microsoft's text-to-speech, no API key needed
- **33 tools** -- system commands, web search, app control, screenshots, WhatsApp

The wake word is "Hey VIJAY." It listens continuously, processes locally, and responds through your speakers.

---

## The Self-Improvement Loop: TRISHUL

CODA doesn't just run -- it improves itself.

**TRISHUL** (Transcendent Recursive Intelligent Self-improving Holistic Unified Learning) is a training loop:

1. **Generate** -- AGNI creates output (image, video, 3D, code)
2. **Evaluate** -- VEDA scores it, CLIP compares quality
3. **Improve** -- weak outputs become training data
4. **Retrain** -- LoRA adapters update on free cloud GPUs

The system literally gets better while you sleep. I wake up to new checkpoints and curated training datasets.

---

## The COSMIC Ecosystem

10 composable projects that form a virtual device:

| Project | What It Does |
|---------|-------------|
| Cosmic Explore | 3D codebase intelligence -- navigate code as a graph |
| Cosmic Voice | Local voice pipeline (STT + TTS) |
| Cosmic Vision | Gesture recognition + hand tracking |
| Cosmic Canvas | Sketch-to-3D generation |
| Cosmic Core | AI operating system shell |
| Cosmic Flow | Visual pipeline builder |
| Cosmic Atlas | 3D code navigation |
| Cosmic Debug | Visual debugger |
| Cosmic Connect | Service registry + discovery |
| Cosmic Shield | Supply chain security scanning |

Each one is a standalone tool. Together, they form something resembling an operating system.

---

## Tech Stack
Enter fullscreen mode Exit fullscreen mode
```
AI/ML        PyTorch, HuggingFace, LoRA, MoE, BPE Tokenizer
3D Recon     COLMAP, ECON, PIFuHD, Gaussian Splatting, TripoSR
Generation   Stable Diffusion XL, AnimateDiff, I2V, NIM FLUX
Voice        Silero VAD, faster-whisper, edge-tts, MediaPipe
Web          FastAPI, Next.js 16, React 19, TailwindCSS
Desktop      PySide6, Electron 28, Flutter/Dart
Security     AES-256-GCM, PBKDF2, MFA, Audit Chain
Cloud GPU    Kaggle T4, Modal T4, Colab T4, Lightning T4
```
Enter fullscreen mode Exit fullscreen mode
---

## What I Learned

**1. Build the boring parts first.**
Everyone wants to build the AI. The hard part is the 17-stage pipeline, the security primitives, the cloud GPU scheduler. Build those first.

**2. Free cloud GPUs are enough.**
Kaggle + Modal + Colab + Lightning = 4 free T4 tiers. You don't need an $800/month A100 to train a 2.2B model.

**3. Local-first is a feature, not a limitation.**
When the AI runs on your machine, you can break things, modify things, and experiment without worrying about API costs or rate limits.

**4. Composition beats monoliths.**
Each CODA component works standalone. This means I can ship parts of the system without waiting for the whole thing to be ready.

---

## What's Next

- **Train KARNA** (the 2.2B assistant) to completion on free cloud GPUs
- **CODA Forge** improvements: better face reconstruction, multi-person support
- **VIJAY** voice improvements: faster wake word detection, better compound commands
- **Community**: open to contributors, looking for people who want to build local-first AI

---

## Try It
Enter fullscreen mode Exit fullscreen mode
```
git clone https://github.com/Sachitt-AV-08/COSMIC.git
cd COSMIC
pip install -r requirements.txt
python -m core_engine.pipeline.orchestrator --video input.mp4 --height 175
```
Enter fullscreen mode Exit fullscreen mode
Or just explore the repos:
- [BHAASM Transformer](https://github.com/Sachitt-AV-08/bhaasm-transformer) -- the neural brain
- [CODA Forge 3D](https://github.com/Sachitt-AV-08/coda-forge-3d) -- 3D reconstruction
- [Rotation-Scan 3D](https://github.com/Sachitt-AV-08/rotation-scan-3d) -- no-GPU 3D scanning
- [Deception Engine](https://github.com/Sachitt-AV-08/deception-engine) -- security through deception
- [COSMIC](https://github.com/Sachitt-AV-08/COSMIC) -- the umbrella

---

**296,000 lines. 25+ components. 5 languages. 1 developer. All local.**

That's CODA.

---

*Built by A.V. Sachitt. Find me on [GitHub](https://github.com/Sachitt-AV-08) and [LinkedIn](https://www.linkedin.com/in/sachitt-a-v-604224414/).*
Enter fullscreen mode Exit fullscreen mode

Top comments (0)