superlab 0.1.60 → 0.1.62
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/README.md +3 -2
- package/lib/auto_runner.cjs +11 -1
- package/lib/auto_state.cjs +27 -0
- package/lib/i18n.cjs +84 -3
- package/lib/install.cjs +44 -0
- package/lib/lab_write_contract.json +4 -4
- package/lib/rule_preflight.cjs +52 -0
- package/package-assets/claude/commands/lab/write.md +1 -1
- package/package-assets/claude/commands/lab-write.md +1 -1
- package/package-assets/claude/commands/lab:write.md +1 -1
- package/package-assets/claude/commands/lab/357/274/232write.md +1 -1
- package/package-assets/codex/prompts/lab/write.md +1 -1
- package/package-assets/codex/prompts/lab-write.md +1 -1
- package/package-assets/codex/prompts/lab:write.md +1 -1
- package/package-assets/codex/prompts/lab/357/274/232write.md +1 -1
- package/package-assets/shared/lab/.managed/scripts/validate_manuscript_delivery.py +19 -0
- package/package-assets/shared/lab/.managed/scripts/validate_section_draft.py +119 -0
- package/package-assets/shared/lab/.managed/templates/iteration-report.md +10 -0
- package/package-assets/shared/lab/.managed/templates/write-iteration.md +11 -0
- package/package-assets/shared/lab/context/auto-status.md +10 -0
- package/package-assets/shared/skills/lab/SKILL.md +16 -2
- package/package-assets/shared/skills/lab/stages/auto.md +8 -0
- package/package-assets/shared/skills/lab/stages/write.md +22 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -329,8 +329,9 @@ If the user approves the default scaffold, persist that choice in `.lab/config/w
|
|
|
329
329
|
Ordinary manuscript drafting rounds should follow `workflow_language`.
|
|
330
330
|
If `workflow_language` and `paper_language` differ, `/lab:write` should preserve a full workflow-language paper layer first, then the first final-draft or export round should ask once whether to keep the draft language or convert the canonical manuscript to `paper_language`, then persist that decision.
|
|
331
331
|
The workflow-language paper layer is a real LaTeX mirror of the paper, not a review layer, and should stay persisted until it is explicitly refreshed.
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
When `workflow_language` and `paper_language` differ, ordinary `/lab:write` rounds should treat the workflow-language paper layer as the default working layer. Do not silently refresh both the canonical manuscript and the workflow-language paper layer on the same round unless the user explicitly asked for cross-language synchronization or the final-draft/export language-finalization step requires it.
|
|
333
|
+
Canonical-manuscript drafting is still allowed, but if workflow-language is active then canonical-only writing should record why that exception was acceptable in the latest write iteration artifact.
|
|
334
|
+
If `paper_language_finalization_decision=convert-to-paper-language`, canonical manuscript work may proceed in `paper_language` during explicit canonical or finalization rounds, but that does not make canonical the default next step while workflow-language remains active.
|
|
334
335
|
For export or remote-publication rounds, if `paper_language_finalization_decision=convert-to-paper-language`, the exported or pushed bundle should include the persisted workflow-language paper layer by default.
|
|
335
336
|
Canonical-only export is acceptable only when the user explicitly asked for it or when the remote target forbids extra files, and that justification should be recorded in the latest write iteration artifact.
|
|
336
337
|
Paper-facing tables must be locally interpretable: readers should be able to recover row meaning, column meaning, metric direction, and any relevant denominator or unit from the table title, note, and adjacent prose without chasing the Method section. Short headers are allowed, but abbreviations must be expanded locally in the same table.
|
package/lib/auto_runner.cjs
CHANGED
|
@@ -40,6 +40,7 @@ const {
|
|
|
40
40
|
writeAutoOutcome,
|
|
41
41
|
writeAutoStatus,
|
|
42
42
|
} = require("./auto_state.cjs");
|
|
43
|
+
const { buildRulePreflight } = require("./rule_preflight.cjs");
|
|
43
44
|
|
|
44
45
|
function normalizeTransition(value) {
|
|
45
46
|
return (value || "").trim();
|
|
@@ -220,7 +221,7 @@ function buildRolledOverAutoMode(mode, requested, now) {
|
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
function rolloverAutoCampaign({ targetDir, mode, status, ledger, requested, lang, now }) {
|
|
224
|
+
function rolloverAutoCampaign({ targetDir, mode, status, ledger, requested, lang, now, rulePreflight = null }) {
|
|
224
225
|
const newMode = buildRolledOverAutoMode(mode, requested, now);
|
|
225
226
|
const archivedPaths = [
|
|
226
227
|
archiveAutoArtifact(targetDir, path.join(".lab", "context", "auto-mode.md"), mode.campaignId || "auto-campaign", now),
|
|
@@ -250,6 +251,7 @@ function rolloverAutoCampaign({ targetDir, mode, status, ledger, requested, lang
|
|
|
250
251
|
writeAutoStatus(
|
|
251
252
|
targetDir,
|
|
252
253
|
{
|
|
254
|
+
...(rulePreflight || {}),
|
|
253
255
|
status: "idle",
|
|
254
256
|
currentStage: "",
|
|
255
257
|
currentCommand: "",
|
|
@@ -488,6 +490,12 @@ async function startAutoMode({ targetDir, now = new Date(), requestedContract =
|
|
|
488
490
|
const mode = parseAutoMode(targetDir);
|
|
489
491
|
const existingStatus = parseAutoStatus(targetDir);
|
|
490
492
|
const existingLedger = parseAutoLedger(targetDir);
|
|
493
|
+
const autoRulePreflight = buildRulePreflight({
|
|
494
|
+
targetDir,
|
|
495
|
+
stage: "auto",
|
|
496
|
+
mode: "execution",
|
|
497
|
+
target: "bounded auto campaign runtime",
|
|
498
|
+
});
|
|
491
499
|
const evalProtocol = parseEvalProtocol(targetDir);
|
|
492
500
|
const lang = readWorkflowLanguage(targetDir);
|
|
493
501
|
const missingSchemaFields = listMissingCurrentAutoModeFields(mode);
|
|
@@ -522,6 +530,7 @@ async function startAutoMode({ targetDir, now = new Date(), requestedContract =
|
|
|
522
530
|
requested: normalizedRequest,
|
|
523
531
|
lang,
|
|
524
532
|
now,
|
|
533
|
+
rulePreflight: autoRulePreflight,
|
|
525
534
|
});
|
|
526
535
|
throw new Error(
|
|
527
536
|
`current auto contract does not fit the requested campaign and was rolled over to a new draft (${newMode.campaignId}); archived old campaign files: ${archivedPaths.join(", ")}; fill the new contract fields and approve it before starting auto mode`
|
|
@@ -557,6 +566,7 @@ async function startAutoMode({ targetDir, now = new Date(), requestedContract =
|
|
|
557
566
|
|
|
558
567
|
const timestamp = now.toISOString();
|
|
559
568
|
const status = {
|
|
569
|
+
...autoRulePreflight,
|
|
560
570
|
status: "running",
|
|
561
571
|
currentStage: resumePlan?.stage || mode.allowedStages[0] || "run",
|
|
562
572
|
currentCommand: "",
|
package/lib/auto_state.cjs
CHANGED
|
@@ -93,6 +93,13 @@ function parseAutoStatus(targetDir) {
|
|
|
93
93
|
return {
|
|
94
94
|
path: contextFile(targetDir, "auto-status.md"),
|
|
95
95
|
text,
|
|
96
|
+
ruleSourceFile: extractValue(text, ["Rule source file", "规则来源文件"]),
|
|
97
|
+
ruleSourceRevision: extractValue(text, ["Rule source revision", "规则来源修订"]),
|
|
98
|
+
projectVersion: extractValue(text, ["Project version", "项目版本"]),
|
|
99
|
+
resolvedStage: extractValue(text, ["Resolved stage", "解析后的阶段"]),
|
|
100
|
+
resolvedMode: extractValue(text, ["Resolved mode", "解析后的模式"]),
|
|
101
|
+
resolvedTarget: extractValue(text, ["Resolved target", "解析后的目标"]),
|
|
102
|
+
overrideReason: extractValue(text, ["Override reason, if any", "如有覆盖理由"]),
|
|
96
103
|
status: extractValue(text, ["Status", "状态"]),
|
|
97
104
|
currentStage: extractValue(text, ["Current stage", "当前阶段"]),
|
|
98
105
|
currentCommand: extractValue(text, ["Current command", "当前命令"]),
|
|
@@ -140,6 +147,16 @@ function renderAutoStatus(status, { lang = "en" } = {}) {
|
|
|
140
147
|
if (lang === "zh") {
|
|
141
148
|
return `# 自动模式状态
|
|
142
149
|
|
|
150
|
+
## 规则预检
|
|
151
|
+
|
|
152
|
+
- 规则来源文件: ${status.ruleSourceFile || ""}
|
|
153
|
+
- 规则来源修订: ${status.ruleSourceRevision || ""}
|
|
154
|
+
- 项目版本: ${status.projectVersion || ""}
|
|
155
|
+
- 解析后的阶段: ${status.resolvedStage || ""}
|
|
156
|
+
- 解析后的模式: ${status.resolvedMode || ""}
|
|
157
|
+
- 解析后的目标: ${status.resolvedTarget || ""}
|
|
158
|
+
- 如有覆盖理由: ${status.overrideReason || ""}
|
|
159
|
+
|
|
143
160
|
## 运行状态
|
|
144
161
|
|
|
145
162
|
- 状态: ${status.status || "idle"}
|
|
@@ -169,6 +186,16 @@ function renderAutoStatus(status, { lang = "en" } = {}) {
|
|
|
169
186
|
|
|
170
187
|
return `# Auto Mode Status
|
|
171
188
|
|
|
189
|
+
## Rule Preflight
|
|
190
|
+
|
|
191
|
+
- Rule source file: ${status.ruleSourceFile || ""}
|
|
192
|
+
- Rule source revision: ${status.ruleSourceRevision || ""}
|
|
193
|
+
- Project version: ${status.projectVersion || ""}
|
|
194
|
+
- Resolved stage: ${status.resolvedStage || ""}
|
|
195
|
+
- Resolved mode: ${status.resolvedMode || ""}
|
|
196
|
+
- Resolved target: ${status.resolvedTarget || ""}
|
|
197
|
+
- Override reason, if any: ${status.overrideReason || ""}
|
|
198
|
+
|
|
172
199
|
## Runtime State
|
|
173
200
|
|
|
174
201
|
- Status: ${status.status || "idle"}
|
package/lib/i18n.cjs
CHANGED
|
@@ -260,6 +260,7 @@ const ZH_SKILL_FILES = {
|
|
|
260
260
|
- \`.lab/context/mission.md\`
|
|
261
261
|
- \`.lab/context/decisions.md\`
|
|
262
262
|
- \`.lab/context/evidence-index.md\`
|
|
263
|
+
- \`.lab/.managed/rule-manifest.json\`
|
|
263
264
|
|
|
264
265
|
## 上下文写回
|
|
265
266
|
|
|
@@ -890,6 +891,16 @@ const ZH_SKILL_FILES = {
|
|
|
890
891
|
[path.join(".lab", ".managed", "templates", "iteration-report.md")]:
|
|
891
892
|
`# 迭代报告
|
|
892
893
|
|
|
894
|
+
## 规则预检
|
|
895
|
+
|
|
896
|
+
- Rule source file:
|
|
897
|
+
- Rule source revision:
|
|
898
|
+
- Project version:
|
|
899
|
+
- Resolved stage:
|
|
900
|
+
- Resolved mode:
|
|
901
|
+
- Resolved target:
|
|
902
|
+
- Override reason, if any:
|
|
903
|
+
|
|
893
904
|
## 轮次
|
|
894
905
|
|
|
895
906
|
- 迭代编号:
|
|
@@ -1336,6 +1347,16 @@ const ZH_SKILL_FILES = {
|
|
|
1336
1347
|
[path.join(".lab", ".managed", "templates", "write-iteration.md")]:
|
|
1337
1348
|
`# 写作迭代
|
|
1338
1349
|
|
|
1350
|
+
## 规则预检
|
|
1351
|
+
|
|
1352
|
+
- Rule source file:
|
|
1353
|
+
- Rule source revision:
|
|
1354
|
+
- Project version:
|
|
1355
|
+
- Resolved stage:
|
|
1356
|
+
- Resolved mode:
|
|
1357
|
+
- Resolved target:
|
|
1358
|
+
- Override reason, if any:
|
|
1359
|
+
|
|
1339
1360
|
## 轮次
|
|
1340
1361
|
|
|
1341
1362
|
- Iteration number:
|
|
@@ -1375,6 +1396,33 @@ const ZH_SKILL_FILES = {
|
|
|
1375
1396
|
- Did any alias drift remain unresolved:
|
|
1376
1397
|
- Remaining reader-facing jargon risk:
|
|
1377
1398
|
|
|
1399
|
+
## Section Acceptance Gate
|
|
1400
|
+
|
|
1401
|
+
- Canonical naming consistency passed:
|
|
1402
|
+
- Adjacent-section consistency passed:
|
|
1403
|
+
- Claim / metric / ranking consistency with evidence passed:
|
|
1404
|
+
- Section-style compliance passed:
|
|
1405
|
+
- Local clarity passed:
|
|
1406
|
+
- Local concision passed:
|
|
1407
|
+
- If any item failed, what blocks further prose polish:
|
|
1408
|
+
|
|
1409
|
+
## Section Style Policy
|
|
1410
|
+
|
|
1411
|
+
- Section-style policy checked:
|
|
1412
|
+
- Any discouraged move kept and why:
|
|
1413
|
+
- Any banned move found:
|
|
1414
|
+
|
|
1415
|
+
## Table Semantics
|
|
1416
|
+
|
|
1417
|
+
- Metrics promised in Method:
|
|
1418
|
+
- Metrics shown in main tables:
|
|
1419
|
+
- Any omitted metric and why:
|
|
1420
|
+
- Were all abbreviations expanded at local first mention:
|
|
1421
|
+
- Did each main table include a local table note:
|
|
1422
|
+
- Can a reader interpret rows and columns without chasing Method:
|
|
1423
|
+
- If this section used canonical short names before their defining section, was a local naming bridge added:
|
|
1424
|
+
- Did model and ablation labels stay canonical instead of drifting into narrative aliases:
|
|
1425
|
+
|
|
1378
1426
|
## Language Decision
|
|
1379
1427
|
|
|
1380
1428
|
- Workflow language:
|
|
@@ -1729,6 +1777,16 @@ const ZH_SKILL_FILES = {
|
|
|
1729
1777
|
[path.join(".lab", "context", "auto-status.md")]:
|
|
1730
1778
|
`# 自动模式状态
|
|
1731
1779
|
|
|
1780
|
+
## 规则预检
|
|
1781
|
+
|
|
1782
|
+
- Rule source file:
|
|
1783
|
+
- Rule source revision:
|
|
1784
|
+
- Project version:
|
|
1785
|
+
- Resolved stage:
|
|
1786
|
+
- Resolved mode:
|
|
1787
|
+
- Resolved target:
|
|
1788
|
+
- Override reason, if any:
|
|
1789
|
+
|
|
1732
1790
|
## 运行状态
|
|
1733
1791
|
|
|
1734
1792
|
- Status: idle
|
|
@@ -2021,14 +2079,23 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "write.md")] = `# \`/l
|
|
|
2021
2079
|
- \`.lab/context/workflow-state.md\`
|
|
2022
2080
|
- \`.lab/context/evidence-index.md\`
|
|
2023
2081
|
|
|
2082
|
+
## 规则预检
|
|
2083
|
+
|
|
2084
|
+
- 起草前先读取 \`.lab/.managed/rule-manifest.json\`。
|
|
2085
|
+
- 在 write iteration artifact 里先写 \`Rule Preflight\`,再改 prose。
|
|
2086
|
+
- \`Rule Preflight\` 至少记录:Rule source file、Rule source revision、Project version、Resolved stage、Resolved mode、Resolved target,以及任何 override reason。
|
|
2087
|
+
- 如果已安装的 write 规则和当前轮次行为不一致,就先修正目标层或补充有效 override 理由,再继续编辑。
|
|
2088
|
+
|
|
2024
2089
|
## 小步写作规则
|
|
2025
2090
|
|
|
2026
2091
|
- 每轮只改一个 section 或一个明确子问题。
|
|
2027
2092
|
- 最终稿必须是 LaTeX。
|
|
2028
2093
|
- 普通起草轮次先跟随 \`workflow_language\`。
|
|
2029
|
-
-
|
|
2094
|
+
- 当 \`workflow_language\` 与 \`paper_language\` 不一致时,把 workflow-language 论文层当成普通写作轮次的默认工作层。
|
|
2095
|
+
- 普通写作轮次仍然只改一个目标层,不要静默同时刷新两种语言层。
|
|
2030
2096
|
- 如果用户明确点名了某个文件或层级,就把它当成当前轮次唯一目标,除非用户另外明确要求同步。
|
|
2031
|
-
- 如果
|
|
2097
|
+
- 如果 workflow-language 论文层现役而本轮仍然写 canonical manuscript,必须在 write iteration artifact 里说明为什么这次 canonical-only 写作是合理的。
|
|
2098
|
+
- 如果 \`paper_language_finalization_decision=convert-to-paper-language\`,显式的 canonical manuscript 工作可以直接落在 \`paper_language\`,但这并不意味着只要 workflow-language 仍然现役,canonical 就变成普通轮次的默认工作层。
|
|
2032
2099
|
- 把 workflow-language 论文层当成正式持久化产物,而不是 review 层。
|
|
2033
2100
|
- workflow-language 层必须是一套完整的 LaTeX 镜像,至少包含 \`workflow-language/main.tex\`、\`workflow-language/references.bib\`、\`workflow-language/sections/*.tex\`、\`workflow-language/tables/*.tex\`、\`workflow-language/figures/*.tex\` 和 \`workflow-language/analysis/analysis-asset.tex\`。
|
|
2034
2101
|
- 不要再把新的 workflow-language 输出写到已经废弃的 review 层路径,例如 \`docs/lab/paper/review_zh/\`。
|
|
@@ -2323,6 +2390,10 @@ description: 严格研究工作流,覆盖 idea、data、auto、framing、spec
|
|
|
2323
2390
|
- 如果某个 stage 会决定后续方向,就要保留明确的 approval gate。
|
|
2324
2391
|
- 使用 \`.lab/config/workflow.json\` 作为全局约束,统一管理 workflow language、paper language、paper format、results_root、figures_root、deliverables_root、paper_template_root 和 paper-language 的最终定稿决定。
|
|
2325
2392
|
- 工作流中间工件默认跟随安装语言。
|
|
2393
|
+
- 每个 \`/lab:*\` stage 开始前,都要先读取 \`.lab/.managed/rule-manifest.json\` 并完成一段 \`Rule Preflight\`。
|
|
2394
|
+
- 每个 stage round 的受管工件都要先记录:Rule source file、Rule source revision、Project version、Resolved stage、Resolved mode、Resolved target,以及任何 override reason。
|
|
2395
|
+
- 如果 \`Rule Preflight\` 缺失、过期或和实际行为冲突,就把它视为 stage-contract failure,而不是继续润色或继续推进。
|
|
2396
|
+
- 项目里已安装的规则优先于模型记忆;如果记忆里的旧做法和 \`.lab/.managed/rule-manifest.json\` 记录的规则冲突,以项目里安装的规则为准。
|
|
2326
2397
|
- 最终论文默认输出为 LaTeX,论文语言与工作流语言分开决定。
|
|
2327
2398
|
- 区分“来源事实”和“模型假设”。
|
|
2328
2399
|
- 保留失败实验、失败想法和局限性。
|
|
@@ -2800,6 +2871,14 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "auto.md")] = `# \`/la
|
|
|
2800
2871
|
- \`.lab/context/auto-mode.md\`
|
|
2801
2872
|
- \`.lab/context/auto-status.md\`
|
|
2802
2873
|
- \`.lab/context/auto-outcome.md\`
|
|
2874
|
+
- \`.lab/.managed/rule-manifest.json\`
|
|
2875
|
+
|
|
2876
|
+
## 规则预检
|
|
2877
|
+
|
|
2878
|
+
- 启动 auto 前先读取 \`.lab/.managed/rule-manifest.json\`。
|
|
2879
|
+
- 可见的 \`Auto preflight\` 块里除了契约字段外,还要写明:Rule source file、Rule source revision、Project version、Resolved stage、Resolved mode、Resolved target,以及任何 override reason。
|
|
2880
|
+
- 这些 \`Rule Preflight\` 字段也要保存在 \`.lab/context/auto-status.md\`。
|
|
2881
|
+
- 如果已安装的 auto 规则和当前 campaign 行为不一致,就先修正契约或补充有效 override 理由,再启动 loop。
|
|
2803
2882
|
|
|
2804
2883
|
## 上下文写回
|
|
2805
2884
|
|
|
@@ -2899,8 +2978,10 @@ ZH_CONTENT[path.join(".codex", "skills", "lab", "stages", "auto.md")] = `# \`/la
|
|
|
2899
2978
|
- 如果用户在最终提醒里仍确认继续使用默认 scaffold,就持久化 \`paper_template_final_reminder_acknowledged: true\`
|
|
2900
2979
|
- 普通 \`write\` 起草轮次先跟随 \`workflow_language\`。
|
|
2901
2980
|
- 普通 \`write\` 起草轮次里的 manuscript 仍然是 LaTeX,所以普通 manuscript \`.tex\` sections 也必须先保留在 \`workflow_language\`,还不是 \`paper_language\` 版本。
|
|
2902
|
-
-
|
|
2981
|
+
- 当 \`workflow_language\` 与 \`paper_language\` 不一致时,把 workflow-language 论文层当成普通写作轮次的默认工作层。
|
|
2982
|
+
- 普通写作轮次仍然只改一个目标层,不要在没有明确要求的情况下同时刷新 canonical manuscript 和 workflow-language 论文层。
|
|
2903
2983
|
- 把 workflow-language 论文层当成正式持久化产物,而不是 review 层。
|
|
2984
|
+
- 如果 workflow-language 论文层现役而本轮仍然写 canonical manuscript,必须在最新 write iteration 里说明为什么这次 canonical-only 写作是合理的。
|
|
2904
2985
|
- 如果当前写作目标是最终导出、\`workflow_language\` 与 \`paper_language\` 不一致,且 \`paper_language_finalization_decision\` 还是 \`unconfirmed\`,就在最终定稿前先完成并保留 workflow-language 论文层,再追问一次:保持当前 workflow language,还是转换成 \`paper_language\`
|
|
2905
2986
|
- 如果用户选择保持当前语言,就持久化 \`paper_language_finalization_decision: keep-workflow-language\`
|
|
2906
2987
|
- 如果用户选择转换,就持久化 \`paper_language_finalization_decision: convert-to-paper-language\`
|
package/lib/install.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require("node:fs");
|
|
2
2
|
const os = require("node:os");
|
|
3
3
|
const path = require("node:path");
|
|
4
|
+
const crypto = require("node:crypto");
|
|
4
5
|
const { CURRENT_AUTO_MODE_MIGRATION_FIELDS } = require("./auto_state.cjs");
|
|
5
6
|
const { getLocalizedContent } = require("./i18n.cjs");
|
|
6
7
|
|
|
@@ -307,6 +308,10 @@ function installMetadataPath(targetDir) {
|
|
|
307
308
|
return path.join(targetDir, ".lab", ".managed", "install.json");
|
|
308
309
|
}
|
|
309
310
|
|
|
311
|
+
function ruleManifestPath(targetDir) {
|
|
312
|
+
return path.join(targetDir, ".lab", ".managed", "rule-manifest.json");
|
|
313
|
+
}
|
|
314
|
+
|
|
310
315
|
function ensureParentDir(filePath) {
|
|
311
316
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
312
317
|
}
|
|
@@ -317,6 +322,44 @@ function writeProjectInstallMetadata(targetDir, metadata) {
|
|
|
317
322
|
fs.writeFileSync(filePath, JSON.stringify(metadata, null, 2) + "\n");
|
|
318
323
|
}
|
|
319
324
|
|
|
325
|
+
function sha256(content) {
|
|
326
|
+
return crypto.createHash("sha256").update(content).digest("hex");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function buildRuleManifest(targetDir, metadata) {
|
|
330
|
+
const stages = Object.fromEntries(
|
|
331
|
+
LAB_STAGE_NAMES.map((stage) => {
|
|
332
|
+
const ruleSourceFile = path.join(".codex", "skills", "lab", "stages", `${stage}.md`);
|
|
333
|
+
const absoluteRuleSourceFile = path.join(targetDir, ruleSourceFile);
|
|
334
|
+
let ruleSourceRevision = "";
|
|
335
|
+
if (fs.existsSync(absoluteRuleSourceFile)) {
|
|
336
|
+
ruleSourceRevision = sha256(fs.readFileSync(absoluteRuleSourceFile, "utf8"));
|
|
337
|
+
}
|
|
338
|
+
return [
|
|
339
|
+
stage,
|
|
340
|
+
{
|
|
341
|
+
rule_source_file: ruleSourceFile.replace(/\\/g, "/"),
|
|
342
|
+
rule_source_revision: ruleSourceRevision,
|
|
343
|
+
},
|
|
344
|
+
];
|
|
345
|
+
})
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
return {
|
|
349
|
+
package_version: metadata.package_version,
|
|
350
|
+
layout_version: metadata.layout_version,
|
|
351
|
+
generated_at: metadata.updated_at,
|
|
352
|
+
lab_skill_source_file: ".codex/skills/lab/SKILL.md",
|
|
353
|
+
stages,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function writeRuleManifest(targetDir, metadata) {
|
|
358
|
+
const filePath = ruleManifestPath(targetDir);
|
|
359
|
+
ensureParentDir(filePath);
|
|
360
|
+
fs.writeFileSync(filePath, JSON.stringify(buildRuleManifest(targetDir, metadata), null, 2) + "\n");
|
|
361
|
+
}
|
|
362
|
+
|
|
320
363
|
function readProjectInstallMetadata(targetDir) {
|
|
321
364
|
const filePath = installMetadataPath(targetDir);
|
|
322
365
|
if (!fs.existsSync(filePath)) {
|
|
@@ -732,6 +775,7 @@ function installSuperlab({
|
|
|
732
775
|
updated_at: new Date().toISOString(),
|
|
733
776
|
};
|
|
734
777
|
writeProjectInstallMetadata(targetDir, metadata);
|
|
778
|
+
writeRuleManifest(targetDir, metadata);
|
|
735
779
|
if (registerProject) {
|
|
736
780
|
registerProjectInstall(targetDir, metadata, { env });
|
|
737
781
|
}
|
|
@@ -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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. Ordinary write rounds should edit one target paper layer
|
|
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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. Ordinary write rounds should edit one target paper layer
|
|
5
|
-
"codex_zh": "本命令运行 `/lab:write` 阶段。把 `.codex/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference、`section-style-policies.md` 里与当前 section 对应的风格块,以及 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`,普通 `.tex` section 草稿也必须先停留在 `workflow_language`,不能把 `paper_language` 当成默认草稿语言,并把 workflow-language 论文层当成正式持久化产物,而不是 review
|
|
6
|
-
"claude_zh": "本命令运行 lab workflow 的 `write` 阶段。把 `.claude/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference、`section-style-policies.md` 里与当前 section 对应的风格块,以及 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`,普通 `.tex` section 草稿也必须先停留在 `workflow_language`,不能把 `paper_language` 当成默认草稿语言,并把 workflow-language 论文层当成正式持久化产物,而不是 review
|
|
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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. When `workflow_language` and `paper_language` differ, treat the workflow-language paper layer as the default ordinary working layer. Ordinary write rounds should still edit one target paper layer at a time rather than silently refreshing both language layers. If the user names a concrete file or layer, treat that as the only target for the round unless they also explicitly request synchronization. If a workflow-language paper layer is active and the round still targets the canonical manuscript, record why canonical-only writing was acceptable in the write iteration artifact. If `paper_language_finalization_decision=convert-to-paper-language`, explicit canonical-manuscript work may target the canonical `paper_language` manuscript, but that does not make canonical the default ordinary working layer while workflow-language remains active. Treat the workflow-language paper layer as a real persisted artifact rather than a review layer, and preserve it as a full LaTeX mirror with `workflow-language/main.tex`, `workflow-language/references.bib`, `workflow-language/sections/*.tex`, `workflow-language/tables/*.tex`, `workflow-language/figures/*.tex`, and `workflow-language/analysis/analysis-asset.tex`. Do not write new workflow-language output to deprecated review-layer paths such as `docs/lab/paper/review_zh/`. Maintain `.lab/writing/terminology-glossary.md` as the write-stage glossary for full forms, approved short forms, reader-facing explanations, and aliases. Apply the same academic readability standard in every language: when the round introduces or revises key terms, abbreviations, metrics, mechanism names, or system labels, use the full form first, define any short form at first mention, explain what the term is and why it matters here, keep one natural-language paper-facing name per concept, use natural-language full names in prose, do not use labels containing `_` or `-` in reader-facing prose, apply the same first-mention rule to table headers, table captions, table notes, and figure captions or labels, do not assume a fixed drafting order such as Method before Experiments, add a local naming bridge when a section uses canonical short names before their defining section has been drafted, and reuse the canonical label instead of replacing it with a narrative alias. Follow the current section's encouraged, discouraged, and banned expression lists from `section-style-policies.md`; section-specific banned expressions take priority over prose-polish goals. Before any additional tighten, compress, or polish pass on the same section, run a section-level acceptance gate first. That gate must explicitly confirm naming consistency, adjacent-section consistency, claim, metric, and ranking consistency with the current evidence, local clarity, local concision, and section-style compliance. If the round changes the paper's canonical experiment or evaluation protocol, treat that change as a canonical replacement unless the user explicitly scoped it as supplementary or appendix-only, run a paper-wide impact audit before more polishing, update the highest-impact stale sections and assets first, and do not default to translation/workflow-layer sync work unless the user explicitly asked for it or the language-finalization workflow requires it. Only edit both the canonical manuscript and the workflow-language paper layer in the same round when the user explicitly asks for cross-language synchronization or when a final-draft/export language-finalization step requires both layers to be refreshed together. Do not treat a routine tighten/compress/polish request as an instruction to sync the workflow-language companion. For export or remote-publication rounds, if `paper_language_finalization_decision=convert-to-paper-language`, include the workflow-language paper layer in the exported or pushed bundle by default. Allow canonical-only export or remote publication only when the user explicitly asked for it or when the remote target forbids extra files. If any gate item is unresolved, or if a banned expression or move from the current section policy remains, spend the round fixing that blocker instead of polishing sentences further, and do not default the next-step recommendation to another polish pass. Main tables must be locally self-contained: the title, header, note, and adjacent prose should tell the reader what each row and column means, the metric direction, and any relevant unit, denominator, or event condition. Short headers remain allowed, but abbreviations in paper-facing tables must be expanded locally in the same table. If Method or Experiments prose promises a metric family, the main table set must either expose those metrics directly or explicitly mark the missing ones as appendix-only and explain why. If a metric is measured but omitted because it is zero everywhere, redundant, or appendix-only, state that disposition explicitly in the table note instead of silently dropping it. Do not treat `\\resizebox{\\linewidth}{!}{...}` as the default way to fit a main table. Fit main tables by redesign first: shorten headers, move secondary metrics out of the main table, reduce or split columns, then adjust `\\tabcolsep` conservatively; only use `\\resizebox` as a last resort, keep width changes readable, and explain the width-control rationale locally in the same table note. Do not use `\\scriptsize` or `\\tiny` as the default main-table fit strategy. Keep internal identifiers out of reader-facing prose unless they are mapped once for the reader and then moved back out of prose, and record the terminology-clarity self-check, the section-level acceptance gate, section-style policy compliance, the protocol/scope impact audit, the export or remote bundle audit, the round target layer, any canonical-only justification while workflow-language was active, any cross-language sync justification, and the table-semantics audit in the write iteration artifact. 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, finish and preserve the workflow-language paper layer first, then ask once whether to keep the draft language or convert the canonical manuscript to `paper_language`, persist that answer, record both the language decision and the workflow-language paper-layer path 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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. When `workflow_language` and `paper_language` differ, treat the workflow-language paper layer as the default ordinary working layer. Ordinary write rounds should still edit one target paper layer at a time rather than silently refreshing both language layers. If the user names a concrete file or layer, treat that as the only target for the round unless they also explicitly request synchronization. If a workflow-language paper layer is active and the round still targets the canonical manuscript, record why canonical-only writing was acceptable in the write iteration artifact. If `paper_language_finalization_decision=convert-to-paper-language`, explicit canonical-manuscript work may target the canonical `paper_language` manuscript, but that does not make canonical the default ordinary working layer while workflow-language remains active. Treat the workflow-language paper layer as a real persisted artifact rather than a review layer, and preserve it as a full LaTeX mirror with `workflow-language/main.tex`, `workflow-language/references.bib`, `workflow-language/sections/*.tex`, `workflow-language/tables/*.tex`, `workflow-language/figures/*.tex`, and `workflow-language/analysis/analysis-asset.tex`. Do not write new workflow-language output to deprecated review-layer paths such as `docs/lab/paper/review_zh/`. Maintain `.lab/writing/terminology-glossary.md` as the write-stage glossary for full forms, approved short forms, reader-facing explanations, and aliases. Apply the same academic readability standard in every language: when the round introduces or revises key terms, abbreviations, metrics, mechanism names, or system labels, use the full form first, define any short form at first mention, explain what the term is and why it matters here, keep one natural-language paper-facing name per concept, use natural-language full names in prose, do not use labels containing `_` or `-` in reader-facing prose, apply the same first-mention rule to table headers, table captions, table notes, and figure captions or labels, do not assume a fixed drafting order such as Method before Experiments, add a local naming bridge when a section uses canonical short names before their defining section has been drafted, and reuse the canonical label instead of replacing it with a narrative alias. Follow the current section's encouraged, discouraged, and banned expression lists from `section-style-policies.md`; section-specific banned expressions take priority over prose-polish goals. Before any additional tighten, compress, or polish pass on the same section, run a section-level acceptance gate first. That gate must explicitly confirm naming consistency, adjacent-section consistency, claim, metric, and ranking consistency with the current evidence, local clarity, local concision, and section-style compliance. If the round changes the paper's canonical experiment or evaluation protocol, treat that change as a canonical replacement unless the user explicitly scoped it as supplementary or appendix-only, run a paper-wide impact audit before more polishing, update the highest-impact stale sections and assets first, and do not default to translation/workflow-layer sync work unless the user explicitly asked for it or the language-finalization workflow requires it. Only edit both the canonical manuscript and the workflow-language paper layer in the same round when the user explicitly asks for cross-language synchronization or when a final-draft/export language-finalization step requires both layers to be refreshed together. Do not treat a routine tighten/compress/polish request as an instruction to sync the workflow-language companion. For export or remote-publication rounds, if `paper_language_finalization_decision=convert-to-paper-language`, include the workflow-language paper layer in the exported or pushed bundle by default. Allow canonical-only export or remote publication only when the user explicitly asked for it or when the remote target forbids extra files. If any gate item is unresolved, or if a banned expression or move from the current section policy remains, spend the round fixing that blocker instead of polishing sentences further, and do not default the next-step recommendation to another polish pass. Main tables must be locally self-contained: the title, header, note, and adjacent prose should tell the reader what each row and column means, the metric direction, and any relevant unit, denominator, or event condition. Short headers remain allowed, but abbreviations in paper-facing tables must be expanded locally in the same table. If Method or Experiments prose promises a metric family, the main table set must either expose those metrics directly or explicitly mark the missing ones as appendix-only and explain why. If a metric is measured but omitted because it is zero everywhere, redundant, or appendix-only, state that disposition explicitly in the table note instead of silently dropping it. Do not treat `\\resizebox{\\linewidth}{!}{...}` as the default way to fit a main table. Fit main tables by redesign first: shorten headers, move secondary metrics out of the main table, reduce or split columns, then adjust `\\tabcolsep` conservatively; only use `\\resizebox` as a last resort, keep width changes readable, and explain the width-control rationale locally in the same table note. Do not use `\\scriptsize` or `\\tiny` as the default main-table fit strategy. Keep internal identifiers out of reader-facing prose unless they are mapped once for the reader and then moved back out of prose, and record the terminology-clarity self-check, the section-level acceptance gate, section-style policy compliance, the protocol/scope impact audit, the export or remote bundle audit, the round target layer, any canonical-only justification while workflow-language was active, any cross-language sync justification, and the table-semantics audit in the write iteration artifact. 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, finish and preserve the workflow-language paper layer first, then ask once whether to keep the draft language or convert the canonical manuscript to `paper_language`, persist that answer, record both the language decision and the workflow-language paper-layer path 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、`section-style-policies.md` 里与当前 section 对应的风格块,以及 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`,普通 `.tex` section 草稿也必须先停留在 `workflow_language`,不能把 `paper_language` 当成默认草稿语言,并把 workflow-language 论文层当成正式持久化产物,而不是 review 层。当 `workflow_language` 与 `paper_language` 不一致时,把 workflow-language 论文层当成普通写作轮次的默认工作层。普通写作轮次仍然只改一个目标层,不要静默同时刷新两种语言层。如果用户明确点名了某个文件或层级,就把它当成当前轮次唯一目标,除非用户另外明确要求同步。如果 workflow-language 论文层现役而本轮仍然写 canonical manuscript,必须在 write iteration artifact 里说明为什么这次 canonical-only 写作是合理的。如果 `paper_language_finalization_decision=convert-to-paper-language`,显式的 canonical manuscript 工作可以直接落在 `paper_language`,但这并不意味着只要 workflow-language 仍然现役,canonical 就变成普通轮次的默认工作层。workflow-language 层必须是一套完整的 LaTeX 镜像,至少包含 `workflow-language/main.tex`、`workflow-language/references.bib`、`workflow-language/sections/*.tex`、`workflow-language/tables/*.tex`、`workflow-language/figures/*.tex` 和 `workflow-language/analysis/analysis-asset.tex`。不要再把新的 workflow-language 输出写到已经废弃的 review 层路径,例如 `docs/lab/paper/review_zh/`。把 `.lab/writing/terminology-glossary.md` 作为写作期 glossary,用来沉淀全称、批准缩写、对外解释和可接受别名。无论当前语言是什么,都要满足同一套学术可读性标准:如果本轮引入或改写了关键术语、缩写、指标名、机制名或系统标签,就先写全称;如果后面要复用短写,就在首次出现时定义;同时说明它是什么、为什么在这里重要,保持一个概念只有一个 paper-facing 名称,并尽量避免新造的连字符拼接标签。相同的首次解释规则也适用于表头、caption、表注和图注;如果术语第一次出现在表里,就必须在同一张表里局部解释。不要假定当前 section 可以无限继续压句子;在同一个 section 上做新的 tighten、compress 或 polish 之前,先过一遍 section-level acceptance gate。这个 gate 至少要显式确认命名一致性、前后文一致性、claim / metric / ranking 与当前证据的一致性、局部清晰度、局部简洁度,以及 section-style compliance。当前 section 的写作表达必须先遵守 `section-style-policies.md` 里的鼓励表达、谨慎表达和禁用表达;只要还有禁用表达或禁用写法残留,本轮就不能算通过 section-level acceptance gate。如果本轮改动的是论文当前的 canonical 实验或评测协议(例如 split 比例、训练/测试规模、seed 或 split 数量、benchmark 集合、主表评测口径),默认把它当成主协议替换,而不是补充实验;除非用户明确说这是 supplementary 或 appendix-only。遇到这种协议替换时,先做全文影响审计(paper-wide impact audit),列出哪些 section 和资产已经过期,优先更新影响最大的 canonical section / asset,再继续润色;不要默认去做 translation/workflow-layer 同步,除非用户明确要求,或者语言最终定稿流程要求这样做。只有在用户明确要求跨语言同步,或者 final-draft/export 的语言最终定稿步骤确实要求两层一起刷新时,才允许同一轮同时修改 canonical manuscript 和 workflow-language 论文层。不要把普通 tighten/compress/polish 请求理解成“顺手同步 companion”。如果当前是导出或远程发布轮次,且 `paper_language_finalization_decision=convert-to-paper-language`,默认把 workflow-language 论文层一起带进导出的或推送的 bundle。只有在用户明确要求只导出 canonical,或者远程目标明确不允许附带额外文件时,才允许 canonical-only export。如果任何一项还没过,就先解决这个 blocker,不要默认继续 prose polish,也不要把下一步建议自动写成“再收紧一轮”。主表必须局部自足:读者只看表题、表头、表注和邻近引入或解读,就应当知道每行是什么、每列是什么、指标方向是什么,以及需要的单位、分母或触发条件。表头可以短,但表里的缩写必须在同表局部展开。如果 Method 或 Experiments 承诺了一组指标,主表就必须直接展示这些指标,或者明确标成 appendix-only 并解释原因;如果某个指标因为恒为零、冗余或只放附录而不单列,也必须在表注里显式说明,不能静默省略。不要把 `\\resizebox{\\linewidth}{!}{...}` 当成主表默认的宽度解决方案。主表如果超宽,先重构表:缩短表头但保留局部解释,把次要指标移到 appendix-only,减少或拆分列,最后才保守调整 `\\tabcolsep`;只有这些都做过仍然超宽时,才允许把 `\\resizebox` 当成最后手段,而且必须在同一张表的表注里解释宽度处理理由。不要把 `\\scriptsize` 或 `\\tiny` 当成主表默认的适配策略。内部标识符默认不要进入 reader-facing prose;若必须出现,只能在完成一次读者映射后使用,并把 terminology-clarity 自检、section-level acceptance gate、section-style policy 合规检查、protocol/scope impact audit、export 或 remote bundle 审计、当前轮次目标层、workflow-language 现役时的 canonical-only 理由、任何跨语言同步理由,以及 table-semantics 审计一起写进 write iteration artifact。如果当前稿件将从托管默认 scaffold 开始,且还没有模板决定,就先追问一次:继续使用默认 scaffold,还是先接入模板目录。如果进入最终定稿时 `workflow_language` 与 `paper_language` 不一致,就先完成并保留 workflow-language 论文层,再追问一次:保持当前语言,还是把 canonical manuscript 转成 `paper_language`;先持久化这个决定,再在最新 write iteration 里记录语言决策和 workflow-language 论文层路径,最后才允许按该语言修改最终稿。",
|
|
6
|
+
"claude_zh": "本命令运行 lab workflow 的 `write` 阶段。把 `.claude/skills/lab/stages/write.md` 当成模板选择、paper-plan、section 参考、校验 gate、资产覆盖和最终 manuscript 规则的单一来源。读取与当前 section 对应的 paper-writing reference、`section-style-policies.md` 里与当前 section 对应的风格块,以及 bundled example-bank 文件,一次只修改一个 section;普通草稿轮次把写作校验当 warning,最终定稿或导出轮次必须满足 write-stage 的接受 gate。普通起草轮次先跟随 `workflow_language`,普通 `.tex` section 草稿也必须先停留在 `workflow_language`,不能把 `paper_language` 当成默认草稿语言,并把 workflow-language 论文层当成正式持久化产物,而不是 review 层。当 `workflow_language` 与 `paper_language` 不一致时,把 workflow-language 论文层当成普通写作轮次的默认工作层。普通写作轮次仍然只改一个目标层,不要静默同时刷新两种语言层。如果用户明确点名了某个文件或层级,就把它当成当前轮次唯一目标,除非用户另外明确要求同步。如果 workflow-language 论文层现役而本轮仍然写 canonical manuscript,必须在 write iteration artifact 里说明为什么这次 canonical-only 写作是合理的。如果 `paper_language_finalization_decision=convert-to-paper-language`,显式的 canonical manuscript 工作可以直接落在 `paper_language`,但这并不意味着只要 workflow-language 仍然现役,canonical 就变成普通轮次的默认工作层。workflow-language 层必须是一套完整的 LaTeX 镜像,至少包含 `workflow-language/main.tex`、`workflow-language/references.bib`、`workflow-language/sections/*.tex`、`workflow-language/tables/*.tex`、`workflow-language/figures/*.tex` 和 `workflow-language/analysis/analysis-asset.tex`。不要再把新的 workflow-language 输出写到已经废弃的 review 层路径,例如 `docs/lab/paper/review_zh/`。把 `.lab/writing/terminology-glossary.md` 作为写作期 glossary,用来沉淀全称、批准缩写、对外解释和可接受别名。无论当前语言是什么,都要满足同一套学术可读性标准:如果本轮引入或改写了关键术语、缩写、指标名、机制名或系统标签,就先写全称;如果后面要复用短写,就在首次出现时定义;同时说明它是什么、为什么在这里重要,保持一个概念只有一个 paper-facing 名称,并尽量避免新造的连字符拼接标签。相同的首次解释规则也适用于表头、caption、表注和图注;如果术语第一次出现在表里,就必须在同一张表里局部解释。不要假定当前 section 可以无限继续压句子;在同一个 section 上做新的 tighten、compress 或 polish 之前,先过一遍 section-level acceptance gate。这个 gate 至少要显式确认命名一致性、前后文一致性、claim / metric / ranking 与当前证据的一致性、局部清晰度、局部简洁度,以及 section-style compliance。当前 section 的写作表达必须先遵守 `section-style-policies.md` 里的鼓励表达、谨慎表达和禁用表达;只要还有禁用表达或禁用写法残留,本轮就不能算通过 section-level acceptance gate。如果本轮改动的是论文当前的 canonical 实验或评测协议(例如 split 比例、训练/测试规模、seed 或 split 数量、benchmark 集合、主表评测口径),默认把它当成主协议替换,而不是补充实验;除非用户明确说这是 supplementary 或 appendix-only。遇到这种协议替换时,先做全文影响审计(paper-wide impact audit),列出哪些 section 和资产已经过期,优先更新影响最大的 canonical section / asset,再继续润色;不要默认去做 translation/workflow-layer 同步,除非用户明确要求,或者语言最终定稿流程要求这样做。只有在用户明确要求跨语言同步,或者 final-draft/export 的语言最终定稿步骤确实要求两层一起刷新时,才允许同一轮同时修改 canonical manuscript 和 workflow-language 论文层。不要把普通 tighten/compress/polish 请求理解成“顺手同步 companion”。如果当前是导出或远程发布轮次,且 `paper_language_finalization_decision=convert-to-paper-language`,默认把 workflow-language 论文层一起带进导出的或推送的 bundle。只有在用户明确要求只导出 canonical,或者远程目标明确不允许附带额外文件时,才允许 canonical-only export。如果任何一项还没过,就先解决这个 blocker,不要默认继续 prose polish,也不要把下一步建议自动写成“再收紧一轮”。主表必须局部自足:读者只看表题、表头、表注和邻近引入或解读,就应当知道每行是什么、每列是什么、指标方向是什么,以及需要的单位、分母或触发条件。表头可以短,但表里的缩写必须在同表局部展开。如果 Method 或 Experiments 承诺了一组指标,主表就必须直接展示这些指标,或者明确标成 appendix-only 并解释原因;如果某个指标因为恒为零、冗余或只放附录而不单列,也必须在表注里显式说明,不能静默省略。不要把 `\\resizebox{\\linewidth}{!}{...}` 当成主表默认的宽度解决方案。主表如果超宽,先重构表:缩短表头但保留局部解释,把次要指标移到 appendix-only,减少或拆分列,最后才保守调整 `\\tabcolsep`;只有这些都做过仍然超宽时,才允许把 `\\resizebox` 当成最后手段,而且必须在同一张表的表注里解释宽度处理理由。不要把 `\\scriptsize` 或 `\\tiny` 当成主表默认的适配策略。内部标识符默认不要进入 reader-facing prose;若必须出现,只能在完成一次读者映射后使用,并把 terminology-clarity 自检、section-level acceptance gate、section-style policy 合规检查、protocol/scope impact audit、export 或 remote bundle 审计、当前轮次目标层、workflow-language 现役时的 canonical-only 理由、任何跨语言同步理由,以及 table-semantics 审计一起写进 write iteration artifact。如果当前稿件将从托管默认 scaffold 开始,且还没有模板决定,就先追问一次:继续使用默认 scaffold,还是先接入模板目录。如果进入最终定稿时 `workflow_language` 与 `paper_language` 不一致,就先完成并保留 workflow-language 论文层,再追问一次:保持当前语言,还是把 canonical manuscript 转成 `paper_language`;先持久化这个决定,再在最新 write iteration 里记录语言决策和 workflow-language 论文层路径,最后才允许按该语言修改最终稿。"
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
|
|
4
|
+
function ruleManifestPath(targetDir) {
|
|
5
|
+
return path.join(targetDir, ".lab", ".managed", "rule-manifest.json");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function readRuleManifest(targetDir) {
|
|
9
|
+
const manifestPath = ruleManifestPath(targetDir);
|
|
10
|
+
if (!fs.existsSync(manifestPath)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function resolveStageRuleEntry(targetDir, stage) {
|
|
17
|
+
const manifest = readRuleManifest(targetDir);
|
|
18
|
+
if (!manifest || !manifest.stages || !manifest.stages[stage]) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
packageVersion: manifest.package_version || "",
|
|
23
|
+
ruleSourceFile: manifest.stages[stage].rule_source_file || "",
|
|
24
|
+
ruleSourceRevision: manifest.stages[stage].rule_source_revision || "",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function buildRulePreflight({
|
|
29
|
+
targetDir,
|
|
30
|
+
stage,
|
|
31
|
+
mode = "",
|
|
32
|
+
target = "",
|
|
33
|
+
overrideReason = "",
|
|
34
|
+
} = {}) {
|
|
35
|
+
const entry = resolveStageRuleEntry(targetDir, stage) || {};
|
|
36
|
+
return {
|
|
37
|
+
ruleSourceFile: entry.ruleSourceFile || "",
|
|
38
|
+
ruleSourceRevision: entry.ruleSourceRevision || "",
|
|
39
|
+
projectVersion: entry.packageVersion || "",
|
|
40
|
+
resolvedStage: stage || "",
|
|
41
|
+
resolvedMode: mode || "",
|
|
42
|
+
resolvedTarget: target || "",
|
|
43
|
+
overrideReason: overrideReason || "",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
buildRulePreflight,
|
|
49
|
+
readRuleManifest,
|
|
50
|
+
resolveStageRuleEntry,
|
|
51
|
+
ruleManifestPath,
|
|
52
|
+
};
|
|
@@ -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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. Ordinary write rounds should edit one target paper layer
|
|
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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. When `workflow_language` and `paper_language` differ, treat the workflow-language paper layer as the default ordinary working layer. Ordinary write rounds should still edit one target paper layer at a time rather than silently refreshing both language layers. If the user names a concrete file or layer, treat that as the only target for the round unless they also explicitly request synchronization. If a workflow-language paper layer is active and the round still targets the canonical manuscript, record why canonical-only writing was acceptable in the write iteration artifact. If `paper_language_finalization_decision=convert-to-paper-language`, explicit canonical-manuscript work may target the canonical `paper_language` manuscript, but that does not make canonical the default ordinary working layer while workflow-language remains active. Treat the workflow-language paper layer as a real persisted artifact rather than a review layer, and preserve it as a full LaTeX mirror with `workflow-language/main.tex`, `workflow-language/references.bib`, `workflow-language/sections/*.tex`, `workflow-language/tables/*.tex`, `workflow-language/figures/*.tex`, and `workflow-language/analysis/analysis-asset.tex`. Do not write new workflow-language output to deprecated review-layer paths such as `docs/lab/paper/review_zh/`. Maintain `.lab/writing/terminology-glossary.md` as the write-stage glossary for full forms, approved short forms, reader-facing explanations, and aliases. Apply the same academic readability standard in every language: when the round introduces or revises key terms, abbreviations, metrics, mechanism names, or system labels, use the full form first, define any short form at first mention, explain what the term is and why it matters here, keep one natural-language paper-facing name per concept, use natural-language full names in prose, do not use labels containing `_` or `-` in reader-facing prose, apply the same first-mention rule to table headers, table captions, table notes, and figure captions or labels, do not assume a fixed drafting order such as Method before Experiments, add a local naming bridge when a section uses canonical short names before their defining section has been drafted, and reuse the canonical label instead of replacing it with a narrative alias. Follow the current section's encouraged, discouraged, and banned expression lists from `section-style-policies.md`; section-specific banned expressions take priority over prose-polish goals. Before any additional tighten, compress, or polish pass on the same section, run a section-level acceptance gate first. That gate must explicitly confirm naming consistency, adjacent-section consistency, claim, metric, and ranking consistency with the current evidence, local clarity, local concision, and section-style compliance. If the round changes the paper's canonical experiment or evaluation protocol, treat that change as a canonical replacement unless the user explicitly scoped it as supplementary or appendix-only, run a paper-wide impact audit before more polishing, update the highest-impact stale sections and assets first, and do not default to translation/workflow-layer sync work unless the user explicitly asked for it or the language-finalization workflow requires it. Only edit both the canonical manuscript and the workflow-language paper layer in the same round when the user explicitly asks for cross-language synchronization or when a final-draft/export language-finalization step requires both layers to be refreshed together. Do not treat a routine tighten/compress/polish request as an instruction to sync the workflow-language companion. For export or remote-publication rounds, if `paper_language_finalization_decision=convert-to-paper-language`, include the workflow-language paper layer in the exported or pushed bundle by default. Allow canonical-only export or remote publication only when the user explicitly asked for it or when the remote target forbids extra files. If any gate item is unresolved, or if a banned expression or move from the current section policy remains, spend the round fixing that blocker instead of polishing sentences further, and do not default the next-step recommendation to another polish pass. Main tables must be locally self-contained: the title, header, note, and adjacent prose should tell the reader what each row and column means, the metric direction, and any relevant unit, denominator, or event condition. Short headers remain allowed, but abbreviations in paper-facing tables must be expanded locally in the same table. If Method or Experiments prose promises a metric family, the main table set must either expose those metrics directly or explicitly mark the missing ones as appendix-only and explain why. If a metric is measured but omitted because it is zero everywhere, redundant, or appendix-only, state that disposition explicitly in the table note instead of silently dropping it. Do not treat `\resizebox{\linewidth}{!}{...}` as the default way to fit a main table. Fit main tables by redesign first: shorten headers, move secondary metrics out of the main table, reduce or split columns, then adjust `\tabcolsep` conservatively; only use `\resizebox` as a last resort, keep width changes readable, and explain the width-control rationale locally in the same table note. Do not use `\scriptsize` or `\tiny` as the default main-table fit strategy. Keep internal identifiers out of reader-facing prose unless they are mapped once for the reader and then moved back out of prose, and record the terminology-clarity self-check, the section-level acceptance gate, section-style policy compliance, the protocol/scope impact audit, the export or remote bundle audit, the round target layer, any canonical-only justification while workflow-language was active, any cross-language sync justification, and the table-semantics audit in the write iteration artifact. 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, finish and preserve the workflow-language paper layer first, then ask once whether to keep the draft language or convert the canonical manuscript to `paper_language`, persist that answer, record both the language decision and the workflow-language paper-layer path in the latest write iteration, and only then edit the final manuscript in the chosen language.
|
|
@@ -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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. Ordinary write rounds should edit one target paper layer
|
|
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, the current section block in `section-style-policies.md`, 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`, and ordinary `.tex` section drafts must stay in `workflow_language` instead of treating `paper_language` as the default draft language. When `workflow_language` and `paper_language` differ, treat the workflow-language paper layer as the default ordinary working layer. Ordinary write rounds should still edit one target paper layer at a time rather than silently refreshing both language layers. If the user names a concrete file or layer, treat that as the only target for the round unless they also explicitly request synchronization. If a workflow-language paper layer is active and the round still targets the canonical manuscript, record why canonical-only writing was acceptable in the write iteration artifact. If `paper_language_finalization_decision=convert-to-paper-language`, explicit canonical-manuscript work may target the canonical `paper_language` manuscript, but that does not make canonical the default ordinary working layer while workflow-language remains active. Treat the workflow-language paper layer as a real persisted artifact rather than a review layer, and preserve it as a full LaTeX mirror with `workflow-language/main.tex`, `workflow-language/references.bib`, `workflow-language/sections/*.tex`, `workflow-language/tables/*.tex`, `workflow-language/figures/*.tex`, and `workflow-language/analysis/analysis-asset.tex`. Do not write new workflow-language output to deprecated review-layer paths such as `docs/lab/paper/review_zh/`. Maintain `.lab/writing/terminology-glossary.md` as the write-stage glossary for full forms, approved short forms, reader-facing explanations, and aliases. Apply the same academic readability standard in every language: when the round introduces or revises key terms, abbreviations, metrics, mechanism names, or system labels, use the full form first, define any short form at first mention, explain what the term is and why it matters here, keep one natural-language paper-facing name per concept, use natural-language full names in prose, do not use labels containing `_` or `-` in reader-facing prose, apply the same first-mention rule to table headers, table captions, table notes, and figure captions or labels, do not assume a fixed drafting order such as Method before Experiments, add a local naming bridge when a section uses canonical short names before their defining section has been drafted, and reuse the canonical label instead of replacing it with a narrative alias. Follow the current section's encouraged, discouraged, and banned expression lists from `section-style-policies.md`; section-specific banned expressions take priority over prose-polish goals. Before any additional tighten, compress, or polish pass on the same section, run a section-level acceptance gate first. That gate must explicitly confirm naming consistency, adjacent-section consistency, claim, metric, and ranking consistency with the current evidence, local clarity, local concision, and section-style compliance. If the round changes the paper's canonical experiment or evaluation protocol, treat that change as a canonical replacement unless the user explicitly scoped it as supplementary or appendix-only, run a paper-wide impact audit before more polishing, update the highest-impact stale sections and assets first, and do not default to translation/workflow-layer sync work unless the user explicitly asked for it or the language-finalization workflow requires it. Only edit both the canonical manuscript and the workflow-language paper layer in the same round when the user explicitly asks for cross-language synchronization or when a final-draft/export language-finalization step requires both layers to be refreshed together. Do not treat a routine tighten/compress/polish request as an instruction to sync the workflow-language companion. For export or remote-publication rounds, if `paper_language_finalization_decision=convert-to-paper-language`, include the workflow-language paper layer in the exported or pushed bundle by default. Allow canonical-only export or remote publication only when the user explicitly asked for it or when the remote target forbids extra files. If any gate item is unresolved, or if a banned expression or move from the current section policy remains, spend the round fixing that blocker instead of polishing sentences further, and do not default the next-step recommendation to another polish pass. Main tables must be locally self-contained: the title, header, note, and adjacent prose should tell the reader what each row and column means, the metric direction, and any relevant unit, denominator, or event condition. Short headers remain allowed, but abbreviations in paper-facing tables must be expanded locally in the same table. If Method or Experiments prose promises a metric family, the main table set must either expose those metrics directly or explicitly mark the missing ones as appendix-only and explain why. If a metric is measured but omitted because it is zero everywhere, redundant, or appendix-only, state that disposition explicitly in the table note instead of silently dropping it. Do not treat `\resizebox{\linewidth}{!}{...}` as the default way to fit a main table. Fit main tables by redesign first: shorten headers, move secondary metrics out of the main table, reduce or split columns, then adjust `\tabcolsep` conservatively; only use `\resizebox` as a last resort, keep width changes readable, and explain the width-control rationale locally in the same table note. Do not use `\scriptsize` or `\tiny` as the default main-table fit strategy. Keep internal identifiers out of reader-facing prose unless they are mapped once for the reader and then moved back out of prose, and record the terminology-clarity self-check, the section-level acceptance gate, section-style policy compliance, the protocol/scope impact audit, the export or remote bundle audit, the round target layer, any canonical-only justification while workflow-language was active, any cross-language sync justification, and the table-semantics audit in the write iteration artifact. 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, finish and preserve the workflow-language paper layer first, then ask once whether to keep the draft language or convert the canonical manuscript to `paper_language`, persist that answer, record both the language decision and the workflow-language paper-layer path in the latest write iteration, and only then edit the final manuscript in the chosen language.
|