456 lines
14 KiB
Markdown
456 lines
14 KiB
Markdown
|
|
# SuperDave AI 2.0 — Full Session Export
|
||
|
|
|
||
|
|
**Date**: Sat Jun 13 2026
|
||
|
|
**Session**: Dual-Layer Backend Build — Glyphs 600 Superpowers
|
||
|
|
**Export Path**: `D:\2125 final glyph sp build\NEW Backend Build-GLyphs 600sp\SESSION_EXPORT_COMPLETE.md`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Table of Contents
|
||
|
|
|
||
|
|
1. [Session Summary](#1-session-summary)
|
||
|
|
2. [Architecture Overview](#2-architecture-overview)
|
||
|
|
3. [File Inventory](#3-file-inventory)
|
||
|
|
4. [Complete Source Files](#4-complete-source-files)
|
||
|
|
5. [Usage Guide](#5-usage-guide)
|
||
|
|
6. [Testing & Validation](#6-testing--validation)
|
||
|
|
7. [Key Decisions Log](#7-key-decisions-log)
|
||
|
|
8. [Next Steps](#8-next-steps)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 1. Session Summary
|
||
|
|
|
||
|
|
### Goal
|
||
|
|
Build and production-test a **dual-layer system** combining:
|
||
|
|
- **Symbolic Glyph Layer**: 600 glyphs, 152 superpowers, resonance computation, intent-based activation
|
||
|
|
- **Computational Layer**: FastAPI server, VRAM management (8GB GTX1080), model routing (Llama/Forge/Janus/Google AI)
|
||
|
|
|
||
|
|
### What Was Built
|
||
|
|
|
||
|
|
| Component | Status | Description |
|
||
|
|
|-----------|--------|-------------|
|
||
|
|
| `dual_layer/router.py` | Complete | Maps 9 specialized types to models, constraints, enhancements |
|
||
|
|
| `dual_layer/vram_manager.py` | Complete | Async VRAM manager with Forge/Janus mutex, priority deactivation |
|
||
|
|
| `dual_layer/symbolic_engine.py` | Complete | Glyph activation from intent, resonance calculation, telemetry |
|
||
|
|
| `dual_layer_integration.py` | Complete | 5 FastAPI symbolic endpoints + enhanced chat |
|
||
|
|
| `glyph_dashboard/index.html` | Complete | Real-time monitoring dashboard |
|
||
|
|
| `glyph_model_integration.py` | Complete | Glyph-enhanced model execution |
|
||
|
|
| `test_multi_glyph_resonance.py` | Complete | 12-test validation suite |
|
||
|
|
| `server.py` | Enhanced | Dual-layer integrated, dashboard mounted |
|
||
|
|
| `DUAL_LAYER_USAGE_GUIDE.md` | Complete | Full documentation |
|
||
|
|
|
||
|
|
### Key Metrics
|
||
|
|
- **G001 (Ledo)**: 152 superpowers, 387.95x boost, aether_node type, priority 10.0
|
||
|
|
- **G001-G600**: 5-25 superpowers each, dynamically assigned
|
||
|
|
- **9 specialized types** mapped to correct models
|
||
|
|
- **VRAM**: Warning=6.5GB, Critical=7.5GB, Total=8.0GB
|
||
|
|
- **All 5 API endpoints** verified via TestClient (200 OK)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Architecture Overview
|
||
|
|
|
||
|
|
```
|
||
|
|
User Intent / API Request
|
||
|
|
|
|
||
|
|
v
|
||
|
|
+-----------------------------+
|
||
|
|
| SYMBOLIC LAYER |
|
||
|
|
| +-----------------------+ |
|
||
|
|
| | SymbolicEngine | |
|
||
|
|
| | * Intent to Glyph | |
|
||
|
|
| | * Superpower assign | |
|
||
|
|
| | * Resonance calc | |
|
||
|
|
| | * Telemetry emit | |
|
||
|
|
| +----------+------------+ |
|
||
|
|
| | |
|
||
|
|
| +----------v------------+ |
|
||
|
|
| | Router | |
|
||
|
|
| | * Type to Model map | |
|
||
|
|
| | * Priority calc | |
|
||
|
|
| | * Constraints/Enhanc | |
|
||
|
|
| +----------+------------+ |
|
||
|
|
+-------------+---------------+
|
||
|
|
| RoutingResult
|
||
|
|
v
|
||
|
|
+-----------------------------+
|
||
|
|
| COMPUTATIONAL LAYER |
|
||
|
|
| +-----------------------+ |
|
||
|
|
| | VRAMManager | |
|
||
|
|
| | * asyncio.Lock | |
|
||
|
|
| | * 8GB GTX1080 limits | |
|
||
|
|
| | * Forge/Janus mutex | |
|
||
|
|
| | * Priority deactivat | |
|
||
|
|
| +----------+------------+ |
|
||
|
|
| | |
|
||
|
|
| +----------v------------+ |
|
||
|
|
| | GlyphModelIntegration | |
|
||
|
|
| | * Constraint apply | |
|
||
|
|
| | * Enhancement apply | |
|
||
|
|
| | * Post-processing | |
|
||
|
|
| +----------+------------+ |
|
||
|
|
| | |
|
||
|
|
| +----------v------------+ |
|
||
|
|
| | Model Connectors | |
|
||
|
|
| | * Llama (Tabby API) | |
|
||
|
|
| | * Forge (diffusers) | |
|
||
|
|
| | * Janus (stub) | |
|
||
|
|
| | * Google AI (Gemini) | |
|
||
|
|
| +-----------------------+ |
|
||
|
|
+-----------------------------+
|
||
|
|
|
|
||
|
|
v
|
||
|
|
JSON Response + Glyph Metadata
|
||
|
|
```
|
||
|
|
|
||
|
|
### Data Flow
|
||
|
|
|
||
|
|
1. **Request arrives** to POST /api/chat with optional glyph_activation param or POST /api/symbolic/activate
|
||
|
|
2. **Symbolic Engine** activates glyph from intent
|
||
|
|
3. **Router** maps to computational layer
|
||
|
|
4. **VRAM Manager** validates and reserves
|
||
|
|
5. **Model Integration** executes with glyph enhancements
|
||
|
|
6. **Response** returned with glyph metadata
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 3. File Inventory
|
||
|
|
|
||
|
|
### Dual-Layer Core (/home/dave/superdave/dual_layer/)
|
||
|
|
|
||
|
|
| File | Lines | Purpose |
|
||
|
|
|------|-------|---------|
|
||
|
|
| __init__.py | 47 | Package exports |
|
||
|
|
| router.py | 336 | Symbolic to Computational mapping |
|
||
|
|
| vram_manager.py | 368 | Async VRAM manager |
|
||
|
|
| symbolic_engine.py | 323 | Glyph activation engine |
|
||
|
|
|
||
|
|
### Integration (/home/dave/superdave/)
|
||
|
|
|
||
|
|
| File | Lines | Purpose |
|
||
|
|
|------|-------|---------|
|
||
|
|
| dual_layer_integration.py | 227 | FastAPI endpoints |
|
||
|
|
| glyph_model_integration.py | 264 | Model execution with glyphs |
|
||
|
|
| server.py | 920 | Main FastAPI server |
|
||
|
|
|
||
|
|
### Dashboard
|
||
|
|
|
||
|
|
| File | Lines | Purpose |
|
||
|
|
|------|-------|---------|
|
||
|
|
| glyph_dashboard/index.html | 558 | Real-time glyph activation UI |
|
||
|
|
|
||
|
|
### Documentation
|
||
|
|
|
||
|
|
| File | Lines | Purpose |
|
||
|
|
|------|-------|---------|
|
||
|
|
| DUAL_LAYER_USAGE_GUIDE.md | 428 | Complete usage documentation |
|
||
|
|
|
||
|
|
### Tests
|
||
|
|
|
||
|
|
| File | Lines | Purpose |
|
||
|
|
|------|-------|---------|
|
||
|
|
| test_multi_glyph_resonance.py | 328 | 12-test validation suite |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 4. Complete Source Files
|
||
|
|
|
||
|
|
### 4.1 CLAUDE.md
|
||
|
|
|
||
|
|
**Path**: /home/dave/CLAUDE.md (183 lines)
|
||
|
|
|
||
|
|
Full contents start below this line.
|
||
|
|
|
||
|
|
```
|
||
|
|
# SuperDave AI 2.0 — Project Instructions
|
||
|
|
|
||
|
|
**Last Updated**: May 14, 2026
|
||
|
|
**Status**: Backend rebuild in progress (Pinokio integration pending)
|
||
|
|
**Hardware**: GTX 1080 (8GB VRAM)
|
||
|
|
**Active Directory**: `D:\SuperDave_2125\` (or `/mnt/d/SuperDave_2125/` on WSL)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Quick Start
|
||
|
|
|
||
|
|
1. **Server Status**: FastAPI server at `/home/dave/server.py` (or Q:\server.py on Windows)
|
||
|
|
2. **Run Server**: `python server.py` (starts on port 8000)
|
||
|
|
3. **Frontend**: React 19 at `Q:\superdave-ai-bundle\source`
|
||
|
|
4. **Pinokio**: Local environment orchestrates Llama, Forge, Google AI
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Architecture
|
||
|
|
|
||
|
|
```
|
||
|
|
React Frontend (Q:\superdave-ai-bundle\source)
|
||
|
|
↓ HTTP/JSON
|
||
|
|
FastAPI Backend (server.py on port 8000)
|
||
|
|
↓
|
||
|
|
Pinokio Environment
|
||
|
|
├─ Llama (chat/text)
|
||
|
|
├─ Forge/Stable Diffusion (image generation)
|
||
|
|
├─ Janus-Pro-7B (video generation)
|
||
|
|
└─ Google AI (vision analysis)
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Core API Endpoints
|
||
|
|
|
||
|
|
| Endpoint | Method | Purpose | Status |
|
||
|
|
|----------|--------|---------|--------|
|
||
|
|
| `/api/chat` | POST | Chat with Llama | Stub (needs Pinokio routing) |
|
||
|
|
| `/api/generate-image` | POST | Create images via Forge | Stub (needs Pinokio routing) |
|
||
|
|
| `/api/generate-video` | POST | Create videos via Janus | Stub (needs Pinokio routing) |
|
||
|
|
| `/api/vision` | POST | Image analysis (Google AI) | Pending (service TBD) |
|
||
|
|
| `/api/status` | GET | System health & VRAM | ✅ Working |
|
||
|
|
| `/api/config` | GET | System configuration | ✅ Working |
|
||
|
|
| `/api/oracle/{action}` | POST | Memory system (save/retrieve) | Stub |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Critical VRAM Rules
|
||
|
|
|
||
|
|
⚠️ **NEVER run Forge + Janus simultaneously** (8GB crash risk)
|
||
|
|
|
||
|
|
```
|
||
|
|
MAX_VRAM = 8.0 GB
|
||
|
|
WARNING_THRESHOLD = 6.5 GB
|
||
|
|
CRITICAL_THRESHOLD = 7.5 GB
|
||
|
|
```
|
||
|
|
|
||
|
|
**Before launching video generation**: Close Forge first
|
||
|
|
**Before launching image generation**: Close Janus first
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## User Authentication
|
||
|
|
|
||
|
|
Add to server requests:
|
||
|
|
```bash
|
||
|
|
curl -H "Authorization: Bearer <user_id>" http://localhost:8000/api/chat
|
||
|
|
```
|
||
|
|
|
||
|
|
Server logs user_id with each request for usage tracking.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Integration TODOs
|
||
|
|
|
||
|
|
### 1. Connect Llama Chat
|
||
|
|
- [ ] Get Pinokio Llama API endpoint
|
||
|
|
- [ ] Implement in `/api/chat` handler
|
||
|
|
- [ ] Test with simple prompt
|
||
|
|
- [ ] Verify VRAM usage
|
||
|
|
|
||
|
|
### 2. Connect Forge Image Generation
|
||
|
|
- [ ] Get Pinokio Forge API endpoint
|
||
|
|
- [ ] Implement in `/api/generate-image` handler
|
||
|
|
- [ ] Test image generation
|
||
|
|
- [ ] Verify output path (C:\SuperDave_Projects\outputs\images\)
|
||
|
|
|
||
|
|
### 3. Connect Google AI Vision
|
||
|
|
- [ ] Confirm service: Gemini API or Vertex AI
|
||
|
|
- [ ] Get credentials/API key
|
||
|
|
- [ ] Implement in `/api/vision` handler
|
||
|
|
- [ ] Test with sample image
|
||
|
|
|
||
|
|
### 4. Connect Janus Video Generation
|
||
|
|
- [ ] Get Pinokio Janus API endpoint
|
||
|
|
- [ ] Implement in `/api/generate-video` handler
|
||
|
|
- [ ] Test video generation
|
||
|
|
- [ ] Verify output path (C:\SuperDave_Projects\outputs\videos\)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Conversion to EXE
|
||
|
|
|
||
|
|
Once server is stable & all models connected:
|
||
|
|
```bash
|
||
|
|
pip install pyinstaller
|
||
|
|
pyinstaller --onefile --windowed server.py
|
||
|
|
```
|
||
|
|
|
||
|
|
Output: `dist/server.exe` (single executable, no Python needed)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## File Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
/home/dave/SuperDave_2125/
|
||
|
|
├── docs/
|
||
|
|
│ ├── OPERATIONS.md ← Full workflow guide
|
||
|
|
│ ├── API_REFERENCE.md ← Endpoint details
|
||
|
|
│ └── PINOKIO_INTEGRATION.md ← How to connect models
|
||
|
|
├── configs/
|
||
|
|
│ └── model_config.json ← Model settings
|
||
|
|
├── logs/
|
||
|
|
│ └── [system logs]
|
||
|
|
└── server.py ← FastAPI backend (copy to root when ready)
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Important Paths
|
||
|
|
|
||
|
|
- **Server**: `/home/dave/server.py` or `Q:\server.py`
|
||
|
|
- **Frontend**: `Q:\superdave-ai-bundle\source`
|
||
|
|
- **Outputs**: `C:\SuperDave_Projects\outputs\`
|
||
|
|
- **Logs**: `C:\SuperDave_Projects\logs\`
|
||
|
|
- **Docs**: `/home/dave/SuperDave_2125/docs/`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Common Tasks
|
||
|
|
|
||
|
|
### Start Server
|
||
|
|
```bash
|
||
|
|
python server.py
|
||
|
|
# Runs on http://localhost:8000
|
||
|
|
# Docs at http://localhost:8000/docs
|
||
|
|
```
|
||
|
|
|
||
|
|
### Check System Status
|
||
|
|
```bash
|
||
|
|
curl http://localhost:8000/api/status
|
||
|
|
```
|
||
|
|
|
||
|
|
### Test Chat Endpoint
|
||
|
|
```bash
|
||
|
|
curl -X POST http://localhost:8000/api/chat \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{"messages": [{"role": "user", "content": "Hello"}]}'
|
||
|
|
```
|
||
|
|
|
||
|
|
### Test Image Generation
|
||
|
|
```bash
|
||
|
|
curl -X POST http://localhost:8000/api/generate-image \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{"prompt": "a cat sitting on a chair"}'
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Next Session Checklist
|
||
|
|
|
||
|
|
- [ ] Read `/home/dave/SuperDave_2125/docs/OPERATIONS.md`
|
||
|
|
- [ ] Check server status: `/api/status`
|
||
|
|
- [ ] Review integration TODOs above
|
||
|
|
- [ ] Connect next Pinokio model (Llama, Forge, or Google AI)
|
||
|
|
- [ ] Test endpoint with sample request
|
||
|
|
- [ ] Monitor VRAM during operation
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Questions?** Check `/home/dave/SuperDave_2125/docs/` for detailed guides.
|
||
|
|
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 4.2 AGENTS.md
|
||
|
|
|
||
|
|
**Path**: /home/dave/superdave/AGENTS.md
|
||
|
|
|
||
|
|
```
|
||
|
|
# SuperDave GlyphRunner - Project Guide
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
|
||
|
|
SuperDave GlyphRunner is a Python system that compiles Python source code into GX binary format (XIC format) and executes it through the LAIN cognition engine — an 8-lane symbolic processor with glyph resonance analysis. Includes a FedMart telemetry system with real-time dashboard.
|
||
|
|
|
||
|
|
## Language & Runtime
|
||
|
|
|
||
|
|
- Python 3.14
|
||
|
|
- No virtual environment or package manager configured
|
||
|
|
- No requirements.txt or pyproject.toml
|
||
|
|
|
||
|
|
## Directory Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
gx_compiler/ — Python → .gx binary compiler (compressor, segmenter, packer)
|
||
|
|
gx_lain/ — LAIN cognition engine (8-lane symbolic processor, glyph bridge, runtime)
|
||
|
|
gx_cli/ — CLI interface (compile, run, inspect, summary, lain commands)
|
||
|
|
runtime_executor/ — GX binary loader and execution runtime
|
||
|
|
glyphs/ — Supercharged glyph registry (600 glyphs from LedoGlyph600.json)
|
||
|
|
glyphos/ — Symbolic pipeline, cognitive kernel, event system
|
||
|
|
xic_extensions/ — Compressed engine, segment runtime, profiler, execution tracer
|
||
|
|
xic_*.py — XIC VM, executor, shell, validator, cache, diagnostics, profiler, visualizer
|
||
|
|
fedmart_ui/ — Web dashboard for XIC telemetry monitoring
|
||
|
|
integrations/ — FedMart integration adapter
|
||
|
|
codex_lineage/ — Grammar hooks, contributor index, lineage model, epoch mapper
|
||
|
|
LLMCompress/ — LLM compression utilities
|
||
|
|
tests/ — Unit tests (plain Python, no framework)
|
||
|
|
integration_tests/ — Integration tests (plain Python, no framework)
|
||
|
|
```
|
||
|
|
|
||
|
|
## Test Commands
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Run all integration tests
|
||
|
|
python3 /home/dave/superdave/integration_tests/run_all_tests.py
|
||
|
|
|
||
|
|
# Run individual integration tests
|
||
|
|
python3 /home/dave/superdave/integration_tests/test_compile.py
|
||
|
|
python3 /home/dave/superdave/integration_tests/test_run.py
|
||
|
|
python3 /home/dave/superdave/integration_tests/test_inspect.py
|
||
|
|
python3 /home/dave/superdave/integration_tests/test_summary.py
|
||
|
|
python3 /home/dave/superdave/integration_tests/test_errors.py
|
||
|
|
python3 /home/dave/superdave/integration_tests/test_determinism.py
|
||
|
|
|
||
|
|
# Run unit tests
|
||
|
|
python3 /home/dave/superdave/tests/test_supercharged_registry.py
|
||
|
|
python3 /home/dave/superdave/tests/test_lain_glyph_bridge.py
|
||
|
|
python3 /home/dave/superdave/tests/test_cognitive_kernel.py
|
||
|
|
python3 /home/dave/superdave/tests/test_events.py
|
||
|
|
python3 /home/dave/superdave/tests/test_control_flow.py
|
||
|
|
|
||
|
|
# Run FedMart validation tests
|
||
|
|
python3 /home/dave/superdave/tests/validate_fedmart_integration.py
|
||
|
|
python3 /home/dave/superdave/tests/validate_ui_integration.py
|
||
|
|
```
|
||
|
|
|
||
|
|
## Lint / Typecheck
|
||
|
|
|
||
|
|
No linter or typecheck configuration found. Run tests as verification.
|
||
|
|
|
||
|
|
## Code Conventions
|
||
|
|
|
||
|
|
- Tests use plain Python (no pytest/unittest) with subprocess and assertions
|
||
|
|
- Tests exit 0 on pass, non-zero on fail
|
||
|
|
- Packages use relative imports (`from .module import`)
|
||
|
|
- Lane processors return `{"summary": str, "key_points": list, "constraints": list, "open_questions": list}`
|
||
|
|
- Lane processors use error recovery (catch exceptions, return safe defaults)
|
||
|
|
- No comments in code unless explicitly requested
|
||
|
|
- GSZ3 compression ensures deterministic output (no timestamps in payload)
|
||
|
|
|
||
|
|
## CLI Usage
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Compile Python source to GX binary
|
||
|
|
python3 -m gx_cli.main compile source.py -o source.gx
|
||
|
|
|
||
|
|
# Execute through LAIN cognition
|
||
|
|
python3 -m gx_cli.main lain source.gx
|
||
|
|
|
||
|
|
# Inspect GX binary
|
||
|
|
python3 -m gx_cli.main inspect source.gx
|
||
|
|
|
||
|
|
# Run GX binary
|
||
|
|
python3 -m gx_cli.main run source.gx
|
||
|
|
|
||
|
|
# Summary of GX binary
|
||
|
|
python3 -m gx_cli.main summary source.gx
|
||
|
|
```
|
||
|
|
|
||
|
|
## Key Data
|
||
|
|
|
||
|
|
- 600 glyphs in LedoGlyph600.json (~2.2 MB)
|
||
|
|
- 8 glyph categories, bands 0-41, scores 0-300+
|
||
|
|
- Resonance formula: 40% activation + 30% frequency + 30% symbolic
|
||
|
|
- Typical compile: ~600 byte source → ~960 byte .gx, 6 segments, ~280 bytes compressed
|
||
|
|
```
|