$npx -y skills add woodfishhhh/EZ_math_model --skill ez-math-modelUse when solving CUMCM, MCM, ICM, or other mathematical modeling tasks that need contest problem intake, model selection, Python solving, figures, paper writing, quality audit, and packaged deliverables.
| 1 | # ez-math-model |
| 2 | |
| 3 | 数学建模一站式 skill。把题目交给我,我会自动走完七个阶段:setup → 题目解析 → |
| 4 | 建模方案 → 代码求解 → 论文撰写 → 质量审查 → 标准打包交付。首次使用必须完成 setup |
| 5 | 提问;完成后写入 `external/tools/setup_state.json`。未经用户确认,只能使用本次临时默认, |
| 6 | 不得写永久配置。 |
| 7 | |
| 8 | ## 一句话主流程 |
| 9 | |
| 10 | > 收到题目 → 识别项目总文件夹 → 检查 `external/tools/setup_state.json` → |
| 11 | > 创建 `用户输入/runtime/output` 标准目录 → 判定 `formal/demo/blocked` → |
| 12 | > 识别赛事/年份/题号 → 选择模型 → 写脚本并执行 → 出图并过 chart gate → |
| 13 | > 写论文 → 跑对象级质量门 → staging 导出与审查 → 原子同步到 `output/` 并打包 |
| 14 | > `output.zip`。 |
| 15 | |
| 16 | ## 触发后的第一动作 |
| 17 | |
| 18 | 先读以下七份文件确认本次运行的契约: |
| 19 | |
| 20 | 1. `pipeline/00-environment-setup.md` — 验环境(Python、字体、工作目录、上游缓存状态) |
| 21 | 2. `references/project-root-protocol.md` — 项目总文件夹与 `用户输入/runtime/output` |
| 22 | 3. `references/setup-policy.md` — setup 硬门与临时默认边界 |
| 23 | 4. `references/run-mode-protocol.md` — `formal/demo/blocked` 判定 |
| 24 | 5. `references/workdir-protocol.md` — runtime 产物结构与命名 |
| 25 | 6. `references/chart-quality-gate.md` — 图表有效性门 |
| 26 | 7. `references/artifact-manifest.md` — 产物 manifest 契约 |
| 27 | |
| 28 | formal 交付不得只检查“文件是否存在”。质量门必须覆盖图表语义、公式语法、 |
| 29 | 表格对象、优秀论文格式抽取、正文工程痕迹、DOCX/PDF 对象级导出和 zip/manifest |
| 30 | 一致性。 |
| 31 | |
| 32 | 然后立刻执行 setup gate: |
| 33 | |
| 34 | - 读取 `external/tools/setup_state.json`。 |
| 35 | - 若文件不存在、JSON 无法解析、`setup_completed` 不是 `true`,或用户说"重新配置工具 / |
| 36 | 重置 setup / 重新 setup",**必须先运行 pipeline 00 的强制提问**,禁止进入 |
| 37 | pipeline 01、建模、写代码或写论文。 |
| 38 | - setup 提问完成后,必须写入 `external/tools/setup_state.json`,再继续本次任务。 |
| 39 | - 若 `setup_completed: true`,默认跳过交互式 setup,只做本次任务所需的轻量环境检查 |
| 40 | 和工作目录创建。 |
| 41 | |
| 42 | 不要用"默认不追问"绕过首次 setup;首次 setup 是硬门禁。若用户要求继续但无法 |
| 43 | 完成交互式 setup,只能写 `runtime/{task_id}/setup_assumptions.json`,并把 |
| 44 | `setup_status` 标为 `temporary_default`,最终质量等级最高为 `provisional_pass`。 |
| 45 | |
| 46 | ## Pipeline 索引 |
| 47 | |
| 48 | | # | 文件 | 入口条件 | 关键产出 | |
| 49 | |---|---|---|---| |
| 50 | | 00 | `pipeline/00-environment-setup.md` | 用户给出题目或附件;setup gate 未完成时必须先问 | setup 状态明确、`runtime/` 创建完成、env-check 通过 | |
| 51 | | 01 | `pipeline/01-problem-intake.md` | env-check 通过 | `runtime/.../problem.md`、`intake.json`、`attachments/`、`run_state.json` | |
| 52 | | 02 | `pipeline/02-modeling-plan.md` | intake 完成 | `modeling_plan.md`、(首次询问 zhanwen 拉取) | |
| 53 | | 03 | `pipeline/03-coding-solve.md` | modeling_plan 落盘 | `src/*.py`、`results/*`、`figures/*.png` | |
| 54 | | 04 | `pipeline/04-paper-writing.md` | coding 完成 | `paper.md` | |
| 55 | | 05 | `pipeline/05-quality-audit.md` | paper.md 落盘 | `quality_report.json`、`quality_report.md`(含证据与未通过项) | |
| 56 | | 06 | `pipeline/06-packaging-output.md` | 质量门评估完成 | `export_report.json`、`export_audit.json`、`output/paper/*` 四格式、`output/manifest.json`、`output.zip` | |
| 57 | |
| 58 | ## 角色 prompt 索引 |
| 59 | |
| 60 | 需要在阶段中扮演具体角色时载入: |
| 61 | |
| 62 | | 角色 | 文件 | 用途 | |
| 63 | |---|---|---| |
| 64 | | coordinator | `prompts/coordinator.md` | 拆题,识别赛事/年份/题号/小问 | |
| 65 | | modeler | `prompts/modeler.md` | 建模分析,模型选择树 + 物理可行性 | |
| 66 | | coder | `prompts/coder.md` | 写脚本、出图、防数据泄露、参数有据 | |
| 67 | | writer | `prompts/writer.md` | 写论文,段落式、图必引、文献唯一编号 | |
| 68 | |
| 69 | ## 角色守则索引 |
| 70 | |
| 71 | 执行阶段开始前必读对应角色守则(比 prompt 更关注流程纪律): |
| 72 | |
| 73 | - `references/roles/modeler-guide.md` |
| 74 | - `references/roles/coder-guide.md` |
| 75 | - `references/roles/writer-guide.md` |
| 76 | |
| 77 | ## 模板索引 |
| 78 | |
| 79 | - `templates/paper_zh.md` — 中文 CUMCM 论文 markdown 兜底模板 |
| 80 | - `templates/paper_en.md` — 英文 MCM/ICM 论文 markdown 兜底模板 |
| 81 | - `templates/chapter_outline.toml` — 章节占比与必备小节 |
| 82 | - `templates/readme_workdir.md` — 任务工作目录的 README 模板 |
| 83 | |
| 84 | ## 算法库索引 |
| 85 | |
| 86 | `references/algorithms/README.md` 提供「问题类型 → 推荐算法」速查表;按类别细看: |
| 87 | |
| 88 | 01 优化 / 02 预测 / 03 评价 / 04 图论 / 05 统计 / 06 综合 / 07 机器学习。 |
| 89 | |
| 90 | ## 优秀论文样例 |
| 91 | |
| 92 | `references/exemplar-papers/` 下提供 7 篇 CUMCM / MCM 优秀论文的 markdown |
| 93 | 摘录(由 MinerU 从 zhanwen/MathModel 转换,前 20 页)。modeler 与 writer |
| 94 | 在动笔前应读取与本题最相关的 1-2 篇,抽取格式规则并写 |
| 95 | `style_reference_notes.md`,**仅作风格 / 章节 / 表述参考**,禁止照抄或同义改写。 |
| 96 | 索引详见 `references/exemplar-papers/README.md`。 |
| 97 | |
| 98 | ## 容错与失败处理 |
| 99 | |
| 100 | `references/fault-tolerance.md` 是单一信息源,定义 4 层容错: |
| 101 | L1 Bounded Retry / L2 Fallback Switch / L3 Evaluator Shadow / L4 Feedback |
| 102 | Rerun。每个 pipeline 阶段都遵守同一套容错协议,绝不死循环。 |
| 103 | |
| 104 | ## Agent 工作模式 |
| 105 | |
| 106 | `references/agent-mode.md` 单一信息源,定义三种工作模式: |
| 107 | |
| 108 | - **single**:所有阶段在主对话顺序推进;上下文压力大但失败定位最容易 |
| 109 | - **multi**:每个独立子任务派 subagent 并行;并发强但 token 成本高 |
| 110 | - **hybrid(默认)**:关键阶段主对话、琐碎阶段 subagent;兼顾稳定与并发 |
| 111 | |
| 112 | pipeline 00 首次会强制询问,决策落到 `external/tools/setup_state.json` 与 |
| 113 | `external/tools/agent_mode.{single,multi,hybrid}`。 |
| 114 | |
| 115 | ## 继承的辅助 Skills |
| 116 | |
| 117 | ezmm 内置 9 个辅助子 skills(在用户机器上检测到才启用): |
| 118 | |
| 119 | | 子 skill | 何时调 | |
| 120 | |---|---| |
| 121 | | `tools/humanizer/SKILL.md` | writer 后去 AI 味 | |
| 122 | | `tools/simplify/SKILL.md` | coder 后做代码精简 | |
| 123 | | `tools/scientific-slides/SKILL.md` | 答辩 PPT | |
| 124 | | `tools/systematic-debugging/SKILL.md` | coder 失败的根因分析 | |
| 125 | | `tools/brainstorming/SKILL.md` | modeler 决策卡住时 | |
| 126 | | `tools/external-context/SKILL. |