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
|
@@ -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.
|
|
@@ -6,4 +6,4 @@ argument-hint: section or writing target
|
|
|
6
6
|
Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
|
|
7
7
|
|
|
8
8
|
Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
|
|
9
|
-
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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
|
|
9
|
+
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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.
|
|
@@ -6,4 +6,4 @@ argument-hint: section or writing target
|
|
|
6
6
|
Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
|
|
7
7
|
|
|
8
8
|
Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
|
|
9
|
-
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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
|
|
9
|
+
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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.
|
|
@@ -6,4 +6,4 @@ argument-hint: section or writing target
|
|
|
6
6
|
Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
|
|
7
7
|
|
|
8
8
|
Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
|
|
9
|
-
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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
|
|
9
|
+
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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.
|
|
@@ -6,4 +6,4 @@ argument-hint: section or writing target
|
|
|
6
6
|
Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
|
|
7
7
|
|
|
8
8
|
Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
|
|
9
|
-
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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
|
|
9
|
+
This command runs the `/lab:write` stage. Use `.codex/skills/lab/stages/write.md` as the single source of truth for template choice, paper-plan requirements, section references, validator gates, asset coverage, and final manuscript rules. Read the matching paper-writing reference, 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,6 +4,7 @@ import json
|
|
|
4
4
|
import re
|
|
5
5
|
import sys
|
|
6
6
|
from pathlib import Path
|
|
7
|
+
from validate_rule_preflight import validate_rule_preflight
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
ABSOLUTE_PATH_MARKERS = ("/Users/", "/home/", "/tmp/", "/private/tmp/")
|
|
@@ -593,6 +594,23 @@ def check_language_layers(paper_dir: Path, issues: list[str]):
|
|
|
593
594
|
)
|
|
594
595
|
|
|
595
596
|
|
|
597
|
+
def check_latest_write_iteration_preflight(paper_dir: Path, issues: list[str]):
|
|
598
|
+
workflow_config = find_workflow_config(paper_dir)
|
|
599
|
+
if workflow_config is None:
|
|
600
|
+
return
|
|
601
|
+
|
|
602
|
+
project_root = workflow_config.parent.parent
|
|
603
|
+
manifest_path = project_root / ".lab" / ".managed" / "rule-manifest.json"
|
|
604
|
+
if not manifest_path.exists():
|
|
605
|
+
return
|
|
606
|
+
|
|
607
|
+
latest_iteration = find_latest_write_iteration(paper_dir)
|
|
608
|
+
if latest_iteration is None:
|
|
609
|
+
issues.append("missing latest write iteration needed for rule preflight validation")
|
|
610
|
+
return
|
|
611
|
+
issues.extend(validate_rule_preflight(latest_iteration, "write", project_root=project_root))
|
|
612
|
+
|
|
613
|
+
|
|
596
614
|
def main():
|
|
597
615
|
args = parse_args()
|
|
598
616
|
paper_dir = Path(args.paper_dir)
|
|
@@ -610,6 +628,7 @@ def main():
|
|
|
610
628
|
check_experiments_section(paper_dir, issues)
|
|
611
629
|
check_asset_consumption(paper_dir, issues)
|
|
612
630
|
check_language_layers(paper_dir, issues)
|
|
631
|
+
check_latest_write_iteration_preflight(paper_dir, issues)
|
|
613
632
|
|
|
614
633
|
tables_dir = paper_dir / "tables"
|
|
615
634
|
check_table_file(tables_dir / REQUIRED_TABLE_FILES[0], issues, "tables/main-results.tex")
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
import argparse
|
|
3
|
+
import json
|
|
3
4
|
import re
|
|
4
5
|
import sys
|
|
5
6
|
from pathlib import Path
|
|
7
|
+
from validate_rule_preflight import validate_rule_preflight
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
def parse_args():
|
|
@@ -58,6 +60,50 @@ def has_local_naming_bridge(text: str) -> bool:
|
|
|
58
60
|
)
|
|
59
61
|
|
|
60
62
|
|
|
63
|
+
def find_project_root(section_path: Path) -> Path | None:
|
|
64
|
+
for parent in (section_path.parent, *section_path.parents):
|
|
65
|
+
workflow_config = parent / ".lab" / "config" / "workflow.json"
|
|
66
|
+
if workflow_config.exists():
|
|
67
|
+
return parent
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def load_workflow_config(project_root: Path | None) -> dict:
|
|
72
|
+
if project_root is None:
|
|
73
|
+
return {}
|
|
74
|
+
workflow_config = project_root / ".lab" / "config" / "workflow.json"
|
|
75
|
+
if not workflow_config.exists():
|
|
76
|
+
return {}
|
|
77
|
+
try:
|
|
78
|
+
return json.loads(workflow_config.read_text(encoding="utf-8"))
|
|
79
|
+
except json.JSONDecodeError:
|
|
80
|
+
return {}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def extract_markdown_field(text: str, section_heading: str, field_label: str) -> str:
|
|
84
|
+
section_match = re.search(
|
|
85
|
+
rf"^##\s+{re.escape(section_heading)}\s*$([\s\S]*?)(?=^##\s+|\Z)",
|
|
86
|
+
text,
|
|
87
|
+
flags=re.MULTILINE,
|
|
88
|
+
)
|
|
89
|
+
if not section_match:
|
|
90
|
+
return ""
|
|
91
|
+
section_text = section_match.group(1)
|
|
92
|
+
field_match = re.search(
|
|
93
|
+
rf"^- \s*{re.escape(field_label)}[ \t]*(.*)$",
|
|
94
|
+
section_text,
|
|
95
|
+
flags=re.MULTILINE,
|
|
96
|
+
)
|
|
97
|
+
if not field_match:
|
|
98
|
+
return ""
|
|
99
|
+
return field_match.group(1).strip()
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def has_meaningful_field_value(value: str) -> bool:
|
|
103
|
+
normalized = value.strip().lower()
|
|
104
|
+
return normalized not in {"", "-", "n/a", "na", "none", "no", "not applicable", "null", "false"}
|
|
105
|
+
|
|
106
|
+
|
|
61
107
|
SECTION_STYLE_WARNINGS = {
|
|
62
108
|
"abstract": [
|
|
63
109
|
(
|
|
@@ -271,6 +317,77 @@ def check_neighbor_asset_files(section: str, section_path: Path, issues: list[st
|
|
|
271
317
|
)
|
|
272
318
|
|
|
273
319
|
|
|
320
|
+
def check_workflow_language_targeting(section_path: Path, issues: list[str]):
|
|
321
|
+
project_root = find_project_root(section_path)
|
|
322
|
+
workflow_config = load_workflow_config(project_root)
|
|
323
|
+
workflow_language = workflow_config.get("workflow_language")
|
|
324
|
+
paper_language = workflow_config.get("paper_language")
|
|
325
|
+
if not workflow_language or not paper_language or workflow_language == paper_language:
|
|
326
|
+
return
|
|
327
|
+
|
|
328
|
+
if "workflow-language" in section_path.parts:
|
|
329
|
+
return
|
|
330
|
+
|
|
331
|
+
if project_root is None:
|
|
332
|
+
return
|
|
333
|
+
|
|
334
|
+
iteration_dir = project_root / ".lab" / "writing" / "iterations"
|
|
335
|
+
if not iteration_dir.exists():
|
|
336
|
+
issues.append(
|
|
337
|
+
"workflow-language is active for this project, but no write-iteration audit explains why this round targeted the canonical manuscript"
|
|
338
|
+
)
|
|
339
|
+
return
|
|
340
|
+
|
|
341
|
+
iteration_files = sorted(iteration_dir.glob("*.md"))
|
|
342
|
+
if not iteration_files:
|
|
343
|
+
issues.append(
|
|
344
|
+
"workflow-language is active for this project, but no write-iteration audit explains why this round targeted the canonical manuscript"
|
|
345
|
+
)
|
|
346
|
+
return
|
|
347
|
+
|
|
348
|
+
latest_iteration = iteration_files[-1]
|
|
349
|
+
iteration_text = read_text(latest_iteration)
|
|
350
|
+
round_target = extract_markdown_field(
|
|
351
|
+
iteration_text,
|
|
352
|
+
"Language Layer Target",
|
|
353
|
+
"Round target layer:",
|
|
354
|
+
)
|
|
355
|
+
canonical_reason = extract_markdown_field(
|
|
356
|
+
iteration_text,
|
|
357
|
+
"Language Layer Target",
|
|
358
|
+
"If workflow-language was active and this round still targeted canonical manuscript, why was canonical-only writing acceptable:",
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
if round_target and all(token not in round_target.lower() for token in ("canonical", "both")):
|
|
362
|
+
issues.append(
|
|
363
|
+
"workflow-language is active for this project, but the latest write-iteration target layer does not match this canonical-manuscript draft"
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
if not has_meaningful_field_value(canonical_reason):
|
|
367
|
+
issues.append(
|
|
368
|
+
"workflow-language is active for this project, but the latest write iteration does not explain why canonical-only writing was acceptable for this round"
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def check_write_rule_preflight(section_path: Path, issues: list[str]):
|
|
373
|
+
project_root = find_project_root(section_path)
|
|
374
|
+
if project_root is None:
|
|
375
|
+
return
|
|
376
|
+
|
|
377
|
+
iteration_dir = project_root / ".lab" / "writing" / "iterations"
|
|
378
|
+
if not iteration_dir.exists():
|
|
379
|
+
issues.append("missing write-iteration history required for rule preflight validation")
|
|
380
|
+
return
|
|
381
|
+
|
|
382
|
+
iteration_files = sorted(iteration_dir.glob("*.md"))
|
|
383
|
+
if not iteration_files:
|
|
384
|
+
issues.append("missing write-iteration artifact required for rule preflight validation")
|
|
385
|
+
return
|
|
386
|
+
|
|
387
|
+
latest_iteration = iteration_files[-1]
|
|
388
|
+
issues.extend(validate_rule_preflight(latest_iteration, "write", project_root=project_root))
|
|
389
|
+
|
|
390
|
+
|
|
274
391
|
def check_abstract(text: str, issues: list[str]):
|
|
275
392
|
numbers = re.findall(r"\b\d+(?:\.\d+)?\b", text)
|
|
276
393
|
if len(numbers) > 6:
|
|
@@ -399,6 +516,8 @@ def main():
|
|
|
399
516
|
text = read_text(section_path)
|
|
400
517
|
issues: list[str] = []
|
|
401
518
|
check_common_section_gate_risks(text, issues)
|
|
519
|
+
check_write_rule_preflight(section_path, issues)
|
|
520
|
+
check_workflow_language_targeting(section_path, issues)
|
|
402
521
|
check_section_style_policy(text, args.section, issues)
|
|
403
522
|
SECTION_CHECKS[args.section](text, issues)
|
|
404
523
|
check_neighbor_asset_files(args.section, section_path, issues)
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Write Iteration
|
|
2
2
|
|
|
3
|
+
## Rule Preflight
|
|
4
|
+
|
|
5
|
+
- Rule source file:
|
|
6
|
+
- Rule source revision:
|
|
7
|
+
- Project version:
|
|
8
|
+
- Resolved stage:
|
|
9
|
+
- Resolved mode:
|
|
10
|
+
- Resolved target:
|
|
11
|
+
- Override reason, if any:
|
|
12
|
+
|
|
3
13
|
## Round
|
|
4
14
|
|
|
5
15
|
- Iteration number:
|
|
@@ -78,6 +88,7 @@
|
|
|
78
88
|
## Language Layer Target
|
|
79
89
|
|
|
80
90
|
- Round target layer:
|
|
91
|
+
- If workflow-language was active and this round still targeted canonical manuscript, why was canonical-only writing acceptable:
|
|
81
92
|
- If both canonical manuscript and workflow-language layer were edited, why:
|
|
82
93
|
- Was cross-language sync explicitly requested or required by final-draft/export:
|
|
83
94
|
|
|
@@ -29,6 +29,17 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
|
|
|
29
29
|
- Treat evaluation semantics as source-backed once evaluation planning starts: metrics, benchmark gates, baseline behavior, comparison implementations, and deviations should come from recorded sources, not memory.
|
|
30
30
|
- Workflow artifacts should follow the installed workflow language.
|
|
31
31
|
- Iteration artifacts under `.lab/iterations/` are workflow artifacts and should follow the installed workflow language.
|
|
32
|
+
- Before acting in any `/lab:*` stage, read `.lab/.managed/rule-manifest.json` and complete a `Rule Preflight` for the current round.
|
|
33
|
+
- Every stage round must record these `Rule Preflight` fields in its managed artifact before further execution:
|
|
34
|
+
- `Rule source file`
|
|
35
|
+
- `Rule source revision`
|
|
36
|
+
- `Project version`
|
|
37
|
+
- `Resolved stage`
|
|
38
|
+
- `Resolved mode`
|
|
39
|
+
- `Resolved target`
|
|
40
|
+
- `Override reason, if any`
|
|
41
|
+
- Treat missing, stale, or contradictory `Rule Preflight` data as a stage-contract failure.
|
|
42
|
+
- Project-installed rules take priority over model memory. If remembered patterns conflict with the installed rule source, follow the installed source recorded in `.lab/.managed/rule-manifest.json`.
|
|
32
43
|
- Final paper output should default to LaTeX, and its manuscript language should be decided separately from the workflow language.
|
|
33
44
|
- Separate sourced facts from model-generated hypotheses.
|
|
34
45
|
- Preserve failed runs, failed ideas, and limitations.
|
|
@@ -213,9 +224,11 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
|
|
|
213
224
|
- Write one paper section or one explicit subproblem per round.
|
|
214
225
|
- Ordinary manuscript drafting rounds should follow `workflow_language`.
|
|
215
226
|
- In those ordinary rounds, the manuscript is still LaTeX, so the initial `.tex` section drafts must stay in `workflow_language` rather than jumping straight to `paper_language`.
|
|
216
|
-
-
|
|
227
|
+
- When `workflow_language` and `paper_language` differ, treat the workflow-language paper layer as active and use it as the default ordinary working layer.
|
|
228
|
+
- Ordinary write rounds should still edit one target paper layer at a time, not both language layers at once.
|
|
217
229
|
- If the user names a concrete file or layer, treat that as the only target for the round unless they also explicitly request synchronization.
|
|
218
|
-
- If
|
|
230
|
+
- 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 latest write iteration artifact.
|
|
231
|
+
- 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.
|
|
219
232
|
- Treat the workflow-language paper as a real persisted paper layer, not as a review layer.
|
|
220
233
|
- If `workflow_language` and `paper_language` differ, finish and preserve the workflow-language paper layer first, then the first final-draft or export round must ask once whether to keep the draft language or convert the canonical manuscript to `paper_language`.
|
|
221
234
|
- When the languages differ, do not rewrite final manuscript sections in `paper_language` before that question has been answered; ask first, persist the choice, then edit the final manuscript in the chosen language.
|
|
@@ -264,6 +277,7 @@ Use this skill when the user invokes `/lab:*` or asks for the structured researc
|
|
|
264
277
|
- Record the section-level acceptance gate in the latest write iteration artifact before recommending another tighten/compress/polish pass on the same section.
|
|
265
278
|
- Record section-style policy compliance, any retained discouraged move, and any banned move found in the latest write iteration artifact.
|
|
266
279
|
- Record the round target layer in the latest write iteration artifact as `canonical manuscript`, `workflow-language paper layer`, or `both`.
|
|
280
|
+
- If workflow-language was active and the round still targeted the canonical manuscript, record why canonical-only writing was acceptable in the latest write iteration artifact.
|
|
267
281
|
- If both layers were edited, record why the cross-language sync was required and whether it was explicitly requested by the user or required by final-draft/export finalization.
|
|
268
282
|
- Record the protocol/scope impact audit in the latest write iteration artifact whenever a round replaces or rewrites a canonical experiment/evaluation protocol.
|
|
269
283
|
- If the round is an export or remote-publication round, record the export target, whether the workflow-language paper layer was included in the exported or pushed bundle, and why any canonical-only export was acceptable.
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
- `.lab/context/auto-status.md`
|
|
25
25
|
- `.lab/context/auto-ledger.md`
|
|
26
26
|
- `.lab/context/auto-outcome.md`
|
|
27
|
+
- `.lab/.managed/rule-manifest.json`
|
|
28
|
+
|
|
29
|
+
## Rule Preflight
|
|
30
|
+
|
|
31
|
+
- Read `.lab/.managed/rule-manifest.json` before arming auto mode.
|
|
32
|
+
- The visible `Auto preflight` summary must also record the installed rule source file, rule source revision, project version, resolved stage, resolved mode, resolved target, and any override reason.
|
|
33
|
+
- Keep the same `Rule Preflight` fields in `.lab/context/auto-status.md` while the campaign is live.
|
|
34
|
+
- If the installed auto rule and the current campaign behavior disagree, stop and fix the contract or record a valid override reason before launching the loop.
|
|
27
35
|
|
|
28
36
|
## Context Write Set
|
|
29
37
|
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
- `.lab/context/data-decisions.md`
|
|
29
29
|
- `.lab/context/terminology-lock.md`
|
|
30
30
|
- `.lab/writing/terminology-glossary.md` when it exists
|
|
31
|
+
- `.lab/.managed/rule-manifest.json`
|
|
32
|
+
|
|
33
|
+
## Rule Preflight
|
|
34
|
+
|
|
35
|
+
- Read `.lab/.managed/rule-manifest.json` before drafting.
|
|
36
|
+
- Record a `Rule Preflight` block in the write-iteration artifact before revising prose.
|
|
37
|
+
- The `Rule Preflight` block must record the installed rule source file, rule source revision, project version, resolved stage, resolved mode, resolved target, and any override reason.
|
|
38
|
+
- If the installed write rule and the current round behavior disagree, fix the targeting or record a valid override reason before further editing.
|
|
31
39
|
|
|
32
40
|
## Context Write Set
|
|
33
41
|
|
|
@@ -66,9 +74,11 @@ Run these on every round:
|
|
|
66
74
|
- LaTeX is the required manuscript output format.
|
|
67
75
|
- Ordinary manuscript drafting rounds should follow `workflow_language`.
|
|
68
76
|
- During ordinary rounds, ordinary `.tex` section drafts must stay in `workflow_language`; do not treat `paper_language` as the default draft language.
|
|
69
|
-
-
|
|
77
|
+
- When `workflow_language` and `paper_language` differ, treat the workflow-language paper layer as active and use it as the default ordinary working layer.
|
|
78
|
+
- Ordinary write rounds should still edit one target paper layer at a time, not both language layers at once.
|
|
70
79
|
- If the user names a concrete file or layer, treat that as the only target for the round unless they also explicitly request synchronization.
|
|
71
|
-
- If
|
|
80
|
+
- 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 instead of silently treating canonical as the default working layer.
|
|
81
|
+
- 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.
|
|
72
82
|
- 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.
|
|
73
83
|
- Treat the workflow-language manuscript as a real persisted paper layer, not just an internal review note.
|
|
74
84
|
- If the user asks to read the paper in `workflow_language`, materialize or refresh a full workflow-language paper layer under `<deliverables_root>/paper/workflow-language/` instead of pointing to a review layer.
|
|
@@ -186,6 +196,7 @@ Run these on every round:
|
|
|
186
196
|
- Record the section-level acceptance gate in the write-iteration artifact before recommending further tightening on the same section.
|
|
187
197
|
- Record section-style policy compliance, any retained discouraged move, and any banned move found in the write-iteration artifact.
|
|
188
198
|
- Record the round target layer in the write-iteration artifact as `canonical manuscript`, `workflow-language paper layer`, or `both`.
|
|
199
|
+
- If workflow-language was active and the round still targeted the canonical manuscript, record why canonical-only writing was acceptable in the write-iteration artifact.
|
|
189
200
|
- If both layers were edited, record why the cross-language sync was required and whether it was explicitly requested by the user or required by final-draft/export finalization.
|
|
190
201
|
- Record the protocol/scope impact audit in the write-iteration artifact whenever a round replaces or rewrites a canonical experiment/evaluation protocol.
|
|
191
202
|
- If the round is an export or remote-publication round, record the export target, whether the workflow-language paper layer was included in the exported or pushed bundle, and why any canonical-only export was acceptable.
|
|
@@ -213,15 +224,15 @@ Run these on every round:
|
|
|
213
224
|
- `<deliverables_root>/paper/figures/method-overview.tex`
|
|
214
225
|
- `<deliverables_root>/paper/figures/results-overview.tex`
|
|
215
226
|
- `<deliverables_root>/paper/analysis/analysis-asset.tex`
|
|
216
|
-
- `<deliverables_root>/paper/workflow-language/main.tex` when
|
|
217
|
-
- `<deliverables_root>/paper/workflow-language/references.bib` when
|
|
218
|
-
- `<deliverables_root>/paper/workflow-language/sections/<section>.tex` when
|
|
219
|
-
- `<deliverables_root>/paper/workflow-language/tables/main-results.tex` when the current paper contains experimental claims and `
|
|
220
|
-
- `<deliverables_root>/paper/workflow-language/tables/ablations.tex` when the current paper contains experimental claims and `
|
|
221
|
-
- `<deliverables_root>/paper/workflow-language/figures/problem-setting.tex` when the current paper contains method or experiments claims and `
|
|
222
|
-
- `<deliverables_root>/paper/workflow-language/figures/method-overview.tex` when the current paper contains method or experiments claims and `
|
|
223
|
-
- `<deliverables_root>/paper/workflow-language/figures/results-overview.tex` when the current paper contains experimental claims and `
|
|
224
|
-
- `<deliverables_root>/paper/workflow-language/analysis/analysis-asset.tex` when the current paper contains experimental claims and `
|
|
227
|
+
- `<deliverables_root>/paper/workflow-language/main.tex` when `workflow_language` and `paper_language` differ
|
|
228
|
+
- `<deliverables_root>/paper/workflow-language/references.bib` when `workflow_language` and `paper_language` differ
|
|
229
|
+
- `<deliverables_root>/paper/workflow-language/sections/<section>.tex` when `workflow_language` and `paper_language` differ
|
|
230
|
+
- `<deliverables_root>/paper/workflow-language/tables/main-results.tex` when the current paper contains experimental claims and `workflow_language` and `paper_language` differ
|
|
231
|
+
- `<deliverables_root>/paper/workflow-language/tables/ablations.tex` when the current paper contains experimental claims and `workflow_language` and `paper_language` differ
|
|
232
|
+
- `<deliverables_root>/paper/workflow-language/figures/problem-setting.tex` when the current paper contains method or experiments claims and `workflow_language` and `paper_language` differ
|
|
233
|
+
- `<deliverables_root>/paper/workflow-language/figures/method-overview.tex` when the current paper contains method or experiments claims and `workflow_language` and `paper_language` differ
|
|
234
|
+
- `<deliverables_root>/paper/workflow-language/figures/results-overview.tex` when the current paper contains experimental claims and `workflow_language` and `paper_language` differ
|
|
235
|
+
- `<deliverables_root>/paper/workflow-language/analysis/analysis-asset.tex` when the current paper contains experimental claims and `workflow_language` and `paper_language` differ
|
|
225
236
|
|
|
226
237
|
## Stop Conditions
|
|
227
238
|
|