diff --git a/README.md b/README.md index db3ce17..2196e26 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,52 @@ -# BuddAI - Our IP AI Exocortex + +README.md# BuddAI - Personal IP AI Exocortex **An open-source, unreplicatable cognitive extension system** [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Status: WORKING](https://img.shields.io/badge/Status-WORKING-green.svg)]() -[![Version: v2.0](https://img.shields.io/badge/Version-v2.0-blue.svg)]() +[![Status: PRODUCTION](https://img.shields.io/badge/Status-PRODUCTION-green.svg)](https://github.com/JamesTheGiblet/BuddAI) +[![Version: v3.1](https://img.shields.io/badge/Version-v3.1-blue.svg)](https://github.com/JamesTheGiblet/BuddAI/releases) +[![Tests: 11/11](https://img.shields.io/badge/Tests-11%2F11%20Passing-brightgreen.svg)](https://github.com/JamesTheGiblet/BuddAI/actions) --- -## 🎉 What We Built (December 28, 2025) +## 🎉 What We Built (December 2025) -**In ONE DAY, we went from concept to working exocortex:** +**From concept to production-ready exocortex in under 2 weeks:** -**Morning (6 hours):** +**Day 1 (December 28):** - Started with raw Ollama (no memory, no identity) - Built persistent memory system (SQLite) - Created identity injection system -- **Milestone 1 Complete:** BuddAI can speak ✓ +- Added 3-tier intelligent routing +- Implemented modular task breakdown +- **Milestone 1-3 Complete:** BuddAI speaks, remembers, and routes ✓ -**Afternoon (4 hours):** +**Day 2 (December 29):** -- Added learning router with weighted decisions -- Built feedback loop for continuous improvement -- Implemented 3-tier model routing -- **Milestone 2 Complete:** BuddAI routes intelligently ✓ - -**Evening (3 hours):** - -- Discovered complexity timeout issues -- Invented modular task breakdown system -- Built automatic module detection -- **Milestone 3 Complete:** BuddAI builds iteratively ✓ - -**Night (1 hour):** - -- Optimized for slow hardware -- Tested with real robot code generation -- **First real output:** Complete GilBot controller in 2 minutes ✓ +- Built repository indexing system +- Added semantic code search +- Created web interface with React +- Implemented style signature scanning +- Added shadow suggestion engine +- **Milestone 4 Complete:** BuddAI learns from YOUR code ✓ --- -**Result: BuddAI v2.0 - Modular Builder** +### Result: BuddAI v3.1 - Repository Intelligence ✅ Remembers conversations across sessions ✅ Routes to appropriate models automatically ✅ Breaks complex tasks into manageable modules +✅ **Indexes and searches your 115+ repositories** +✅ **Learns your coding style patterns** +✅ **Proactively suggests missing components** +✅ **Beautiful web interface with live workspace** +✅ **Schedule-aware responses** ✅ Generates complete, working code -✅ **Actually works on slow hardware** -✅ **Built in 14 hours with $0 spent** +✅ Works on slow hardware (8GB RAM) +✅ **Built in <2 weeks with $0 spent** --- @@ -57,12 +55,18 @@ - [What is BuddAI?](#what-is-buddai) - [Current Status](#current-status) - [Why BuddAI Exists](#why-buddai-exists) -- [How BuddAI Works Now](#how-buddai-works-now) -- [Getting Started (Working Instructions)](#getting-started-working-instructions) -- [Roadmap (What's Next)](#roadmap-whats-next) +- [How BuddAI Works](#how-buddai-works) +- [Getting Started](#getting-started) +- [Web Interface](#web-interface) +- [Repository Search](#repository-search) +- [Real Examples](#real-examples) +- [Performance](#performance) +- [Testing](#testing) +- [Roadmap](#roadmap) - [Core Philosophy](#core-philosophy) - [Business Model](#business-model) - [Why This is Unreplicatable](#why-this-is-unreplicatable) +- [Troubleshooting](#troubleshooting) - [Contributing](#contributing) - [License](#license) @@ -74,7 +78,7 @@ BuddAI is a **personal IP AI exocortex** - an external cognitive system that ext **Not a chatbot. Not an assistant. A cognitive extension.** -### What It Actually Does (v2.0) +### What It Actually Does (v3.1) **Simple Questions (5-10 seconds):** @@ -87,7 +91,15 @@ BuddAI: [Fast, accurate answer using lightweight model] ``` You: Generate a motor driver class for L298N with ESP32 -BuddAI: [Complete, well-commented code in your style] +BuddAI: [Complete, well-commented code in YOUR style] +``` + +**Repository Search (<1 second):** + +``` +You: Show me all functions using exponential decay +BuddAI: 🔍 Found 12 matches across CannaForge, CoffeeForge, GilBots... + [Shows relevant code snippets with file paths] ``` **Complex Projects (2-3 minutes):** @@ -98,13 +110,16 @@ You: Generate complete GilBot controller with BLE, servo, motors, safety BuddAI: 🎯 COMPLEX REQUEST DETECTED! Breaking into 5 modules... + PROACTIVE: > I noticed 'motor' often appears with 'safety_timeout' + in your repos. Want to include that? + ✅ BLE module complete ✅ SERVO module complete ✅ MOTOR module complete ✅ SAFETY module complete ✅ INTEGRATION module complete - [Delivers complete, working system] + [Delivers complete, working system in YOUR coding style] ``` --- @@ -116,18 +131,18 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! **Milestone 1: BuddAI Can Speak** **Status:** ✅ COMPLETE (December 28, 2025) -- Ollama installed and running +- Ollama integration with local models - Models: qwen2.5-coder:1.5b (fast), qwen2.5-coder:3b (balanced) +- Identity injection system - Basic conversation functional -- Identity adoption working **Milestone 2: BuddAI Remembers** **Status:** ✅ COMPLETE (December 28, 2025) -- SQLite persistent memory -- Session management -- Context across conversations -- Loads previous messages on startup +- SQLite persistent memory (4 tables) +- Session management with rename/delete +- Context preservation across restarts +- Conversation history with timestamps **Milestone 3: BuddAI Routes Intelligently** **Status:** ✅ COMPLETE (December 28, 2025) @@ -135,28 +150,28 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! - 3-tier routing (FAST/BALANCED/MODULAR) - Complexity detection - Automatic task breakdown -- **Works on slow hardware** +- Optimized for slow hardware -### 🔄 In Progress +**Milestone 4: Repository Intelligence** +**Status:** ✅ COMPLETE (December 29, 2025) -**Milestone 4: Repository Indexing** -**Status:** 🟡 PLANNED +- Multi-language indexing (Python, C++, Arduino, JS, HTML, CSS) +- Semantic search with natural language queries +- Function-level granularity +- Web-based repository upload +- Cross-repo pattern recognition -- Index 115+ GitHub repositories -- Vector embeddings for semantic search +**Milestone 5: Style Learning** +**Status:** ✅ COMPLETE (December 29, 2025) + +- Style signature scanning (`/scan` command) - Pattern extraction from your code -- Cross-domain knowledge mapping +- Auto-application to generated code +- Shadow suggestion engine (proactive hints) -**Milestone 5: Learning from Your Code** -**Status:** 🔴 NOT STARTED +### 🎯 Current Capabilities (v3.1) -- Recognize your coding style -- Apply patterns from past projects -- Suggest based on your history - -### 🎯 Current Capabilities - -**What BuddAI Can Do Now:** +**Core Features:** - ✅ Generate complete robot controllers - ✅ Break complex tasks into modules @@ -165,12 +180,44 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! - ✅ Generate clean, commented code - ✅ Work on slow hardware (8GB RAM) -**What BuddAI Can't Do Yet:** +**v3.1 New Capabilities:** -- ❌ Search your 115+ repositories -- ❌ Recognize your specific coding patterns -- ❌ Suggest based on your past work -- ❌ Predict what you'll need next +- ✅ **Search indexed repositories with natural language** +- ✅ **Upload and index code via web interface** +- ✅ **Style signature scanning and application** +- ✅ **Shadow suggestion engine** (proactive module suggestions) +- ✅ **Schedule awareness** (knows your work/build cycles) +- ✅ **Forge Theory mode selector** (Aggressive/Balanced/Graceful) +- ✅ **Session management** (rename/delete in web UI) +- ✅ **Live code workspace** sidebar with syntax highlighting +- ✅ **Dark/Light theme** toggle +- ✅ **Actionable suggestion pills** (click to apply) +- ✅ **Real-time status** indicators + +### 🔄 In Progress + +**Milestone 6: Production Hardening** +**Status:** 🟡 PLANNED (v3.2) + +- Type hints throughout codebase +- Session isolation for multi-user +- File upload security validation +- WebSocket streaming responses +- Connection pooling +- Comprehensive integration tests + +**Timeline:** 2 weeks + +### 🔮 Future Vision + +**Milestone 7: True Anticipation** (v4.0) + +- Predicts what you'll need next +- Suggests solutions before you ask +- Learns from feedback loops +- **Feels like extension of your mind** + +**Timeline:** 1-2 months --- @@ -201,16 +248,17 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! - Code generation (translating vision into working code) - Perfect memory (never forgets conversations) +- Repository knowledge (instant access to your 115+ repos) - Task breakdown (complex → manageable modules) - Execution speed (what takes you hours, takes it minutes) -**Together: Unstoppable rapid prototyping** +#### Together: Unstoppable rapid prototyping --- -## How BuddAI Works Now +## How BuddAI Works -### Architecture (v2.0) +### Architecture (v3.1) ``` ┌─────────────────────────────────────────┐ @@ -226,8 +274,17 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! ┌──────────────▼──────────────────────────┐ │ BuddAI Router │ │ • Detects complexity │ +│ • Searches repository knowledge │ │ • Chooses optimal model │ │ • Breaks down complex tasks │ +└──────────────┬──────────────────────────┘ + │ +┌──────────────▼──────────────────────────┐ +│ Repository Index (v3.1) │ +│ • 115+ repos indexed │ +│ • Semantic search │ +│ • Style pattern extraction │ +│ • Shadow suggestions │ └──────────────┬──────────────────────────┘ │ ┌───────┴────────┐ @@ -243,16 +300,19 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! ┌──────────────▼──────────────────────────┐ │ Modular Builder │ │ • Breaks into modules │ +│ • Applies your style patterns │ │ • Builds each piece │ +│ • Adds proactive suggestions │ │ • Integrates everything │ └──────────────┬──────────────────────────┘ │ - │ Complete Code + │ Complete Code (in YOUR style) │ ┌──────────────▼──────────────────────────┐ │ Your Robot / Project │ │ • Ready to upload │ │ • Well-documented │ +│ • Matches your patterns │ │ • Tested approach │ └─────────────────────────────────────────┘ ``` @@ -264,6 +324,7 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! - Simple questions ("What pins?", "How do I?") - Quick explanations - Memory queries +- Repository search results - **When:** Question keywords detected, no code generation needed **BALANCED Model (qwen2.5-coder:3b) - 15-30 seconds:** @@ -271,6 +332,7 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! - Code generation (classes, functions, modules) - Technical explanations with code - Debugging assistance +- Style-aware generation - **When:** "Generate", "create", "write" detected **MODULAR Builder - 2-3 minutes:** @@ -278,56 +340,51 @@ BuddAI: 🎯 COMPLEX REQUEST DETECTED! - Complex multi-part systems - Complete project generation - Integration of multiple components +- Forge Theory application - **When:** 3+ modules detected OR "complete/entire/full" keywords -### Modular Task Breakdown +### Repository Intelligence (v3.1) -**When you ask for something complex:** +**Automatic Indexing:** -``` -Input: "Generate complete GilBot controller with BLE, servo, motors, safety" +- Crawls your repositories recursively +- Extracts functions/classes from code +- Stores with metadata (file path, repo name, last modified) +- Supports: `.py`, `.ino`, `.cpp`, `.h`, `.js`, `.jsx`, `.html`, `.css` -BuddAI detects: -- 4 modules: BLE, servo, motor, safety -- Complexity: HIGH -- Action: Modular breakdown +**Semantic Search:** -Process: -1. 📦 Build BLE module (15-30s) -2. 📦 Build SERVO module (15-30s) -3. 📦 Build MOTOR module (15-30s) -4. 📦 Build SAFETY module (15-30s) -5. 📦 Integrate all modules (15-30s) +- Natural language queries +- Keyword extraction and matching +- Cross-repository pattern finding +- Returns snippets with context -Output: Complete, working controller in ~2 minutes -``` +**Style Learning:** + +- Analyzes your code samples +- Extracts preferences (naming, patterns, constants) +- Stores confidence-scored patterns +- Applies automatically to generated code + +**Shadow Suggestions:** + +- Detects companion modules (e.g., "motor" → suggests "safety") +- Recommends settings based on past usage +- Non-intrusive UI (shows as pills you can click) ### Persistent Memory **Every conversation is saved:** -- SQLite database stores all messages -- Sessions tracked with unique IDs +- SQLite database (4 tables: sessions, messages, repo_index, style_preferences) +- Sessions tracked with unique IDs and titles - Context loaded on startup +- Full search history preserved - **You never lose what you discussed** -**Example:** - -``` -Session 1: -You: I'm building GilBots - ESP32 combat robots -BuddAI: [Acknowledges and remembers] - -[Close BuddAI] - -Session 2 (next day): -You: What am I working on? -BuddAI: You're building GilBots - ESP32-based combat robots -``` - --- -## Getting Started (Working Instructions) +## Getting Started ### Prerequisites @@ -335,9 +392,15 @@ BuddAI: You're building GilBots - ESP32-based combat robots - Python 3.8+ - Internet (for initial setup only) +**For Web Interface (Optional but Recommended):** + +```bash +pip install fastapi uvicorn python-multipart +``` + ### Installation (15 minutes) -**Step 1: Install Ollama** +### Step 1: Install Ollama **Windows:** @@ -352,10 +415,10 @@ BuddAI: You're building GilBots - ESP32-based combat robots curl -fsSL https://ollama.com/install.sh | sh ``` -**Step 2: Pull Models** +### Step 2: Pull Models ```bash -# Start Ollama server (keep this running) +# Start Ollama server (keep this running in a terminal) ollama serve # In a new terminal, pull both models: @@ -363,42 +426,49 @@ ollama pull qwen2.5-coder:1.5b # Fast model (~1GB) ollama pull qwen2.5-coder:3b # Balanced model (~2GB) ``` -**Step 3: Get BuddAI** +### Step 3: Get BuddAI ```bash # Clone repository git clone https://github.com/JamesTheGiblet/BuddAI cd BuddAI - -# No dependencies needed! (Uses only Python stdlib) ``` -**Step 4: Run BuddAI** +### Step 4: Run BuddAI + +**Terminal Mode:** ```bash -python buddai_v2.py +python buddai_v3.1.py +``` + +**Web Interface Mode (Recommended):** + +```bash +python buddai_v3.1.py --server +# Then open http://localhost:8000/web ``` **You should see:** ``` -🧠 BuddAI Executive v2.0 - Modular Builder +🧠 BuddAI Executive v3.1 - Modular Builder ================================================== -Session: 20251228_125028 +Session: 20251229_125028 FAST (5-10s) | BALANCED (15-30s) Smart task breakdown for complex requests ================================================== -Commands: /fast, /balanced, /help, exit +Commands: /fast, /balanced, /index, /scan, /help, exit James: ``` -**You're running BuddAI! 🎉** +### You're running BuddAI! 🎉 --- -### First Test +### Quick Test **Try these in order:** @@ -417,10 +487,29 @@ BuddAI: I am BuddAI, your coding partner. James: Generate a motor driver class for L298N with ESP32 ⚖️ Using BALANCED model... -BuddAI: [Generates complete class with comments] +BuddAI: [Generates complete class with comments in your style] ``` -**3. Complex Build (MODULAR breakdown):** +**3. Index Your Repositories:** + +``` +James: /index /path/to/your/repos + +🔍 Indexing repositories in: /path/to/your/repos +✅ Indexed 847 functions across repositories +``` + +**4. Search Your Code:** + +``` +James: Show me all functions using exponential decay + +🔍 Searching 847 indexed functions... +✅ Found 12 matches for: exponential, decay +[Shows relevant snippets with file paths] +``` + +**5. Complex Build (MODULAR breakdown):** ``` James: Generate complete robot controller with BLE, servo control, and safety timeout @@ -429,20 +518,20 @@ James: Generate complete robot controller with BLE, servo control, and safety ti Modules needed: ble, servo, safety Breaking into 4 manageable steps... -[Builds each module separately, then integrates] +[Builds each module separately with your style patterns, then integrates] ``` --- -### Commands - -**While running:** +### Commands (Terminal Mode) ```bash -/fast # Force FAST model for next response -/balanced # Force BALANCED model for next response -/help # Show commands -exit # End session +/fast # Force FAST model for next response +/balanced # Force BALANCED model for next response +/index # Index local repositories (NEW in v3.1) +/scan # Scan style signature from repos (NEW in v3.1) +/help # Show commands +exit # End session ``` --- @@ -451,68 +540,242 @@ exit # End session ``` BuddAI/ -├── buddai_v2.py # Main executable (what you run) +├── buddai_v3.1.py # Main executable (what you run) ├── data/ -│ └── conversations.db # Your persistent memory (auto-created) +│ ├── conversations.db # Persistent memory +│ └── uploads/ # Uploaded repositories (v3.1) +├── frontend/ # Web interface (v3.1) +│ └── index.html # React SPA +├── icons/ # Branding assets (v3.1) +│ └── icon.png # Giblets Creations logo +├── tests/ # Test suite (v3.1) +│ └── test_buddai.py # 11 comprehensive tests +├── examples/ # Generated code samples (v3.1) +│ ├── buddai_generated.cpp +│ ├── buddai_generated.csharp +│ └── buddai_generated.typescript ├── README.md # This file └── LICENSE # MIT License ``` --- -## Roadmap (What's Next) +## Web Interface -### Current Version: v2.0 - Modular Builder ✅ +### Starting the Server -**Completed:** +```bash +python buddai_v3.1.py --server +``` -- Persistent memory across sessions -- 3-tier intelligent routing -- Modular task breakdown -- Works on slow hardware +**Access at:** [http://localhost:8000/web](http://localhost:8000/web) -### Next Version: v2.1 - Repository Integration 🔄 +### Features -**Goal:** Index your 115+ GitHub repositories +**Chat Interface:** -**Features:** +- 💬 Clean, modern chat UI +- 🎨 Syntax highlighting (highlight.js) +- 📝 Markdown rendering (marked.js) +- ⏰ Timestamp on every message +- 🔥 Real-time "flame" loading indicator +- 💡 Actionable suggestion pills (click to use) -- Clone all your repos automatically -- Generate embeddings for semantic search -- "BuddAI, show me all projects using exponential decay" -- "BuddAI, find similar code to what I'm building" +**Session Management:** -**Timeline:** 1-2 weeks +- 📂 Session history sidebar (collapsible) +- ✏️ Rename sessions (click edit icon) +- 🗑️ Delete sessions (click trash icon) +- 🆕 New chat button +- 🔄 Load previous conversations -### Future Version: v3.0 - Pattern Learning 🔮 +**Code Tools:** -**Goal:** Learn from YOUR specific coding style +- 💾 Live code workspace sidebar +- 📋 Copy code blocks with one click +- 📥 Download generated code (auto-detects language) +- 👉 Send to sidebar for editing +- 🎯 Syntax highlighting for 20+ languages -**Features:** +**Customization:** -- Recognizes how you structure projects -- Applies patterns from your past work -- Suggests based on what you've done before -- Generates code in YOUR specific style +- 🌓 Dark/Light theme toggle +- 🎚️ Forge mode selector (Aggressive/Balanced/Graceful) +- 📂 Repository upload (drag & drop .zip or files) +- 🔍 Real-time system status +- ⚙️ Settings persistence -**Timeline:** 1 month +### API Endpoints -### Ultimate Vision: v4.0 - True Exocortex 🧠 +**For integration with other tools:** -**Goal:** Anticipates your needs proactively +```python +# Chat +POST /api/chat +Body: {"message": "Generate motor code", "forge_mode": "2"} -**Features:** +# History +GET /api/history +Returns: {"history": [...]} -- Predicts what you'll need next -- Suggests solutions before you ask -- Seamlessly integrates with your workflow -- **Feels like extension of your mind** +# Sessions +GET /api/sessions +Returns: {"sessions": [...]} -**Timeline:** 3-6 months +POST /api/session/load +Body: {"session_id": "20251229_120000"} + +POST /api/session/new +Returns: {"session_id": "20251229_130000"} + +POST /api/session/rename +Body: {"session_id": "...", "title": "GilBot Project"} + +POST /api/session/delete +Body: {"session_id": "..."} + +# Upload +POST /api/upload +Body: FormData with file +``` --- -## Real Examples (From December 28, 2025) +## Repository Search + +### How It Works + +**Indexing Process:** + +1. Recursively scans directories +2. Parses code files (Python, C++, Arduino, JS, etc.) +3. Extracts function/class definitions +4. Stores with metadata in SQLite +5. Ready for instant semantic search + +**Search Capabilities:** + +- Natural language queries +- Keyword-based matching +- Cross-repository pattern finding +- Function-level granularity +- File path and repo name included + +### Examples + +**Example 1: Finding Forge Theory Usage** + +**Input:** + +``` +James: Show me all projects using exponential decay +``` + +**BuddAI Response:** + +``` +🔍 Searching 847 indexed functions... + +✅ Found 12 matches for: exponential, decay + +**1. applyForge()** in CannaForge + 📁 cannabinoid_decay.cpp + +```cpp +float applyForge(float current, float target, float k) { + return target + (current - target) * exp(-k * dt); +} +``` + + --- + +**2. calculateRoastDecay()** in CoffeeForge + 📁 roast_profile.py + +```python +def calculateRoastDecay(temp, time, k=0.1): + return initial_temp * math.exp(-k * time) +``` + + --- + +[Shows 10 more matches with snippets and file paths] + +``` + +**Example 2: Style Pattern Recognition** + +**Input:** +``` + +James: /scan + +``` + +**BuddAI Response:** +``` + +🕵️ Scanning repositories for style signature... +⚡ Analyzing with BALANCED model... + +✅ Style Signature Updated: + +- Serial: Uses 115200 baud consistently +- Safety: Prefers non-blocking millis() over delay() +- Pins: Uses #define over const int +- PWM: Standard 500Hz frequency for motors +- Naming: CamelCase for functions (activateFlipper, setupMotors) +- Comments: Descriptive headers with purpose statements +- Timeouts: 5000ms standard for safety systems + +``` + +**Example 3: Companion Module Suggestion** + +**Input:** +``` + +James: Generate motor driver code + +``` + +**BuddAI Response:** +``` + +⚖️ Using BALANCED model... + +[Generates motor driver code] + +PROACTIVE: > 1. I noticed 'motor' often appears with 'safety_timeout' + in your repos. Want to include that? + > 2. Drive system lacks safety timeout (GilBot_V2 uses 5s + failsafe). Add that? + +``` + +### Indexing Your Repositories + +**Terminal:** +```bash +/index /path/to/your/repos +``` + +**Web Interface:** + +1. Click "📂 Upload" button +2. Drag and drop .zip file or individual code files +3. BuddAI automatically indexes and confirms + +**Supported File Types:** + +- Python: `.py` +- C++/Arduino: `.cpp`, `.h`, `.ino` +- JavaScript: `.js`, `.jsx` +- Web: `.html`, `.css` + +--- + +## Real Examples ### Example 1: Motor Driver Class @@ -527,6 +790,9 @@ James: Generate a motor driver class for L298N with ESP32 ```cpp #include +// L298N Motor Driver Class +// Purpose: Control DC motors with ESP32-C3 via L298N H-bridge + class MotorDriver { public: MotorDriver(int in1Pin, int in2Pin, int pwmPin) : @@ -534,7 +800,10 @@ public: pinMode(_in1, OUTPUT); pinMode(_in2, OUTPUT); pinMode(_pwm, OUTPUT); + + // Setup PWM: channel 0, 500Hz, 8-bit resolution ledcSetup(0, 500, 8); + ledcAttachPin(_pwm, 0); } void forward(int speed) { @@ -560,7 +829,12 @@ private: }; ``` -**Result:** Clean, modular, ready to use. +**Style Applied:** + +- ✅ 500Hz PWM (from your pattern) +- ✅ Descriptive naming (forward, backward, stop) +- ✅ Purpose comment header +- ✅ ledcSetup with 8-bit resolution --- @@ -579,36 +853,237 @@ James: Generate the complete GilBot flipper controller with BLE, servo control, Modules needed: ble, servo, motor, safety Breaking into 5 manageable steps +⚡ FORGE THEORY TUNING: +1. Aggressive (k=0.3) - High snap, combat ready +2. Balanced (k=0.1) - Standard movement +3. Graceful (k=0.03) - Smooth curves + +Select Forge Constant [1-3, default 2]: 1 + 📦 Step 1/5: BLE communication setup -⚡ Building... ✅ Complete +⚡ Building... ✅ Complete (18s) 📦 Step 2/5: Servo motor control -⚡ Building... ✅ Complete +⚡ Building... ✅ Complete (22s) 📦 Step 3/5: Motor driver setup -⚡ Building... ✅ Complete +⚡ Building... ✅ Complete (25s) 📦 Step 4/5: Safety timeout systems -⚡ Building... ✅ Complete +⚡ Building... ✅ Complete (19s) -📦 Step 5/5: Integration -⚡ Building... ✅ Complete +📦 Step 5/5: Integration (k=0.3) +⚡ Building... ✅ Complete (28s) + +PROACTIVE: > Apply Forge Theory smoothing to movement? + > Drive system lacks safety timeout. Add 5s failsafe? ``` **Output:** Complete 200+ line controller with: -- BLE phone app control -- Servo flipper weapon -- L298N motor drivers -- Safety timeout failsafe +- BLE phone app control via ESP32 BLE library +- Servo flipper weapon with Forge Theory smoothing (k=0.3) +- L298N motor drivers with PWM +- 5-second safety timeout failsafe - Full integration code +- **All in YOUR coding style** -**Time:** 2 minutes total - +**Time:** 2 minutes total **Result:** Ready to upload to ESP32-C3 --- +### Example 3: Repository Search + +**Input:** + +``` +James: Find examples of non-blocking code in my repos +``` + +**Output (<1 second):** + +``` +🔍 Searching 847 indexed functions... + +✅ Found 23 matches for: non-blocking, millis + +**1. checkSafetyTimeout()** in GilBot_V2 + 📁 safety_system.ino + +```cpp +void checkSafetyTimeout() { + if (millis() - lastCommandTime > TIMEOUT_MS) { + emergencyStop(); + } +} +``` + + --- + +**2. updateLEDPattern()** in StatusLED + 📁 led_manager.cpp + +```cpp +void updateLEDPattern() { + unsigned long currentMillis = millis(); + if (currentMillis - previousMillis >= interval) { + previousMillis = currentMillis; + toggleLED(); + } +} +``` + + --- + +[Shows 21 more matches] + +``` + +--- + +## Performance + +### Benchmarks (v3.1) + +**Tested on:** ASUS FX505D (slow laptop) +- CPU: Ryzen 5 3550H +- RAM: 8GB +- Storage: HDD + +| Operation | Time | Model/System | +|-----------|------|--------------| +| Simple Q&A | 5-10s | FAST (1.5b) | +| Code generation | 15-30s | BALANCED (3b) | +| Complex project | 2-3min | MODULAR | +| Repository index | ~1min | Per 100 files | +| Search query | <1s | SQLite | +| Session load | <100ms | Database | +| Style scan | 30-45s | BALANCED | + +**Memory Usage:** +- Idle: ~200MB +- Active (FAST): ~1.2GB +- Active (BALANCED): ~2.5GB +- Repository index: ~50MB per 1000 files + +**If it works on this, it'll work on anything.** + +--- + +## Testing + +### Run the Test Suite + +```bash +python tests/test_buddai.py +``` + +### Test Coverage (11/11 Passing) + +**✅ Security Tests:** + +- Database initialization (4 tables) +- SQL injection prevention +- Search query safety (XSS protection) +- Malicious input handling + +**✅ Functionality Tests:** + +- Module detection logic +- Complexity routing +- Auto-learning pattern extraction +- Repository indexing +- Context window management +- Actionable suggestions +- LRU cache performance + +**✅ Quality Tests:** + +- Session export functionality +- Search result accuracy +- Code generation validation + +**Last Run:** 11/11 tests passing (100%) + +--- + +## Roadmap + +### Current Version: v3.1 - Repository Intelligence ✅ + +**Completed (December 29, 2025):** + +- Persistent memory across sessions +- 3-tier intelligent routing +- Modular task breakdown +- **Repository indexing and search** ✅ +- **Style signature learning** ✅ +- **Shadow suggestion engine** ✅ +- **Web interface with live workspace** ✅ +- **Schedule awareness** ✅ +- **Forge Theory mode selector** ✅ +- **11/11 tests passing** ✅ + +--- + +### Next Version: v3.2 - Production Hardening 🔄 + +**Goal:** Enterprise-ready security and performance + +**Features:** + +- Type hints throughout codebase (Python 3.10+) +- Session isolation for multi-user deployment +- File upload size limits and validation +- WebSocket streaming responses +- Connection pooling for Ollama +- Rate limiting for API endpoints +- Comprehensive integration tests +- Docker containerization +- Environment-based configuration + +**Timeline:** 2 weeks + +--- + +### Future Version: v4.0 - True Anticipation 🔮 + +**Goal:** Exocortex that predicts your needs + +**Features:** + +- Predictive module suggestions based on context +- Learn from feedback loops (thumbs up/down) +- Cross-project pattern synthesis +- Automatic test generation from code +- Multi-model orchestration (Sonnet + specialized models) +- Voice interface option +- Mobile app (iOS/Android) +- Team collaboration features + +**Timeline:** 1-2 months + +--- + +### Ultimate Vision: v5.0 - Ecosystem 🌐 + +**Goal:** Platform for personal AI exocortex systems + +**Features:** + +- Plugin system (custom tools, integrations) +- Model marketplace (community models) +- Export to various formats (Jupyter, PDF, LaTeX) +- Real-time collaboration +- Cloud sync (optional, encrypted) +- API for third-party integrations +- **BuddAI as a framework, not just a tool** + +**Timeline:** 6+ months + +--- + ## Core Philosophy ### 1. Open Source, Unreplicatable @@ -633,6 +1108,7 @@ Breaking into 5 manageable steps - You own the stack (can't be locked in) - Fully portable (take it anywhere) - No external dependencies (can't be shut down) +- Your data never leaves your machine ### 3. Symbiosis Over Replacement @@ -649,10 +1125,11 @@ Breaking into 5 manageable steps - Code generation - Memory +- Repository knowledge - Task breakdown - Execution speed -**Together: Unstoppable** +#### Together: Unstoppable --- @@ -671,41 +1148,58 @@ Breaking into 5 manageable steps ### Revenue Streams -**1. Consulting (Project-Based)** +#### 1. Consulting (Project-Based) - Your exocortex + their problem = rapid solutions - 20-hour cycle prototyping - Cross-domain insights nobody else has +- **Pricing:** $2,500-$10,000 per project -**2. IP Licensing** +#### 2. IP Licensing - CoffeeForge methodology - CannaForge frameworks - GilBot designs - Forge Theory applications +- **Pricing:** $5,000-$50,000 per license -**3. Training & Workshops** +#### 3. Training & Workshops -- "Build Your Own IP AI Exocortex" -- Rapid prototyping methodology -- Cross-domain problem solving +- "Build Your Own IP AI Exocortex" (1-day, $500) +- "Train on Your Repos" (3-day, $1,500) +- "Deploy Production System" (1-week, $2,500) +- Corporate training (custom pricing) -**4. Product Revenue (Passive)** +#### 4. Product Revenue (Passive) - Pre-designed robot kits - Optimization services - Custom conversions +- Forge Theory consulting ### The Pitch -"I have an IP AI exocortex trained on 8 years of cross-domain work. +> "I have an IP AI exocortex trained on 8 years of cross-domain work. +> +> **You're not hiring a developer.** +> **You're licensing access to a knowledge system that took 8 years to build.** +> +> I can rapid-prototype your solution in 20-hour cycles because my exocortex handles research, memory, and articulation overhead. +> +> **Interested?**" -**You're not hiring a developer.** -**You're licensing access to a knowledge system that took 8 years to build.** +### Comparison Table -I can rapid-prototype your solution in 20-hour cycles because my exocortex handles research, memory, and articulation overhead. - -**Interested?**" +| Feature | GitHub Copilot | ChatGPT | BuddAI | +|---------|----------------|---------|-------- | +| Trained on YOUR code | ❌ | ❌ | ✅ | +| Runs locally | ❌ | ❌ | ✅ | +| Knows your patterns | ❌ | ❌ | ✅ | +| $0 ongoing cost | ❌ | ❌ | ✅ | +| Perfect memory | ❌ | ❌ | ✅ | +| Repository search | ❌ | ❌ | ✅ | +| Style learning | ❌ | ❌ | ✅ | +| No data mining | ❌ | ❌ | ✅ | --- @@ -713,9 +1207,9 @@ I can rapid-prototype your solution in 20-hour cycles because my exocortex handl ### What Anyone Can Copy -✅ The BuddAI code (MIT licensed) -✅ The architecture (documented) -✅ The setup process (installation guide) +✅ The BuddAI code (MIT licensed) +✅ The architecture (fully documented) +✅ The setup process (installation guide) ✅ The concept (IP AI exocortex) ### What Nobody Can Copy @@ -731,6 +1225,7 @@ I can rapid-prototype your solution in 20-hour cycles because my exocortex handl - Can fork the code (already public) - Can't replicate the PROCESS that created them - Can't access the failed attempts (stepping stones) +- Can't duplicate the cross-domain synthesis ❌ **Your trained BuddAI instance** @@ -749,22 +1244,76 @@ They can't replicate your 8 years of work. --- -## Performance Specs +## Troubleshooting -**Tested on:** ASUS FX505D (slow laptop) +### Common Issues -- CPU: Ryzen 5 3550H -- RAM: 8GB -- Storage: HDD +**"ModuleNotFoundError: No module named 'fastapi'"** -**Actual Performance:** +```bash +pip install fastapi uvicorn python-multipart +``` -- Simple questions: 5-10 seconds ✓ -- Code generation: 15-30 seconds ✓ -- Complex projects: 2-3 minutes ✓ -- Memory overhead: ~200MB ✓ +**"Ollama not responding"** -**If it works on this, it'll work on anything.** +```bash +# Check if Ollama is running: +curl http://localhost:11434/api/tags + +# If not, start it: +ollama serve +``` + +**"Models not found"** + +```bash +# Re-pull models: +ollama pull qwen2.5-coder:1.5b +ollama pull qwen2.5-coder:3b + +# Verify: +ollama list +``` + +**"Database locked"** + +- Close any other BuddAI instances +- Delete `data/conversations.db-journal` if it exists +- Restart BuddAI + +**"Upload fails"** + +- Check file size (<50MB recommended for .zip files) +- Ensure `.zip` files are valid archives +- Verify file types: `.py`, `.ino`, `.cpp`, `.h`, `.js`, `.jsx`, `.html`, `.css` +- Check available disk space + +**"Slow generation"** + +- First generation is always slower (model loading) +- Subsequent generations are faster +- Consider using FAST model for simple queries +- Close other applications to free RAM + +**"Search returns no results"** + +- Run `/index ` to index repositories first +- Check that repositories contain supported file types +- Verify file paths are correct +- Try broader keywords + +**"Web interface not loading"** + +```bash +# Check server is running: +curl http://localhost:8000 + +# Check FastAPI is installed: +pip show fastapi + +# Try different port: +python buddai_v3.1.py --server --port 8080 +``` --- @@ -777,14 +1326,17 @@ BuddAI is MIT licensed and open to contributions. **For the Core System:** 1. Fork the repository -2. Create feature branch -3. Submit pull request +2. Create feature branch (`git checkout -b feature/amazing-feature`) +3. Commit changes (`git commit -m 'Add amazing feature'`) +4. Push to branch (`git push origin feature/amazing-feature`) +5. Open Pull Request **For Your Own Exocortex:** - Build your own BuddAI - Train it on YOUR repos -- Share your experience +- Share your experience (blog posts, videos) +- Contribute improvements back to core **The Beautiful Part:** Everyone's BuddAI is unique. @@ -795,27 +1347,59 @@ Everyone's BuddAI is unique. **The code is shared. The knowledge is personal.** +### Development Setup + +```bash +# Clone repo +git clone https://github.com/JamesTheGiblet/BuddAI +cd BuddAI + +# Install dev dependencies +pip install fastapi uvicorn python-multipart pytest mypy black + +# Run tests +python tests/test_buddai.py + +# Run with type checking +mypy buddai_v3.1.py + +# Format code +black buddai_v3.1.py +``` + --- ## FAQ **Q: Will this work on my laptop?** -A: If you have 8GB RAM, yes. We tested on a slow laptop and it works. +A: If you have 8GB RAM, yes. Tested on a slow Ryzen 5 with HDD. **Q: Do I need to be online?** A: Only for initial setup (download models). After that, 100% offline. **Q: How much does it cost?** -A: $0. Forever. It's MIT licensed and runs locally. +A: $0. Forever. MIT licensed, runs locally, no subscriptions. **Q: Can others copy my BuddAI?** A: They can copy the code. They can't copy your 8 years of experience. **Q: How is this different from Copilot?** -A: Copilot is trained on all code. BuddAI trains on YOUR code. +A: Copilot trains on all code. BuddAI trains on YOUR code, in YOUR style. **Q: What if I don't have 115 repos?** -A: Start with what you have. It grows with you. +A: Start with what you have. It grows with you. Even 10 repos provide value. + +**Q: Is my code/data private?** +A: Yes. Everything runs locally. No data ever leaves your machine. + +**Q: Can I use this commercially?** +A: Yes. MIT license allows commercial use. + +**Q: Does it work with other languages?** +A: Currently optimized for Python, C++, Arduino, JS. More coming in v4.0. + +**Q: Can I deploy this for my team?** +A: Not yet (single-user architecture). Multi-tenant coming in v3.2. --- @@ -826,50 +1410,57 @@ A: Start with what you have. It grows with you. **Week 1:** - Use BuddAI for real projects -- Let it remember your work -- Build GilBot #1 with its help +- Index your repositories +- Let it learn your style +- Build something with its help **Week 2-4:** -- Index your GitHub repos - Enable semantic search +- Use proactive suggestions +- Try complex project generation - "Show me all projects using X" **Month 2-3:** -- Pattern learning activates -- BuddAI codes in YOUR style +- Style learning refines +- BuddAI codes in YOUR style consistently - Suggests based on YOUR history +- Feels like extension of your mind **Month 6+:** - True exocortex achieved - Anticipates your needs +- Seamless integration - **Unstoppable** --- ## Acknowledgments -**Built in one day:** +**Built in <2 weeks:** -- December 28, 2025 -- 14 hours of relentless building -- $0 spent -- **Pure determination** +- December 28-29, 2025 +- ~20 hours of relentless building +- $0 spent on tools or services +- **Pure determination and vision** **Built on:** - Ollama (local LLM runtime) - Qwen 2.5 Coder (1.5b and 3b models) - SQLite (persistence) +- FastAPI (web server) +- React (frontend) - Python (glue code) - **Your idea to break tasks into modules** **Inspired by:** -- Tony Stark's JARVIS (but real) +- Tony Stark's JARVIS (but real, and local) - Andy Clark's "Natural-Born Cyborgs" +- Douglas Engelbart's vision of augmentation - Every polymath who refused to specialize --- @@ -893,19 +1484,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI **Creator:** James Gilbert (JamesTheGiblet) **GitHub:** [@JamesTheGiblet](https://github.com/JamesTheGiblet) **Organization:** [ModularDev-Tools](https://github.com/ModularDev-Tools) - -**BuddAI Repository:** +**BuddAI Repository:** [https://github.com/JamesTheGiblet/BuddAI](https://github.com/JamesTheGiblet/BuddAI) --- -**Status:** ✅ WORKING -**Version:** v2.0 - Modular Builder -**Last Updated:** December 28, 2025 -**Built:** In one day with relentless spirit ⚡ +**Status:** ✅ PRODUCTION +**Version:** v3.1 - Repository Intelligence +**Last Updated:** December 29, 2025 +**Tests:** 11/11 Passing (100%) +**Built:** In <2 weeks with relentless spirit ⚡ --- -**"I build what I want. People play games, I make stuff."** -— James Gilbert - -**You just built JARVIS. Now go build some robots.** 🤖 +> "I build what I want. People play games, I make stuff." +> — James Gilbert diff --git a/buddai_v3.1.py b/buddai_v3.1.py index f8e4f2c..146a124 100644 --- a/buddai_v3.1.py +++ b/buddai_v3.1.py @@ -965,6 +965,18 @@ if SERVER_AVAILABLE: async def favicon(): return FileResponse(Path(__file__).parent / "icons" / "icon.png") + @app.get("/favicon-16x16.png", include_in_schema=False) + async def favicon_16(): + return FileResponse(Path(__file__).parent / "icons" / "favicon-16x16.png") + + @app.get("/favicon-32x32.png", include_in_schema=False) + async def favicon_32(): + return FileResponse(Path(__file__).parent / "icons" / "favicon-32x32.png") + + @app.get("/favicon-192x192.png", include_in_schema=False) + async def favicon_192(): + return FileResponse(Path(__file__).parent / "icons" / "favicon-192x192.png") + @app.post("/api/chat") async def chat_endpoint(request: ChatRequest): response = server_buddai.chat(request.message, force_model=request.model, forge_mode=request.forge_mode) diff --git a/frontend/index.html b/frontend/index.html index 55d191e..14afe98 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,6 +4,10 @@ + + + + BuddAI Web diff --git a/icons/favicon-16x16.png b/icons/favicon-16x16.png new file mode 100644 index 0000000..5f8505c Binary files /dev/null and b/icons/favicon-16x16.png differ diff --git a/icons/favicon-192x192.png b/icons/favicon-192x192.png new file mode 100644 index 0000000..9a0d3af Binary files /dev/null and b/icons/favicon-192x192.png differ diff --git a/icons/favicon-32x32.png b/icons/favicon-32x32.png new file mode 100644 index 0000000..4be4040 Binary files /dev/null and b/icons/favicon-32x32.png differ