superlab 0.1.14 → 0.1.15

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.
Files changed (55) hide show
  1. package/README.md +7 -3
  2. package/README.zh-CN.md +7 -3
  3. package/bin/superlab.cjs +38 -0
  4. package/lib/auto_contracts.cjs +7 -3
  5. package/lib/auto_runner.cjs +33 -52
  6. package/lib/auto_state.cjs +27 -21
  7. package/lib/context.cjs +15 -0
  8. package/lib/i18n.cjs +106 -33
  9. package/lib/install.cjs +1 -0
  10. package/package-assets/claude/commands/lab/write.md +1 -1
  11. package/package-assets/claude/commands/lab.md +1 -0
  12. package/package-assets/codex/prompts/lab-write.md +1 -1
  13. package/package-assets/codex/prompts/lab.md +1 -0
  14. package/package-assets/shared/lab/.managed/templates/final-report.md +12 -0
  15. package/package-assets/shared/lab/.managed/templates/main-tables.md +37 -0
  16. package/package-assets/shared/lab/config/workflow.json +3 -1
  17. package/package-assets/shared/lab/context/auto-outcome.md +3 -0
  18. package/package-assets/shared/skills/lab/SKILL.md +6 -2
  19. package/package-assets/shared/skills/lab/references/paper-writing/abstract.md +7 -1
  20. package/package-assets/shared/skills/lab/references/paper-writing/examples/abstract/template-a.md +21 -0
  21. package/package-assets/shared/skills/lab/references/paper-writing/examples/abstract/template-b.md +34 -0
  22. package/package-assets/shared/skills/lab/references/paper-writing/examples/abstract/template-c.md +28 -0
  23. package/package-assets/shared/skills/lab/references/paper-writing/examples/abstract-examples.md +13 -0
  24. package/package-assets/shared/skills/lab/references/paper-writing/examples/index.md +21 -0
  25. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/novel-task-challenge-decomposition.md +18 -0
  26. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/pipeline-not-recommended-abstract-only.md +30 -0
  27. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/pipeline-version-1-one-contribution-multi-advantages.md +30 -0
  28. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/pipeline-version-2-two-contributions.md +34 -0
  29. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/pipeline-version-3-new-module-on-existing-pipeline.md +18 -0
  30. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/pipeline-version-4-observation-driven.md +16 -0
  31. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/technical-challenge-version-1-existing-task.md +32 -0
  32. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/technical-challenge-version-2-existing-task-insight-backed-by-traditional.md +33 -0
  33. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/technical-challenge-version-3-novel-task.md +21 -0
  34. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/version-1-task-then-application.md +14 -0
  35. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/version-2-application-first.md +10 -0
  36. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/version-3-general-to-specific-setting.md +14 -0
  37. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction/version-4-open-with-challenge.md +20 -0
  38. package/package-assets/shared/skills/lab/references/paper-writing/examples/introduction-examples.md +25 -0
  39. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/example-of-the-three-elements.md +67 -0
  40. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/method-writing-common-issues-note.md +10 -0
  41. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/module-design-instant-ngp.md +55 -0
  42. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/module-motivation-patterns.md +15 -0
  43. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/module-triad-neural-body.md +19 -0
  44. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/neural-body-annotated-figure-text.md +66 -0
  45. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/overview-template.md +30 -0
  46. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/pre-writing-questions.md +17 -0
  47. package/package-assets/shared/skills/lab/references/paper-writing/examples/method/section-skeleton.md +9 -0
  48. package/package-assets/shared/skills/lab/references/paper-writing/examples/method-examples.md +24 -0
  49. package/package-assets/shared/skills/lab/references/paper-writing/introduction.md +7 -1
  50. package/package-assets/shared/skills/lab/references/paper-writing/method.md +6 -2
  51. package/package-assets/shared/skills/lab/references/paper-writing-integration.md +26 -0
  52. package/package-assets/shared/skills/lab/stages/auto.md +9 -1
  53. package/package-assets/shared/skills/lab/stages/report.md +5 -1
  54. package/package-assets/shared/skills/lab/stages/write.md +16 -1
  55. package/package.json +1 -1
package/README.md CHANGED
@@ -179,7 +179,7 @@ superlab auto stop
179
179
 
180
180
  - `run` and `iterate` must change persistent outputs under `results_root`
181
181
  - `review` must update canonical review context
182
- - `report` must write `<deliverables_root>/report.md`
182
+ - `report` must write `<deliverables_root>/report.md` and `<deliverables_root>/main-tables.md`
183
183
  - `write` must produce LaTeX output under `<deliverables_root>/paper/`
184
184
  - a successful promotion must write back into `.lab/context/data-decisions.md`, `.lab/context/decisions.md`, `.lab/context/state.md`, and `.lab/context/session-brief.md`
185
185
  - every run must end with `.lab/context/auto-outcome.md`, including why it stopped, whether the terminal goal was reached, and which artifact is the final outcome
@@ -246,7 +246,7 @@ Stages should follow that file rather than guess language locally.
246
246
  - Python 3.10+
247
247
  - Git
248
248
 
249
- `/lab:write` ships with vendored paper-writing references under the installed `lab` skill, so it does not depend on an extra runtime skill installation.
249
+ `/lab:write` ships with vendored paper-writing references and the upstream example bank for `abstract`, `introduction`, and `method` under the installed `lab` skill, so it does not depend on an extra runtime skill installation.
250
250
 
251
251
  ## Command Set
252
252
 
@@ -294,6 +294,7 @@ See the source command docs in [commands/codex/lab.md](/Users/zhouhao119/coding/
294
294
  `/lab:write` writes final manuscript output under the configured `deliverables_root` (default: `docs/research`):
295
295
 
296
296
  - `docs/research/report.md`
297
+ - `docs/research/main-tables.md`
297
298
  - `docs/research/paper/main.tex`
298
299
  - `docs/research/paper/sections/*.tex`
299
300
 
@@ -303,7 +304,10 @@ Internal writing-control artifacts stay under:
303
304
  - `.lab/writing/plan.md`
304
305
  - `.lab/writing/iterations/*.md`
305
306
 
306
- If `paper_template_root` is configured, `/lab:write` should inspect that template directory first and align drafting to it. If no template is configured, it falls back to the managed default LaTeX scaffold.
307
+ If `paper_template_root` is configured, `/lab:write` should inspect that template directory first and align drafting to it.
308
+ If no template is configured, the first manuscript-writing round should ask once whether to continue with the managed default LaTeX scaffold or attach a template directory first.
309
+ If the user approves the default scaffold, persist that choice in `.lab/config/workflow.json` and stop asking on ordinary rounds.
310
+ At the final export or final-draft boundary, if the project is still on the default scaffold and no attached template exists, ask one final reminder question before finalizing.
307
311
 
308
312
  `/lab` treats `.lab/` as the workflow-control layer only. Durable outputs should use natural project roots:
309
313
 
package/README.zh-CN.md CHANGED
@@ -177,7 +177,7 @@ superlab auto stop
177
177
 
178
178
  - `run` 和 `iterate` 必须更新 `results_root` 下的持久输出
179
179
  - `review` 必须更新规范的审查上下文
180
- - `report` 必须写出 `<deliverables_root>/report.md`
180
+ - `report` 必须写出 `<deliverables_root>/report.md` 和 `<deliverables_root>/main-tables.md`
181
181
  - `write` 必须写出 `<deliverables_root>/paper/` 下的 LaTeX 论文产物
182
182
  - promotion 成功后必须写回 `.lab/context/data-decisions.md`、`.lab/context/decisions.md`、`.lab/context/state.md` 和 `.lab/context/session-brief.md`
183
183
  - 每次运行都必须写出 `.lab/context/auto-outcome.md`,记录为什么停止、是否达到终止目标,以及哪一个工件是最终结果
@@ -244,7 +244,7 @@ superlab init --lang en
244
244
  - Python 3.10+
245
245
  - Git
246
246
 
247
- `/lab:write` 自带 vendored 的 paper-writing 章节参考,不再依赖额外安装一个运行时写作 skill。
247
+ `/lab:write` 自带 vendored 的 paper-writing 章节参考,以及 `abstract`、`introduction`、`method` 对应的 upstream example bank,不再依赖额外安装一个运行时写作 skill。
248
248
 
249
249
  ## 命令集合
250
250
 
@@ -279,6 +279,7 @@ superlab init --lang en
279
279
  `/lab:write` 会把最终可交付物写到 `deliverables_root` 指定的目录,默认是 `docs/research`:
280
280
 
281
281
  - `docs/research/report.md`
282
+ - `docs/research/main-tables.md`
282
283
  - `docs/research/paper/main.tex`
283
284
  - `docs/research/paper/sections/*.tex`
284
285
 
@@ -288,7 +289,10 @@ superlab init --lang en
288
289
  - `.lab/writing/plan.md`
289
290
  - `.lab/writing/iterations/*.md`
290
291
 
291
- 如果配置了 `paper_template_root`,`/lab:write` 应先检查该模板目录并按其结构写作;如果没有配置模板,就回退到内置的默认 LaTeX scaffold。
292
+ 如果配置了 `paper_template_root`,`/lab:write` 应先检查该模板目录并按其结构写作。
293
+ 如果没有配置模板,第一次进入论文 `.tex` 写作时应先追问一次:继续使用内置默认 LaTeX scaffold,还是先接入模板目录。
294
+ 如果用户确认先用默认 scaffold,就把这个决定持久化到 `.lab/config/workflow.json`,后续普通轮次不再重复追问。
295
+ 但在最终导出或最终定稿节点,如果项目仍在使用默认 scaffold 且没有接入模板,应再提醒一次,给用户最后切换模板的机会。
292
296
 
293
297
  `/lab` 把 `.lab/` 视为工作流控制层,不是正式结果目录。持久输出应按自然根目录放置:
294
298
 
package/bin/superlab.cjs CHANGED
@@ -603,6 +603,8 @@ function attachPaperTemplate({ targetDir, templatePath }) {
603
603
  }
604
604
 
605
605
  config.paper_template_root = storedProjectPath(targetDir, normalizedTemplatePath);
606
+ config.paper_template_decision = "attached-template";
607
+ config.paper_template_final_reminder_acknowledged = true;
606
608
  writeWorkflowConfig(targetDir, config);
607
609
  return {
608
610
  storedPath: config.paper_template_root,
@@ -660,6 +662,33 @@ function validateWorkflowConfig(config) {
660
662
  issues.push("paper_template_root must not point inside .lab");
661
663
  }
662
664
  }
665
+ const validTemplateDecisions = new Set(["unconfirmed", "default-scaffold", "attached-template"]);
666
+ if (
667
+ config.paper_template_decision !== undefined &&
668
+ !validTemplateDecisions.has(config.paper_template_decision)
669
+ ) {
670
+ issues.push("invalid paper_template_decision");
671
+ }
672
+ if (
673
+ config.paper_template_final_reminder_acknowledged !== undefined &&
674
+ typeof config.paper_template_final_reminder_acknowledged !== "boolean"
675
+ ) {
676
+ issues.push("invalid paper_template_final_reminder_acknowledged");
677
+ }
678
+ if (
679
+ typeof config.paper_template_root === "string" &&
680
+ config.paper_template_root.trim() !== "" &&
681
+ config.paper_template_decision === "default-scaffold"
682
+ ) {
683
+ issues.push("paper_template_decision conflicts with configured paper_template_root");
684
+ }
685
+ if (
686
+ typeof config.paper_template_root === "string" &&
687
+ config.paper_template_root.trim() === "" &&
688
+ config.paper_template_decision === "attached-template"
689
+ ) {
690
+ issues.push("paper_template_decision requires a configured paper_template_root");
691
+ }
663
692
  return issues;
664
693
  }
665
694
 
@@ -922,6 +951,15 @@ async function main() {
922
951
  console.log(`stages executed: ${result.executedStages.join(", ")}`);
923
952
  console.log(`goal type: ${result.outcome.goalType}`);
924
953
  console.log(`goal target: ${result.outcome.goalTarget}`);
954
+ if (result.outcome.primaryMetrics) {
955
+ console.log(`primary metrics: ${result.outcome.primaryMetrics}`);
956
+ }
957
+ if (result.outcome.secondaryMetrics) {
958
+ console.log(`secondary metrics: ${result.outcome.secondaryMetrics}`);
959
+ }
960
+ if (result.outcome.requiredTerminalEvidence) {
961
+ console.log(`required terminal evidence: ${result.outcome.requiredTerminalEvidence}`);
962
+ }
925
963
  if (result.outcome.experimentLadder) {
926
964
  console.log(`experiment ladder: ${result.outcome.experimentLadder}`);
927
965
  }
@@ -285,7 +285,10 @@ function stageContractSnapshot(targetDir, stage) {
285
285
  run: [resultsRoot],
286
286
  iterate: [resultsRoot],
287
287
  review: REVIEW_CONTEXT_FILES.map((relativePath) => path.resolve(targetDir, relativePath)),
288
- report: [path.join(deliverablesRoot, "report.md")],
288
+ report: [
289
+ path.join(deliverablesRoot, "report.md"),
290
+ path.join(deliverablesRoot, "main-tables.md"),
291
+ ],
289
292
  write: [
290
293
  path.join(deliverablesRoot, "paper", "main.tex"),
291
294
  path.join(deliverablesRoot, "paper", "sections"),
@@ -322,8 +325,9 @@ function verifyStageContract({ stage, snapshot }) {
322
325
  }
323
326
 
324
327
  if (stage === "report") {
325
- if (changedPaths.length === 0) {
326
- throw new Error("report stage did not produce the deliverable report.md under deliverables_root");
328
+ const missing = Array.from(snapshot.keys()).filter((absolutePath) => !changedPaths.includes(absolutePath));
329
+ if (missing.length > 0) {
330
+ throw new Error("report stage did not produce the deliverable report.md and main-tables.md under deliverables_root");
327
331
  }
328
332
  return;
329
333
  }
@@ -264,6 +264,18 @@ async function startAutoMode({ targetDir, now = new Date() }) {
264
264
  let promotionApplied = false;
265
265
  let stopReason = "";
266
266
  let finalRung = "";
267
+ const outcomeProtocolFields = {
268
+ primaryMetrics: evalProtocol.primaryMetrics,
269
+ secondaryMetrics: evalProtocol.secondaryMetrics,
270
+ requiredTerminalEvidence: evalProtocol.requiredTerminalEvidence,
271
+ experimentLadder: evalProtocol.experimentLadder,
272
+ metricGlossary: evalProtocol.metricGlossary,
273
+ metricSourcePapers: evalProtocol.metricSourcePapers,
274
+ metricImplementationSource: evalProtocol.metricImplementationSource,
275
+ comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
276
+ comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
277
+ deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
278
+ };
267
279
 
268
280
  const writeRunningStatus = (overrides = {}) => {
269
281
  currentStatus = {
@@ -287,13 +299,7 @@ async function startAutoMode({ targetDir, now = new Date() }) {
287
299
  targetDir,
288
300
  {
289
301
  objective: mode.objective,
290
- experimentLadder: evalProtocol.experimentLadder,
291
- metricGlossary: evalProtocol.metricGlossary,
292
- metricSourcePapers: evalProtocol.metricSourcePapers,
293
- metricImplementationSource: evalProtocol.metricImplementationSource,
294
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
295
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
296
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
302
+ ...outcomeProtocolFields,
297
303
  terminalGoalType: mode.terminalGoalType,
298
304
  terminalGoalTarget: mode.terminalGoalTarget,
299
305
  requiredTerminalArtifact: mode.requiredTerminalArtifact,
@@ -597,8 +603,7 @@ async function startAutoMode({ targetDir, now = new Date() }) {
597
603
  targetDir,
598
604
  {
599
605
  objective: mode.objective,
600
- experimentLadder: evalProtocol.experimentLadder,
601
- metricGlossary: evalProtocol.metricGlossary,
606
+ ...outcomeProtocolFields,
602
607
  terminalGoalType: mode.terminalGoalType,
603
608
  terminalGoalTarget: mode.terminalGoalTarget,
604
609
  requiredTerminalArtifact: mode.requiredTerminalArtifact,
@@ -620,14 +625,8 @@ async function startAutoMode({ targetDir, now = new Date() }) {
620
625
  mode,
621
626
  status: currentStatus,
622
627
  executedStages,
623
- outcome: {
624
- experimentLadder: evalProtocol.experimentLadder,
625
- metricGlossary: evalProtocol.metricGlossary,
626
- metricSourcePapers: evalProtocol.metricSourcePapers,
627
- metricImplementationSource: evalProtocol.metricImplementationSource,
628
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
629
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
630
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
628
+ outcome: {
629
+ ...outcomeProtocolFields,
631
630
  goalType: mode.terminalGoalType,
632
631
  goalTarget: mode.terminalGoalTarget,
633
632
  goalReached: false,
@@ -656,13 +655,7 @@ async function startAutoMode({ targetDir, now = new Date() }) {
656
655
  targetDir,
657
656
  {
658
657
  objective: mode.objective,
659
- experimentLadder: evalProtocol.experimentLadder,
660
- metricGlossary: evalProtocol.metricGlossary,
661
- metricSourcePapers: evalProtocol.metricSourcePapers,
662
- metricImplementationSource: evalProtocol.metricImplementationSource,
663
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
664
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
665
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
658
+ ...outcomeProtocolFields,
666
659
  terminalGoalType: mode.terminalGoalType,
667
660
  terminalGoalTarget: mode.terminalGoalTarget,
668
661
  requiredTerminalArtifact: mode.requiredTerminalArtifact,
@@ -685,13 +678,7 @@ async function startAutoMode({ targetDir, now = new Date() }) {
685
678
  status: currentStatus,
686
679
  executedStages,
687
680
  outcome: {
688
- experimentLadder: evalProtocol.experimentLadder,
689
- metricGlossary: evalProtocol.metricGlossary,
690
- metricSourcePapers: evalProtocol.metricSourcePapers,
691
- metricImplementationSource: evalProtocol.metricImplementationSource,
692
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
693
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
694
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
681
+ ...outcomeProtocolFields,
695
682
  goalType: mode.terminalGoalType,
696
683
  goalTarget: mode.terminalGoalTarget,
697
684
  goalReached: false,
@@ -722,13 +709,7 @@ async function startAutoMode({ targetDir, now = new Date() }) {
722
709
  targetDir,
723
710
  {
724
711
  objective: mode.objective,
725
- experimentLadder: evalProtocol.experimentLadder,
726
- metricGlossary: evalProtocol.metricGlossary,
727
- metricSourcePapers: evalProtocol.metricSourcePapers,
728
- metricImplementationSource: evalProtocol.metricImplementationSource,
729
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
730
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
731
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
712
+ ...outcomeProtocolFields,
732
713
  terminalGoalType: mode.terminalGoalType,
733
714
  terminalGoalTarget: mode.terminalGoalTarget,
734
715
  requiredTerminalArtifact: mode.requiredTerminalArtifact,
@@ -751,13 +732,7 @@ async function startAutoMode({ targetDir, now = new Date() }) {
751
732
  status: currentStatus,
752
733
  executedStages,
753
734
  outcome: {
754
- experimentLadder: evalProtocol.experimentLadder,
755
- metricGlossary: evalProtocol.metricGlossary,
756
- metricSourcePapers: evalProtocol.metricSourcePapers,
757
- metricImplementationSource: evalProtocol.metricImplementationSource,
758
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
759
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
760
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
735
+ ...outcomeProtocolFields,
761
736
  goalType: mode.terminalGoalType,
762
737
  goalTarget: mode.terminalGoalTarget,
763
738
  goalReached: successReached,
@@ -774,6 +749,18 @@ function stopAutoMode({ targetDir, now = new Date() }) {
774
749
  const mode = parseAutoMode(targetDir);
775
750
  const evalProtocol = parseEvalProtocol(targetDir);
776
751
  const lang = readWorkflowLanguage(targetDir);
752
+ const outcomeProtocolFields = {
753
+ primaryMetrics: evalProtocol.primaryMetrics,
754
+ secondaryMetrics: evalProtocol.secondaryMetrics,
755
+ requiredTerminalEvidence: evalProtocol.requiredTerminalEvidence,
756
+ experimentLadder: evalProtocol.experimentLadder,
757
+ metricGlossary: evalProtocol.metricGlossary,
758
+ metricSourcePapers: evalProtocol.metricSourcePapers,
759
+ metricImplementationSource: evalProtocol.metricImplementationSource,
760
+ comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
761
+ comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
762
+ deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
763
+ };
777
764
  const status = {
778
765
  ...existing,
779
766
  status: "stopped",
@@ -785,13 +772,7 @@ function stopAutoMode({ targetDir, now = new Date() }) {
785
772
  targetDir,
786
773
  {
787
774
  objective: mode.objective,
788
- experimentLadder: evalProtocol.experimentLadder,
789
- metricGlossary: evalProtocol.metricGlossary,
790
- metricSourcePapers: evalProtocol.metricSourcePapers,
791
- metricImplementationSource: evalProtocol.metricImplementationSource,
792
- comparisonSourcePapers: evalProtocol.comparisonSourcePapers,
793
- comparisonImplementationSource: evalProtocol.comparisonImplementationSource,
794
- deviationFromOriginalImplementation: evalProtocol.deviationFromOriginalImplementation,
775
+ ...outcomeProtocolFields,
795
776
  terminalGoalType: mode.terminalGoalType,
796
777
  terminalGoalTarget: mode.terminalGoalTarget,
797
778
  requiredTerminalArtifact: mode.requiredTerminalArtifact,
@@ -140,30 +140,33 @@ function renderAutoOutcome(outcome, { lang = "en" } = {}) {
140
140
 
141
141
  ## 目标
142
142
 
143
- - Objective: ${outcome.objective || ""}
144
- - Experiment ladder: ${outcome.experimentLadder || ""}
145
- - Metric glossary: ${outcome.metricGlossary || ""}
146
- - Metric source papers: ${outcome.metricSourcePapers || ""}
147
- - Metric implementation source: ${outcome.metricImplementationSource || ""}
148
- - Comparison source papers: ${outcome.comparisonSourcePapers || ""}
149
- - Comparison implementation source: ${outcome.comparisonImplementationSource || ""}
150
- - Deviation from original implementation: ${outcome.deviationFromOriginalImplementation || ""}
151
- - Terminal goal type: ${outcome.terminalGoalType || ""}
152
- - Terminal goal target: ${outcome.terminalGoalTarget || ""}
153
- - Required terminal artifact: ${outcome.requiredTerminalArtifact || ""}
143
+ - 目标: ${outcome.objective || ""}
144
+ - 主指标: ${outcome.primaryMetrics || ""}
145
+ - 次级指标: ${outcome.secondaryMetrics || ""}
146
+ - 必要终局证据: ${outcome.requiredTerminalEvidence || ""}
147
+ - 实验阶梯: ${outcome.experimentLadder || ""}
148
+ - 指标释义: ${outcome.metricGlossary || ""}
149
+ - 指标来源论文: ${outcome.metricSourcePapers || ""}
150
+ - 指标实现来源: ${outcome.metricImplementationSource || ""}
151
+ - 对比方法来源论文: ${outcome.comparisonSourcePapers || ""}
152
+ - 对比方法实现来源: ${outcome.comparisonImplementationSource || ""}
153
+ - 与原始实现的偏差: ${outcome.deviationFromOriginalImplementation || ""}
154
+ - 终止目标类型: ${outcome.terminalGoalType || ""}
155
+ - 终止目标目标值: ${outcome.terminalGoalTarget || ""}
156
+ - 必要终止工件: ${outcome.requiredTerminalArtifact || ""}
154
157
 
155
158
  ## 结果
156
159
 
157
- - Status: ${outcome.status || ""}
158
- - Goal reached: ${outcome.goalReached ? "yes" : "no"}
159
- - Stop reason: ${outcome.stopReason || ""}
160
- - Promotion applied: ${outcome.promotionApplied ? "yes" : "no"}
161
- - Final artifact: ${outcome.finalArtifact || ""}
162
- - Final rung: ${outcome.finalRung || ""}
163
- - Executed stages: ${outcome.executedStages || ""}
164
- - Iterations completed: ${outcome.iterationsCompleted || "0"}
165
- - Started at: ${outcome.startedAt || ""}
166
- - Finished at: ${outcome.finishedAt || ""}
160
+ - 状态: ${outcome.status || ""}
161
+ - 目标是否达成: ${outcome.goalReached ? "" : ""}
162
+ - 停止原因: ${outcome.stopReason || ""}
163
+ - 是否已升格: ${outcome.promotionApplied ? "" : ""}
164
+ - 最终工件: ${outcome.finalArtifact || ""}
165
+ - 最终 rung: ${outcome.finalRung || ""}
166
+ - 已执行阶段: ${outcome.executedStages || ""}
167
+ - 已完成迭代数: ${outcome.iterationsCompleted || "0"}
168
+ - 开始时间: ${outcome.startedAt || ""}
169
+ - 结束时间: ${outcome.finishedAt || ""}
167
170
  `;
168
171
  }
169
172
 
@@ -172,6 +175,9 @@ function renderAutoOutcome(outcome, { lang = "en" } = {}) {
172
175
  ## Goal
173
176
 
174
177
  - Objective: ${outcome.objective || ""}
178
+ - Primary metrics: ${outcome.primaryMetrics || ""}
179
+ - Secondary metrics: ${outcome.secondaryMetrics || ""}
180
+ - Required terminal evidence: ${outcome.requiredTerminalEvidence || ""}
175
181
  - Experiment ladder: ${outcome.experimentLadder || ""}
176
182
  - Metric glossary: ${outcome.metricGlossary || ""}
177
183
  - Metric source papers: ${outcome.metricSourcePapers || ""}
package/lib/context.cjs CHANGED
@@ -96,6 +96,9 @@ function renderSummary(lang, data) {
96
96
  - Auto final artifact: ${data.autoFinalArtifact || "待补充"}
97
97
  - Auto final rung: ${data.autoFinalRung || "待补充"}
98
98
  - Eval objective: ${data.evalObjective || "待补充"}
99
+ - Primary metrics: ${data.evalPrimaryMetrics || "待补充"}
100
+ - Secondary metrics: ${data.evalSecondaryMetrics || "待补充"}
101
+ - Required terminal evidence: ${data.evalRequiredTerminalEvidence || "待补充"}
99
102
  - Table plan: ${data.evalTablePlan || "待补充"}
100
103
  - Metric glossary: ${data.evalMetricGlossary || "待补充"}
101
104
  - Metric source papers: ${data.evalMetricSourcePapers || "待补充"}
@@ -148,6 +151,9 @@ function renderSummary(lang, data) {
148
151
  - Auto final artifact: ${data.autoFinalArtifact || "TBD"}
149
152
  - Auto final rung: ${data.autoFinalRung || "TBD"}
150
153
  - Eval objective: ${data.evalObjective || "TBD"}
154
+ - Primary metrics: ${data.evalPrimaryMetrics || "TBD"}
155
+ - Secondary metrics: ${data.evalSecondaryMetrics || "TBD"}
156
+ - Required terminal evidence: ${data.evalRequiredTerminalEvidence || "TBD"}
151
157
  - Table plan: ${data.evalTablePlan || "TBD"}
152
158
  - Metric glossary: ${data.evalMetricGlossary || "TBD"}
153
159
  - Metric source papers: ${data.evalMetricSourcePapers || "TBD"}
@@ -255,6 +261,9 @@ ${data.problem || "待补充"}
255
261
  - Auto final artifact: ${data.autoFinalArtifact || "待补充"}
256
262
  - Auto final rung: ${data.autoFinalRung || "待补充"}
257
263
  - Eval objective: ${data.evalObjective || "待补充"}
264
+ - Primary metrics: ${data.evalPrimaryMetrics || "待补充"}
265
+ - Secondary metrics: ${data.evalSecondaryMetrics || "待补充"}
266
+ - Required terminal evidence: ${data.evalRequiredTerminalEvidence || "待补充"}
258
267
  - Table plan: ${data.evalTablePlan || "待补充"}
259
268
  - Metric glossary: ${data.evalMetricGlossary || "待补充"}
260
269
  - Metric source papers: ${data.evalMetricSourcePapers || "待补充"}
@@ -318,6 +327,9 @@ ${data.problem || "TBD"}
318
327
  - Auto final artifact: ${data.autoFinalArtifact || "TBD"}
319
328
  - Auto final rung: ${data.autoFinalRung || "TBD"}
320
329
  - Eval objective: ${data.evalObjective || "TBD"}
330
+ - Primary metrics: ${data.evalPrimaryMetrics || "TBD"}
331
+ - Secondary metrics: ${data.evalSecondaryMetrics || "TBD"}
332
+ - Required terminal evidence: ${data.evalRequiredTerminalEvidence || "TBD"}
321
333
  - Table plan: ${data.evalTablePlan || "TBD"}
322
334
  - Metric glossary: ${data.evalMetricGlossary || "TBD"}
323
335
  - Metric source papers: ${data.evalMetricSourcePapers || "TBD"}
@@ -569,6 +581,9 @@ function buildContextSnapshot(targetDir) {
569
581
  autoFinalArtifact: extractValue(autoOutcome, ["Final artifact", "最终工件"]),
570
582
  autoFinalRung: extractValue(autoOutcome, ["Final rung", "最终 rung"]),
571
583
  evalObjective: evalProtocol.primaryEvaluationObjective,
584
+ evalPrimaryMetrics: evalProtocol.primaryMetrics,
585
+ evalSecondaryMetrics: evalProtocol.secondaryMetrics,
586
+ evalRequiredTerminalEvidence: evalProtocol.requiredTerminalEvidence,
572
587
  evalTablePlan: evalProtocol.tablePlan,
573
588
  evalMetricGlossary: evalProtocol.metricGlossary,
574
589
  evalMetricSourcePapers: evalProtocol.metricSourcePapers,
package/lib/i18n.cjs CHANGED
@@ -61,7 +61,7 @@ const ZH_CONTENT = {
61
61
  [path.join(".codex", "prompts", "lab-write.md")]: codexPrompt(
62
62
  "把验证过的研究工件转成论文 section,并按小步方式修订",
63
63
  "section or writing target",
64
- "使用已安装的 `lab` 技能:`.codex/skills/lab/SKILL.md`。\n\n立刻针对用户当前给出的参数执行 `/lab:write`,不要只推荐别的 `/lab` 阶段。只有在缺少阻塞性前提时,才明确指出缺什么,并且一次最多追问一个问题。\n\n本命令运行 `/lab:write` 阶段。它必须先有来自 `/lab:framing` 的已批准 framing artifact,再读取 `.codex/skills/lab/references/paper-writing/` 下与当前 section 对应的参考文件,并结合 `paper-review.md` 与 `does-my-writing-flow-source.md`,先写 mini-outline,再只修改一个 section"
64
+ "使用已安装的 `lab` 技能:`.codex/skills/lab/SKILL.md`。\n\n立刻针对用户当前给出的参数执行 `/lab:write`,不要只推荐别的 `/lab` 阶段。只有在缺少阻塞性前提时,才明确指出缺什么,并且一次最多追问一个问题。\n\n本命令运行 `/lab:write` 阶段。它必须先有来自 `/lab:framing` 的已批准 framing artifact,再读取 `.codex/skills/lab/references/paper-writing/` 下与当前 section 对应的参考文件;如果当前是 `abstract`、`introduction` 或 `method`,还必须继续读取 `.codex/skills/lab/references/paper-writing/examples/index.md`、对应的 examples index,以及 1-2 个具体 example 文件。然后结合 `paper-review.md` 与 `does-my-writing-flow-source.md`,先写 mini-outline,再只修改一个 section。第一次进入会产出论文 `.tex` 的路径时,如果 `paper_template_root` 为空,必须先问一次:继续使用默认 LaTeX scaffold,还是先接入模板目录。"
65
65
  ),
66
66
  [path.join(".claude", "commands", "lab", "idea.md")]: claudeCommand(
67
67
  "LAB: Idea",
@@ -109,7 +109,7 @@ const ZH_CONTENT = {
109
109
  "LAB: Write",
110
110
  "把验证过的研究工件转成论文 section,并按小步方式修订",
111
111
  "workflow, research, writing",
112
- "使用已安装的 `lab` 技能:`.claude/skills/lab/SKILL.md`。\n\n立刻针对用户当前给出的参数执行 `/lab:write`,不要只推荐别的 `/lab` 阶段。只有在缺少阻塞性前提时,才明确指出缺什么,并且一次最多追问一个问题。\n\n本命令运行 `/lab:write` 阶段。它必须先有来自 `/lab:framing` 的已批准 framing artifact,再读取 `.claude/skills/lab/references/paper-writing/` 下与当前 section 对应的参考文件,并结合 `paper-review.md` 与 `does-my-writing-flow-source.md`,先写 mini-outline,再只修改一个 section"
112
+ "使用已安装的 `lab` 技能:`.claude/skills/lab/SKILL.md`。\n\n立刻针对用户当前给出的参数执行 `/lab:write`,不要只推荐别的 `/lab` 阶段。只有在缺少阻塞性前提时,才明确指出缺什么,并且一次最多追问一个问题。\n\n本命令运行 `/lab:write` 阶段。它必须先有来自 `/lab:framing` 的已批准 framing artifact,再读取 `.claude/skills/lab/references/paper-writing/` 下与当前 section 对应的参考文件;如果当前是 `abstract`、`introduction` 或 `method`,还必须继续读取 `.claude/skills/lab/references/paper-writing/examples/index.md`、对应的 examples index,以及 1-2 个具体 example 文件。然后结合 `paper-review.md` 与 `does-my-writing-flow-source.md`,先写 mini-outline,再只修改一个 section。第一次进入会产出论文 `.tex` 的路径时,如果 `paper_template_root` 为空,必须先问一次:继续使用默认 LaTeX scaffold,还是先接入模板目录。"
113
113
  ),
114
114
  };
115
115
 
@@ -291,8 +291,10 @@ const ZH_SKILL_FILES = {
291
291
  ## 必要输出
292
292
 
293
293
  - 方法概述
294
+ - 选定指标摘要
294
295
  - 实验设置
295
296
  - 已验证主结果
297
+ - 位于 \`<deliverables_root>/main-tables.md\` 的受管主表工件
296
298
  - 消融
297
299
  - 失败尝试
298
300
  - 局限性
@@ -317,13 +319,15 @@ const ZH_SKILL_FILES = {
317
319
  - 每个主要 claim 都要指向已记录的 summary 或 iteration artifact。
318
320
  - 主表结构、gate 和最终结果 framing 必须对齐已批准的评估协议。
319
321
  - 不要凭记忆重述指标定义、baseline 行为或对比方法实现;直接引用评估协议里记录的来源。
322
+ - 必须把已批准的主指标、次级指标和必要终局证据明确写进 \`report.md\` 与受管的 \`main-tables.md\`。
320
323
  - 如果报告依赖了对原始指标或原始实现的偏差,必须明确写出这个偏差。
324
+ - 如果 workflow language 是中文,\`report.md\` 和 \`<deliverables_root>/main-tables.md\` 也应使用中文,除非文件路径、代码标识符或字面指标名必须保持原样。
321
325
  - 解释优先保守,不要写成营销文案。
322
326
  - 要给 \`/lab:write\` 留下清晰 handoff,尤其是 section draft 可以直接引用的证据链接。
323
327
 
324
328
  ## 交互约束
325
329
 
326
- - 开始前先简洁说明:campaign outcome、最强已支撑 claim、最大的报告风险。
330
+ - 开始前先简洁说明:campaign outcome、选定的主指标和次级指标、最强已支撑 claim、最大的报告风险。
327
331
  - 如果某个未决前提会改变报告解释,一次只问一个问题。
328
332
  - 如果存在多种报告 framing,先给 2-3 个方案、trade-offs 和推荐项,优先最忠于证据的 framing。
329
333
  - 如果某种 framing 会实质影响后续论文 claim,要保留 approval gate。
@@ -679,27 +683,78 @@ const ZH_SKILL_FILES = {
679
683
  - 方差和显著性问题是否交代清楚?
680
684
  `,
681
685
  [path.join(".lab", ".managed", "templates", "final-report.md")]:
682
- `# Final Report
686
+ `# 最终报告
683
687
 
684
688
  ## 目标
685
689
 
686
690
  - 本轮研究目标:
687
691
  - 是否达标:
688
692
 
693
+ ## 选定指标
694
+
695
+ - 主指标:
696
+ - 次级指标:
697
+ - 必要终局证据:
698
+
699
+ ## 主表工件
700
+
701
+ - 受管主表路径:\`<deliverables_root>/main-tables.md\`
702
+ - 最终表现摘要:
703
+ - 主表覆盖情况:
704
+
689
705
  ## 主要结果
690
706
 
691
- - Main finding 1:
692
- - Main finding 2:
707
+ - 主要发现 1
708
+ - 主要发现 2
693
709
 
694
710
  ## 失败尝试与局限
695
711
 
696
- - Failed attempt:
697
- - Limitation:
712
+ - 失败尝试:
713
+ - 局限:
698
714
 
699
715
  ## 仍需加强的 claims
700
716
 
701
- - Claim:
702
- - Missing support:
717
+ - Claim
718
+ - 缺失支持:
719
+ `,
720
+ [path.join(".lab", ".managed", "templates", "main-tables.md")]:
721
+ `# 主表工件
722
+
723
+ ## 选定指标
724
+
725
+ - 主指标:
726
+ - 次级指标:
727
+ - 必要终局证据:
728
+
729
+ ## 最终表现摘要
730
+
731
+ - 主要结果摘要:
732
+ - 最重要数字:
733
+ - 报告边界:
734
+
735
+ ## Table 1
736
+
737
+ - 作用:
738
+ - 使用指标:
739
+ - 最强支撑 claim:
740
+
741
+ ## Table 2
742
+
743
+ - 作用:
744
+ - 使用指标:
745
+ - 最强支撑 claim:
746
+
747
+ ## Table 3
748
+
749
+ - 作用:
750
+ - 使用指标:
751
+ - 最强支撑 claim:
752
+
753
+ ## Table 4
754
+
755
+ - 作用:
756
+ - 使用指标:
757
+ - 最强支撑 claim:
703
758
  `,
704
759
  [path.join(".lab", ".managed", "templates", "paper-plan.md")]:
705
760
  `# 论文计划
@@ -829,7 +884,9 @@ const ZH_SKILL_FILES = {
829
884
  "results_root": "results",
830
885
  "figures_root": "figures",
831
886
  "deliverables_root": "docs/research",
832
- "paper_template_root": ""
887
+ "paper_template_root": "",
888
+ "paper_template_decision": "unconfirmed",
889
+ "paper_template_final_reminder_acknowledged": false
833
890
  }`,
834
891
  [path.join(".lab", "context", "mission.md")]:
835
892
  `# 研究主线
@@ -995,30 +1052,33 @@ const ZH_SKILL_FILES = {
995
1052
 
996
1053
  ## 目标
997
1054
 
998
- - Objective:
999
- - Experiment ladder:
1000
- - Metric glossary:
1001
- - Metric source papers:
1002
- - Metric implementation source:
1003
- - Comparison source papers:
1004
- - Comparison implementation source:
1005
- - Deviation from original implementation:
1006
- - Terminal goal type:
1007
- - Terminal goal target:
1008
- - Required terminal artifact:
1055
+ - 目标:
1056
+ - 主指标:
1057
+ - 次级指标:
1058
+ - 必要终局证据:
1059
+ - 实验阶梯:
1060
+ - 指标释义:
1061
+ - 指标来源论文:
1062
+ - 指标实现来源:
1063
+ - 对比方法来源论文:
1064
+ - 对比方法实现来源:
1065
+ - 与原始实现的偏差:
1066
+ - 终止目标类型:
1067
+ - 终止目标目标值:
1068
+ - 必要终止工件:
1009
1069
 
1010
1070
  ## 结果
1011
1071
 
1012
- - Status: idle
1013
- - Goal reached: no
1014
- - Stop reason:
1015
- - Promotion applied: no
1016
- - Final artifact:
1017
- - Final rung:
1018
- - Executed stages:
1019
- - Iterations completed: 0
1020
- - Started at:
1021
- - Finished at:
1072
+ - 状态: idle
1073
+ - 目标是否达成:
1074
+ - 停止原因:
1075
+ - 是否已升格:
1076
+ - 最终工件:
1077
+ - 最终 rung:
1078
+ - 已执行阶段:
1079
+ - 已完成迭代数: 0
1080
+ - 开始时间:
1081
+ - 结束时间:
1022
1082
  `,
1023
1083
  [path.join(".lab", "context", "auto-status.md")]:
1024
1084
  `# 自动模式状态
@@ -1299,8 +1359,15 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "write.md")] = `# \`/l
1299
1359
  - 最终稿必须是 LaTeX。
1300
1360
  - 如果配置了 \`paper_template_root\`,先检查该模板目录,再按其结构起草论文。
1301
1361
  - 已接入的模板目录可能包含用户或上游修改,默认不要改模板文件。
1302
- - 如果没有配置模板,就使用交付目录下的默认 LaTeX scaffold
1362
+ - 如果没有配置模板且 \`paper_template_decision\` 是 \`unconfirmed\`,在第一次起草 \`.tex\` 之前必须先追问一次:继续使用默认 LaTeX scaffold,还是先接入模板目录。
1363
+ - 如果用户选择默认 scaffold,就把该决定持久化到 \`.lab/config/workflow.json\`,写成 \`paper_template_decision: default-scaffold\`。
1364
+ - 如果用户选择接入模板,就停止当前写作回合,先转到 \`superlab paper attach-template --path <dir>\`。
1365
+ - 如果 \`paper_template_decision\` 已经是 \`default-scaffold\`,就使用交付目录下的默认 LaTeX scaffold。
1366
+ - 如果当前是最终导出或最终定稿轮次、\`paper_template_root\` 仍为空、\`paper_template_decision\` 是 \`default-scaffold\`,且 \`paper_template_final_reminder_acknowledged\` 是 \`false\`,就在最终定稿前再提醒一次是否切到模板。
1367
+ - 如果用户在最终提醒里仍确认继续使用默认 scaffold,就把 \`paper_template_final_reminder_acknowledged\` 持久化为 \`true\`。
1303
1368
  - 只加载当前 section guide,不要一次加载全部章节参考。
1369
+ - 如果当前 section 是 \`abstract\`、\`introduction\` 或 \`method\`,还必须继续读取本地 example bank:\`references/paper-writing/examples/index.md\`、对应的 examples index,以及 1-2 个具体 example 文件。
1370
+ - 例子只能复用结构、段落角色和句法逻辑,不能直接复用原句。
1304
1371
  - 先写 mini-outline 再写 prose。
1305
1372
  - 如果缺少 framing artifact,不要继续写作,直接回到 \`/lab:framing\`。
1306
1373
  - 如果某个 claim 没有证据支撑,就削弱或删除。
@@ -1949,6 +2016,12 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "auto.md")] = `# \`/la
1949
2016
  - 先做输入归一化:把 \`Autonomy level L1/L2/L3\` 视为执行权限级别,把 \`Layer 3\`、\`Phase 1\`、\`Table 2\` 视为论文范围目标。
1950
2017
  - 如果用户同时提了论文层、实验 phase 和自治级别,先用一句话重述:objective、自治级别、terminal goal、scope、allowed modifications。
1951
2018
  - 如果 workflow language 是中文,摘要、清单条目、任务标签和进度更新都应使用中文,除非文件路径、代码标识符或字面指标名必须保持原样。
2019
+ - 当循环即将进入 \`write\`,且 \`paper_template_root\` 为空时:
2020
+ - 如果 \`paper_template_decision\` 是 \`unconfirmed\`,必须先追问一次:继续使用默认 scaffold,还是先接入模板目录
2021
+ - 如果用户选择默认 scaffold,就持久化 \`paper_template_decision: default-scaffold\`
2022
+ - 如果用户选择模板,就停止当前循环并转到 \`superlab paper attach-template --path <dir>\`
2023
+ - 如果当前是最终导出或最终定稿、\`paper_template_decision\` 是 \`default-scaffold\`,且 \`paper_template_final_reminder_acknowledged\` 是 \`false\`,就在最终定稿前再提醒一次
2024
+ - 如果用户在最终提醒里仍确认继续使用默认 scaffold,就持久化 \`paper_template_final_reminder_acknowledged: true\`
1952
2025
  - 不要把 \`sleep 30\`、单次 \`pgrep\` 或一次性的 \`metrics.json\` 探针当成 rung 主命令;这些只能算进度检查。
1953
2026
  - 当真实实验进程还活着时,只允许发进度更新并继续等待,不能把这一 rung 当作已经完成。
1954
2027
  `;