错题本(cuotiben)
Turn a wrong problem into a structured study record: analyze it, explain the
error, generate similar practice problems, and keep everything in a searchable
local 错题本 that can be exported to a Chinese-friendly PDF.
When to use
- User pastes text or shares a photo of a wrong problem and asks for 解析 / 讲解.
- User asks for 相似题 / 同类题 / 变式题 based on a problem.
- User wants to 整理错题 / 建错题本 / 复习错题 / 按学科或知识点搜索.
- User wants to 导出 PDF 错题本.
Workflow
1. 录入并分析(核心)
Accept either an image (photo of the problem) or text.
- If an image path is given, read it with multimodal capability and transcribe the
problem faithfully (keep math notation; describe diagrams in words). - Follow the analysis template in
references/schema.mdto produce, in one
structured answer:
1. 学科 (subject) and 知识点 (knowledge point) — pick a short,
consistent label (e.g. 数学 / 二次函数) so later filtering works.
2. 错误原因 — the misconception that leads to the wrong answer.
3. 解析 — step-by-step correct solution.
4. 答案.
5. Exactly 2 道相似题 — same knowledge point & difficulty, varied
numbers/context; each with its own 答案 (and a brief 解析).
1.5 是否生成交互程序(主动判断)
For concepts that are geometric / spatial / dynamic — where seeing or
manipulating beats reading — proactively build a self-contained interactive
HTML and present it (write the file, then present_files to open a live
preview). Do NOT ask first when the concept clearly benefits. Strong candidates:
圆面积推导, 函数图像与变换, 几何图形变换, 运动/轨迹, 概率模拟.
Keep the HTML single-file, dependency-free, Chinese UI, light theme.
Also generate an interactive for the 2 相似题 whenever they share the same
interactive-friendly concept — prefer folding them into the SAME html as a
practice mode (preset buttons that load each 相似题's numbers and let the
student self-check against the live computed result).
2. 存储
Persist the record so it becomes part of the 错题本. Build the JSON object
(schema in references/schema.md) and append it:
python3 ~/.workbuddy/skills/cuotiben/scripts/add_mistake.py --data '<json>'
The script assigns an id + created_at and writes to
~/.workbuddy/cuotiben_data/mistakes.json by default (override with --store).
3. 复习 / 搜索
- List or filter:
python3 ~/.workbuddy/skills/cuotiben/scripts/search_mistakes.py --subject 数学 --keyword 函数 --format list
- Output formats:
list(compact),md(readable report),json(raw). - For 重复练习: pick records (optionally filtered), re-ask the 相似题 to the
user, then reveal answers and 解析.
4. 导出 PDF
python3 ~/.workbuddy/skills/cuotiben/scripts/export_pdf.py --out ~/Desktop/错题本.pdf
Renders each record with a system CJK font (no garbled Chinese). Requires
reportlab — the script auto-installs it if missing.
Notes
- The 错题本 is a single JSON file at
~/.workbuddy/cuotiben_data/mistakes.json;
it persists across sessions and is independent of any project. - Keep 学科 / 知识点 labels consistent across entries to make search/filter useful.