# MathClaw **Repository Path**: wangbing69/MathClaw ## Basic Information - **Project Name**: MathClaw - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-04 - **Last Updated**: 2026-08-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README


MathClaw Logo

MathClaw

A multi-channel AI learning assistant for junior and senior high school mathematics

δΈ­ζ–‡  ο½œ  English

> ⭐ If you like this project, please click the "Star" button in the upper right corner to support us! ## πŸ“ Introduction MathClaw is a multi-channel AI learning system for junior and senior high school mathematics, built around the following core pipeline: ``` Multi-channel intake β†’ Tutoring workspace β†’ Weakness diagnosis β†’ Memory consolidation β†’ Graphs / Plans / Summaries ``` Core components include: - a **math tutoring agent** built on top of the `mathclaw` runtime - a customized **MathClaw console** with both student-facing and operator-facing pages - a learning workflow centered on **study plans, knowledge graphs, error graphs, and scheduled summaries** - a **multi-channel gateway** for WeCom, QQ, Feishu, Telegram, Slack, WhatsApp, Email, Matrix, Discord, and more ## ✨ Key Features - **πŸ“ Math-first tutoring workflow**: Built for secondary-school mathematics, with guided explanations, weakness analysis, and correction-oriented feedback. - **πŸ–ΌοΈ Multi-modal input**: Supports text, image, screenshot, and PDF input for real-world problem-solving scenarios. - **πŸ•ΈοΈ Structured learning memory**: Automatically builds knowledge graphs and error graphs for continuous learning state tracking. - **πŸ—“οΈ Study plans & auto-summaries**: Daily memory, weekly reports, and tomorrow suggestions driven by heartbeat + cron. - **πŸ“‘ Unified multi-channel gateway**: Connect the same agent to WeCom, QQ, Feishu, and more, with unified message routing. - **πŸ–₯️ Student + operator console**: Student workspace and operations management in one console. - **πŸ”Œ Extensible toolchain**: Filesystem, web, shell, cron, MCP services, and channel plugins are all extensible. ## πŸ—οΈ Architecture ```mermaid flowchart LR A["Student / Teacher / Operator"] --> B["Channels
WeCom / QQ / Feishu / ..."] B --> C["mathclaw gateway"] C --> D["MathClaw AgentLoop"] D --> E["LLM Providers
DashScope / OpenAI / Anthropic / ..."] D --> F["Tools
Web Β· Filesystem Β· Shell Β· Cron Β· MCP"] D --> G["Sessions
JSONL conversation history"] D --> H["Memory Runtime
Daily / Weekly / Graphs"] D --> I["Heartbeat / Cron"] H --> J["Study Plan page"] H --> K["Memory Graph page"] I --> L["Heartbeat page"] C --> M["MathClaw Console"] ``` ## πŸ“ Repository Structure ```text . β”œβ”€β”€ mathclaw/ # Core runtime: agent, channels, providers, memory, cron, heartbeat β”œβ”€β”€ console/ # MathClaw console: static frontend shell + serve.py API layer β”œβ”€β”€ workspace/ # Repo-owned MathClaw persona, plans, and templates β”œβ”€β”€ bridge/ # WhatsApp bridge (Node 20+) β”œβ”€β”€ docs/ # Docs such as the channel plugin guide └── tests/ # Runtime, tool, security, and channel tests ``` ## πŸš€ Quick Start ### 1. Install ```bash git clone https://github.com/MathClaw-ruc/MathClaw.git cd MathClaw python -m venv .venv source .venv/bin/activate python -m pip install -U pip python -m pip install -e . ``` To enable WeCom support: ```bash python -m pip install -e ".[wecom]" ``` ### 2. Initialize config and workspace ```bash mathclaw onboard --workspace ./workspace ``` This creates: - config: `~/.mathclaw/config.json` - workspace templates: `./workspace/AGENTS.md`, `USER.md`, `HEARTBEAT.md`, `cron/jobs.json` Interactive setup: ```bash mathclaw onboard --workspace ./workspace --wizard ``` ### 3. Minimal config example ```json { "agents": { "defaults": { "workspace": "/path/to/MathClaw/workspace", "model": "qwen3.5-plus", "provider": "dashscope", "timezone": "Asia/Shanghai" } }, "providers": { "dashscope": { "api_key": "YOUR_DASHSCOPE_API_KEY" } }, "tools": { "web": { "search": { "provider": "tavily", "api_key": "YOUR_TAVILY_API_KEY" } } } } ``` ### 4. Launch ```bash # Start the gateway (default port 18790) mathclaw gateway --workspace ./workspace # Start the console (default address http://127.0.0.1:6006) cd console MATHCLAW_CONSOLE_WORKSPACE=../workspace python serve.py # Or talk to the agent from CLI mathclaw agent --workspace ./workspace -m "Teach me monotonicity from derivatives" ``` To use a different port: ```bash cd console MATHCLAW_CONSOLE_WORKSPACE=../workspace MATHCLAW_CONSOLE_PORT=6008 python serve.py ``` > **Requirements**: Python `3.11+`; Linux / macOS / WSL recommended for deployment; optional Node.js `20+` (only for WhatsApp bridge). --- ## πŸ“Έ Feature Preview
Chat Workspace
Chat Workspace
Study Plan
Study Plan
Runtime Status
Runtime Status
Heartbeat & Auto Tasks
Heartbeat & Auto Tasks
Knowledge Graph
Knowledge Graph
Error Graph
Error Graph
Skills
Skills
--- ## 🧩 Core Capabilities | Module | Current capability | Main code | | --- | --- | --- | | 🧠 Chat Workspace | Single-thread tutoring workspace with text, image, and PDF upload; Markdown/table rendering | `console/main.js` Β· `console/serve.py` | | πŸ—“οΈ Study Plan | Daily status, weekly plan, tomorrow suggestions, focus topics, and correction directions | `mathclaw/agent/memory.py` Β· `workspace/cron/jobs.json` | | πŸ•ΈοΈ Memory Graphs | Knowledge graph + error graph, focus/overview modes, node details, node deletion | `workspace/memory/graphs/*` Β· `console/main.js` | | ⏰ Heartbeat & Summaries | Daily summary, weekly summary, scheduled jobs, `HEARTBEAT.md` wake-up execution | `mathclaw/cron/service.py` Β· `mathclaw/heartbeat/service.py` | | πŸ“‘ Multi-channel Gateway | Channel intake, routing, streaming coalescing, outbound retry | `mathclaw/channels/manager.py` Β· `mathclaw/cli/commands.py` | | πŸ› οΈ Models & Tools | Multi-provider routing, Web Search/Web Fetch, filesystem tools, shell, cron, message send-back, MCP, subagents | `mathclaw/providers/registry.py` Β· `mathclaw/agent/loop.py` | | ✨ Custom Output Skills | Optional follow-up output boxes after attachment replies | `mathclaw/agent/custom_output_skills.py` | | 🧾 Sessions & Memory | JSONL session persistence, daily memory, weekly summaries, graph snapshots | `mathclaw/session/manager.py` Β· `mathclaw/agent/memory.py` | ## πŸ–₯️ Console Modules | Page | Audience | Primary role | | --- | --- | --- | | 🧠 Chat Workspace | Student | Single-thread tutoring workspace with attachment upload and rich Markdown answers | | πŸ—“οΈ Study Plan | Student | Daily status, weekly plan, tomorrow suggestions, focus topics, practice load | | πŸ•ΈοΈ Memory | Student / Teacher | Knowledge graph, error graph, node details, relation browsing | | πŸ“Š Runtime Status | Operator | Health summary, model chain, tool abilities, active channels, attachment pipeline | | πŸ“‘ Channels | Operator | Per-channel enablement, daily message count, active sessions, last activity | | ❀️ Heartbeat | Operator | Scheduled summaries, heartbeat rhythm, latest result, troubleshooting order | | ✨ Skills | Operator | Manage custom output skills used after attachment replies | | πŸ› οΈ MCP / Agent Config / Models | Operator | View current tools, agent boundaries, and model chain | ## πŸ“‘ Channels and Integrations ### Built-in channels WeCom, QQ, Feishu, Telegram, Slack, Email, Discord, Matrix, Weixin, DingTalk, WhatsApp, MoChat External channel plugins are supported via Python entry points. See [docs/CHANNEL_PLUGIN_GUIDE.md](docs/CHANNEL_PLUGIN_GUIDE.md). ### Runtime override examples
WeCom ```bash mathclaw gateway --workspace ./workspace \ --wecom \ --wecom-bot-id YOUR_WECOM_BOT_ID \ --wecom-secret YOUR_WECOM_SECRET \ --wecom-allow-from "*" ```
QQ ```bash mathclaw gateway --workspace ./workspace \ --qq \ --qq-app-id YOUR_QQ_APP_ID \ --qq-secret YOUR_QQ_SECRET \ --qq-allow-from "*" ```
Feishu ```bash mathclaw gateway --workspace ./workspace \ --feishu \ --feishu-app-id YOUR_FEISHU_APP_ID \ --feishu-app-secret YOUR_FEISHU_APP_SECRET \ --feishu-allow-from "*" ```
Interactive auth and status: ```bash mathclaw channels login mathclaw channels status ``` ## πŸ› οΈ Providers and Tools ### Supported providers DashScope, OpenAI, Anthropic, DeepSeek, Gemini, OpenRouter, Azure OpenAI, Zhipu AI, Moonshot, MiniMax, Mistral, Step Fun, Groq, Ollama, vLLM, OpenVINO Model Server, OpenAI Codex, GitHub Copilot, custom OpenAI-compatible endpoints ### Default agent tools `AgentLoop` currently registers: - file read / write / edit / list - shell execution - web search / web fetch - outbound message tool - subagent spawn - cron scheduling - MCP tool servers ## 🧠 Learning Memory and Automation What makes this repository distinctive is not just chat. It continuously turns tutoring activity into reusable learning memory: - daily learning memory - weekly summaries - knowledge graphs - error graphs - tomorrow suggestions - heartbeat tasks - persisted cron schedules ### πŸ—‚οΈ What each history path is for | Path | Purpose | | --- | --- | | `workspace/sessions/*.jsonl` | Raw session logs for the console and external channels | | `workspace/memory/daily_conversations/*/events.jsonl` | Day-bucketed event streams used as input to memory and summary jobs | | `workspace/memory/daily_memory/*/*.json` / `.md` | Daily learning memory snapshots that power today-status and tomorrow-suggestion outputs | | `workspace/memory/weekly_memory/*/*.md` | Weekly summaries and weekly plans used by the study-plan page and scheduled reports | | `workspace/memory/graphs/*.json` | The actual data sources behind the knowledge graph and error graph views | | `workspace/cron/jobs.json` | Scheduled job definitions plus runtime state such as last/next execution and run history | | `workspace/HEARTBEAT.md` | Persistent task instructions checked by the heartbeat service | ### πŸ”„ Data flow ```mermaid flowchart LR A["workspace/sessions/*.jsonl
raw conversations"] --> B["daily_conversations/*/events.jsonl
day-level event stream"] B --> C["daily_memory/*
daily learning memory"] C --> D["weekly_memory/*
weekly summary and plan"] C --> E["graphs/*.json
knowledge / error graphs"] D --> F["Study Plan page
today status / weekly plan / tomorrow suggestions"] E --> G["Memory page
knowledge graph / error graph"] H["HEARTBEAT.md"] --> I["cron/jobs.json
scheduled task state"] I --> J["Heartbeat page
automatic sends / rhythm / troubleshooting"] ``` ## πŸ“„ License This project is released under the [MIT License](LICENSE). ## πŸ™ Acknowledgements MathClaw draws inspiration from the following open-source projects, with thanks to their authors and communities: - [HKUDS/nanobot](https://github.com/HKUDS/nanobot) - [ymx10086/ResearchClaw](https://github.com/ymx10086/ResearchClaw)