diff --git a/PROMPT.md b/PROMPT.md index 21ac0d4..3f8524f 100644 --- a/PROMPT.md +++ b/PROMPT.md @@ -19,27 +19,100 @@ botapp/ # Desktop wrapper (consumes botui) botbook/ # Documentation ``` -### What BotUI Provides +--- -- **Web Mode**: Axum server serving HTML/CSS/JS UI on port 3000 -- **Desktop Mode**: Tauri native application with same UI -- **HTTP Bridge**: Proxies all requests to botserver -- **Local Assets**: All JS/CSS bundled locally (no CDN) +## LLM Workflow Strategy + +### Two Types of LLM Work + +1. **Execution Mode (Fazer)** + - Pre-annotate phrases and send for execution + - Focus on automation freedom + - Less concerned with code details + - Primary concern: Is the LLM destroying something? + - Trust but verify output doesn't break existing functionality + +2. **Review Mode (Conferir)** + - Read generated code with full attention + - Line-by-line verification + - Check for correctness, security, performance + - Validate against requirements + +### LLM Fallback Strategy (After 3 attempts / 10 minutes) + +1. DeepSeek-V3-0324 (good architect, reliable) +2. gpt-5-chat (slower but thorough) +3. gpt-oss-120b (final validation) +4. Claude Web (for complex debugging, unit tests, UI) --- -## Quick Start +## Code Generation Rules -```bash -# Terminal 1: Start BotServer -cd ../botserver && cargo run +### CRITICAL REQUIREMENTS -# Terminal 2: Start BotUI (Web Mode) -cd ../botui && cargo run -# Visit http://localhost:3000 +``` +- BotUI = Presentation + HTTP bridge ONLY +- All business logic goes in botserver +- No code duplication between layers +- Feature gates eliminate unused code paths +- Zero warnings - feature gating prevents dead code +- NO DEAD CODE - implement real functionality, never use _ for unused +- All JS/CSS must be local (no CDN) +``` -# OR Desktop Mode -cargo tauri dev +### HTMX-First Frontend + +``` +- Use HTMX to minimize JavaScript at maximum +- Delegate ALL logic to Rust server +- Server returns HTML fragments, not JSON +- Use hx-get, hx-post, hx-target, hx-swap attributes +- WebSocket via htmx-ws extension for real-time +- NO custom JavaScript where HTMX can handle it +``` + +### Local Assets Only + +All external libraries are bundled locally - NEVER use CDN: + +``` +ui/suite/js/vendor/ +├── htmx.min.js # HTMX core +├── htmx-ws.js # WebSocket extension +├── htmx-json-enc.js # JSON encoding +├── marked.min.js # Markdown parser +├── gsap.min.js # Animation (minimal use) +├── alpinejs.min.js # Alpine.js (minimal use) +└── livekit-client.umd.min.js # LiveKit video + +ui/minimal/js/vendor/ +└── (same structure) +``` + +```html + + + + + +``` + +### Dependency Management + +``` +- Use diesel for any local database needs +- After adding to Cargo.toml: cargo audit must show 0 warnings +- If audit fails, find alternative library +- Minimize redundancy - check existing libs before adding new ones +``` + +### Documentation Rules + +``` +- Rust code examples ONLY allowed in architecture/gbapp documentation +- Scan for ALL_CAPS.md files created at wrong places - delete or integrate +- Keep only README.md and PROMPT.md at project root level ``` --- @@ -72,93 +145,80 @@ src/ ui/ ├── suite/ # Main UI (HTML/CSS/JS) -│ ├── js/vendor/ # Local JS libraries (htmx, marked, etc.) +│ ├── js/vendor/ # Local JS libraries │ └── css/ # Stylesheets └── minimal/ # Minimal chat UI └── js/vendor/ # Local JS libraries ``` ---- - -## Feature Gating +### Feature Gating ```rust -#[cfg(feature = "desktop")] // Desktop build only +#[cfg(feature = "desktop")] pub mod desktop; -#[cfg(not(feature = "desktop"))] // Web build only +#[cfg(not(feature = "desktop"))] pub mod http_client; ``` -Build commands: -```bash -cargo build # Web mode (default) -cargo build --features desktop # Desktop mode -cargo tauri build # Optimized desktop build -``` - --- -## Code Generation Rules +## HTMX Patterns -### CRITICAL REQUIREMENTS +### Server-Side Rendering -``` -- BotUI = Presentation + HTTP bridge ONLY -- All business logic goes in botserver -- No code duplication between layers -- Feature gates eliminate unused code paths -- Zero warnings - feature gating prevents dead code -- All JS/CSS must be local (no CDN) -``` - -### Key Principles - -1. **Minimize Code** - Only presentation and HTTP bridging -2. **Feature Gating** - Desktop code doesn't compile in web mode -3. **HTTP Communication** - All botserver calls through BotServerClient -4. **Local Assets** - All vendor JS in ui/*/js/vendor/ - ---- - -## Local JS/CSS Vendor Files - -All external libraries are bundled locally: - -``` -ui/suite/js/vendor/ -├── htmx.min.js # HTMX 1.9.10 -├── htmx-ws.js # HTMX WebSocket extension -├── htmx-json-enc.js # HTMX JSON encoding -├── marked.min.js # Markdown parser -├── gsap.min.js # Animation library -├── alpinejs.min.js # Alpine.js reactivity -└── livekit-client.umd.min.js # LiveKit video -``` - -**NEVER use CDN URLs** - always reference local vendor files: ```html - - + + - - +