# Math-To-Manim
**Repository Path**: hsc2018/Math-To-Manim
## Basic Information
- **Project Name**: Math-To-Manim
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2026-05-21
- **Last Updated**: 2026-05-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Math-To-Manim
[](https://www.python.org/)
[](LICENSE)
[](https://ffmpeg.org/)
[](https://www.manim.community/)
[](https://github.com/HarleyCoops/Math-To-Manim)
[](https://www.anthropic.com)
[](https://deepmind.google/technologies/gemini/)
[](https://kimi.moonshot.cn/)
[](https://www.deepseek.com/)
[](https://x.ai/)
[](https://www.star-history.com/#HarleyCoops/Math-To-Manim&type=date&legend=top-left)
---
> **January 29, 2026** - The **Kimi Agent pipeline has been upgraded from K2 Thinking to the K2.5 Swarm architecture**. This brings significant improvements to chain-of-thought reasoning and multi-agent coordination. If you've used the Kimi pipeline before, I encourage you to give this new version a try!
---
## CLaude Code Learns Manim
**Use Math-To-Manim directly in Claude Code** — no setup required. Just install the skill and start creating animations with natural language.
### Quick Install
```bash
# Clone and run with the skill
git clone https://github.com/HarleyCoops/Math-To-Manim.git
claude --plugin-dir ./Math-To-Manim/skill
```
### What You Can Do
Once installed, just ask Claude:
- *"Create a math animation about the Fourier transform"*
- *"Animate how neural networks learn"*
- *"Generate Manim code explaining quantum entanglement"*
Claude will automatically use the **six-agent reverse knowledge tree pipeline** to:
1. **Analyze** your concept and extract the core topic
2. **Discover** prerequisites recursively (*"What must I understand BEFORE this?"*)
3. **Enrich** each concept with LaTeX equations and definitions
4. **Design** visual specifications (colors, animations, timing)
5. **Compose** a 2000+ token verbose prompt
6. **Generate** working Manim Python code
### Why This Matters
No training data. No examples needed. Pure LLM reasoning builds pedagogically sound animations that flow from foundations to advanced topics.
Skill Directory Structure
```
skill/
├── .claude-plugin/plugin.json
└── skills/math-to-manim/
├── SKILL.md # Core workflow definition
├── references/ # Detailed documentation
│ ├── reverse-knowledge-tree.md # Algorithm deep-dive
│ ├── agent-system-prompts.md # All 6 agent prompts
│ ├── verbose-prompt-format.md # 2000+ token template
│ └── manim-code-patterns.md # Code generation patterns
└── examples/
└── pythagorean-theorem/ # Complete workflow example
```
> **Requirements**: [Claude Code CLI](https://claude.ai/code) + Python 3.10+ + Manim
---
## See It In Action
**Brownian Motion: From Pollen to Portfolio**

*A journey from Robert Brown's microscope to Einstein's heat equation, arriving at the Black-Scholes model for financial options pricing.*
---
**Recursive Rhombicosidodecahedron**

*A fractal Archimedean solid where every vertex spawns another complete rhombicosidodecahedron.*
---
**The Hopf Fibration**

*Stereographic projection of S3 fibers creating nested tori - pure topology rendered in 3D.*
---
**The Whiskering Exchange**

*Visualizing the commutative property of 2-cell composition in higher category theory.*
## Three AI Pipelines, One Goal
Math-To-Manim offers **three distinct AI pipelines**. Choose based on your API access and preferences:
### Pipeline Comparison
| Feature | Gemini 3 (Google ADK) | Claude Sonnet 4.5 | Kimi K2.5 |
|:--------|:---------------------|:------------------|:--------|
| **Framework** | Google Agent Development Kit | Anthropic Agent SDK | OpenAI-compatible API |
| **Architecture** | Six-Agent Swarm | Six-Agent Pipeline | Six-Agent Swarm |
| **Strengths** | Complex topology, physics reasoning | Reliable code generation, recursion | Chain-of-thought, multi-agent coordination |
| **Best For** | Advanced 3D math, Kerr metrics | General purpose, production use | LaTeX-heavy explanations, structured reasoning |
| **Setup Complexity** | Moderate | Simple | Simple |
---
## Pipeline 1: Google Gemini 3 (ADK)
**Location**: `Gemini3/`
The Gemini pipeline uses the **Google Agent Development Kit** with a six-agent swarm architecture. Each agent is a specialist with a specific role in the animation generation process.
### How It Works

### Quick Start
```bash
# Set API key
echo "GOOGLE_API_KEY=your_key_here" >> .env
# Run the pipeline
python Gemini3/run_pipeline.py "Explain the Hopf Fibration"
```
### Key Files
- `Gemini3/run_pipeline.py` - Entry point
- `Gemini3/src/agents.py` - Agent definitions with system prompts
- `Gemini3/src/pipeline.py` - Orchestration logic
- `Gemini3/docs/GOOGLE_ADK_AGENTS.md` - Full documentation
---
## Pipeline 2: Claude Sonnet 4.5 (Anthropic SDK)
**Location**: `src/`
The Claude pipeline uses the **Anthropic Agent SDK** with automatic context management and built-in tools.
### How It Works

### Key Files
- `src/app_claude.py` - Gradio UI entry point
- `src/agents/prerequisite_explorer_claude.py` - Claude SDK agent
- `docs/ARCHITECTURE.md` - System design details
---
## Pipeline 3: Kimi K2.5 Swarm
**Location**: `KimiK2Thinking/`
The Kimi pipeline uses Moonshot AI's **K2.5 Swarm architecture** with an OpenAI-compatible API, six-agent coordination, and enhanced chain-of-thought reasoning.
### How It Works

### Quick Start
```bash
# Set API key
echo "MOONSHOT_API_KEY=your_key_here" >> .env
# Run prerequisite exploration
python KimiK2Thinking/examples/test_kimi_integration.py
# Run full enrichment pipeline
python KimiK2Thinking/examples/run_enrichment_pipeline.py path/to/tree.json
```
### Key Files
- `KimiK2Thinking/kimi_client.py` - API client
- `KimiK2Thinking/agents/enrichment_chain.py` - Three-stage pipeline
- `KimiK2Thinking/README.md` - Complete documentation
---
## Installation
```bash
# Clone repository
git clone https://github.com/HarleyCoops/Math-To-Manim
cd Math-To-Manim
# Install dependencies
pip install -r requirements.txt
# Set up your preferred API key
echo "ANTHROPIC_API_KEY=your_key" >> .env # For Claude
echo "GOOGLE_API_KEY=your_key" >> .env # For Gemini
echo "MOONSHOT_API_KEY=your_key" >> .env # For Kimi
# Install FFmpeg (required for video rendering)
# Windows: choco install ffmpeg
# Linux: sudo apt-get install ffmpeg
# macOS: brew install ffmpeg
```
---
## Run Example Animations
We have **55+ working examples** organized by topic:
```bash
# Physics - Black Hole Symphony
manim -pql examples/physics/black_hole_symphony.py BlackHoleSymphony
# Mathematics - Hopf Fibration
manim -pql examples/misc/epic_hopf.py HopfFibrationEpic
# Finance - Option Pricing
manim -pql examples/finance/optionskew.py OptionSkewScene
# Computer Science - Neural Networks
manim -pql examples/computer_science/machine_learning/AlexNet.py AlexNetScene
```
**Flags**: `-p` preview, `-q` quality (`l` low, `m` medium, `h` high, `k` 4K)
Browse all examples: [docs/EXAMPLES.md](docs/EXAMPLES.md)
---
## Repository Structure
```
Math-To-Manim/
|
+-- skill/ # [LAUNCH] Claude Code Skill (NEW!)
| +-- .claude-plugin/ # Plugin manifest
| +-- skills/math-to-manim/ # Skill definition & references
|
+-- src/ # Claude Sonnet 4.5 pipeline
| +-- agents/ # Agent implementations
| +-- app_claude.py # Gradio UI
|
+-- Gemini3/ # Google Gemini 3 pipeline
| +-- src/ # Agent definitions
| +-- docs/ # Gemini-specific docs
| +-- run_pipeline.py # Entry point
|
+-- KimiK2Thinking/ # Kimi K2 pipeline
| +-- agents/ # Enrichment chain
| +-- examples/ # Usage examples
|
+-- examples/ # 55+ working animations
| +-- physics/ # Quantum, gravity, particles
| +-- mathematics/ # Geometry, topology, analysis
| +-- computer_science/ # ML, algorithms
| +-- cosmology/ # Cosmic evolution
| +-- finance/ # Option pricing
|
+-- docs/ # Documentation
+-- tests/ # Test suite
+-- tools/ # Utility scripts
```
---
## Why LaTeX-Rich Prompting Works
### The Problem with Vague Prompts
```
"Create an animation showing quantum field theory"
```
**Result**: Generic, incorrect, or broken code.
### The Solution: Verbose LaTeX Prompts
```
"Begin with Minkowski spacetime showing the metric:
$$ds^2 = -c^2 dt^2 + dx^2 + dy^2 + dz^2$$
Each component highlighted in different hues. Introduce the QED Lagrangian:
$$\mathcal{L}_{\text{QED}} = \bar{\psi}(i \gamma^\mu D_\mu - m)\psi - \tfrac{1}{4}F_{\mu\nu}F^{\mu\nu}$$
with Dirac spinor $\psi$ in orange, covariant derivative $D_\mu$ in green..."
```
**Result**: Perfect animations with correct LaTeX, camera movements, and timing.
**Our agents generate these verbose prompts automatically** by walking the knowledge tree.
---
## Common Pitfalls (And How We Solve Them)
| Problem | Traditional Approach | Our Solution |
|:--------|:--------------------|:-------------|
| **LaTeX Errors** | Hope for the best | Verbose prompts show exact formulas |
| **Vague Cinematography** | "Show quantum field" | Specify colors, angles, timing |
| **Missing Prerequisites** | Jump to advanced topics | Recursive dependency discovery |
| **Inconsistent Notation** | Mixed symbols | Mathematical enricher maintains consistency |
---
## Technical Requirements
- **Python**: 3.10+
- **API Key**: Anthropic, Google, or Moonshot
- **FFmpeg**: For video rendering
- **Manim Community**: v0.19.0
- **RAM**: 8GB minimum, 16GB recommended
---
## Contributing
We welcome contributions:
1. **Add Examples**: Create animations for new topics
2. **Improve Agents**: Enhance prerequisite discovery
3. **Fix Bugs**: Report and fix issues
4. **Documentation**: Improve guides
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
---
## Documentation
- **[Claude Code Skill](skill/README.md)** - Use Math-To-Manim in Claude Code (NEW!)
- [Reverse Knowledge Tree](docs/REVERSE_KNOWLEDGE_TREE.md) - Core innovation
- [Architecture](docs/ARCHITECTURE.md) - System design
- [Examples Catalog](docs/EXAMPLES.md) - All 55+ animations
- [Gemini Pipeline](Gemini3/docs/GOOGLE_ADK_AGENTS.md) - Google ADK details
- [Kimi Pipeline](KimiK2Thinking/README.md) - Moonshot AI integration
- [Quick Start Guide](docs/QUICK_START_GUIDE.md) - Get started fast
---
## License
MIT License - See [LICENSE](LICENSE)
---
## Acknowledgments
- **Manim Community** - Incredible animation framework
- **Anthropic** - Claude Sonnet 4.5 and Agent SDK
- **Google** - Gemini 3 and Agent Development Kit
- **Moonshot AI** - Kimi K2.5 Swarm architecture
- **1400+ Stargazers** - Thank you for the support!
---
**Built with recursive reasoning, not training data.**
**Star this repo if you find it useful!**