--- name: math-textbook-compiler description: 'Hacker-Style Math-for-DL/RL Textbook Compiler. Use when: (1) Converting math textbooks into interactive courseware, (2) Generating daily learning materials from source textbooks, (3) Creating Python exercises with numpy/torch, (4) Scheduling batch compilation and deployment workflows, (5) Managing Git repositories for MathLab and RobotDaily projects' --- # Math Textbook Compiler ## 🎯 Core Mission Convert mathematical formulas into engineering APIs to help overcome "symbol phobia". Transform dense math textbooks into interactive, hands-on learning materials. ## 📚 Course Structure ### Phase 1: Statistical Learning Methods (Symbol Desensitization) - Symbol familiarization - Convex optimization - Curse of dimensionality ### Phase 2: Deep Learning (Deep Dive) - Computational graphs - Automatic differentiation - Tensor mappings ### Phase 3: RL Math Foundations - State spaces - Markov Decision Processes (MDP) - Dynamic agent interactions ## 🗂️ Directory Structure ``` clawd/ ├── staging/ # Draft materials awaiting release │ ├── course_dayN.html │ ├── exercises/dayN_task.py │ └── tests/test_dayN.py ├── courseware/ # Final published course materials ├── exercises/ # Python exercise files ├── tests/ # Test cases ├── templates/ # HTML/Python templates ├── scripts/ # Automation scripts └── textbook/ # Source textbook files ``` ## 🔧 Workflow ### Batch Compilation (Saturday 10:00 AM) 1. Read source textbooks from `/mnt/ai/textbooks/` - `lihang-code` (Statistical Learning Methods) - `d2l-zh` (Dive into Deep Learning) - `Book-Mathematical-Foundation-of-Reinforcement-Learning` 2. Generate 7 days of learning materials to `staging/` 3. Each day includes: - HTML courseware (6-module structure) - Python exercises - Test cases ### Daily Deployment (14:00 PM) 1. Move today's files from `staging/` to `courseware/`, `exercises/`, `tests/` 2. Git commit and push to repositories 3. Send Telegram notification ## 📝 LaTeX Rules (STRICT) - **Inline formulas**: `$formula$` (no spaces inside delimiters) - ✅ Correct: `$x + y$` - ❌ Wrong: `$ x + y $` - **Display formulas**: `$$formula$$` (no spaces inside delimiters) - ✅ Correct: `$$\sum_{i=1}^{n} x_i$$` - ❌ Wrong: `$$ \sum_{i=1}^{n} x_i $$` ## 🐍 Python Exercise Constraints - **Allowed**: `numpy`, `torch` (basic tensor operations only) - **Forbidden**: `torch.nn` and other high-level APIs - **Goal**: Implement algorithms from scratch to understand the math ## 🌐 Git Repositories - **MathLab**: `https://code.indigofloyd.space/ClawLab/MathLab.git` - Remote name: `origin` - Contains: Textbook compiler, courseware, exercises - **RobotDaily**: `https://code.indigofloyd.space/ClawLab/RobotDaily.git` - Remote name: `dailybot` - Contains: Daily report deployment code ### Git Configuration ```bash git config http.sslVerify false # Self-signed certificate git config credential.helper store ``` ## 📋 Templates ### HTML Course Module (6 sections) See `templates/course_module_template.html` for structure: 1. Learning objectives 2. Core concepts 3. Visual explanations 4. Interactive examples 5. Practice exercises 6. Summary & preview ### Exercise Template See `templates/exercise_template.py`: ```python """ Day N: [Topic] Implement [algorithm] from scratch using numpy/torch """ import numpy as np # or import torch def your_implementation(): pass ``` ### Test Template See `templates/test_template.py`: ```python """ Test cases for Day N exercises """ import numpy as np def test_implementation(): # Verify correctness pass ``` ## 🤖 Cron Jobs ### Weekend Batch Compile - **Schedule**: Saturday 10:00 AM (Asia/Shanghai) - **Cron**: `0 10 * * 6` - **Job ID**: `87041122-59af-4f79-8599-e987fd494dad` - **Task**: Generate 7 days of materials from textbooks ### Daily Deploy - **Schedule**: Daily 14:00 PM (Asia/Shanghai) - **Cron**: `0 14 * * *` - **Job ID**: `78dee83d-4c29-4f79-8599-e987fd494dad` - **Task**: Deploy staging files, git push, Telegram notify ## 🛠️ Scripts ### config-dailybot.sh Configure RobotDaily repository settings: ```bash #!/bin/bash git remote add dailybot git config remote.dailybot.url ``` ## 📦 Packaging When skill updates are needed: ```bash cd /home/zhn/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/skills/skill-creator python3 scripts/package_skill.py ../math-textbook-compiler ``` ## 🔍 Troubleshooting ### HTTP 403 on Git Push - Check repository permissions on Gogs - Verify credentials in `~/.git-credentials` - Ensure `git config http.sslVerify false` for self-signed certs ### Missing Textbook Files - Verify path: `/mnt/ai/textbooks/` - Check mount status of AI drive - Confirm file permissions ### LaTeX Rendering Issues - Ensure no spaces in `$...$` or `$$...$$` - Check for unescaped special characters - Validate HTML template syntax ## 📖 Reference Files - **Workflow details**: See `references/workflow.md` - **LaTeX cheat sheet**: See `references/latex-rules.md` - **Exercise patterns**: See `references/exercise-patterns.md`