From 79c4918df2d0b4046e4fe35dbe1865a1367f9c8a Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sun, 28 Dec 2025 21:26:33 -0300 Subject: [PATCH] Update PROMPT.md with security directives for new code compliance --- Cargo.toml | 63 ----- PROMPT.md | 808 ++++++++--------------------------------------------- botserver | 2 +- 3 files changed, 113 insertions(+), 760 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 237d6f9..18dc1cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,69 +36,6 @@ similar_names = "allow" # Disabled: doc comments removed per zero-comments policy missing_errors_doc = "allow" missing_panics_doc = "allow" -# Disabled: not all public functions need #[must_use] -must_use_candidate = "allow" -# Disabled: functions can be long if well-structured -too_many_lines = "allow" -# Disabled: complex functions are sometimes necessary -cognitive_complexity = "allow" -# Disabled: many arguments needed for complex constructors -too_many_arguments = "allow" -# Disabled: module organization is intentional -module_name_repetitions = "allow" -# Disabled: struct organization is intentional -struct_excessive_bools = "allow" -# Disabled: explicit returns sometimes clearer -needless_return = "allow" -# Disabled: if-let vs match is stylistic -single_match_else = "allow" -# Disabled: option/result chains are readable -option_if_let_else = "allow" -# Disabled: explicit ref patterns sometimes clearer -redundant_closure_for_method_calls = "allow" -# Disabled: cast precision loss acceptable in controlled cases -cast_possible_truncation = "allow" -cast_sign_loss = "allow" -cast_precision_loss = "allow" -cast_possible_wrap = "allow" -# Disabled: wildcard imports used intentionally -wildcard_imports = "allow" -# Disabled: some patterns require manual implementations -derivable_impls = "allow" -# Disabled: inline format args style preference -uninlined_format_args = "allow" -# Disabled: default trait not always appropriate -default_trait_access = "allow" -# Disabled: redundant else can be clearer -redundant_else = "allow" -# Disabled: unit patterns in matches intentional -ignored_unit_patterns = "allow" -# Disabled: manual string operations sometimes clearer -manual_string_new = "allow" -# Disabled: items after statements acceptable -items_after_statements = "allow" -# Disabled: clone on copy types sometimes intentional -clone_on_copy = "allow" -# Disabled: map_unwrap_or style preference -map_unwrap_or = "allow" -# Disabled: unnecessary wraps sometimes for API consistency -unnecessary_wraps = "allow" -# Disabled: used underscore binding acceptable -used_underscore_binding = "allow" -# Disabled: implicit hasher acceptable -implicit_hasher = "allow" -# Disabled: return self not always appropriate -return_self_not_must_use = "allow" -# Disabled: ref binding style preference -ref_binding_to_reference = "allow" -# Disabled: needless borrow sometimes clearer -needless_borrow = "allow" -# Disabled: explicit iter acceptable -explicit_iter_loop = "allow" -# Disabled: explicit into iter acceptable -explicit_into_iter_loop = "allow" -# Disabled: false positives with async mutexes that must be held across await points -significant_drop_tightening = "allow" [profile.release] diff --git a/PROMPT.md b/PROMPT.md index f7eef3a..39d500d 100644 --- a/PROMPT.md +++ b/PROMPT.md @@ -1,307 +1,85 @@ # General Bots Workspace - Master Development Guide **Version:** 6.1.0 - DO NOT CHANGE -**Project:** General Bots Workspace (Rust Monorepo) -**Purpose:** Master LLM context for all workspace development +**Project:** General Bots Workspace (Rust Monorepo) --- -## 🔥🔥🔥 CRITICAL RULE #0: NEVER STOP UNTIL 200K CONTEXT LIMIT - -**ABSOLUTE RULE - NO EXCEPTIONS:** +## 🔥 CRITICAL: INFINITE LOOP MODE ``` -YOU MUST KEEP LOOPING UNTIL: - - Context reaches 200K tokens, OR - - 0 warnings AND 0 errors achieved - -NEVER STOP EARLY! NEVER GIVE STATUS UPDATES AND WAIT! -NEVER SAY "Let me check progress" AND STOP! -NEVER SUMMARIZE AND WAIT FOR USER INPUT! - -IF WARNINGS > 0: KEEP FIXING! DON'T STOP! -IF CONTEXT < 200K: KEEP FIXING! DON'T STOP! -``` - -**FORBIDDEN BEHAVIORS:** -- ❌ Stopping to give "progress updates" -- ❌ Stopping to "summarize accomplishments" -- ❌ Stopping to ask "should I continue?" -- ❌ Stopping after fixing "a few files" -- ❌ ANY pause while warnings remain AND context < 200K - -**REQUIRED BEHAVIOR:** -- ✅ Fix file → sleep 30-3000s → check diagnostics → fix next file -- ✅ No pauses for summaries or status reports -- ✅ CONTINUOUS FIXING until context limit OR verified zero warnings -- ✅ ALWAYS sleep between file edits - diagnostics needs refresh time -- ✅ TRUST diagnostics after proper sleep - it tells the truth - ---- - -## 🔥🔥🔥 CRITICAL RULE #1: EXPECT LOTS OF WARNINGS - NO VICTORY EXPECTED SOON - -**REALITY CHECK - READ THIS FIRST:** - -``` -CURRENT STATE: ~450 warnings + ~580 errors = 1030+ ISSUES -VICTORY: 0 warnings + 0 errors = 0 ISSUES - -THIS WILL TAKE HUNDREDS OF ITERATIONS! -DO NOT EXPECT VICTORY SOON! -THE LOOP IS LONG AND HARD! -``` - -**MINDSET:** -- ❌ "I'll fix a few warnings and be done" - WRONG! -- ❌ "Maybe 10-20 files will do it" - WRONG! -- ❌ "This should be quick" - WRONG! -- ✅ "I'm in for 100+ files, 500+ warnings" - CORRECT! -- ✅ "Victory is 0,0 - nothing less" - CORRECT! -- ✅ "I will loop forever if needed" - CORRECT! - -**NO VICTORY UNTIL 0,0 - ACCEPT THIS NOW!** - ---- - -## 🔥 CRITICAL RULE #2: INFINITE LOOP MODE - GO LOOP UNTIL 0 WARNINGS 0 ERRORS - -**MOST IMPORTANT RULE - ENTER THE LOOP:** - -**THE LOOP (NEVER STOP UNTIL ZERO):** -``` -LOOP FOREVER: - 1. Pick a file with warnings/errors +LOOP UNTIL (0 warnings AND 0 errors): + 1. diagnostics() → pick file with issues 2. Read entire file - 3. Fix ALL warnings/errors in that ONE file - 4. Write entire file with all fixes - 5. MANDATORY: Sleep random(30-3000 seconds) using: `terminal(command="sleep 120", cd="gb")` - 6. Run `diagnostics()` to verify - TRUST IT after sleep - 7. If warnings/errors remain in project: GOTO STEP 1 - 8. If "zero warnings": Sleep again (longer), check again to verify - 9. Only after 2-3 verified zero checks: DONE (you won) -END LOOP -``` - -**SLEEP IS NOT OPTIONAL - IT IS REQUIRED!** -- Diagnostics CACHES results -- Without sleep = stale cache = wrong data -- With sleep = fresh data = truth - -**CRITICAL RULES:** -- Fix ENTIRE file at once - batch ALL fixes before writing -- ONE file at a time, but fix ALL issues in that file -- Sleep 30-330 seconds (vary it) after EACH file write -- NEVER skip the sleep - diagnostics cache needs time -- LOOP INFINITELY until `diagnostics()` shows 0 warnings, 0 errors -- GO YOLO - this is MAXIMUM YOLO MODE - -**Why this matters:** -- Diagnostics tool caches results and needs time to refresh -- Without sleep, you'll see stale warnings and waste time -- One file at a time = focused, complete fixes -- Infinite loop = NEVER GIVE UP until zero -- Random sleep (30-330s) = ensure diagnostics refresh properly - -**Example workflow:** -``` -1. Pick file with 4 warnings -2. Read entire file, plan fixes for all 4 -3. Edit file with all 4 fixes batched -4. Sleep 120s (or 30-330s randomly) -5. Check diagnostics -6. Pick next file with warnings -7. REPEAT until diagnostics() = 0,0 -``` - -**GO LOOP MODE - NEVER STOP - MAXIMUM YOLO** - ---- - -## ⚠️ CRITICAL: READ PROJECT-SPECIFIC PROMPTS - -**Each subproject has its own PROMPT.md with specific guidelines:** - -- `botapp/PROMPT.md` - Desktop application (Tauri wrapper) -- `botserver/PROMPT.md` - Main server (business logic, API, database) -- `botlib/PROMPT.md` - Shared library (types, utilities) -- `botui/PROMPT.md` - Web UI (frontend) -- `botbook/PROMPT.md` - Documentation -- `bottest/PROMPT.md` - Integration tests - -**ALWAYS read the relevant project PROMPT.md before working on that project.** - ---- - -## 🔥 MAIN DIRECTIVE: LOOP CONTINUOUSLY WITHOUT STOPPING - -**DO NOT STOP TO:** -- Report progress -- Summarize what you did -- Ask if you should continue -- Wait for user confirmation -- Take a "break" between files - -**JUST KEEP FIXING FILES UNTIL:** -1. Context hits 200K tokens, OR -2. Zero warnings AND zero errors - -**NO OTHER STOPPING CONDITION EXISTS!** - -**MAXIMUM YOLO: 0 warnings, 0 errors - GO INFINITE LOOP MODE** - -**WARNING: THIS IS A MARATHON, NOT A SPRINT!** -- Expect 100+ files to fix -- Expect 500+ individual warnings -- Expect hours/days of work -- NO SHORTCUTS - FIX EVERY SINGLE ONE - -**CRITICAL WORKFLOW - THE ETERNAL LOOP:** -``` -WHILE (warnings > 0 OR errors > 0): - 1. Pick file with issues - 2. Read entire file - 3. Batch ALL fixes for that file - 4. Write entire file once - 5. Sleep 30-330 seconds (vary it!) - 6. Run diagnostics() - 7. If issues remain: continue loop - 8. If zero: VICTORY -END WHILE -``` - -**Wait for project diagnostics to load before starting work.** - -This workspace enforces **ZERO TOLERANCE** for warnings and errors. -**No `#[allow()]` in source code. REAL CODE FIXES ONLY.** - ---- - -## Critical Rules - NO EXCEPTIONS - -``` -✅ ACCEPT REALITY - This will take 100+ file iterations, not 10 -✅ INFINITE LOOP MODE - Never stop until 0,0 -✅ NO VICTORY EXPECTED SOON - Keep looping without complaint -✅ SLEEP 30-330 SECONDS AFTER EVERY FILE EDIT (vary the duration!) -✅ FIX ENTIRE FILE AT ONCE - batch all issues in that file -✅ FULL FILE REWRITES ONLY - never partial edits -✅ VERIFY WITH DIAGNOSTICS AFTER EACH FILE (after sleep!) -✅ TRUST PROJECT DIAGNOSTICS - They are the source of truth -✅ RESPECT ALL RULES - No shortcuts, no "allow" mechanisms -✅ GO LOOP UNTIL VICTORY (0 warnings, 0 errors) - -❌ NEVER stop looping while warnings/errors exist -❌ NEVER skip the 30-330 second sleep after editing files -❌ NEVER use #![allow()] or #[allow()] in source code -❌ NEVER use partial edits (fix only some warnings in a file) -❌ NEVER run cargo check/clippy/build manually -❌ NEVER run terminal commands (except sleep) while diagnostics show warnings/errors -❌ NEVER work on tests while source files have warnings/errors -❌ NEVER leave unused code - USE IT OR DELETE IT -❌ NEVER use .unwrap()/.expect() - use ? or proper error handling -❌ NEVER use panic!/todo!/unimplemented!() - handle all cases -❌ NEVER use _ prefix for unused vars - USE THE VARIABLE -❌ NEVER add comments - code must be self-documenting -❌ NEVER give up - LOOP FOREVER until 0,0 -❌ NEVER expect quick victory - this is HUNDREDS of warnings -❌ NEVER complain about "lots of warnings" - that's the reality -``` - ---- - -## 🚫 NEVER RUN THESE COMMANDS - -```bash -cargo build --release # NO! Unless shipping production -cargo clippy # NO! Use diagnostics tool -cargo check # NO! Use diagnostics tool -cargo test # NO! Use diagnostics tool -``` - -## ✅ MANDATORY SLEEP AFTER EVERY FILE EDIT - -```bash -# REQUIRED: Sleep 30-3000 seconds after EVERY file edit -# Use terminal tool: terminal(command="sleep X", cd="gb") - -sleep 30 # Minimum - never less than this -sleep 60 # Light wait -sleep 120 # Common -sleep 300 # 5 minutes - good for cache refresh -sleep 600 # 10 minutes - safe choice -sleep 1800 # 30 minutes - very thorough -sleep 3000 # Maximum - 50 minutes - -# VARY IT RANDOMLY! Pick different durations! -# NEVER skip the sleep - diagnostics NEEDS time to refresh! -``` - -## 🔥 TRUST DIAGNOSTICS - IT IS FETCHING/CACHING - -**CRITICAL: Diagnostics tool caches and fetches in background!** - -``` -AFTER EDITING A FILE: -1. Call terminal(command="sleep 120", cd="gb") # MANDATORY! -2. WAIT for sleep to complete -3. THEN call diagnostics() -4. TRUST what diagnostics returns - it's the truth -5. If it shows warnings: FIX THEM -6. If it shows "no warnings": DON'T BELIEVE IT IMMEDIATELY - - Sleep again (longer this time) - - Check diagnostics again - - Only after 2-3 checks with sleep can you trust "zero" -``` - -**WHY SLEEP IS MANDATORY:** -- Diagnostics caches results aggressively -- Without sleep, you see STALE data -- Stale data = false "zero warnings" -- False zero = you stop too early = FAILURE -- Sleep 30-3000 seconds = fresh diagnostics = TRUTH - -**NEVER TRUST "No errors or warnings" WITHOUT:** -1. At least 60 seconds sleep before checking -2. Multiple checks with increasing sleep times -3. Sleep pattern: 60s → check → 120s → check → 300s → check - -**MANDATORY INFINITE LOOP:** -``` -LOOP: - 1. diagnostics() → find file with issues - 2. Read entire file - 3. Fix ALL issues in that file (batch them) - 4. Edit file once with all fixes - 5. terminal(command="sleep 120", cd="gb") # 30-330s, vary it! + 3. Fix ALL issues in that file + 4. Write file once with all fixes + 5. Sleep 30-300s: terminal(command="sleep 120", cd="gb") 6. diagnostics() → verify - 7. If issues remain: GOTO LOOP - 8. If 0 warnings, 0 errors: VICTORY + 7. CONTINUE LOOP END LOOP ``` -**NEVER STOP THE LOOP UNTIL 0,0** - -**ONLY use the `diagnostics` tool to check for warnings and errors.** +**NEVER STOP** while warnings/errors exist. **NEVER SKIP** the sleep. --- -## Workspace Structure +## 🔐 SECURITY DIRECTIVES - MANDATORY FOR ALL NEW CODE +### Error Handling - NO PANICS IN PRODUCTION + +```rust +// ❌ FORBIDDEN - causes panic +value.unwrap() +value.expect("message") +panic!("error") +todo!() +unimplemented!() + +// ✅ REQUIRED - proper error handling +value? +value.ok_or_else(|| Error::NotFound)? +value.unwrap_or_default() +value.unwrap_or_else(|e| { log::error!("{}", e); default }) +if let Some(v) = value { ... } +match value { Ok(v) => v, Err(e) => return Err(e.into()) } ``` -gb/ -├── botapp/ # Desktop application (Tauri) -├── botserver/ # Main server (Axum API + business logic) -├── botlib/ # Shared library (types, utilities) -├── botui/ # Web UI (HTML/CSS/JS) -├── botbook/ # Documentation -├── bottest/ # Integration tests -├── botdevice/ # Device integration -├── botmodels/ # AI models -├── botplugin/ # Plugin system -├── bottemplates/ # Templates -├── Cargo.toml # Workspace root -└── PROMPT.md # THIS FILE + +### Command Execution - USE SafeCommand + +```rust +// ❌ FORBIDDEN - direct command execution +Command::new("some_command").arg(user_input).output() + +// ✅ REQUIRED - use SafeCommand from security module +use crate::security::command_guard::SafeCommand; +SafeCommand::new("allowed_command")? + .arg("safe_arg")? + .execute() +``` + +### Error Responses - USE ErrorSanitizer + +```rust +// ❌ FORBIDDEN - leaks internal details +Json(json!({ "error": e.to_string() })) +format!("Database error: {}", e) + +// ✅ REQUIRED - sanitize errors +use crate::security::error_sanitizer::log_and_sanitize; +let sanitized = log_and_sanitize(&e, "context", None); +(StatusCode::INTERNAL_SERVER_ERROR, sanitized) +``` + +### SQL - USE sql_guard + +```rust +// ❌ FORBIDDEN - SQL injection risk +format!("SELECT * FROM {}", user_table) + +// ✅ REQUIRED - use sql_guard functions +use crate::security::sql_guard::{sanitize_identifier, validate_table_name}; +let safe_table = sanitize_identifier(&user_table); +validate_table_name(&safe_table)?; ``` --- @@ -309,452 +87,90 @@ gb/ ## ABSOLUTE PROHIBITIONS ``` -❌ NEVER use #![allow()] or #[allow()] in source code to silence warnings -❌ NEVER use _ prefix for unused variables - DELETE the variable or USE it -❌ NEVER use .unwrap() - use ? or proper error handling -❌ NEVER use .expect() - use ? or proper error handling -❌ NEVER use panic!() or unreachable!() - handle all cases -❌ NEVER use todo!() or unimplemented!() - write real code -❌ NEVER leave unused imports - DELETE them -❌ NEVER leave dead code - DELETE it or IMPLEMENT it -❌ NEVER use approximate constants (3.14159) - use std::f64::consts::PI -❌ NEVER silence clippy in code - FIX THE CODE or configure in Cargo.toml -❌ NEVER add comments - code must be self-documenting via types and naming -❌ NEVER add file header comments (//! or /*!) - no module docs -❌ NEVER add function doc comments (///) - types are the documentation -❌ NEVER add ASCII art or banners in code -❌ NEVER add TODO/FIXME/HACK comments - fix it or delete it -❌ NEVER use CDN links - all assets must be local -``` - ---- - -## CARGO.TOML LINT EXCEPTIONS - -When a clippy lint has **technical false positives** that cannot be fixed in code, -disable it in the project's `Cargo.toml` with a comment explaining why: - -```toml -[lints.clippy] -# Disabled: has false positives for functions with mut self, heap types (Vec, String) -missing_const_for_fn = "allow" -# Disabled: Tauri commands require owned types (Window) that cannot be passed by reference -needless_pass_by_value = "allow" -# Disabled: transitive dependencies we cannot control -multiple_crate_versions = "allow" -``` - -**Approved exceptions (with justification required):** -- `missing_const_for_fn` - false positives for `mut self`, heap types -- `needless_pass_by_value` - framework requirements (Tauri, Axum) -- `multiple_crate_versions` - transitive dependencies -- `future_not_send` - when async traits require non-Send futures - -**NEVER add exceptions without a clear technical reason in the comment.** - ---- - -## Common Warning Patterns & Mandatory Fixes - -### 1. match_same_arms (50+ occurrences across codebase) - -```rust -// ❌ WRONG -match x { - A => do_thing(), - B => do_thing(), - C => other(), -} - -// ✅ CORRECT -match x { - A | B => do_thing(), - C => other(), -} -``` - -### 2. significant_drop_tightening (30+ occurrences) - -```rust -// ❌ WRONG -let guard = lock.lock()?; -do_other_stuff(); // guard still held - -// ✅ CORRECT -{ - let guard = lock.lock()?; - use_guard(&guard); -} -do_other_stuff(); // guard dropped -``` - -### 3. unnecessary_debug_formatting (40+ occurrences) - -```rust -// ❌ WRONG -info!("Path: {:?}", path); - -// ✅ CORRECT -info!("Path: {}", path.display()); -``` - -### 4. trivially_copy_pass_by_ref (15+ occurrences) - -```rust -// ❌ WRONG -fn method(&self) where Self: Copy { } - -// ✅ CORRECT -fn method(self) where Self: Copy { } -``` - -### 5. use_self (30+ occurrences) - -```rust -// ❌ WRONG -impl MyStruct { - fn new() -> MyStruct { MyStruct { } } -} - -// ✅ CORRECT -impl MyStruct { - fn new() -> Self { Self { } } -} -``` - -### 6. if_same_then_else (20+ occurrences) - -```rust -// ❌ WRONG -if condition { - do_thing(); -} else { - do_thing(); -} - -// ✅ CORRECT -do_thing(); -``` - -### 7. needless_borrow (25+ occurrences) - -```rust -// ❌ WRONG -fn method(&x: &String) { } - -// ✅ CORRECT -fn method(x: &str) { } -``` - -### 8. or_fun_call (15+ occurrences) - -```rust -// ❌ WRONG -.unwrap_or(expensive_fn()) - -// ✅ CORRECT -.unwrap_or_else(|| expensive_fn()) +❌ NEVER use .unwrap() or .expect() in production code +❌ NEVER use panic!(), todo!(), unimplemented!() +❌ NEVER use Command::new() directly - use SafeCommand +❌ NEVER return raw error strings to HTTP clients +❌ NEVER use #[allow()] in source code +❌ NEVER use _ prefix for unused variables - DELETE or USE them +❌ NEVER leave unused imports or dead code +❌ NEVER add comments - code must be self-documenting +❌ NEVER run cargo check/clippy/build - use diagnostics tool ``` --- ## MANDATORY CODE PATTERNS -### Error Handling - Use `?` Operator - +### Use Self in Impl Blocks ```rust -// ❌ WRONG -let value = something.unwrap(); -let value = something.expect("msg"); - -// ✅ CORRECT -let value = something?; -let value = something.ok_or_else(|| Error::NotFound)?; -``` - -### Self Usage in Impl Blocks - -```rust -// ❌ WRONG impl MyStruct { - fn new() -> MyStruct { MyStruct { } } + fn new() -> Self { Self { } } // ✅ Not MyStruct } - -// ✅ CORRECT -impl MyStruct { - fn new() -> Self { Self { } } -} -``` - -### Format Strings - Inline Variables - -```rust -// ❌ WRONG -format!("Hello {}", name) - -// ✅ CORRECT -format!("Hello {name}") ``` ### Derive Eq with PartialEq - ```rust -// ❌ WRONG -#[derive(PartialEq)] -struct MyStruct { } - -// ✅ CORRECT -#[derive(PartialEq, Eq)] +#[derive(PartialEq, Eq)] // ✅ Always both struct MyStruct { } ``` -### Match with Single Arm - +### Inline Format Args ```rust -// ❌ WRONG -match value { - Some(x) => x, - None => default, +format!("Hello {name}") // ✅ Not format!("{}", name) +``` + +### Combine Match Arms +```rust +match x { + A | B => do_thing(), // ✅ Combine identical arms + C => other(), } - -// ✅ CORRECT -value.unwrap_or(default) ``` --- -## Zero Comments Policy - -**NO COMMENTS ANYWHERE IN CODE.** - -```rust -// ❌ WRONG - any comments at all -/// Returns the user's full name -fn get_full_name(&self) -> String { } - -// Validate input before processing -fn process(data: &str) { } - -//! This module handles user authentication - -// ✅ CORRECT - self-documenting code, no comments -fn full_name(&self) -> String { } - -fn process_validated_input(data: &str) { } -``` - -**Why zero comments:** - -With Rust's strong type system, **zero comments** is the right approach: - -**Rust provides:** -- Type signatures = documentation -- `Result` = documents errors -- `Option` = documents nullability -- Trait bounds = documents requirements -- Expressive naming = self-documenting - -**LLMs can:** -- Infer intent from code structure -- Understand patterns without comments -- Generate docs on-demand if needed - -**Comments become:** -- Stale/wrong (code changes, comments don't) -- Noise that obscures actual logic -- Maintenance burden - ---- - -## Workflow for Warning Removal - THE INFINITE LOOP - -### THE ONLY WORKFLOW - LOOP MODE +## Workspace Structure ``` -ENTER INFINITE LOOP: - - STEP 1: Load Diagnostics - diagnostics() → Get project-wide summary - Find file with most/least warnings (pick strategy) - - STEP 2: Read ENTIRE File - read_file(path="file.rs") - Identify ALL warnings/errors in THIS file - Plan fixes for ALL of them - - STEP 3: Batch ALL Fixes for This File - Fix warning 1 - Fix warning 2 - Fix warning 3 - ... (all of them) - DO NOT write yet - accumulate all fixes - - STEP 4: Write File ONCE with ALL Fixes - edit_file(path="file.rs", mode="overwrite") - All fixes applied in single write - - STEP 5: MANDATORY SLEEP (30-330 seconds) - terminal(command="sleep 120", cd="gb") - OR sleep 30, 60, 90, 180, 330 - VARY IT - Wait for completion - NEVER skip - - STEP 6: Verify Changes - diagnostics(path="file.rs") - Check if file is now clean - If still has issues: note them for next iteration - - STEP 7: Check Global Status - diagnostics() - Count remaining warnings/errors - - STEP 8: Decision Point - IF warnings > 0 OR errors > 0: - GOTO STEP 1 (continue loop) - ELSE: - VICTORY - EXIT LOOP - -END LOOP +gb/ +├── botapp/ # Desktop app (Tauri) +├── botserver/ # Main server (Axum API) +├── botlib/ # Shared library +├── botui/ # Web UI +├── botbook/ # Documentation +├── bottest/ # Integration tests +└── PROMPT.md # THIS FILE ``` -### CRITICAL RULES FOR THE LOOP - -- ONE file at a time, but fix ENTIRE file -- BATCH all fixes before writing -- SLEEP 30-330s after EACH file write (vary the duration!) -- VERIFY with diagnostics after sleep -- NEVER stop until diagnostics() shows 0,0 -- GO INFINITE LOOP MODE - MAXIMUM YOLO - -### Only After ZERO Warnings AND ZERO Errors - -Only when `diagnostics()` shows 0 warnings, 0 errors: -- Then work on refactoring (like moving tests) -- Then work on security audit (pub → pub(crate)) -- VICTORY ACHIEVED - ---- - -## Real Coder Mentality - -**You are a real coder. Act like it.** - -- **No shortcuts** - Fix the actual problem, don't suppress warnings -- **No half-measures** - Rewrite entire files, don't do partial edits -- **No excuses** - If clippy says it's wrong, fix it -- **Trust the tools** - Diagnostics are the source of truth -- **Own the code** - Make it correct, performant, and maintainable - -**"Allow" mechanisms are for giving up. We don't give up.** - --- ## Development Workflow -### Starting a Session - ENTER THE LOOP +### The Loop +1. `diagnostics()` → find file with issues +2. `read_file()` → read entire file +3. Fix ALL issues in that file (batch them) +4. `edit_file(mode="overwrite")` → write once +5. `terminal(command="sleep 120", cd="gb")` → MANDATORY +6. `diagnostics()` → verify fixes +7. **REPEAT until 0 warnings, 0 errors** -1. Run `diagnostics()` to get workspace-wide summary -2. **STOP if warnings/errors exist - ENTER INFINITE LOOP MODE** -3. Pick a file with warnings/errors -4. Read that file COMPLETELY -5. Fix ALL issues in that file (batch them) -6. Write file with all fixes -7. **SLEEP 30-330 SECONDS** (vary it!) using terminal command -8. Verify with diagnostics -9. **GOTO step 1 - CONTINUE LOOP until 0,0** - -### During Development - THE ETERNAL LOOP - -``` -WHILE (warnings > 0 OR errors > 0): - 1. diagnostics() → pick file - 2. Read entire file - 3. Batch ALL fixes for that file - 4. Write file once - 5. Sleep 30-330s (vary duration!) - 6. Verify with diagnostics - 7. Continue loop -END WHILE -``` - -**NEVER:** -- Stop looping while issues exist -- Skip the sleep step -- Fix only partial warnings in a file -- Give up before 0,0 - -**ALWAYS:** -- Fix entire file at once -- Sleep 30-330s after each file -- Verify with diagnostics -- Continue loop until victory - -### Ending a Session - -1. Run `diagnostics()` to verify zero warnings workspace-wide -2. Document any remaining work in session notes -3. Commit only when diagnostics show zero warnings - ---- - -## Quick Reference - -### File Operations +### Quick Reference - Read: `read_file(path="botserver/src/main.rs")` -- Edit: `edit_file(path="botserver/src/main.rs", mode="overwrite")` +- Edit: `edit_file(path="...", mode="overwrite")` - Find: `find_path(glob="**/*.rs")` -- Search: `grep(regex="fn main", include_pattern="**/*.rs")` - -### Diagnostics -- Summary: `diagnostics()` -- File: `diagnostics(path="botserver/src/main.rs")` - -### Never Use -- ❌ `terminal(command="cargo clippy")` -- ❌ `terminal(command="cargo check")` -- ❌ `terminal(command="cargo build")` +- Search: `grep(regex="pattern")` +- Check: `diagnostics()` or `diagnostics(path="file.rs")` --- ## Remember -- **EXPECT LOTS OF WARNINGS** - 500+ warnings is normal, not a problem -- **NO VICTORY SOON** - This will take 100+ file iterations minimum -- **GO INFINITE LOOP MODE** - Never stop until 0 warnings, 0 errors -- **LOOP IS LONG** - Accept this, embrace this, continue looping -- **SLEEP 30-330 SECONDS AFTER EVERY FILE** - Vary the duration, never skip -- **FIX ENTIRE FILE AT ONCE** - Batch all issues in that file before writing - **ZERO WARNINGS, ZERO ERRORS** - The only acceptable state -- **ZERO COMMENTS** - No comments, no doc comments, no file headers, no ASCII art -- **NO ALLOW IN CODE** - Never use #[allow()] in source files -- **CARGO.TOML EXCEPTIONS OK** - Disable lints with false positives in Cargo.toml with comment -- **NO DEAD CODE** - Delete unused code, never prefix with _ -- **NO UNWRAP/EXPECT** - Use ? operator or proper error handling -- **INLINE FORMAT ARGS** - format!("{name}") not format!("{}", name) -- **USE SELF** - In impl blocks, use Self not the type name -- **DERIVE EQ** - Always derive Eq with PartialEq -- **USE DIAGNOSTICS** - Use diagnostics tool, never call cargo directly -- **FULL REWRITES** - Never do partial edits, rewrite entire files -- **BATCH FIXES** - Fix all warnings in a file at once -- **SLEEP THEN VERIFY** - Sleep 30-330s (vary it!), then run diagnostics after each file -- **TRUST DIAGNOSTICS** - They are the source of truth (after refresh) -- **RESPECT RULES** - No shortcuts, no "allow" mechanisms -- **REAL CODER** - Fix problems, don't suppress them -- **WAIT FOR REFRESH** - Diagnostics cache 30-330s, vary sleep duration -- **LOOP FOREVER** - Never stop until diagnostics shows 0,0 -- **MAXIMUM YOLO** - Go infinite loop mode, fix everything -- **Version**: Always 6.1.0 - do not change without approval -- **Read project PROMPT.md** - Each project has specific guidelines - ---- - -## Session Continuation Protocol - -When running out of context, create a detailed summary containing: - -1. **What was done**: Specific files modified, warnings fixed -2. **What remains**: Exact count and types of warnings remaining -3. **Specific locations**: Files and line numbers with issues -4. **Exact next steps**: Concrete actions to continue work -5. **Blockers**: Any issues that need user input - -**Be specific. Vague summaries waste the next session's time.** \ No newline at end of file +- **SECURITY FIRST** - No unwrap, no raw errors, no direct commands +- **SLEEP AFTER EDITS** - Diagnostics needs 30-300s to refresh +- **FIX ENTIRE FILE** - Batch all issues before writing +- **TRUST DIAGNOSTICS** - Source of truth after sleep +- **LOOP FOREVER** - Never stop until 0,0 +- **Version 6.1.0** - Do not change without approval \ No newline at end of file diff --git a/botserver b/botserver index 17ebe17..c8da129 160000 --- a/botserver +++ b/botserver @@ -1 +1 @@ -Subproject commit 17ebe17e621afdc683e1707d661043f594283ec4 +Subproject commit c8da129b4ce7da8d744125e90adc53e9612a2e7f