superlab 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/i18n.cjs CHANGED
@@ -387,10 +387,13 @@ const ZH_SKILL_FILES = {
387
387
  - 为什么我们的想法优于现有方法
388
388
  - 用白话解释我们准备怎么做
389
389
  - 三个一眼就有意义的点
390
- - 第一轮脑暴:先列 2-4 个候选方向
390
+ - 第一轮脑暴:先列 3-4 个候选方向
391
+ - 每个候选方向都要讲清:它是什么、为什么值得研究、大致怎么做、解决了什么问题、主要风险是什么
391
392
  - 第一轮文献检索:每个方向补 3-5 篇最接近前作
392
393
  - 第二轮脑暴:收敛到 1-2 个幸存方向
394
+ - 第二轮脑暴还要讲清:为什么保留这些方向、为什么淘汰其他方向、为什么当前推荐项更强
393
395
  - 第二轮文献检索:把幸存方向扩展成完整文献范围包
396
+ - 用于最终推荐的文献摘要:明确写出最接近前作、近期强相关论文,以及现有工作仍未解决什么
394
397
  - 文献范围包,默认目标约 20 篇来源;如果领域太窄不足 20 篇,必须明确解释
395
398
  - idea 来源清单:记录两轮检索实际用到的查询、来源分桶和最终来源数
396
399
  - 进入 \`/lab:spec\` 前的 approval gate
@@ -403,8 +406,10 @@ const ZH_SKILL_FILES = {
403
406
  - 在谈 novelty 前先做文献范围梳理。默认目标是约 20 篇来源,覆盖最接近前作、近期强相关论文、benchmark 或评测论文、survey 或 taxonomy,以及必要的相邻领域工作。
404
407
  - 必须维护单独的 idea 来源清单,把两轮检索真正使用过的查询、来源分桶和最终来源数记下来。
405
408
  - 第一轮脑暴只负责打开空间,不负责直接下 novelty 结论。
409
+ - 第一轮脑暴至少覆盖三个候选方向,并为每个方向写清楚核心理由。
406
410
  - 第一轮文献检索负责快速淘汰撞题或没有缺口的方向。
407
411
  - 第二轮脑暴必须明确哪些方向被保留、哪些被否掉、为什么。
412
+ - 最终推荐前要有一个用户可见的文献摘要,而不是只把来源藏在 source log 里。
408
413
  - 第二轮文献检索完成前,不要把方向写成最终 paper fit 或 final recommendation。
409
414
  - 如果真实领域过窄,达不到默认数量,也必须把原因写清楚,而不是静默跳过。
410
415
  - \`idea\` 工件必须跟随仓库的 \`workflow_language\`,不能自己换成别的语言。
@@ -1881,6 +1886,8 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "write.md")] = `# \`/l
1881
1886
  - 如果当前是最终导出或最终定稿轮次,且 \`workflow_language\` 与 \`paper_language\` 不一致、\`paper_language_finalization_decision\` 还是 \`unconfirmed\`,就必须追问一次:保持当前 workflow language,还是把最终稿转换成 \`paper_language\`。
1882
1887
  - 如果用户选择保持当前 workflow language,就把 \`paper_language_finalization_decision\` 持久化成 \`keep-workflow-language\`。
1883
1888
  - 如果用户选择转换成最终论文语言,就把 \`paper_language_finalization_decision\` 持久化成 \`convert-to-paper-language\`。
1889
+ - 如果 \`workflow_language\` 与 \`paper_language\` 不一致,就不要在确认前先把最终论文正文改写成 \`paper_language\`;必须先追问、再持久化、再改稿。
1890
+ - 如果 \`workflow_language\` 与 \`paper_language\` 不一致,就要在最新 write iteration artifact 里记录工作流语言、论文语言、最终语言决定,以及为什么这样决定。
1884
1891
  - 如果 \`paper_language_finalization_decision\` 是 \`convert-to-paper-language\`,在接受最终定稿前必须把最终稿转换到 \`paper_language\`。
1885
1892
  - 只加载当前 section guide,不要一次加载全部章节参考。
1886
1893
  - 如果当前 section 是 \`abstract\`、\`introduction\` 或 \`method\`,还必须继续读取本地 example bank:\`references/paper-writing/examples/index.md\`、对应的 examples index,以及 1-2 个具体 example 文件。
@@ -1909,6 +1916,7 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "write.md")] = `# \`/l
1909
1916
  - 最终定稿或导出轮次结束前,必须先通过 \`.lab/.managed/scripts/validate_section_draft.py --section <section> --section-file <section-file> --mode final\` 和 \`.lab/.managed/scripts/validate_paper_claims.py --section-file <section-file> --mode final\`。
1910
1917
  - 如果最终轮次的 section 或 claim 校验失败,就继续改正文;不能因为资产齐全就停下。
1911
1918
  - 在最终定稿或导出轮次结束前,必须运行 \`.lab/.managed/scripts/validate_manuscript_delivery.py --paper-dir <deliverables_root>/paper\`;如果失败,就继续补表、图、引用和正文。
1919
+ - 如果 \`workflow_language\` 与 \`paper_language\` 不一致,\`validate_manuscript_delivery.py\` 还会检查最新 write iteration 里是否存在语言决策审计;缺这块就不能算最终稿合格。
1912
1920
  - 如果本地有 LaTeX 工具链,就再跑一次 compile smoke test;如果没有,也要在 write iteration artifact 里记录该限制。
1913
1921
  - 如果缺少 framing artifact,不要继续写作,直接回到 \`/lab:framing\`。
1914
1922
  - 如果某个 claim 没有证据支撑,就削弱或删除。
@@ -2003,7 +2011,7 @@ ZH_CONTENT[path.join(".lab", ".managed", "templates", "framing.md")] = `# 论文
2003
2011
  ZH_CONTENT[path.join(".codex", "prompts", "lab.md")] = codexPrompt(
2004
2012
  "查看 /lab 研究工作流总览并选择合适阶段",
2005
2013
  "workflow question 或 stage choice",
2006
- "# `/lab` for Codex\n\n`/lab` 是严格的研究工作流命令族。每次都使用同一套仓库工件和阶段边界。\n\n## 子命令\n\n- `/lab:idea`\n 先做两轮脑暴和两轮文献检索,再定义问题与 failure case、对比最接近前作,并输出带 approval gate 的 source-backed recommendation。\n\n- `/lab:data`\n 把已批准的 idea 转成数据集与 benchmark 方案,记录数据集年份、使用过该数据集的论文、下载来源、许可或访问限制,以及 classic-public、recent-strong-public、claim-specific 三类 benchmark 的纳入理由,和 canonical baselines、strong historical baselines、recent strong public methods、closest prior work 四类对比方法的纳入理由。\n\n- `/lab:auto`\n 在不改变 mission、framing 和核心 claims 的前提下,读取 eval-protocol 与 auto-mode 契约并自动编排 `run`、`iterate`、`review`、`report`,必要时扩展数据集、benchmark 和 comparison methods,并在满足升格策略时自动升级 primary package。启动前必须选定 autonomy level、声明 terminal goal,并显式批准契约。\n\n- `/lab:framing`\n 通过审计当前领域与相邻领域的术语,锁定 paper-facing 的方法名、模块名、论文题目和 contribution bullets,并在 section 起草前保留 approval gate。\n\n- `/lab:spec`\n 把已批准的 idea 转成 `.lab/changes/<change-id>/` 下的一个 lab change 目录,并在其中写出 `proposal`、`design`、`spec`、`tasks`。\n\n- `/lab:run`\n 执行最小有意义验证运行,登记 run,并生成第一版标准化评估摘要。\n\n- `/lab:iterate`\n 在冻结 mission、阈值、verification commands 与 `completion_promise` 的前提下执行有边界的实验迭代。\n\n- `/lab:review`\n 以 reviewer mode 审查文档或结果,先给短摘要,再输出 findings、fatal flaws、fix priority 和 residual risks。\n\n- `/lab:report`\n 从 runs 和 iterations 工件生成最终研究报告。\n\n- `/lab:write`\n 使用已安装 `lab` skill 下 vendored 的 paper-writing references,把稳定 report 工件转成论文 section。\n\n## 调度规则\n\n- 始终使用 `skills/lab/SKILL.md` 作为工作流合同。\n- 用户显式调用 `/lab:<stage>` 时,要立刻执行该 stage,而不是只推荐别的 `/lab` stage。\n- 先给简洁摘要,再决定是否写工件,最后回报输出路径和下一步。\n- 如果歧义会影响结论,一次只问一个问题;如果有多条可行路径,先给 2-3 个方案再收敛。\n- `/lab:spec` 前应已有经批准的数据集与 benchmark 方案。\n- `/lab:run`、`/lab:iterate`、`/lab:auto`、`/lab:report` 都应遵循 `.lab/context/eval-protocol.md`。\n- `.lab/context/eval-protocol.md` 不只定义主指标和主表,也应定义指标释义、实验阶梯,以及指标和对比实现的来源。\n- `/lab:auto` 只编排已批准边界内的执行阶段,不替代手动的 idea/data/framing/spec 决策。\n- `/lab:write` 前必须已有经批准的 `/lab:framing` 工件。\n\n## 如何输入 `/lab:auto`\n\n## `/lab:auto` 层级指南\n\n- `L1`:适合安全验证、一轮 bounded 真实运行,或简单 report 刷新。\n- `L2`:默认推荐级别,适合冻结核心边界内的常规实验迭代。\n- `L3`:激进 campaign 级别,只在你明确想做更大范围探索和可选写作时使用。\n- 如果不确定,默认推荐 `L2`。\n- 如果用户输入没写级别,或者把级别和 `paper layer`、`phase`、`table` 混用了,就应先停下来,要求用户明确选 `L1/L2/L3`。\n\n- 把 `Autonomy level L1/L2/L3` 视为执行权限级别,不要和论文里的 layer、phase、table 编号混用。\n- 把 `paper layer`、`phase`、`table` 视为实验目标。例如 `paper layer 3` 或 `Phase 1` 不是 `Autonomy level L3`。\n- 一条好的 `/lab:auto` 输入应至少说清:objective、自治级别、terminal goal、scope、allowed modifications。\n- 如果 workflow language 是中文,摘要、清单条目、任务标签和进度更新都应使用中文,除非文件路径、代码标识符或字面指标名必须保持原样。\n- 示例:`/lab:auto 自治级别 L2。目标:推进 paper layer 3。终止条件:完成 bounded protocol、测试、最小实现和一轮小规模结果。允许修改:配置、数据接入、评估脚本。`\n"
2014
+ "# `/lab` for Codex\n\n`/lab` 是严格的研究工作流命令族。每次都使用同一套仓库工件和阶段边界。\n\n## 子命令\n\n- `/lab:idea`\n 先做两轮脑暴和两轮文献检索,再定义问题与 failure case、对比最接近前作,并输出带 approval gate 的 source-backed recommendation。\n\n- `/lab:data`\n 把已批准的 idea 转成数据集与 benchmark 方案,记录数据集年份、使用过该数据集的论文、下载来源、许可或访问限制,以及 classic-public、recent-strong-public、claim-specific 三类 benchmark 的纳入理由,和 canonical baselines、strong historical baselines、recent strong public methods、closest prior work 四类对比方法的纳入理由。\n\n- `/lab:auto`\n 在不改变 mission、framing 和核心 claims 的前提下,读取 eval-protocol 与 auto-mode 契约并自动编排 `run`、`iterate`、`review`、`report`,必要时扩展数据集、benchmark 和 comparison methods,并在满足升格策略时自动升级 primary package。启动前必须选定 autonomy level、声明 terminal goal,并显式批准契约。\n\n- `/lab:framing`\n 通过审计当前领域与相邻领域的术语,锁定 paper-facing 的方法名、模块名、论文题目和 contribution bullets,并在 section 起草前保留 approval gate。\n\n- `/lab:spec`\n 把已批准的 idea 转成 `.lab/changes/<change-id>/` 下的一个 lab change 目录,并在其中写出 `proposal`、`design`、`spec`、`tasks`。\n\n- `/lab:run`\n 执行最小有意义验证运行,登记 run,并生成第一版标准化评估摘要。\n\n- `/lab:iterate`\n 在冻结 mission、阈值、verification commands 与 `completion_promise` 的前提下执行有边界的实验迭代。\n\n- `/lab:review`\n 以 reviewer mode 审查文档或结果,先给短摘要,再输出 findings、fatal flaws、fix priority 和 residual risks。\n\n- `/lab:report`\n 从 runs 和 iterations 工件生成最终研究报告。\n\n- `/lab:write`\n 使用已安装 `lab` skill 下 vendored 的 paper-writing references,把稳定 report 工件转成论文 section。\n\n## 调度规则\n\n- 始终使用 `skills/lab/SKILL.md` 作为工作流合同。\n- 用户显式调用 `/lab:<stage>` 时,要立刻执行该 stage,而不是只推荐别的 `/lab` stage。\n- 先给简洁的阶段摘要;只要 stage 合同要求受管工件,就应立刻落盘,再回报输出路径和下一步。\n- 如果歧义会影响结论,一次只问一个问题;如果有多条可行路径,先给 2-3 个方案再收敛。\n- `/lab:spec` 前应已有经批准的数据集与 benchmark 方案。\n- `/lab:run`、`/lab:iterate`、`/lab:auto`、`/lab:report` 都应遵循 `.lab/context/eval-protocol.md`。\n- `.lab/context/eval-protocol.md` 不只定义主指标和主表,也应定义指标释义、实验阶梯,以及指标和对比实现的来源。\n- `/lab:auto` 只编排已批准边界内的执行阶段,不替代手动的 idea/data/framing/spec 决策。\n- `/lab:write` 前必须已有经批准的 `/lab:framing` 工件。\n\n## 如何输入 `/lab:auto`\n\n## `/lab:auto` 层级指南\n\n- `L1`:适合安全验证、一轮 bounded 真实运行,或简单 report 刷新。\n- `L2`:默认推荐级别,适合冻结核心边界内的常规实验迭代。\n- `L3`:激进 campaign 级别,只在你明确想做更大范围探索和可选写作时使用。\n- 如果不确定,默认推荐 `L2`。\n- 如果用户输入没写级别,或者把级别和 `paper layer`、`phase`、`table` 混用了,就应先停下来,要求用户明确选 `L1/L2/L3`。\n\n- 把 `Autonomy level L1/L2/L3` 视为执行权限级别,不要和论文里的 layer、phase、table 编号混用。\n- 把 `paper layer`、`phase`、`table` 视为实验目标。例如 `paper layer 3` 或 `Phase 1` 不是 `Autonomy level L3`。\n- 一条好的 `/lab:auto` 输入应至少说清:objective、自治级别、terminal goal、scope、allowed modifications。\n- 如果 workflow language 是中文,摘要、清单条目、任务标签和进度更新都应使用中文,除非文件路径、代码标识符或字面指标名必须保持原样。\n- 示例:`/lab:auto 自治级别 L2。目标:推进 paper layer 3。终止条件:完成 bounded protocol、测试、最小实现和一轮小规模结果。允许修改:配置、数据接入、评估脚本。`\n"
2007
2015
  );
2008
2016
 
2009
2017
  ZH_CONTENT[path.join(".codex", "prompts", "lab-data.md")] = codexPrompt(
@@ -2022,7 +2030,7 @@ ZH_CONTENT[path.join(".claude", "commands", "lab.md")] = claudeCommand(
2022
2030
  "lab",
2023
2031
  "查看 /lab 研究工作流总览并选择合适阶段",
2024
2032
  "[stage] [target]",
2025
- "# `/lab` for Claude\n\n`/lab` 是 Claude Code 里的 lab 工作流分发入口。调用方式有两种:\n\n- `/lab <stage> ...`\n- `/lab-idea`、`/lab-data`、`/lab-auto`、`/lab-framing`、`/lab-spec`、`/lab-run`、`/lab-iterate`、`/lab-review`、`/lab-report`、`/lab-write`\n\n## 阶段别名\n\n- `/lab idea ...` 或 `/lab-idea`\n- `/lab data ...` 或 `/lab-data`\n- `/lab auto ...` 或 `/lab-auto`\n- `/lab framing ...` 或 `/lab-framing`\n- `/lab spec ...` 或 `/lab-spec`\n- `/lab run ...` 或 `/lab-run`\n- `/lab iterate ...` 或 `/lab-iterate`\n- `/lab review ...` 或 `/lab-review`\n- `/lab report ...` 或 `/lab-report`\n- `/lab write ...` 或 `/lab-write`\n\n## 调度规则\n\n- 始终使用 `skills/lab/SKILL.md` 作为工作流合同。\n- 用户显式调用 `/lab <stage> ...` 或 `/lab-<stage>` 时,要立刻执行该 stage,而不是只推荐别的阶段。\n- 先给简洁摘要,再决定是否写工件,最后回报输出路径和下一步。\n- 如果歧义会影响结论,一次只问一个问题;如果有多条可行路径,先给 2-3 个方案再收敛。\n- `spec` 前应已有经批准的数据集与 benchmark 方案。\n- `run`、`iterate`、`auto`、`report` 都应遵循 `.lab/context/eval-protocol.md`。\n- `auto` 只编排已批准边界内的执行阶段,不替代手动的 idea/data/framing/spec 决策。\n- `write` 前必须已有经批准的 `framing` 工件。\n\n## 如何输入 `/lab auto`\n\n## `/lab auto` 层级指南\n\n- `L1`:适合安全验证、一轮 bounded 真实运行,或简单 report 刷新。\n- `L2`:默认推荐级别,适合冻结核心边界内的常规实验迭代。\n- `L3`:激进 campaign 级别,只在你明确想做更大范围探索和可选写作时使用。\n- 如果不确定,默认推荐 `L2`。\n- 如果用户输入没写级别,或者把级别和 `paper layer`、`phase`、`table` 混用了,就应先停下来,要求用户明确选 `L1/L2/L3`。\n\n- 把 `Autonomy level L1/L2/L3` 视为执行权限级别,不要和论文里的 layer、phase、table 编号混用。\n- 把 `paper layer`、`phase`、`table` 视为实验目标。例如 `paper layer 3` 或 `Phase 1` 不是 `Autonomy level L3`。\n- 一条好的 `/lab auto` 输入应至少说清:objective、自治级别、terminal goal、scope、allowed modifications。\n- 如果 workflow language 是中文,摘要、清单条目、任务标签和进度更新都应使用中文,除非文件路径、代码标识符或字面指标名必须保持原样。\n- 示例:`/lab auto 自治级别 L2。目标:推进 paper layer 3。终止条件:完成 bounded protocol、测试、最小实现和一轮小规模结果。允许修改:配置、数据接入、评估脚本。`\n"
2033
+ "# `/lab` for Claude\n\n`/lab` 是 Claude Code 里的 lab 工作流分发入口。调用方式有两种:\n\n- `/lab <stage> ...`\n- `/lab-idea`、`/lab-data`、`/lab-auto`、`/lab-framing`、`/lab-spec`、`/lab-run`、`/lab-iterate`、`/lab-review`、`/lab-report`、`/lab-write`\n\n## 阶段别名\n\n- `/lab idea ...` 或 `/lab-idea`\n- `/lab data ...` 或 `/lab-data`\n- `/lab auto ...` 或 `/lab-auto`\n- `/lab framing ...` 或 `/lab-framing`\n- `/lab spec ...` 或 `/lab-spec`\n- `/lab run ...` 或 `/lab-run`\n- `/lab iterate ...` 或 `/lab-iterate`\n- `/lab review ...` 或 `/lab-review`\n- `/lab report ...` 或 `/lab-report`\n- `/lab write ...` 或 `/lab-write`\n\n## 调度规则\n\n- 始终使用 `skills/lab/SKILL.md` 作为工作流合同。\n- 用户显式调用 `/lab <stage> ...` 或 `/lab-<stage>` 时,要立刻执行该 stage,而不是只推荐别的阶段。\n- 先给简洁的阶段摘要;只要 stage 合同要求受管工件,就应立刻落盘,再回报输出路径和下一步。\n- 如果歧义会影响结论,一次只问一个问题;如果有多条可行路径,先给 2-3 个方案再收敛。\n- `spec` 前应已有经批准的数据集与 benchmark 方案。\n- `run`、`iterate`、`auto`、`report` 都应遵循 `.lab/context/eval-protocol.md`。\n- `auto` 只编排已批准边界内的执行阶段,不替代手动的 idea/data/framing/spec 决策。\n- `write` 前必须已有经批准的 `framing` 工件。\n\n## 如何输入 `/lab auto`\n\n## `/lab auto` 层级指南\n\n- `L1`:适合安全验证、一轮 bounded 真实运行,或简单 report 刷新。\n- `L2`:默认推荐级别,适合冻结核心边界内的常规实验迭代。\n- `L3`:激进 campaign 级别,只在你明确想做更大范围探索和可选写作时使用。\n- 如果不确定,默认推荐 `L2`。\n- 如果用户输入没写级别,或者把级别和 `paper layer`、`phase`、`table` 混用了,就应先停下来,要求用户明确选 `L1/L2/L3`。\n\n- 把 `Autonomy level L1/L2/L3` 视为执行权限级别,不要和论文里的 layer、phase、table 编号混用。\n- 把 `paper layer`、`phase`、`table` 视为实验目标。例如 `paper layer 3` 或 `Phase 1` 不是 `Autonomy level L3`。\n- 一条好的 `/lab auto` 输入应至少说清:objective、自治级别、terminal goal、scope、allowed modifications。\n- 如果 workflow language 是中文,摘要、清单条目、任务标签和进度更新都应使用中文,除非文件路径、代码标识符或字面指标名必须保持原样。\n- 示例:`/lab auto 自治级别 L2。目标:推进 paper layer 3。终止条件:完成 bounded protocol、测试、最小实现和一轮小规模结果。允许修改:配置、数据接入、评估脚本。`\n"
2026
2034
  );
2027
2035
 
2028
2036
  ZH_CONTENT[path.join(".claude", "commands", "lab-data.md")] = claudeCommand(
@@ -2055,7 +2063,7 @@ description: 严格研究工作流,覆盖 idea、data、auto、framing、spec
2055
2063
  - 论文写作阶段要与实验执行阶段分离。
2056
2064
  - 用户显式调用某个 \`/lab:stage\` 时,要直接执行该 stage,而不是只推荐别的 stage。
2057
2065
  - 关键决策必须落盘,不能只留在聊天里。
2058
- - 每个 stage 都要先给用户一个简洁简介,再决定是否落盘;如果落盘,最后必须回报路径和下一步。
2066
+ - 每个 stage 都要先给用户一个简洁简介;如果 stage 合同要求受管工件,就应立刻落盘,最后必须回报路径和下一步。
2059
2067
  - 如果缺少的前提会改变结论,一次只追问一个问题。
2060
2068
  - 如果存在多条可行路径,先给 2-3 个方案、trade-offs 和推荐项,再收敛。
2061
2069
  - 如果某个 stage 会决定后续方向,就要保留明确的 approval gate。
@@ -2617,6 +2625,8 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "auto.md")] = `# \`/la
2617
2625
  - 如果当前写作目标是最终导出、\`workflow_language\` 与 \`paper_language\` 不一致,且 \`paper_language_finalization_decision\` 还是 \`unconfirmed\`,就在最终定稿前追问一次:保持当前 workflow language,还是转换成 \`paper_language\`
2618
2626
  - 如果用户选择保持当前语言,就持久化 \`paper_language_finalization_decision: keep-workflow-language\`
2619
2627
  - 如果用户选择转换,就持久化 \`paper_language_finalization_decision: convert-to-paper-language\`
2628
+ - 如果当前写作目标是最终导出,且语言不一致,就不要在追问前先把最终论文正文改成 \`paper_language\`;先问、先持久化,再改稿
2629
+ - 如果当前写作目标是最终导出,且语言不一致,就在最新 write iteration 里记录语言决策审计:工作流语言、论文语言、最终语言决定,以及为什么这样决定
2620
2630
  - 不要把 \`sleep 30\`、单次 \`pgrep\` 或一次性的 \`metrics.json\` 探针当成 rung 主命令;这些只能算进度检查。
2621
2631
  - 当真实实验进程还活着时,只允许发进度更新并继续等待,不能把这一 rung 当作已经完成。
2622
2632
  `;
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "stage_prompt": {
3
- "codex_en": "This command runs the `/lab:idea` stage. Use `.codex/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, and approval gate. Start with brainstorm pass 1 over 2-4 candidate directions, run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, and what the user should decide next. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified.",
4
- "claude_en": "This command runs the `idea` stage of the lab workflow. Use `.claude/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, and approval gate. Start with brainstorm pass 1 over 2-4 candidate directions, run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, and what the user should decide next. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified.",
5
- "codex_zh": "本命令运行 `/lab:idea` 阶段。把 `.codex/skills/lab/stages/idea.md` 当成两轮脑暴、两轮文献检索、最接近前作对照、source-backed proposal memo、评测草图、暂定贡献、用户引导、最小可行实验和 approval gate 的单一来源。先做第一轮脑暴,产出 2-4 个候选方向;再做第一轮文献检索,为每个方向补最接近前作;然后用第二轮脑暴淘汰或收敛方向;最后做第二轮文献检索,补齐最终来源包,再输出协作者可读的推荐结论。最终 idea memo 必须讲清真实场景、解决了什么问题、现有方法为什么不够、准备怎么做、大致怎么评、暂定贡献是什么,以及用户下一步该决定什么。`.lab/writing/idea-source-log.md` 必须和两轮检索实际用到的查询、来源分桶和最终来源数保持一致。文献来源包默认目标约 20 篇;如果领域确实很窄,必须显式解释为什么合理地低于这个目标。",
6
- "claude_zh": "本命令运行 lab workflow 的 `idea` 阶段。把 `.claude/skills/lab/stages/idea.md` 当成两轮脑暴、两轮文献检索、最接近前作对照、source-backed proposal memo、评测草图、暂定贡献、用户引导、最小可行实验和 approval gate 的单一来源。先做第一轮脑暴,产出 2-4 个候选方向;再做第一轮文献检索,为每个方向补最接近前作;然后用第二轮脑暴淘汰或收敛方向;最后做第二轮文献检索,补齐最终来源包,再输出协作者可读的推荐结论。最终 idea memo 必须讲清真实场景、解决了什么问题、现有方法为什么不够、准备怎么做、大致怎么评、暂定贡献是什么,以及用户下一步该决定什么。`.lab/writing/idea-source-log.md` 必须和两轮检索实际用到的查询、来源分桶和最终来源数保持一致。文献来源包默认目标约 20 篇;如果领域确实很窄,必须显式解释为什么合理地低于这个目标。"
3
+ "codex_en": "This command runs the `/lab:idea` stage. Use `.codex/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, convergence status, and approval gate. Start with brainstorm pass 1 over 3-4 candidate directions. For each candidate direction, explain what it is, why it matters, roughly how it would work, what problem it solves, and its main risk. Run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2 to 1-2 surviving directions, explain why each survivor remains, why each rejected direction was dropped, and why the narrowed recommendation is stronger now, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. Materialize or update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before any final recommendation, paper-fit judgment, or mission writeback. Do not end the stage with a chat-only brainstorm; if the work is still unconverged, say so explicitly, list what is still missing, and stop there. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, what is already source-backed, what is still hypothesis-only, and what the user should decide next. It must also include a user-visible literature summary naming the closest prior found, the recent strong papers found, and what existing work still does not solve. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified. Only after `.lab/.managed/scripts/validate_idea_artifact.py` passes may the stage present a final recommendation as converged.",
4
+ "claude_en": "This command runs the `idea` stage of the lab workflow. Use `.claude/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, convergence status, and approval gate. Start with brainstorm pass 1 over 3-4 candidate directions. For each candidate direction, explain what it is, why it matters, roughly how it would work, what problem it solves, and its main risk. Run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2 to 1-2 surviving directions, explain why each survivor remains, why each rejected direction was dropped, and why the narrowed recommendation is stronger now, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. Materialize or update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before any final recommendation, paper-fit judgment, or mission writeback. Do not end the stage with a chat-only brainstorm; if the work is still unconverged, say so explicitly, list what is still missing, and stop there. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, what is already source-backed, what is still hypothesis-only, and what the user should decide next. It must also include a user-visible literature summary naming the closest prior found, the recent strong papers found, and what existing work still does not solve. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified. Only after `.lab/.managed/scripts/validate_idea_artifact.py` passes may the stage present a final recommendation as converged.",
5
+ "codex_zh": "本命令运行 `/lab:idea` 阶段。把 `.codex/skills/lab/stages/idea.md` 当成两轮脑暴、两轮文献检索、最接近前作对照、source-backed proposal memo、评测草图、暂定贡献、用户引导、最小可行实验、收敛状态和 approval gate 的单一来源。先做第一轮脑暴,产出 3-4 个候选方向。每个候选方向都要说明:它是什么、为什么值得研究、大致怎么做、解决了什么问题、主要风险是什么。再做第一轮文献检索,为每个方向补最接近前作;然后用第二轮脑暴把范围收敛到 1-2 个幸存方向,并写清每个幸存方向为什么保留、每个被淘汰方向为什么淘汰、为什么当前 narrowed recommendation 更强;最后做第二轮文献检索,补齐最终来源包,再输出协作者可读的推荐结论。任何 final recommendation、paper fit 判断或 mission 写回之前,都必须先 materialize or update `.lab/writing/idea.md` 和 `.lab/writing/idea-source-log.md`。不要以纯聊天脑暴收尾;如果当前还没收敛,就明确写出还缺什么,并停在未收敛状态。最终 idea memo 必须讲清真实场景、解决了什么问题、现有方法为什么不够、准备怎么做、大致怎么评、暂定贡献是什么、哪些部分已经 source-backed、哪些还只是 hypothesis,以及用户下一步该决定什么。它还必须包含一个用户可见的文献摘要,明确写出:找到的最接近前作、找到的近期强相关论文、以及现有工作仍未解决什么。`.lab/writing/idea-source-log.md` 必须和两轮检索实际用到的查询、来源分桶和最终来源数保持一致。文献来源包默认目标约 20 篇;如果领域确实很窄,必须显式解释为什么合理地低于这个目标。只有在 `.lab/.managed/scripts/validate_idea_artifact.py` 通过之后,才可以把最终推荐当成已收敛结论输出。",
6
+ "claude_zh": "本命令运行 lab workflow 的 `idea` 阶段。把 `.claude/skills/lab/stages/idea.md` 当成两轮脑暴、两轮文献检索、最接近前作对照、source-backed proposal memo、评测草图、暂定贡献、用户引导、最小可行实验、收敛状态和 approval gate 的单一来源。先做第一轮脑暴,产出 3-4 个候选方向。每个候选方向都要说明:它是什么、为什么值得研究、大致怎么做、解决了什么问题、主要风险是什么。再做第一轮文献检索,为每个方向补最接近前作;然后用第二轮脑暴把范围收敛到 1-2 个幸存方向,并写清每个幸存方向为什么保留、每个被淘汰方向为什么淘汰、为什么当前 narrowed recommendation 更强;最后做第二轮文献检索,补齐最终来源包,再输出协作者可读的推荐结论。任何 final recommendation、paper fit 判断或 mission 写回之前,都必须先 materialize or update `.lab/writing/idea.md` 和 `.lab/writing/idea-source-log.md`。不要以纯聊天脑暴收尾;如果当前还没收敛,就明确写出还缺什么,并停在未收敛状态。最终 idea memo 必须讲清真实场景、解决了什么问题、现有方法为什么不够、准备怎么做、大致怎么评、暂定贡献是什么、哪些部分已经 source-backed、哪些还只是 hypothesis,以及用户下一步该决定什么。它还必须包含一个用户可见的文献摘要,明确写出:找到的最接近前作、找到的近期强相关论文、以及现有工作仍未解决什么。`.lab/writing/idea-source-log.md` 必须和两轮检索实际用到的查询、来源分桶和最终来源数保持一致。文献来源包默认目标约 20 篇;如果领域确实很窄,必须显式解释为什么合理地低于这个目标。只有在 `.lab/.managed/scripts/validate_idea_artifact.py` 通过之后,才可以把最终推荐当成已收敛结论输出。"
7
7
  }
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "stage_prompt": {
3
- "codex_en": "This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`.",
4
- "claude_en": "This command runs the `write` stage of the lab workflow. Use `.claude/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`.",
5
- "codex_zh": "本命令运行 `/lab:write` 阶段。把 `.codex/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference 和 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`。如果当前稿件将从托管默认 scaffold 开始,且还没有模板决定,就先追问一次:继续使用默认 scaffold,还是先接入模板目录。如果进入最终定稿时 `workflow_language` 与 `paper_language` 不一致,就再追问一次:保持当前语言,还是把最终稿转换成 `paper_language`。",
6
- "claude_zh": "本命令运行 lab workflow 的 `write` 阶段。把 `.claude/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference 和 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`。如果当前稿件将从托管默认 scaffold 开始,且还没有模板决定,就先追问一次:继续使用默认 scaffold,还是先接入模板目录。如果进入最终定稿时 `workflow_language` 与 `paper_language` 不一致,就再追问一次:保持当前语言,还是把最终稿转换成 `paper_language`。"
3
+ "codex_en": "This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`, persist that answer, record the language decision in the latest write iteration, and only then edit the final manuscript in the chosen language.",
4
+ "claude_en": "This command runs the `write` stage of the lab workflow. Use `.claude/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`, persist that answer, record the language decision in the latest write iteration, and only then edit the final manuscript in the chosen language.",
5
+ "codex_zh": "本命令运行 `/lab:write` 阶段。把 `.codex/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference 和 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`。如果当前稿件将从托管默认 scaffold 开始,且还没有模板决定,就先追问一次:继续使用默认 scaffold,还是先接入模板目录。如果进入最终定稿时 `workflow_language` 与 `paper_language` 不一致,就再追问一次:保持当前语言,还是把最终稿转换成 `paper_language`;先持久化这个决定,再在最新 write iteration 里记录语言决策,最后才允许按该语言修改最终稿。",
6
+ "claude_zh": "本命令运行 lab workflow 的 `write` 阶段。把 `.claude/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference 和 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`。如果当前稿件将从托管默认 scaffold 开始,且还没有模板决定,就先追问一次:继续使用默认 scaffold,还是先接入模板目录。如果进入最终定稿时 `workflow_language` 与 `paper_language` 不一致,就再追问一次:保持当前语言,还是把最终稿转换成 `paper_language`;先持久化这个决定,再在最新 write iteration 里记录语言决策,最后才允许按该语言修改最终稿。"
7
7
  }
8
8
  }
@@ -7,4 +7,4 @@ argument-hint: idea or research problem
7
7
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
8
8
 
9
9
  Execute the requested `/lab-idea` command against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
10
- This command runs the `idea` stage of the lab workflow. Use `.claude/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, and approval gate. Start with brainstorm pass 1 over 2-4 candidate directions, run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, and what the user should decide next. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified.
10
+ This command runs the `idea` stage of the lab workflow. Use `.claude/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, convergence status, and approval gate. Start with brainstorm pass 1 over 3-4 candidate directions. For each candidate direction, explain what it is, why it matters, roughly how it would work, what problem it solves, and its main risk. Run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2 to 1-2 surviving directions, explain why each survivor remains, why each rejected direction was dropped, and why the narrowed recommendation is stronger now, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. Materialize or update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before any final recommendation, paper-fit judgment, or mission writeback. Do not end the stage with a chat-only brainstorm; if the work is still unconverged, say so explicitly, list what is still missing, and stop there. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, what is already source-backed, what is still hypothesis-only, and what the user should decide next. It must also include a user-visible literature summary naming the closest prior found, the recent strong papers found, and what existing work still does not solve. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified. Only after `.lab/.managed/scripts/validate_idea_artifact.py` passes may the stage present a final recommendation as converged.
@@ -7,4 +7,4 @@ argument-hint: section or writing target
7
7
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
8
8
 
9
9
  Execute the requested `/lab-write` command against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
10
- This command runs the `write` stage of the lab workflow. Use `.claude/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`.
10
+ This command runs the `write` stage of the lab workflow. Use `.claude/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`, persist that answer, record the language decision in the latest write iteration, and only then edit the final manuscript in the chosen language.
@@ -50,7 +50,7 @@ Use the same repository artifacts and stage boundaries every time.
50
50
 
51
51
  - Always use `skills/lab/SKILL.md` as the workflow contract.
52
52
  - When the user explicitly invokes `/lab <stage> ...` or a direct `/lab-<stage>` alias, execute that stage now against the provided argument instead of only recommending another lab stage.
53
- - Start by giving the user a concise summary, then decide whether to write artifacts, then report the output path and next step.
53
+ - Start by giving the user a concise stage summary. Materialize managed artifacts immediately when the stage contract requires them, then report the output path and next step.
54
54
  - When ambiguity matters, ask one clarifying question at a time; when multiple paths are viable, present 2-3 approaches before converging.
55
55
  - `spec` is not complete until the approved change is frozen under `.lab/changes/<change-id>/`.
56
56
  - `spec` should inherit the approved dataset package from `.lab/context/data-decisions.md`.
@@ -6,4 +6,4 @@ argument-hint: idea or research problem
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
8
  Execute the requested `/lab:idea` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
- This command runs the `/lab:idea` stage. Use `.codex/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, and approval gate. Start with brainstorm pass 1 over 2-4 candidate directions, run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, and what the user should decide next. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified.
9
+ This command runs the `/lab:idea` stage. Use `.codex/skills/lab/stages/idea.md` as the single source of truth for the two brainstorm passes, two literature sweeps, closest-prior comparison, source-backed proposal memo, evaluation sketch, tentative contributions, user guidance, minimum viable experiment, convergence status, and approval gate. Start with brainstorm pass 1 over 3-4 candidate directions. For each candidate direction, explain what it is, why it matters, roughly how it would work, what problem it solves, and its main risk. Run literature sweep 1 with real closest-prior references for each direction, narrow the field with brainstorm pass 2 to 1-2 surviving directions, explain why each survivor remains, why each rejected direction was dropped, and why the narrowed recommendation is stronger now, then run literature sweep 2 to build the final source bundle before producing a collaborator-readable recommendation. Materialize or update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before any final recommendation, paper-fit judgment, or mission writeback. Do not end the stage with a chat-only brainstorm; if the work is still unconverged, say so explicitly, list what is still missing, and stop there. The final idea memo must explain the real-world scenario, the problem solved, why current methods fall short, roughly how the idea would work, how it would be evaluated, what the tentative contributions are, what is already source-backed, what is still hypothesis-only, and what the user should decide next. It must also include a user-visible literature summary naming the closest prior found, the recent strong papers found, and what existing work still does not solve. Keep `.lab/writing/idea-source-log.md` synchronized with the actual search queries, bucketed sources, and final source count used in both sweeps. The literature bundle should default to about 20 sources unless the field is genuinely narrow and that smaller bundle is explicitly justified. Only after `.lab/.managed/scripts/validate_idea_artifact.py` passes may the stage present a final recommendation as converged.
@@ -6,4 +6,4 @@ argument-hint: section or writing target
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
8
  Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
- This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`.
9
+ This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference and any bundled example-bank files for the requested section, revise only one section, and keep draft rounds warning-only while final-draft or export rounds must satisfy the write-stage acceptance gates. Draft ordinary manuscript rounds in `workflow_language`. If the manuscript would start from the managed scaffold and no template decision is recorded yet, ask once whether to keep the default scaffold or attach a template directory first. If finalization reaches a round where `workflow_language` and `paper_language` differ, ask once whether to keep the draft language or convert the final manuscript to `paper_language`, persist that answer, record the language decision in the latest write iteration, and only then edit the final manuscript in the chosen language.
@@ -44,7 +44,7 @@ argument-hint: workflow question or stage choice
44
44
 
45
45
  - Always use `skills/lab/SKILL.md` as the workflow contract.
46
46
  - When the user explicitly invokes `/lab:<stage>`, execute that stage now against the provided argument instead of only recommending another `/lab` stage.
47
- - Start by giving the user a concise summary, then decide whether to write artifacts, then report the output path and next step.
47
+ - Start by giving the user a concise stage summary. Materialize managed artifacts immediately when the stage contract requires them, then report the output path and next step.
48
48
  - When ambiguity matters, ask one clarifying question at a time; when multiple paths are viable, present 2-3 approaches before converging.
49
49
  - `/lab:spec` is not complete until the approved change is frozen under `.lab/changes/<change-id>/`.
50
50
  - `/lab:spec` should inherit the approved dataset package from `.lab/context/data-decisions.md`.
@@ -17,16 +17,52 @@ REQUIRED_SECTIONS = {
17
17
  "Closest Prior Work Comparison": [r"^##\s+Closest Prior Work Comparison\s*$", r"^##\s+最接近前作对照\s*$"],
18
18
  "Brainstorm Pass 2": [r"^##\s+Brainstorm Pass 2\s*$", r"^##\s+第二轮脑暴\s*$"],
19
19
  "Literature Sweep 2": [r"^##\s+Literature Sweep 2\s*$", r"^##\s+第二轮文献(?:检索|收敛)?\s*$"],
20
+ "Literature Summary for Recommendation": [
21
+ r"^##\s+Literature Summary for Recommendation\s*$",
22
+ r"^##\s+用于最终推荐的文献摘要\s*$",
23
+ ],
20
24
  "Rough Approach": [r"^##\s+Rough Approach\s*$", r"^##\s+我们准备怎么做\s*$"],
21
25
  "Problem Solved": [r"^##\s+Problem Solved\s*$", r"^##\s+解决了什么问题\s*$"],
22
26
  "Evaluation Sketch": [r"^##\s+Evaluation Sketch\s*$", r"^##\s+评测草图\s*$"],
23
27
  "Tentative Contributions": [r"^##\s+Tentative Contributions\s*$", r"^##\s+暂定贡献\s*$"],
24
28
  "Candidate Experiment": [r"^##\s+Candidate Experiment\s*$", r"^##\s+(?:最小实验|候选实验)\s*$"],
25
29
  "Falsifiable Hypothesis": [r"^##\s+Falsifiable Hypothesis\s*$", r"^##\s+可证伪假设\s*$"],
30
+ "Convergence Status": [r"^##\s+Convergence Status\s*$", r"^##\s+收敛状态\s*$"],
26
31
  "Final Recommendation": [r"^##\s+Final Recommendation\s*$", r"^##\s+最终推荐\s*$"],
27
32
  "User Guidance": [r"^##\s+User Guidance\s*$", r"^##\s+用户引导\s*$"],
28
33
  }
29
34
 
35
+ CANDIDATE_DIRECTION_STARTS = (
36
+ r"^-\s*Candidate direction \d+\s*[::]",
37
+ r"^-\s*候选方向 \d+\s*[::]",
38
+ )
39
+
40
+ SURVIVING_DIRECTION_STARTS = (
41
+ r"^-\s*Surviving direction \d+\s*[::]",
42
+ r"^-\s*幸存方向 \d+\s*[::]",
43
+ )
44
+
45
+ CANDIDATE_DIRECTION_FIELDS = {
46
+ "what it is": ("What it is", "是什么"),
47
+ "why it matters": ("Why it matters", "为什么重要", "为什么值得研究"),
48
+ "rough how": ("Rough how", "大致怎么做", "粗略做法"),
49
+ "problem solved": ("Problem solved", "解决了什么问题"),
50
+ "main risk": ("Main risk", "主要风险"),
51
+ }
52
+
53
+ SURVIVING_DIRECTION_FIELDS = {
54
+ "why it survived": ("Why it survived", "为什么保留", "为什么留下"),
55
+ }
56
+
57
+ LITERATURE_SUMMARY_FIELDS = {
58
+ "closest prior found": ("Closest prior found", "最接近前作"),
59
+ "recent strong papers found": ("Recent strong papers found", "近期强相关论文", "近期强论文"),
60
+ "what existing work still does not solve": (
61
+ "What existing work still does not solve",
62
+ "现有工作仍未解决什么",
63
+ ),
64
+ }
65
+
30
66
  SOURCE_LOG_SECTIONS = {
31
67
  "Search Intent": [r"^##\s+Search Intent\s*$", r"^##\s+检索意图\s*$"],
32
68
  "Sweep 1 Log": [r"^##\s+Sweep 1 Log\s*$", r"^##\s+第一轮检索记录\s*$"],
@@ -170,6 +206,34 @@ def extract_bucket_body(body: str, labels: tuple[str, ...]) -> str:
170
206
  return "\n".join(captured).strip()
171
207
 
172
208
 
209
+ def extract_labeled_blocks(body: str, start_patterns: tuple[str, ...]) -> list[str]:
210
+ lines = body.splitlines()
211
+ blocks: list[str] = []
212
+ current: list[str] = []
213
+ current_indent: int | None = None
214
+
215
+ for line in lines:
216
+ stripped = line.lstrip()
217
+ indent = len(line) - len(stripped)
218
+ is_start = any(re.match(pattern, stripped, flags=re.IGNORECASE) for pattern in start_patterns)
219
+ if is_start:
220
+ if current:
221
+ blocks.append("\n".join(current).strip())
222
+ current = [line]
223
+ current_indent = indent
224
+ continue
225
+ if current and stripped.startswith("- ") and current_indent is not None and indent <= current_indent:
226
+ blocks.append("\n".join(current).strip())
227
+ current = []
228
+ current_indent = None
229
+ if current:
230
+ current.append(line)
231
+
232
+ if current:
233
+ blocks.append("\n".join(current).strip())
234
+ return blocks
235
+
236
+
173
237
  def validate_content(text: str) -> list[str]:
174
238
  issues: list[str] = []
175
239
  scenario = extract_section_body(text, REQUIRED_SECTIONS["Scenario"])
@@ -187,6 +251,13 @@ def validate_content(text: str) -> list[str]:
187
251
  brainstorm_1 = extract_section_body(text, REQUIRED_SECTIONS["Brainstorm Pass 1"])
188
252
  if not contains_any(brainstorm_1, ("candidate direction", "候选方向", "worth checking", "值得检查")):
189
253
  issues.append("idea artifact is missing a real brainstorm pass 1 shortlist")
254
+ candidate_blocks = extract_labeled_blocks(brainstorm_1, CANDIDATE_DIRECTION_STARTS)
255
+ if len(candidate_blocks) < 3:
256
+ issues.append("idea artifact brainstorm pass 1 must include at least three candidate directions")
257
+ for index, block in enumerate(candidate_blocks[:3], start=1):
258
+ for field_name, labels in CANDIDATE_DIRECTION_FIELDS.items():
259
+ if not has_field_value(block, labels):
260
+ issues.append(f"idea artifact candidate direction {index} is missing {field_name}")
190
261
 
191
262
  sweep_1 = extract_section_body(text, REQUIRED_SECTIONS["Literature Sweep 1"])
192
263
  if count_references(sweep_1) < 3:
@@ -221,11 +292,36 @@ def validate_content(text: str) -> list[str]:
221
292
  brainstorm_2 = extract_section_body(text, REQUIRED_SECTIONS["Brainstorm Pass 2"])
222
293
  if not contains_any(brainstorm_2, ("surviving direction", "recommended narrowed direction", "surviving", "幸存方向", "推荐收敛方向", "淘汰")):
223
294
  issues.append("idea artifact is missing a real brainstorm pass 2 narrowing step")
295
+ surviving_blocks = extract_labeled_blocks(brainstorm_2, SURVIVING_DIRECTION_STARTS)
296
+ if not surviving_blocks:
297
+ issues.append("idea artifact brainstorm pass 2 must include at least one surviving direction")
298
+ if len(surviving_blocks) > 2:
299
+ issues.append("idea artifact brainstorm pass 2 must narrow to at most two surviving directions")
300
+ for index, block in enumerate(surviving_blocks, start=1):
301
+ for field_name, labels in SURVIVING_DIRECTION_FIELDS.items():
302
+ if not has_field_value(block, labels):
303
+ issues.append(f"idea artifact surviving direction {index} is missing {field_name}")
304
+ if not has_field_value(brainstorm_2, ("Rejected directions and why", "被淘汰的方向和原因")):
305
+ issues.append("idea artifact brainstorm pass 2 is missing rejected directions and why")
306
+ if not has_field_value(brainstorm_2, ("Recommended narrowed direction", "推荐收敛方向")):
307
+ issues.append("idea artifact brainstorm pass 2 is missing the recommended narrowed direction")
308
+ if not has_field_value(brainstorm_2, ("Why this is stronger now", "为什么它现在更强")):
309
+ issues.append("idea artifact brainstorm pass 2 is missing why the surviving recommendation is stronger now")
224
310
 
225
311
  sweep_2 = extract_section_body(text, REQUIRED_SECTIONS["Literature Sweep 2"])
226
312
  if count_references(sweep_2) < 5:
227
313
  issues.append("idea artifact is missing literature sweep 2 with real references")
228
314
 
315
+ literature_summary = extract_section_body(text, REQUIRED_SECTIONS["Literature Summary for Recommendation"])
316
+ if not literature_summary:
317
+ issues.append("idea artifact is missing a literature summary for recommendation")
318
+ else:
319
+ for field_name, labels in LITERATURE_SUMMARY_FIELDS.items():
320
+ if not has_field_value(literature_summary, labels):
321
+ issues.append(f"idea artifact literature summary for recommendation is missing {field_name}")
322
+ if count_references(literature_summary) < 2:
323
+ issues.append("idea artifact literature summary for recommendation is missing real references")
324
+
229
325
  rough_approach = extract_section_body(text, REQUIRED_SECTIONS["Rough Approach"])
230
326
  if not contains_any(rough_approach, ("plain-language", "how this would work", "粗略做法", "怎么做", "why this design", "为什么")):
231
327
  issues.append("idea artifact is missing a rough plain-language approach")
@@ -254,6 +350,16 @@ def validate_content(text: str) -> list[str]:
254
350
  if not contains_any(experiment, ("minimum viable experiment", "minimum experiment", "dataset", "metric", "最小实验", "主指标", "次指标")):
255
351
  issues.append("idea artifact is missing a minimum experiment")
256
352
 
353
+ convergence_status = extract_section_body(text, REQUIRED_SECTIONS["Convergence Status"])
354
+ if not has_field_value(convergence_status, ("Current status", "当前状态")):
355
+ issues.append("idea artifact is missing a convergence status with the current stage state")
356
+ if not has_field_value(convergence_status, ("What is already source-backed", "哪些部分已经 source-backed", "已经有来源支撑的部分")):
357
+ issues.append("idea artifact is missing a convergence status section that states what is already source-backed")
358
+ if not has_field_value(convergence_status, ("What is still hypothesis-only", "哪些部分还只是 hypothesis", "还只是生成性假设的部分")):
359
+ issues.append("idea artifact is missing a convergence status section that states what is still hypothesis-only")
360
+ if not has_field_value(convergence_status, ("Can this round end with a final recommendation", "这一轮能否结束并给出 final recommendation", "这一轮能否给出最终推荐")):
361
+ issues.append("idea artifact is missing a convergence status section that states whether the stage can end with a final recommendation")
362
+
257
363
  final_recommendation = extract_section_body(text, REQUIRED_SECTIONS["Final Recommendation"])
258
364
  if not contains_any(final_recommendation, ("recommended direction", "paper-worthy", "推荐方向", "值得做论文")):
259
365
  issues.append("idea artifact is missing a final recommendation after the second sweep")
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  import argparse
3
+ import json
3
4
  import re
4
5
  import sys
5
6
  from pathlib import Path
@@ -8,6 +9,10 @@ from pathlib import Path
8
9
  ABSOLUTE_PATH_MARKERS = ("/Users/", "/home/", "/tmp/", "/private/tmp/")
9
10
  REQUIRED_TABLE_FILES = ("main-results.tex", "ablations.tex")
10
11
  REQUIRED_FIGURE_FILES = ("problem-setting.tex", "method-overview.tex", "results-overview.tex")
12
+ REF_PATTERN_TEMPLATE = r"\\(?:auto|c|C)?ref\{%s\}"
13
+ WRITE_ITERATION_LANGUAGE_SECTION = {
14
+ "Language Decision": (r"^##\s+Language Decision\s*$", r"^##\s+语言决策\s*$"),
15
+ }
11
16
 
12
17
 
13
18
  def parse_args():
@@ -22,6 +27,73 @@ def read_text(path: Path) -> str:
22
27
  return path.read_text(encoding="utf-8")
23
28
 
24
29
 
30
+ def find_workflow_config(start_path: Path) -> Path | None:
31
+ search_roots = [start_path, *start_path.parents]
32
+ for root in search_roots:
33
+ for relative in ("config/workflow.json", ".lab/config/workflow.json"):
34
+ candidate = root / relative
35
+ if candidate.exists():
36
+ return candidate
37
+ return None
38
+
39
+
40
+ def load_workflow_config(path: Path) -> dict:
41
+ return json.loads(path.read_text(encoding="utf-8"))
42
+
43
+
44
+ def extract_section_body(text: str, patterns: tuple[str, ...]) -> str:
45
+ for pattern in patterns:
46
+ match = re.search(pattern, text, flags=re.MULTILINE)
47
+ if not match:
48
+ continue
49
+ start = match.end()
50
+ next_heading = re.search(r"^##\s+", text[start:], flags=re.MULTILINE)
51
+ end = start + next_heading.start() if next_heading else len(text)
52
+ return text[start:end].strip()
53
+ return ""
54
+
55
+
56
+ def has_field_value(body: str, labels: tuple[str, ...]) -> bool:
57
+ for label in labels:
58
+ pattern = re.compile(rf"^\s*(?:-|\d+\.)\s*{re.escape(label)}[::][ \t]*([^\n]+?)\s*$", flags=re.MULTILINE)
59
+ for match in pattern.finditer(body):
60
+ value = match.group(1).strip()
61
+ if value and value not in {"TBD", "TODO", "待补", "待定", "unclear"}:
62
+ return True
63
+ return False
64
+
65
+
66
+ def find_latest_write_iteration(paper_dir: Path) -> Path | None:
67
+ search_roots = [paper_dir, *paper_dir.parents]
68
+ for root in search_roots:
69
+ iterations_dir = root / ".lab" / "writing" / "iterations"
70
+ if not iterations_dir.exists():
71
+ continue
72
+ candidates = sorted(path for path in iterations_dir.glob("*.md") if path.is_file())
73
+ if candidates:
74
+ return candidates[-1]
75
+ return None
76
+
77
+
78
+ def text_looks_like_language(text: str, language: str) -> bool:
79
+ cjk_chars = len(re.findall(r"[\u4e00-\u9fff]", text))
80
+ latin_chars = len(re.findall(r"[A-Za-z]", text))
81
+ if language == "zh":
82
+ return cjk_chars >= 20
83
+ if language == "en":
84
+ return latin_chars >= 80 and cjk_chars < 20
85
+ return True
86
+
87
+
88
+ def extract_label(text: str) -> str | None:
89
+ match = re.search(r"\\label\{([^}]+)\}", text)
90
+ return match.group(1) if match else None
91
+
92
+
93
+ def section_references_label(text: str, label: str) -> bool:
94
+ return bool(re.search(REF_PATTERN_TEMPLATE % re.escape(label), text))
95
+
96
+
25
97
  def check_exists(path: Path, issues: list[str], label: str):
26
98
  if not path.exists():
27
99
  issues.append(f"missing required file: {label} ({path})")
@@ -100,6 +172,13 @@ def check_analysis_asset(path: Path, issues: list[str]):
100
172
  issues.append("analysis/analysis-asset.tex must explain asset intent")
101
173
 
102
174
 
175
+ def require_section_reference(section_text: str, label: str | None, issues: list[str], section_name: str, asset_name: str):
176
+ if not label:
177
+ return
178
+ if not section_references_label(section_text, label):
179
+ issues.append(f"{section_name} must explicitly reference the {asset_name} via \\ref{{{label}}}")
180
+
181
+
103
182
  def check_introduction_section(paper_dir: Path, issues: list[str]):
104
183
  introduction = paper_dir / "sections" / "introduction.tex"
105
184
  check_exists(introduction, issues, "sections/introduction.tex")
@@ -153,6 +232,41 @@ def check_experiments_section(paper_dir: Path, issues: list[str]):
153
232
  issues.append("experiments section is missing an analysis asset")
154
233
 
155
234
 
235
+ def check_asset_consumption(paper_dir: Path, issues: list[str]):
236
+ intro_path = paper_dir / "sections" / "introduction.tex"
237
+ method_path = paper_dir / "sections" / "method.tex"
238
+ experiments_path = paper_dir / "sections" / "experiments.tex"
239
+ if not intro_path.exists() or not method_path.exists() or not experiments_path.exists():
240
+ return
241
+
242
+ introduction_text = read_text(intro_path)
243
+ method_text = read_text(method_path)
244
+ experiments_text = read_text(experiments_path)
245
+
246
+ figures_dir = paper_dir / "figures"
247
+ tables_dir = paper_dir / "tables"
248
+ analysis_dir = paper_dir / "analysis"
249
+
250
+ problem_label = extract_label(read_text(figures_dir / "problem-setting.tex")) if (figures_dir / "problem-setting.tex").exists() else None
251
+ method_label = extract_label(read_text(figures_dir / "method-overview.tex")) if (figures_dir / "method-overview.tex").exists() else None
252
+ results_label = extract_label(read_text(figures_dir / "results-overview.tex")) if (figures_dir / "results-overview.tex").exists() else None
253
+ main_table_label = extract_label(read_text(tables_dir / "main-results.tex")) if (tables_dir / "main-results.tex").exists() else None
254
+ ablation_label = extract_label(read_text(tables_dir / "ablations.tex")) if (tables_dir / "ablations.tex").exists() else None
255
+ analysis_label = extract_label(read_text(analysis_dir / "analysis-asset.tex")) if (analysis_dir / "analysis-asset.tex").exists() else None
256
+
257
+ require_section_reference(introduction_text, problem_label, issues, "introduction section", "problem-setting figure")
258
+ require_section_reference(method_text, method_label, issues, "method section", "method-overview figure")
259
+ require_section_reference(experiments_text, main_table_label, issues, "experiments section", "main results table")
260
+ require_section_reference(experiments_text, ablation_label, issues, "experiments section", "ablation table")
261
+ require_section_reference(experiments_text, results_label, issues, "experiments section", "results-overview figure")
262
+ require_section_reference(experiments_text, analysis_label, issues, "experiments section", "analysis asset")
263
+
264
+ main_results_text = read_text(tables_dir / "main-results.tex") if (tables_dir / "main-results.tex").exists() else ""
265
+ prose_for_ranking_claims = "\n".join((introduction_text, experiments_text))
266
+ if re.search(r"\bQini\b", prose_for_ranking_claims, flags=re.IGNORECASE) and "Qini" not in main_results_text:
267
+ issues.append("manuscript prose mentions Qini but tables/main-results.tex does not expose it")
268
+
269
+
156
270
  def check_method_section(paper_dir: Path, issues: list[str]):
157
271
  method = paper_dir / "sections" / "method.tex"
158
272
  check_exists(method, issues, "sections/method.tex")
@@ -180,6 +294,67 @@ def check_main_tex(paper_dir: Path, issues: list[str]):
180
294
  issues.append("main.tex must include the references bibliography")
181
295
 
182
296
 
297
+ def check_language_layers(paper_dir: Path, issues: list[str]):
298
+ workflow_config = find_workflow_config(paper_dir)
299
+ if workflow_config is None:
300
+ return
301
+
302
+ config = load_workflow_config(workflow_config)
303
+ workflow_language = config.get("workflow_language")
304
+ paper_language = config.get("paper_language", workflow_language)
305
+ finalization_decision = config.get("paper_language_finalization_decision", "unconfirmed")
306
+
307
+ if not workflow_language or workflow_language == paper_language:
308
+ return
309
+
310
+ if finalization_decision == "unconfirmed":
311
+ issues.append(
312
+ "workflow_language and paper_language differ; confirm paper_language_finalization_decision before finalizing the manuscript"
313
+ )
314
+ return
315
+
316
+ latest_iteration = find_latest_write_iteration(paper_dir)
317
+ if latest_iteration is None:
318
+ issues.append(
319
+ "workflow_language and paper_language differ; record the language decision in the latest write iteration before finalizing the manuscript"
320
+ )
321
+ return
322
+
323
+ iteration_text = read_text(latest_iteration)
324
+ language_section = extract_section_body(iteration_text, WRITE_ITERATION_LANGUAGE_SECTION["Language Decision"])
325
+ if not language_section:
326
+ issues.append(
327
+ "latest write iteration is missing a language decision section for the final manuscript language choice"
328
+ )
329
+ else:
330
+ if not has_field_value(language_section, ("Workflow language", "workflow_language", "工作流语言")):
331
+ issues.append("latest write iteration is missing the workflow language in its language decision audit")
332
+ if not has_field_value(language_section, ("Paper language", "paper_language", "论文语言")):
333
+ issues.append("latest write iteration is missing the paper language in its language decision audit")
334
+ if not has_field_value(
335
+ language_section,
336
+ ("Finalization decision", "paper_language_finalization_decision", "最终语言决定"),
337
+ ):
338
+ issues.append("latest write iteration is missing the finalization decision in its language decision audit")
339
+ if not has_field_value(
340
+ language_section,
341
+ ("Why this decision was chosen", "Why this language was chosen", "为什么这样决定"),
342
+ ):
343
+ issues.append("latest write iteration is missing why the language decision was chosen")
344
+ if workflow_language == "zh" and not text_looks_like_language(iteration_text, workflow_language):
345
+ issues.append("latest write iteration should follow workflow_language=zh instead of drifting into another language")
346
+
347
+ sections_dir = paper_dir / "sections"
348
+ section_text = "\n".join(
349
+ read_text(path) for path in sorted(sections_dir.glob("*.tex")) if path.is_file()
350
+ )
351
+ target_language = workflow_language if finalization_decision == "keep-workflow-language" else paper_language
352
+ if section_text and not text_looks_like_language(section_text, target_language):
353
+ issues.append(
354
+ f"final manuscript sections should follow {target_language} after paper_language_finalization_decision={finalization_decision}"
355
+ )
356
+
357
+
183
358
  def main():
184
359
  args = parse_args()
185
360
  paper_dir = Path(args.paper_dir)
@@ -195,6 +370,8 @@ def main():
195
370
  check_introduction_section(paper_dir, issues)
196
371
  check_method_section(paper_dir, issues)
197
372
  check_experiments_section(paper_dir, issues)
373
+ check_asset_consumption(paper_dir, issues)
374
+ check_language_layers(paper_dir, issues)
198
375
 
199
376
  tables_dir = paper_dir / "tables"
200
377
  check_table_file(tables_dir / REQUIRED_TABLE_FILES[0], issues, "tables/main-results.tex")
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  import argparse
3
+ import json
3
4
  import re
4
5
  import sys
5
6
  from pathlib import Path
@@ -144,6 +145,31 @@ def read_text(path: Path) -> str:
144
145
  return path.read_text(encoding="utf-8")
145
146
 
146
147
 
148
+ def find_workflow_config(start_path: Path) -> Path | None:
149
+ search_roots = [start_path.parent, *start_path.parents]
150
+ for root in search_roots:
151
+ for relative in ("config/workflow.json", ".lab/config/workflow.json"):
152
+ candidate = root / relative
153
+ if candidate.exists():
154
+ return candidate
155
+ return None
156
+
157
+
158
+ def load_workflow_language(path: Path) -> str:
159
+ data = json.loads(path.read_text(encoding="utf-8"))
160
+ return data.get("workflow_language", "en")
161
+
162
+
163
+ def text_looks_like_language(text: str, language: str) -> bool:
164
+ cjk_chars = len(re.findall(r"[\u4e00-\u9fff]", text))
165
+ latin_chars = len(re.findall(r"[A-Za-z]", text))
166
+ if language == "zh":
167
+ return cjk_chars >= 20
168
+ if language == "en":
169
+ return latin_chars >= 80 and cjk_chars < 20
170
+ return True
171
+
172
+
147
173
  def extract_section_body(text: str, patterns: list[str]) -> str:
148
174
  for pattern in patterns:
149
175
  match = re.search(pattern, text, flags=re.MULTILINE)
@@ -250,6 +276,14 @@ def main():
250
276
  issues.append(f"paper plan is missing required sections: {', '.join(missing)}")
251
277
  issues.extend(validate_filled_fields(text))
252
278
 
279
+ workflow_config = find_workflow_config(plan_path)
280
+ if workflow_config is not None:
281
+ workflow_language = load_workflow_language(workflow_config)
282
+ if not text_looks_like_language(text, workflow_language):
283
+ issues.append(
284
+ f"paper plan should follow workflow_language={workflow_language} instead of drifting into another language"
285
+ )
286
+
253
287
  if issues:
254
288
  for issue in issues:
255
289
  print(issue, file=sys.stderr)
@@ -67,9 +67,29 @@ Suggested levels:
67
67
  ## Brainstorm Pass 1
68
68
 
69
69
  - Candidate direction 1:
70
+ - What it is:
71
+ - Why it matters:
72
+ - Rough how:
73
+ - Problem solved:
74
+ - Main risk:
70
75
  - Candidate direction 2:
76
+ - What it is:
77
+ - Why it matters:
78
+ - Rough how:
79
+ - Problem solved:
80
+ - Main risk:
71
81
  - Candidate direction 3:
82
+ - What it is:
83
+ - Why it matters:
84
+ - Rough how:
85
+ - Problem solved:
86
+ - Main risk:
72
87
  - Candidate direction 4:
88
+ - What it is:
89
+ - Why it matters:
90
+ - Rough how:
91
+ - Problem solved:
92
+ - Main risk:
73
93
  - Why these directions are worth checking:
74
94
 
75
95
  ## Literature Sweep 1
@@ -109,9 +129,12 @@ Suggested levels:
109
129
  ## Brainstorm Pass 2
110
130
 
111
131
  - Surviving direction 1:
132
+ - Why it survived:
112
133
  - Surviving direction 2:
134
+ - Why it survived:
113
135
  - Rejected directions and why:
114
136
  - Recommended narrowed direction:
137
+ - Why this is stronger now:
115
138
 
116
139
  ## Literature Sweep 2
117
140
 
@@ -121,6 +144,12 @@ Suggested levels:
121
144
  - Adjacent-field papers:
122
145
  - Final literature takeaway:
123
146
 
147
+ ## Literature Summary for Recommendation
148
+
149
+ - Closest prior found:
150
+ - Recent strong papers found:
151
+ - What existing work still does not solve:
152
+
124
153
  ## Why Ours Is Different
125
154
 
126
155
  - Existing methods rely on:
@@ -180,6 +209,13 @@ Suggested levels:
180
209
  - If the idea is correct:
181
210
  - If the idea is wrong:
182
211
 
212
+ ## Convergence Status
213
+
214
+ - Current status:
215
+ - What is already source-backed:
216
+ - What is still hypothesis-only:
217
+ - Can this round end with a final recommendation:
218
+
183
219
  ## Candidate Experiment
184
220
 
185
221
  - Baseline:
@@ -27,6 +27,13 @@
27
27
  - Terminology consistency:
28
28
  - Five-dimension self-review outcome:
29
29
 
30
+ ## Language Decision
31
+
32
+ - Workflow language:
33
+ - Paper language:
34
+ - Finalization decision:
35
+ - Why this decision was chosen:
36
+
30
37
  ## Decision
31
38
 
32
39
  - Continue or stop:
@@ -14,8 +14,8 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
14
14
  - Keep dataset and benchmark selection separate from idea generation and specification.
15
15
  - Keep paper writing separate from experiment execution and reporting.
16
16
  - When the user explicitly invokes `/lab:<stage>`, execute that stage against the provided target instead of replying with a recommendation for another `/lab` stage.
17
- - Start each stage with a concise user-facing summary before writing artifacts.
18
- - After that summary, decide whether immediate artifact creation is useful; if yes, write the artifact and then report the output path plus next step.
17
+ - Start each stage with a concise user-facing summary.
18
+ - If the stage contract requires managed artifacts, materialize them immediately instead of treating artifact creation as optional. Then report the output path plus next step.
19
19
  - When a missing assumption would materially change the stage outcome, ask one clarifying question at a time.
20
20
  - When there are multiple viable paths, present 2-3 approaches with trade-offs and a recommendation before converging.
21
21
  - When a stage materially sets downstream direction, keep an explicit approval gate before proceeding.
@@ -37,11 +37,14 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
37
37
  ### `/lab:idea`
38
38
 
39
39
  - Search relevant literature, baselines, datasets, and evaluation metrics before proposing a plan.
40
- - Start with brainstorm pass 1 over 2-4 candidate directions instead of locking the first idea immediately.
40
+ - Start with brainstorm pass 1 over 3-4 candidate directions instead of locking the first idea immediately.
41
+ - For each brainstorm pass 1 candidate direction, explain what it is, why it matters, roughly how it would work, what problem it solves, and its main risk.
41
42
  - Run literature sweep 1 with closest-prior references for each candidate direction before narrowing.
42
- - Use brainstorm pass 2 to keep only the strongest 1-2 directions and explain what was rejected.
43
+ - Use brainstorm pass 2 to keep only the strongest 1-2 directions, explain why each surviving direction remains, explain what was rejected, and say why the narrowed recommendation is stronger now.
43
44
  - Run literature sweep 2 before making a final recommendation or novelty claim.
45
+ - Include a user-visible literature summary that names the closest prior found, the recent strong papers found, and what existing work still does not solve before giving the final recommendation.
44
46
  - Build a literature-scoping bundle before claiming novelty. The default target is 20 relevant sources unless the field is genuinely too narrow and that exception is written down.
47
+ - Materialize or update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before giving any final recommendation, paper-fit judgment, or mission writeback.
45
48
  - Read `.lab/context/mission.md` and `.lab/context/open-questions.md` before drafting.
46
49
  - Read `.lab/config/workflow.json` before drafting and follow its `workflow_language` for idea artifacts.
47
50
  - Ask one clarifying question at a time when critical ambiguity remains.
@@ -58,6 +61,8 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
58
61
  - Write idea artifacts with the template in `.lab/.managed/templates/idea.md`.
59
62
  - Keep `.lab/writing/idea-source-log.md` as the source-backed search manifest for the two literature sweeps.
60
63
  - Run `.lab/.managed/scripts/validate_idea_artifact.py --idea <idea-artifact> --source-log .lab/writing/idea-source-log.md --workflow-config .lab/config/workflow.json` before treating the idea as converged.
64
+ - Do not end the stage with a chat-only brainstorm. If only one brainstorm pass or literature sweep is complete, mark the idea as unconverged, list what is missing, and stop without pretending that the stage has converged.
65
+ - Only after the validator passes may the stage update `.lab/context/mission.md`, `.lab/context/decisions.md`, and `.lab/context/open-questions.md` with a final recommendation.
61
66
  - Update `.lab/context/mission.md`, `.lab/context/decisions.md`, and `.lab/context/open-questions.md` after convergence.
62
67
  - Do not leave `.lab/context/mission.md` as a template shell once the problem statement and approved direction are known.
63
68
  - Do not implement code in this stage.
@@ -182,7 +187,9 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
182
187
  - Read `.lab/context/mission.md`, `.lab/context/decisions.md`, `.lab/context/evidence-index.md`, and `.lab/context/data-decisions.md` before drafting.
183
188
  - Write one paper section or one explicit subproblem per round.
184
189
  - Ordinary manuscript drafting rounds should follow `workflow_language`.
185
- - If `workflow_language` and `paper_language` differ, the first final-draft or export round must ask once whether to keep the draft language or convert the final manuscript to `paper_language`, then persist that choice.
190
+ - If `workflow_language` and `paper_language` differ, the first final-draft or export round must ask once whether to keep the draft language or convert the final manuscript to `paper_language`.
191
+ - When the languages differ, do not rewrite final manuscript sections in `paper_language` before that question has been answered; ask first, persist the choice, then edit the final manuscript in the chosen language.
192
+ - When the languages differ, record the workflow language, paper language, finalization decision, and why the decision was chosen in the latest write iteration artifact.
186
193
  - Bind each claim to evidence from `report`, iteration reports, or normalized summaries.
187
194
  - Use the write-stage contract in `.codex/skills/lab/stages/write.md` or `.claude/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section-specific references, validator calls, asset coverage, and final manuscript gates.
188
195
  - Use the vendored paper-writing references under `skills/lab/references/paper-writing/` and the matching example-bank files under `skills/lab/references/paper-writing/examples/`.
@@ -209,6 +216,7 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
209
216
  - No final report without validated normalized results.
210
217
  - No paper-writing round without stable report artifacts, an approved framing artifact, evidence links, and LaTeX manuscript output.
211
218
  - No final-draft or export round without passing section-quality, claim-safety, and manuscript-delivery validation.
219
+ - No final-draft or export round with mismatched `workflow_language` and `paper_language` unless the latest write iteration records the language decision audit that justified the final manuscript language.
212
220
 
213
221
  ## References
214
222
 
@@ -16,11 +16,15 @@
16
16
  - rough plain-language approach description
17
17
  - evaluation sketch with the evaluation subject, any proxy or simulator, the main outcome to observe, and the main validity risk
18
18
  - tentative contributions stated at idea level, not final paper-facing wording
19
+ - convergence status that says what is already source-backed, what is still hypothesis-only, and whether the stage may end with a final recommendation
19
20
  - three meaningful points
20
- - brainstorm pass 1 with 2-4 candidate directions
21
+ - brainstorm pass 1 with 3-4 candidate directions
22
+ - each brainstorm pass 1 candidate direction explained with what it is, why it matters, rough how it would work, what problem it solves, and its main risk
21
23
  - literature sweep 1 with 3-5 closest-prior references per direction
22
24
  - brainstorm pass 2 that narrows to 1-2 surviving directions
25
+ - each brainstorm pass 2 surviving direction explained with why it survived, plus rejected directions and why, and why the narrowed recommendation is stronger now
23
26
  - literature sweep 2 that expands the surviving directions into the full source bundle
27
+ - literature summary for recommendation with closest prior found, recent strong papers found, and what existing work still does not solve
24
28
  - literature scoping bundle with a default target of 20 sources, or an explicit explanation for a smaller scoped field
25
29
  - literature-backed framing
26
30
  - sourced datasets and metrics
@@ -42,10 +46,16 @@
42
46
  - Build a source bundle before claiming novelty. The default target is 20 relevant sources split across closest prior work, recent strong papers, benchmark or evaluation papers, surveys or taxonomies, and adjacent-field work when useful.
43
47
  - Treat closest prior work, recent strong papers, benchmark or evaluation papers, and survey or taxonomy papers as mandatory coverage buckets. Do not leave those buckets empty in the final source bundle.
44
48
  - Keep a separate idea source log that records the actual search queries, bucketed sources, and final source count for both literature sweeps.
49
+ - Materialize or update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before giving any final recommendation, paper-fit judgment, or mission writeback.
45
50
  - Use the first brainstorm pass only to generate candidate directions. Treat it as hypothesis generation, not as a novelty judgment.
51
+ - Brainstorm pass 1 should cover at least three candidate directions before narrowing.
52
+ - For each brainstorm pass 1 candidate, explain what it is, why it matters, rough how it would work, what problem it solves, and its main risk.
46
53
  - After brainstorm pass 1, run a first literature sweep that gathers 3-5 closest-prior references per direction before narrowing the idea.
47
54
  - After literature sweep 1, run a second brainstorm pass that explicitly kills, merges, or narrows directions.
55
+ - Brainstorm pass 2 must narrow the field to one or two surviving directions, explain why each survived, explain why the others were rejected, and say why the narrowed recommendation is stronger now.
48
56
  - Only after literature sweep 2 may the artifact give a final recommendation, paper fit, or novelty claim.
57
+ - Before the final recommendation, add a user-visible literature summary that names the closest prior found, the recent strong papers found, and what existing work still does not solve.
58
+ - Do not end the stage with a chat-only brainstorm. If only a brainstorm pass or literature sweep is complete, mark the stage as unconverged, list what is still missing, and stop without pretending that the idea has converged.
49
59
  - If the field is genuinely too narrow to support that target, say so explicitly in both the idea artifact and the idea source log, and justify the smaller literature bundle instead of silently skipping the search.
50
60
  - The idea artifact must follow the repository `workflow_language`, not whichever language is easiest locally.
51
61
  - Before writing the full artifact, give the user a short summary with the one-sentence problem, why current methods fail, and the three meaningful points.
@@ -69,6 +79,7 @@
69
79
 
70
80
  - idea artifact derived from `.lab/.managed/templates/idea.md`
71
81
  - idea source log at `.lab/writing/idea-source-log.md`, derived from `.lab/.managed/templates/idea-source-log.md`
82
+ - the working idea artifact should live at `.lab/writing/idea.md`
72
83
 
73
84
  ## Recommended Structure
74
85
 
@@ -84,21 +95,23 @@
84
95
  10. Closest-prior-work comparison
85
96
  11. Brainstorm pass 2
86
97
  12. Literature sweep 2
87
- 13. Rough approach in plain language
88
- 14. Problem solved in plain language
89
- 15. Why the proposed idea is better
90
- 16. Evaluation sketch
91
- 17. Tentative contributions
92
- 18. Three meaningful points
93
- 19. Candidate approaches and recommendation
94
- 20. Dataset, baseline, and metric candidates
95
- 21. Falsifiable hypothesis
96
- 22. Expert critique
97
- 23. Revised proposal or final recommendation
98
- 24. User guidance
99
- 25. Approval gate
100
- 26. Minimum viable experiment
101
- 27. Idea source log aligned with the two literature sweeps
98
+ 13. Literature summary for recommendation
99
+ 14. Rough approach in plain language
100
+ 15. Problem solved in plain language
101
+ 16. Why the proposed idea is better
102
+ 17. Evaluation sketch
103
+ 18. Tentative contributions
104
+ 19. Three meaningful points
105
+ 20. Candidate approaches and recommendation
106
+ 21. Dataset, baseline, and metric candidates
107
+ 22. Falsifiable hypothesis
108
+ 23. Convergence status
109
+ 24. Expert critique
110
+ 25. Revised proposal or final recommendation
111
+ 26. User guidance
112
+ 27. Approval gate
113
+ 28. Minimum viable experiment
114
+ 29. Idea source log aligned with the two literature sweeps
102
115
 
103
116
  ## Writing Standard
104
117
 
@@ -106,13 +119,17 @@
106
119
  - Explain the scenario, target user or beneficiary, and why the problem matters before talking about novelty.
107
120
  - State why the target problem matters before talking about the method.
108
121
  - Use brainstorm pass 1 to open the space, not to declare a winner.
122
+ - Give brainstorm pass 1 at least three candidate directions, and explain each one with what it is, why it matters, rough how it would work, what problem it solves, and its main risk.
109
123
  - Use literature sweep 1 to test candidate directions against real papers before narrowing them.
110
- - Use brainstorm pass 2 to explain what survived, what was rejected, and why.
124
+ - Use brainstorm pass 2 to explain what survived, why it survived, what was rejected, why it was rejected, and why the narrowed recommendation is stronger now.
111
125
  - Use literature sweep 2 to support the final recommendation with real references across the required buckets.
126
+ - Add a short literature summary for recommendation so the final output shows the closest prior found, the recent strong papers found, and what existing work still does not solve.
112
127
  - Compare against existing methods explicitly, not by vague novelty language.
113
128
  - Do not call something new without a literature-scoping bundle and a closest-prior comparison.
114
129
  - Do not call something paper-worthy or novel after only one brainstorm pass or one literature sweep.
115
130
  - Do not treat the idea artifact itself as the only evidence record; keep `.lab/writing/idea-source-log.md` synchronized with the actual searches and source buckets used in both literature sweeps.
131
+ - Do not leave the working result only in chat. Update `.lab/writing/idea.md` and `.lab/writing/idea-source-log.md` before returning a stage conclusion.
132
+ - Do not present a final recommendation, paper fit, or next-stage approval unless the working idea artifact is validator-clean and its convergence status says the stage is ready for that recommendation.
116
133
  - Explain what current methods do, why they fall short, and roughly how the proposed idea would work in plain language.
117
134
  - Explain what problem the idea actually solves before describing tentative contributions.
118
135
  - Keep the evaluation sketch high-level: who or what is evaluated, what proxy or simulator is used if any, what outcome matters, and what the main validity risk is. Leave full protocol design to later stages.
@@ -77,6 +77,7 @@ Run these on every round:
77
77
  - If the current round is a final manuscript export or final-draft pass, `paper_template_root` is still empty, `paper_template_decision` is `default-scaffold`, and `paper_template_final_reminder_acknowledged` is `false`, ask one final reminder question about switching to a template before finalizing.
78
78
  - If the user confirms staying on the default scaffold at that final reminder, persist `paper_template_final_reminder_acknowledged: true`.
79
79
  - If the current round is a final manuscript export or final-draft pass, `workflow_language` and `paper_language` differ, and `paper_language_finalization_decision` is `unconfirmed`, ask one explicit question before finalizing: keep the manuscript in `workflow_language`, or convert the final manuscript to `paper_language`.
80
+ - Do not rewrite final manuscript sections in `paper_language` before that question has been answered. Ask first, persist the answer, then edit the final manuscript.
80
81
  - If the user chooses to keep the draft language, persist `paper_language_finalization_decision: keep-workflow-language`.
81
82
  - If the user chooses to convert, persist `paper_language_finalization_decision: convert-to-paper-language`.
82
83
  - If `paper_language_finalization_decision` is `convert-to-paper-language`, the final manuscript output should be converted to `paper_language` before accepting the final round.
@@ -92,6 +93,7 @@ Run these on every round:
92
93
  - record what each figure or analysis asset should show and why the reader needs it
93
94
  - record which citation anchors must appear in the section and why each anchor matters
94
95
  - Before drafting `introduction`, `method`, `experiments`, `related work`, or `conclusion`, run `.lab/.managed/scripts/validate_paper_plan.py --paper-plan .lab/writing/plan.md`.
96
+ - When the repository workflow config is available, the paper-plan validator also checks that `.lab/writing/plan.md` stays in `workflow_language` instead of silently drifting into another language.
95
97
  - If the paper-plan validator fails, stop and fill `.lab/writing/plan.md` first instead of drafting prose.
96
98
  - During ordinary draft rounds, run `.lab/.managed/scripts/validate_section_draft.py --section <section> --section-file <section-file> --mode draft` and `.lab/.managed/scripts/validate_paper_claims.py --section-file <section-file> --mode draft` after revising the active section.
97
99
  - Treat draft-round output from the section and claim validators as warnings that must be recorded and addressed in the write-iteration artifact, not as immediate stop conditions.
@@ -120,9 +122,11 @@ Run these on every round:
120
122
  - For final-draft or export rounds, run `.lab/.managed/scripts/validate_section_draft.py --section <section> --section-file <section-file> --mode final` and `.lab/.managed/scripts/validate_paper_claims.py --section-file <section-file> --mode final` before accepting the round.
121
123
  - If the final-round section or claim validators fail, keep editing the affected section until it passes; do not stop at asset-complete but rhetorically weak or unsafe prose.
122
124
  - Run `.lab/.managed/scripts/validate_manuscript_delivery.py --paper-dir <deliverables_root>/paper` before accepting a final-draft or export round.
125
+ - The manuscript-delivery validator should fail if the core figures and tables are only inserted but never cited from section prose, if final manuscript acceptance tries to bypass the one-time `paper_language_finalization_decision` gate when `workflow_language` and `paper_language` differ, or if the latest write iteration does not audit that language decision.
123
126
  - If the manuscript validator fails, keep editing and asset generation until it passes; do not stop at prose-only completion.
124
127
  - Run a LaTeX compile smoke test when a local LaTeX toolchain is available; if not available, record the missing verification in the write iteration artifact.
125
128
  - Record what changed and why in a write-iteration artifact.
129
+ - When `workflow_language` and `paper_language` differ, record the final manuscript language choice in the write-iteration artifact with the workflow language, paper language, finalization decision, and why that decision was chosen.
126
130
  - Return paragraph-level roles for the revised prose when drafting.
127
131
  - Run the five-dimension self-review checklist before accepting a round.
128
132
  - Run reviewer-style checks after every round.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superlab",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "Strict /lab research workflow installer for Codex and Claude",
5
5
  "keywords": [
6
6
  "codex",