diff --git a/CLAUDE.md b/CLAUDE.md index 0a0d6a7..811db53 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,250 +4,647 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## CF_Zero_V1 Project Overview -CF_Zero_V1 is an educational Bash learning platform called "Crumbforest" that uses character-based AI assistants to teach command-line concepts through interactive missions. The project combines shell scripting, Python-based computer vision, and OpenRouter API integration to create an immersive learning experience. +CF_Zero_V1 is an educational Bash learning platform called "Crumbforest" that uses 17 character-based AI assistants ("WaldwΓ€chter" - Forest Guardians) to teach command-line concepts, programming fundamentals, and hardware/robotics projects through interactive missions. The system is designed to run on devices ranging from Raspberry Pi Zero to desktop computers, emphasizing transparency, file-based state, and pedagogical value. ## Key Commands ### Mission System ```bash -# Launch the interactive mission selector +# Launch the interactive mission selector (main entry point) ./crumb-mission-selector.sh +# Option 9 opens CrumbCrew Command Central (interactive shell with all AI characters) + # Run individual missions directly -bash missions/basics/fridolin.sh # Navigation basics -bash missions/basics/balu.sh # File creation -bash missions/basics/noko.sh # File reading -bash missions/advanced/dns_mission.sh # DNS tools -bash missions/advanced/ssh_security.sh # SSH basics +bash missions/basics/fridolin.sh # Navigation basics +bash missions/basics/balu.sh # File creation +bash missions/basics/noko.sh # File reading +bash missions/advanced/dns_mission.sh # DNS tools +bash missions/advanced/ssh_security.sh # SSH basics +bash missions/robots/lipo_power_academy.sh # LiPo battery education +bash missions/robots/regenbogen_zaehlmaschine.sh # Rainbow counter project +bash missions/robots/mond_maschine.sh # Moon machine ML project +bash missions/robots/solar_kettle.sh # Solar water heater physics ``` -### AI Character Assistants (Crumbforest Roles) -All roles require `OPENROUTER_API_KEY` environment variable set in `.env` file: +### AI Character Assistants - The 17 WaldwΓ€chter + +All characters require `OPENROUTER_API_KEY` environment variable set in `.env` file: + ```bash -# Configure environment +# Configure environment (required first step) cp .env.template .env # Edit .env and add your OPENROUTER_API_KEY -# Character-based CLI assistants -./crumbforest_roles/mayaeule_zero.sh "What is friendship?" -./crumbforest_roles/deepbit_zero.sh "How do I use grep?" -./crumbforest_roles/bugsy_zero.sh "Explain loops in bash" -./crumbforest_roles/schnippsi_zero.sh "What is curl?" -./crumbforest_roles/tobi_zero.sh "How to use jq?" -./crumbforest_roles/templatus_zero.sh "Create HTML structure" +# === DAS DREIECK (The Triangle - Foundation) === +# Philosophical/didactic framework (not a technical module) +./crumbforest_roles/dumbosql_zero.sh "Design a sensor database" # Structure/Lists +./crumbforest_roles/funkfox_zero.sh "Explain pipes in rap form" # Flow/Rhythm +./crumbforest_roles/taichitaube_zero.sh "How to balance chaos?" # Balance/Spiral -# Access CrumbCrew Command Central (all assistants in one shell) -# Run mission selector and choose option 9 -./crumb-mission-selector.sh +# === Hardware Team === +./crumbforest_roles/tobi_zero.sh "Explain capacitors" # CapaciTobi - Electronics +./crumbforest_roles/schnecki_zero.sh "How to wire sensors?" # Wiring specialist +./crumbforest_roles/schraubaer_zero_final.sh "Welding tips?" # Heavy machinery + +# === Code Team === +./crumbforest_roles/snakepy_zero.sh "Python list comprehension" # Python guide +./crumbforest_roles/pepperphp_zero.sh "MVC architecture" # PHP structure +./crumbforest_roles/crabbrust_zero.sh "Memory safety in Rust" # Security guardian +./crumbforest_roles/spider_zero.sh "API REST design" # Network specialist + +# === UI Team === +./crumbforest_roles/schnippsi_zero.sh "CSS grid layout" # Styling +./crumbforest_roles/templatus_zero.sh "HTML structure" # Templates +./crumbforest_roles/asciimonster_zero.sh "Draw ASCII art" # Terminal art + +# === System Team === +./crumbforest_roles/mayaeule_zero.sh "What is wisdom?" # Meta-knowledge owl +./crumbforest_roles/deepbit_zero.sh "How does grep work?" # Bash deep dive +./crumbforest_roles/bugsy_zero.sh "Debug this error" # Debugging +./crumbforest_roles/vektor_zero.sh "Navigate this project" # Point-to-point guide ``` -### Camera Vision System (SnakeCam) -```bash -# Start the Flask-based gesture recognition app -cd snake_camera_vision_v2 -python app.py -# Access at http://localhost:5000 +### Unified Access via WaldwΓ€chter Library -# View gesture detection module -python gestures/gestures_v4.py +**Preferred method for missions and scripts:** +```bash +# Source the library to get all characters as shell functions +source lib/waldwaechter.sh + +# Now all characters are available as commands (no path needed) +dumbosql "Design a users table" +funkfox "Explain while loops as a rap" +schnippsi "Center a div with CSS" +mayaeule "What is the meaning of code?" + +# Utility commands (available after sourcing waldwaechter.sh) +crew_tokens # View token usage across all characters +crew_status # Check which characters are available +crew_memory # View conversation histories (crew context) +crew_doctor # System health check (dependencies, API keys) +crew_syntax # Validate bash syntax for all scripts +crew_help # Show available commands +crew_memo # Track creative outputs (Mixcloud, Git, etc.) +``` + +### CrumbCrew Command Central (Position 9 in Mission Selector) + +Interactive shell with all WaldwΓ€chter pre-loaded: +- Custom prompt: `(π² CrumbCrew) user@host:path$` +- All 17 characters available as direct commands +- Utilities: `crew_status`, `crew_tokens`, `crew_memory`, `crew_doctor` +- Exit with `exit` or Ctrl+D + +### Crumbblocks - Browser-Terminal Bridge + +```bash +# Start local server for interactive HTML simulations +./start_crumbblocks.sh + +# Opens browser to http://localhost:8000 (or similar) +# Available simulations: +# - lipo_6s_charger_sim_safe_v7.html (LiPo battery charger) +# - rainbow_counter.html (Color event counter) +# - solar_kettle_dark.html (Solar water heater physics) +# - bezier_stream.html, painter.html, and more + +# Simulations use Clipboard API to send results back to terminal +# Evaluation scripts in missions/robots/ parse clipboard data ``` ### Token Usage Monitoring + ```bash -# View token usage across all AI assistants -./log_tokens_viewer_v4.sh +# View token usage across all AI assistants (new unified system) +crew_tokens -# Clean up malformed token logs -./fix_token_logs.sh +# View individual character logs (repo-based) +cat logs/mayaeule/token_log.json +cat logs/funkfox/token_log.json +cat logs/dumbosql/token_log.json -# Check individual agent logs -cat ~/.deepbit_logs/token_log.json -cat ~/.bugsy_logs/token_log.json +# View conversation history +cat logs/mayaeule/eule_history.json +cat logs/funkfox/funkfox_history.json + +# Track creative outputs +crew_memo +cat logs/crumb_memo.json +``` + +### Creative Output Tracking (crumb_memo) + +```bash +# Log creative outputs (dual transparency: input + output) +crumb_memo "https://mixcloud.com/your-mix" "My first beat" +crumb_memo "https://github.com/user/repo" "My robot code" +crumb_memo "https://youtube.com/watch?v=..." "Tutorial video" + +# View all logged creative outputs +crew_memo ``` ## Architecture Overview +### Core Design Philosophy + +**WaldwΓ€chter (Forest Guardian) Architecture:** +- **Transparency over magic** - All state is file-based JSON +- **Metadata-driven extensibility** - Add content without code changes +- **Educational first** - Token tracking teaches mindful questioning +- **Raspberry Pi Zero compatible** - Minimal dependencies, lightweight +- **Multilingual** - Characters respond in the language of the question +- **File-based agent memory** - Characters can read each other's logs + ### Mission System Architecture **Metadata-Driven Design:** - Each mission consists of two files: `mission_name.sh` (executable) and `mission_name.meta.json` (metadata) - The mission selector (`crumb-mission-selector.sh`) dynamically loads missions by scanning directories -- Metadata structure: - ```json - { - "icon": "π¦", - "title": "Mission Title", - "description": "What this teaches", - "category": "basics|advanced|challenges", - "enabled": true - } - ``` +- **No code changes required** to add new content - just drop in files + +**Metadata structure:** +```json +{ + "icon": "π¦", + "title": "Mission Title", + "description": "What this teaches", + "category": "basics|advanced|challenges|robots", + "enabled": true +} +``` **Mission Categories:** -- `missions/basics/` - Beginner missions (navigation, file operations) -- `missions/advanced/` - Advanced topics (DNS, SSH, networking) -- `missions/challenges/` - Interactive challenges (future) +- `missions/basics/` - Beginner missions (navigation, file operations) - 3 missions +- `missions/advanced/` - Advanced topics (DNS, SSH, networking) - 2 missions +- `missions/challenges/` - Story-based complex missions - 1 mission +- `missions/robots/` - Hardware projects (LiPo, rainbow counter, moon machine, solar kettle) - 5 missions +- `missions/dojo/` - BashPanda Kung Fu Belt System (progressive Bash mastery) - 6 missions -### AI Assistant Architecture +### AI Assistant Architecture - The 17 WaldwΓ€chter -**Character-Based Learning Roles (WaldwΓ€chter - Forest Guardians):** -Each role is a specialized bash script that wraps OpenRouter API calls with distinct personalities: +**Character Roster (Organized by Role):** -- **Maya-Eule** (owl) - Wise guide with Qdrant memory integration for contextual conversations -- **Deepbit** (octopus) - Explains Bash concepts poetically to children -- **Bugsy** - Debugging and troubleshooting assistant -- **Schnippsi** - General shell command helper -- **Tobi** - JSON/data processing expert (alias "Capacitoby" for electronics) -- **Templatus** - HTML architecture assistant -- **SchraubbΓ€r** - Heavy-duty hardware specialist (welding, tools, mechanical systems) +1. **Das Dreieck (The Triangle)** - Philosophical framework: + - **DumboSQL** (π) - Structure/Lists (SQL, data organization, never forgets) + - **FunkFox** (π¦) - Flow/Rhythm (Bash rapper, explains as hip-hop) + - **Taichi Taube** (ποΈ) - Balance/Spiral (Chaos management, patience) -**Common Pattern:** -1. Accept question as command-line argument -2. Store conversation history in `~/.{role}_logs/{role}_history.json` -3. Track token usage in `~/.{role}_logs/token_log.json` -4. Use OpenRouter API with `openai/gpt-3.5-turbo` model -5. Respond in the same language as the input question +2. **Hardware Team**: + - **CapaciTobi** (πΏοΈ) - Electronics, power, capacitors (alias: Tobi) + - **Schnecki** (π) - Wiring, connections (slow and precise) + - **SchraubbΓ€r** (π») - Heavy machinery, welding, mechanical systems + +3. **Code Team**: + - **SnakePy** (π) - Python guide (shows multiple paths) + - **PepperPHP** (π§) - PHP structure mentor (MVC as recipes) + - **CrabbyRust** (π¦) - Rust security guardian (memory safety) + - **Spider** (π·οΈ) - Network specialist (APIs, connections) + +4. **UI Team**: + - **Schnippsi** (βοΈ) - CSS and styling expert + - **Templatus** (π) - HTML template master + - **ASCII-Monster** (πΎ) - Terminal artist (ASCII art) + +5. **System Team**: + - **Maya-Eule** (π¦) - Wise owl with meta-knowledge + - **Deepbit** (π§) - Bash deep dive explainer + - **Bugsy** (π) - Debugging detective + - **Vektor** (π§) - Point-to-point navigation guide + +6. **Education Team**: + - **BashPanda** (πΌ) - Kung Fu Bash Meister (teaches progressive Bash through martial arts metaphors) + +**Common Pattern (Each Character Script):** +1. Load `.env` file (API keys) +2. Check token budget (optional parental control) +3. Build personality-specific system prompt +4. Check crew memory (if other characters mentioned in question) +5. Call OpenRouter API with conversation history +6. Log response + tokens to `logs/{character}/` +7. Display with character-specific formatting + +**The Personality IS the System Prompt:** +Each character has a unique system prompt that defines their teaching style. Example from FunkFox: +``` +"Du bist FunkFox - der Bash Rapper. +Du erklΓ€rst Terminal-Konzepte im Hip-Hop-Flow. +Pipes sind Beats, Loops sind Rhythmen." +``` **API Flow:** ```bash -Question β JSON Payload β OpenRouter API β Response β Log History β Display +Question β Check Budget β Load History β Build Prompt β OpenRouter API β Log Response β Display + β + Check Crew Memory (if other characters mentioned) ``` -**Log Structure:** -- Request: `~/.{role}_logs/{role}_request.json` -- Response: `~/.{role}_logs/{role}_response.json` -- History: `~/.{role}_logs/{role}_history.json` -- Token usage: `~/.{role}_logs/token_log.json` +**Log Structure (Repo-Based):** +``` +logs/ +βββ mayaeule/ +β βββ eule_history.json # Conversation history +β βββ token_log.json # Token usage tracking +β βββ eule_request.json # Last API request +β βββ eule_response.json # Last API response +βββ funkfox/ +β βββ funkfox_history.json +β βββ token_log.json +βββ dumbosql/ +β βββ dumbosql_history.json +β βββ token_log.json +βββ ... (all 17 characters) +βββ crumb_memo.json # Creative output tracking +βββ missions/ # Mission execution logs +``` -**WaldwΓ€chter Library (`lib/waldwaechter.sh`):** -Missions can source this library to make all AI assistants available as shell functions: +**Key Difference from Old System:** +- **Old:** Logs in `~/.{character}_logs/` (home directory) +- **New:** Logs in `logs/{character}/` (repository-based) +- **Why:** Git-trackable, transparent, portable, easier debugging + +### WaldwΓ€chter Library (`lib/waldwaechter.sh`) + +**Central Integration Point - 715 lines of unified functionality:** + +This is the **most important file** for understanding how the system works. It provides: + +1. **Unified character access** - All 17 characters as shell functions +2. **Environment management** - Loads `.env`, sets `CRUMB_LOGS_DIR` +3. **Utility functions** - `crew_tokens`, `crew_status`, `crew_memory`, `crew_doctor`, etc. +4. **Token budget enforcement** - Optional parental controls +5. **Cross-shell compatibility** - Works in bash, zsh + +**Usage in missions:** ```bash -# In a mission script +# At top of mission script SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/../../lib/waldwaechter.sh" -# Now all AI assistants are available as commands -templatus "Create an HTML5 structure" -schnippsi "Show me CSS for a button" -bugsy "Debug this error" -mayaeule "What is friendship?" +# Now all characters and utilities are available +funkfox "Explain this concept" +crew_tokens ``` -The library automatically: -1. Loads `.env` file with API keys -2. Defines functions for all AI characters -3. Exports functions for use in subshells -4. Sets correct paths to role scripts in `crumbforest_roles/` +**Utility Functions:** +- `crew_tokens` - Display token usage across all characters with cost estimates +- `crew_status` - Check which character scripts are available +- `crew_memory` - View conversation histories (crew context awareness) +- `crew_doctor` - System health check (dependencies, API keys, paths) +- `crew_syntax` - Validate bash syntax for all scripts +- `crew_help` - Show available commands and characters +- `crew_memo` - Track creative outputs (Mixcloud, Git repos, YouTube, etc.) -**CrumbCrew Command Central:** -Position 9 in the mission selector opens an interactive shell with all WaldwΓ€chter pre-loaded: -- Custom prompt: `(π² CrumbCrew) user@host:path$` -- Commands: `mayaeule`, `deepbit`, `bugsy`, `schnippsi`, `templatus`, `tobi`, `schraubaer` -- Utilities: `crew_status`, `crew_tokens`, `crew_memory` +### Inter-Character Communication (Crew Memory) + +**Lightweight Agent-Like Behavior:** -**Inter-Character Communication (Crew Memory):** Characters can reference each other's conversation histories through JSON log files: -```bash -# SchraubbΓ€r automatically checks if question mentions other crew members -schraubaer "Tobi sagte wir brauchen 5V, welches Netzteil empfiehlst du?" -# The script reads Tobi's recent conversations and includes them as context -# Keeps it lightweight for Raspberry Pi Zero - simple JSON file memory +```bash +# User asks FunkFox a question mentioning another character +funkfox "DumboSQL said we need a users table, what bash loops do I use?" + +# FunkFox script automatically: +# 1. Detects "dumbosql" mention in question +# 2. Reads logs/dumbosql/dumbosql_history.json +# 3. Includes last 3 conversations as context +# 4. Enriches system prompt with crew context +# 5. Responds with awareness of DumboSQL's advice ``` -Each character stores conversations in `~/.{character}_logs/{character}_history.json`: -- Lightweight JSON format for Raspi Zero compatibility -- Last 3 conversations from referenced character are included as context -- Characters detect mentions of other crew members (tobi, schnecki, schnippsi, etc.) -- System prompt automatically enriched with crew context +**Implementation:** +- Characters detect mentions of other crew members (case-insensitive grep) +- Read last 3 conversations from mentioned character's history file +- Include as context in API call system prompt +- **Lightweight:** Simple JSON file reading, no complex orchestration +- **Transparent:** All context visible in log files +- **Raspberry Pi friendly:** No Redis, no databases, just files -### Camera Vision System (SnakeCam) +**Crew context format:** +```json +{ + "role": "system", + "content": "Context from DumboSQL: [last 3 conversations]..." +} +``` -**Technology Stack:** -- Flask web server with MJPEG video streaming -- OpenCV for camera capture and image processing -- Custom gesture detection using HSV color space and contour analysis +### Crumbblocks Architecture (Browser-Terminal Bridge) -**Key Components:** -- `app.py` - Flask application with video streaming endpoints -- `gestures/gestures_v4.py` - Hand gesture detection algorithm -- Detection method: Skin color detection β Contour analysis β Convexity defects β Gesture classification -- Current gestures: "wave" detection based on defect count, area, and aspect ratio +**17 HTML files** in `crumbblocks/` directory: -**Endpoints:** -- `/` - Main camera interface -- `/video_feed` - MJPEG stream -- `/log_answer` - Log user responses with mood and gesture -- `/shutdown` - Clean camera release +**Design Pattern:** +- **Self-contained** - No external dependencies, single HTML files +- **Clipboard API** - Send data back to terminal via copy to clipboard +- **Interactive simulations** - Physics engines, visualizations, games +- **Educational** - Each teaches a concept (batteries, colors, energy, art) + +**Key Examples:** +- `lipo_6s_charger_sim_safe_v7.html` - LiPo battery charger simulation (6S, balancing, safety) +- `rainbow_counter.html` - Color event counter with RGB sensor simulation +- `solar_kettle_dark.html` - Solar water heater physics engine +- `bezier_stream.html` - BΓ©zier curve generator +- `painter.html`, `painter_spray.html`, `painter_lines.html` - Creative painting tools +- `schnippsi_ui.html` - Schnippsi's UI editor + +**Evaluation Flow:** +1. User interacts with Crumbblock simulation in browser +2. Simulation calculates results (e.g., battery voltage, water temperature) +3. Results exported to clipboard as JSON +4. User pastes in terminal +5. Mission evaluation script parses JSON and provides feedback + +**Server Options:** +```bash +# PHP server (if available) +php -S localhost:8000 + +# Python server (fallback) +python3 -m http.server 8000 + +# start_crumbblocks.sh detects and uses best option +``` + +### "Das Dreieck" - Philosophical Framework + +**Important:** This is a **didactic model**, not a technical module. + +The Triangle represents three foundational concepts taught through specific characters: + +1. **DumboSQL (π)** - Structure/Lists + - Data organization, SQL, tables, persistence + - "The elephant never forgets" + - Teaches: How to organize information + +2. **FunkFox (π¦)** - Flow/Rhythm + - Pipes, loops, process orchestration + - "Terminal concepts as hip-hop beats" + - Teaches: How processes flow and connect + +3. **Taichi Taube (ποΈ)** - Balance/Spiral + - Chaos management, patience, iterative refinement + - "The spiral path, not the straight line" + - Teaches: How to handle complexity gracefully + +**Usage in Missions:** + +Complex projects (like robots missions) explicitly invoke The Triangle for planning: +```bash +dumbosql "Design the data structure for rainbow counter" +funkfox "What's the flow of data from sensor to display?" +taichitaube "How do we balance hardware and software complexity?" +``` + +This creates a structured approach to problem-solving that children can internalize. + +### "BashPanda Dojo" - Progressive Bash Learning System + +**NEW in v0.0-RC4:** A complete Kung Fu-themed Bash learning curriculum with belt progression system. + +The BashPanda Dojo teaches Bash through martial arts metaphors, creating a gamified progression path from beginner to master. Each belt represents a skill level with dedicated missions and interactive quizzes. + +**The 6 Belts:** + +1. **π€ Schwarzer GΓΌrtel (Black)** - The Basics + - echo, printf, ANSI codes + - Variables (creating, using) + - read (user input) + - Mission: `bash missions/dojo/schwarzer_guertel.sh` + +2. **π Pinker GΓΌrtel (Pink)** - Control Flow + - if/then/else conditions + - while and for loops + - Arrays + - Arithmetik $(( )) + - Mission: `bash missions/dojo/pinker_guertel.sh` + +3. **π Blauer GΓΌrtel (Blue)** - Text Mastery + - sed (stream editor) + - case statements + - bc (floating point math) + - wc (word count) + - Mission: `bash missions/dojo/blauer_guertel.sh` + +4. **π GrΓΌner GΓΌrtel (Green)** - Pattern Recognition + - grep basics and options + - Regular expressions (regex) + - Email/date pattern matching + - grep -E (extended regex) + - Mission: `bash missions/dojo/gruener_guertel.sh` + +5. **π Gelber GΓΌrtel (Yellow)** - Modularity + - Functions (defining, calling) + - Function parameters ($1, $@, $#) + - source (library loading) + - return vs exit + - local variables + - Mission: `bash missions/dojo/gelber_guertel.sh` + +6. **π€ Weisser GΓΌrtel (White)** - Mastery + - Background jobs (&) + - jobs, ps commands + - wait for synchronization + - Parallel processing + - Process control + - Mission: `bash missions/dojo/weisser_guertel.sh` + +**Interactive GΓΌrtelprΓΌfung (Belt Exam):** + +Each belt has a browser-based quiz for assessment: +1. Open: `./start_crumbblocks.sh` +2. Navigate to: `bashpanda_guertelpruefung.html` +3. Select your belt and answer 5 questions +4. Results auto-copy to clipboard +5. Paste into terminal: `bash missions/dojo/evaluate_guertelpruefung.sh` +6. Receive certificate if passed (80%+ required) + +**Certificates:** +- Stored in `logs/zertifikate/` +- Format: `{belt}_{user}_{timestamp}.txt` +- Contains score, date, BashPanda seal + +**Teaching Philosophy:** +- "Der Weg des Codes ist wie der Weg der Kampfkunst: Geduld, PrΓ€zision, Wiederholung" +- Each command is a "kata" (form) to be practiced +- Errors are teachers, not failures +- Progressive difficulty builds confidence +- BashPanda provides wisdom and encouragement throughout + +**Integration with WaldwΓ€chter:** +- BashPanda can be called from any mission: `bashpanda "question"` +- Understands context from other characters via crew memory +- Responds in language of question (German/English/etc.) +- Token tracking for mindful learning + +**Usage Example:** +```bash +# Start belt progression +bash missions/dojo/schwarzer_guertel.sh + +# Ask BashPanda for help +source lib/waldwaechter.sh +bashpanda "ErklΓ€re mir echo vs printf" + +# Take belt exam +./start_crumbblocks.sh +# (Open bashpanda_guertelpruefung.html in browser) + +# Evaluate results +bash missions/dojo/evaluate_guertelpruefung.sh +``` ## Project Structure ``` CF_Zero_V1/ -βββ crumb-mission-selector.sh # Main mission launcher (metadata-driven) -βββ missions/ # Educational missions -β βββ basics/ # Beginner tutorials +βββ crumb-mission-selector.sh # Main entry point (1027 lines) +βββ lib/ +β βββ waldwaechter.sh # 17 AI characters + utilities (715 lines) +βββ crumbforest_roles/ # 17 individual AI character scripts +β βββ dumbosql_zero.sh # Structure/Lists (Das Dreieck) +β βββ funkfox_zero.sh # Flow/Rhythm (Das Dreieck) +β βββ taichitaube_zero.sh # Balance/Spiral (Das Dreieck) +β βββ tobi_zero.sh # CapaciTobi - Electronics +β βββ schnecki_zero.sh # Wiring specialist +β βββ schraubaer_zero_final.sh # Heavy machinery +β βββ snakepy_zero.sh # Python guide +β βββ pepperphp_zero.sh # PHP structure +β βββ crabbrust_zero.sh # Rust security +β βββ spider_zero.sh # Network APIs +β βββ schnippsi_zero.sh # CSS styling +β βββ templatus_zero.sh # HTML templates +β βββ asciimonster_zero.sh # ASCII art +β βββ mayaeule_zero.sh # Wise owl +β βββ deepbit_zero.sh # Bash deep dive +β βββ bugsy_zero.sh # Debugging +β βββ vektor_zero.sh # Navigation +βββ missions/ # Educational missions +β βββ basics/ # 3 beginner missions β β βββ fridolin.sh/meta.json # Navigation (pwd, ls, cd) -β β βββ balu.sh/meta.json # File creation (mkdir, touch, echo) +β β βββ balu.sh/meta.json # File creation (mkdir, touch) β β βββ noko.sh/meta.json # File reading (cat, grep) -β βββ advanced/ # Advanced topics -β βββ dns_mission.sh/meta.json # DNS tools (dig, nslookup, host) -β βββ ssh_security.sh/meta.json # SSH basics -βββ crumbforest_roles/ # AI character assistants -β βββ deepbit_zero.sh # Poetic Bash explainer -β βββ bugsy_zero.sh # Debugging helper -β βββ schnippsi_zero.sh # Shell command assistant -β βββ tobi_zero.sh # JSON/data expert -βββ snake_camera_vision_v2/ # Flask gesture recognition app -β βββ app.py # Main Flask server -β βββ gestures/ # Gesture detection modules -β βββ gestures_v4.py # Hand detection algorithm -β βββ gestures_debug_test.py # Debug version with visualization -βββ log_tokens_viewer_v4.sh # Token usage viewer -βββ fix_token_logs.sh # Clean malformed logs +β βββ advanced/ # 2 advanced missions +β β βββ dns_mission.sh/meta.json # DNS tools +β β βββ ssh_security.sh/meta.json # SSH basics +β βββ challenges/ # 1 story-based mission +β βββ robots/ # 5 hardware missions +β β βββ lipo_power_academy.sh # LiPo battery education (8 phases) +β β βββ regenbogen_zaehlmaschine.sh # Rainbow counter (7 phases) +β β βββ mond_maschine.sh # Moon machine ML (8 phases) +β β βββ solar_kettle.sh # Solar water heater (6 phases) +β β βββ evaluate_solar_kettle.sh # Evaluation script +β βββ dojo/ # 6 BashPanda belt missions (NEW!) +β βββ schwarzer_guertel.sh # Black belt - Basics +β βββ pinker_guertel.sh # Pink belt - Control flow +β βββ blauer_guertel.sh # Blue belt - Text +β βββ gruener_guertel.sh # Green belt - Pattern matching +β βββ gelber_guertel.sh # Yellow belt - Functions +β βββ weisser_guertel.sh # White belt - Processes +β βββ evaluate_guertelpruefung.sh # Quiz evaluation +βββ crumbblocks/ # 18 HTML interactive simulations +β βββ lipo_6s_charger_sim_safe_v7.html +β βββ rainbow_counter.html +β βββ solar_kettle_dark.html +β βββ bashpanda_guertelpruefung.html # Belt quiz (NEW!) +β βββ bezier_stream.html +β βββ painter.html +β βββ ... (12 more) +βββ logs/ # Repo-based logging +β βββ mayaeule/ +β β βββ eule_history.json +β β βββ token_log.json +β βββ funkfox/ +β βββ dumbosql/ +β βββ bashpanda/ # BashPanda logs (NEW!) +β βββ ... (all 18 characters) +β βββ crumb_memo.json # Creative output tracking +β βββ zertifikate/ # Belt certificates (NEW!) +β βββ missions/ # Mission execution logs +βββ seeds/ # Seed data for collaborative systems +βββ start_crumbblocks.sh # Launch browser simulations +βββ .env.template # Environment variables template +βββ README.md # German documentation ``` ## Important Implementation Notes ### Adding New Missions +**Zero code changes required - just drop in two files:** + 1. Create two files in appropriate category folder: ```bash - touch missions/basics/new_mission.sh - touch missions/basics/new_mission.meta.json - chmod +x missions/basics/new_mission.sh + touch missions/robots/new_mission.sh + touch missions/robots/new_mission.meta.json + chmod +x missions/robots/new_mission.sh ``` 2. Metadata must include: - - `icon`: Emoji for menu display - - `title`: Human-readable name - - `description`: What the mission teaches - - `category`: basics/advanced/challenges - - `enabled`: true/false + ```json + { + "icon": "π", + "title": "Your Mission Title", + "description": "What this teaches", + "category": "basics|advanced|challenges|robots", + "enabled": true + } + ``` -3. Mission script should: - - Use `cat << 'EOF'` for multi-line instructions - - Include interactive prompts with `read -p` - - Provide examples before asking user to try - - End with success message +3. Mission script best practices: + ```bash + #!/bin/bash + # Source waldwaechter library for AI character access + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + source "${SCRIPT_DIR}/../../lib/waldwaechter.sh" + + # Use cat << 'EOF' for multi-line instructions + # Include interactive prompts with read -p + # Provide examples before asking user to try + # Call AI characters as needed: funkfox "question" + # End with success message + ``` + +4. Mission will **automatically appear** in mission selector on next run ### Creating New AI Assistants -1. Copy template from existing role (e.g., `deepbit_zero.sh`) -2. Update these variables: - - `LOGDIR` - Log directory path - - System prompt in `jq -n` command - - Character name in echo statements -3. Create log directory structure automatically via `mkdir -p` -4. Initialize empty JSON arrays for history and token logs +**Current roster is complete (17 characters), but if adding new ones:** + +1. Copy template from existing character: + ```bash + cp crumbforest_roles/deepbit_zero.sh crumbforest_roles/newchar_zero.sh + ``` + +2. Update these elements: + - Character name and emoji in echo statements + - System prompt in `jq -n` command (defines personality) + - Log file paths (use `${CRUMB_LOGS_DIR}/newchar/`) + - Function name if adding to waldwaechter.sh + +3. Add to `lib/waldwaechter.sh`: + ```bash + # π NewChar - Description + function newchar() { + "${ROLES_DIR}/newchar_zero.sh" "$@" + } + export -f newchar + ``` + +4. Test with: + ```bash + source lib/waldwaechter.sh + newchar "Test question" + crew_status # Should show new character + ``` ### Token Log Format -Each role logs API usage in this format: +Each character logs API usage in this format: ```json { - "zeit": "2025-06-18 19:05:33", - "rolle": "deepbit", + "zeit": "2025-12-23 19:05:33", + "rolle": "funkfox", "usage": { "prompt_tokens": 45, "completion_tokens": 123, @@ -256,92 +653,394 @@ Each role logs API usage in this format: } ``` -### Gesture Detection Tuning +View with: `crew_tokens` (formatted with cost estimates) -Located in `snake_camera_vision_v2/gestures/gestures_v4.py`: -- **HSV Range**: `lower_skin=[0,30,60]`, `upper_skin=[20,150,255]` -- **ROI**: Fixed at (100,100) with 150x150 size -- **Area Threshold**: 2500-15000 pixels for valid hand detection -- **Defect Count**: 3-10 convexity defects for "wave" gesture -- **Aspect Ratio**: 1.3-2.3 for hand shape validation +### Creating New Crumblocks + +**Self-contained HTML simulations:** + +1. Create single HTML file in `crumbblocks/`: + ```bash + touch crumbblocks/my_simulation.html + ``` + +2. Include in HTML: + - All CSS in ` + +
+