Files

195 lines
6.7 KiB
Markdown
Raw Permalink Normal View History

2026-07-09 12:55:00 -04:00
## 5. Usage Guide (Summary)
See `DUAL_LAYER_USAGE_GUIDE.md` in Part 2 for the complete guide. Key commands:
### Start Server
```bash
python3 /home/dave/server.py
```
### Access Dashboard
Open in browser: **http://localhost:8000/glyphs/index.html**
### Test Symbolic Endpoints
```bash
# Check status
curl http://localhost:8000/api/symbolic/status
# Activate glyph
curl -X POST http://localhost:8000/api/symbolic/activate \
-H "Content-Type: application/json" \
-d '{"intent": "I need primordial authority", "request_type": "chat"}'
```
### Chat with Glyph Activation
```bash
curl -X POST http://localhost:8000/api/chat \
-H "Content-Type: application/json" \
-d '{
"model": "llama-3.5-35b",
"messages": [{"role": "user", "content": "Hello"}],
"temperature": 0.7,
"glyph_activation": {
"intent": "I need root authority",
"request_type": "chat"
}
}'
```
---
## 6. Testing & Validation
### Dual-Layer Endpoint Tests
All 5 symbolic API endpoints verified via TestClient returning 200 OK:
| Endpoint | Method | Status |
|----------|--------|--------|
| /api/symbolic/status | GET | Verified |
| /api/symbolic/glyphs | GET | Verified |
| /api/symbolic/activate | POST | Verified |
| /api/symbolic/deactivate | POST | Verified |
| /api/symbolic/routing/summary | GET | Verified |
### Multi-Glyph Resonance Tests
The validation suite (test_multi_glyph_resonance.py) runs 12 tests:
1. New operations in OP_TABLE
2. XICContext.glyph_contexts field
3. PUSH_GLYPH_CONTEXT accumulation
4. CLEAR_GLYPH_CONTEXT reset
5. Guardrail enforcement
6. run_symbolic_pipeline signature
7. compute_multi_glyph_resonance() exists
8. Multi-glyph computation structure
9. execute_symbolic with glyph_ids
10. Backward compatibility
11. Demo programs validation
12. Multi-glyph demo structure
Run with:
```bash
python3 /home/dave/superdave/test_multi_glyph_resonance.py
```
---
## 7. Key Decisions Log
### Architecture
| Decision | Rationale |
|----------|-----------|
| Dual-layer design | Separates symbolic intent (glyphs/resonance) from computational execution (models/VRAM) |
| Async VRAM lock (asyncio.Lock) | Prevents threading lock timeouts while keeping concurrent safety |
| Priority formula: min(10.0, power_boost / 40.0) | G001 (387.95x) gets max priority 10.0; normal glyphs scale proportionally |
| Resonance formula: 40% activation + 30% frequency + 30% symbolic | Balances power count, boost intensity, and type significance on 0-100 scale |
| Singleton managers (get_vram_manager, get_symbolic_engine) | Ensures global state consistency across requests |
### VRAM Management
| Decision | Rationale |
|----------|-----------|
| 8GB GTX1080 limits | Hardware constraint; Warning=6.5GB, Critical=7.5GB |
| Forge/Janus mutex | Both consume ~4.5-5GB each; running together would exceed 8GB |
| Priority-based deactivation | Higher-priority glyphs can evict lower-priority ones when VRAM is full |
| Per-type VRAM budgets | Different model types need different amounts (llama=2GB, forge=4.5GB, janus=5GB) |
### Glyph Configuration
| Decision | Rationale |
|----------|-----------|
| G001 gets 152 superpowers, priority 10.0 | Root glyph (Ledo) has maximum authority |
| G002-G600 get 5-25 powers dynamically | Metric-based assignment ensures balanced distribution |
| 9 specialized types | Maps to available computational models (Llama, Forge, etc.) |
| aether_node: 7.5GB max VRAM | G001 needs maximum resources for full capability |
### Specialized Type Routing
| Decision | Rationale |
|----------|-----------|
| star_bloom_creativity -> forge | Creative tasks map to image generation |
| frost_steel_stabilizer -> llama | Safety/stability handled by LLM constraints |
| mirror_weave_reasoning -> llama | Reasoning/logic handled by LLM enhancements |
| monument_grade_equilibrium -> llama | System balance handled by LLM orchestration |
### Dashboard Design
| Decision | Rationale |
|----------|-----------|
| Real-time VRAM bar | Visual indicator of GPU memory pressure |
| 5-second auto-refresh | Balance between responsiveness and API load |
| Activity log with 20 entries | Keep UI clean while showing recent history |
| Fixed refresh button | Always accessible for manual refresh |
---
## 8. Next Steps
### Immediate (Blocked)
1. **Fix server persistence**: Server keeps shutting down when shell times out
- Use: `nohup python3 /home/dave/server.py &`
- Or set up systemd/tmux service
2. **Verify dashboard** from browser at http://localhost:8000/glyphs/index.html
### Short Term
3. Test glyph activation from dashboard UI
4. Connect to Pinokio for real model execution
5. Verify VRAM monitoring during operation
### Medium Term
6. Connect Llama Chat (Tabby API endpoint)
7. Connect Forge Image Generation (diffusers/SDXL-Turbo)
8. Connect Google AI Vision (Gemini API key)
9. Connect Janus Video Generation
### Long Term
10. Convert to single EXE via PyInstaller
11. Tune routing thresholds based on real usage
12. Expand beyond 600 glyphs if desired
---
## 9. Session Context & Thinking Log
### Build Sequence
1. Created dual-layer package structure (dual_layer/__init__.py, router.py, vram_manager.py, symbolic_engine.py)
2. Built routing system mapping 9 specialized types to models with constraints/enhancements
3. Implemented async VRAM manager with Forge/Janus mutex and priority deactivation
4. Created SymbolicEngine for intent-based glyph activation and resonance calculation
5. Built FastAPI integration with 5 symbolic endpoints
6. Created real-time glyph activation dashboard (HTML/CSS/JS)
7. Implemented glyph-enhanced model execution (constraint/enhancement framework)
8. Enhanced server.py with dual-layer import and dashboard mounting
9. Fixed bugs: threading.Lock -> asyncio.Lock, import paths, parameter mismatches
10. Verified all 5 endpoints via TestClient returning 200 OK
11. Created comprehensive usage guide
### Bugs Fixed
- **Threading lock timeout**: Replaced threading.Lock() with asyncio.Lock() in VRAMManager
- **Import paths**: Standardized "dual_layer.*" -> "superdave.dual_layer.*"
- **GlyphActivationEvent parameter mismatch**: Changed success/failure_reason to context dict
- **Variable naming conflict**: Fixed logger redefinition in server.py (line 37)
### Critical Rules Enforced
- NEVER run Forge + Janus simultaneously (8GB VRAM crash risk)
- G001 has maximum priority (10.0) and VRAM budget (7.5GB)
- Priority-based preemption for VRAM allocation
- FedMart telemetry on every glyph activation
---
## 10. Version History
| Date | Version | Changes |
|------|---------|---------|
| Sat Jun 13 2026 | 1.0.0 | Initial dual-layer build complete |
| Sat Jun 13 2026 | 1.0.1 | Fixed async lock, imports, event params |
| Sat Jun 13 2026 | 1.0.2 | Added dashboard, enhanced server.py |
| Sat Jun 13 2026 | 1.0.3 | Endpoint verification, usage guide |
---
*End of Session Export*