section-merger
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSection Merger
小节合并工具
Goal: assemble a paper-like from:
output/DRAFT.md- (per-section/per-subsection prose)
sections/ - (short hand-offs; generated by
outline/transitions.md)transition-weaver - (reader-facing Appendix tables; generated by
outline/tables_appendix.md)appendix-table-writer
Merge order is driven by . The draft title is taken from when present. is an optional diagnostics input.
outline/outline.ymlGOAL.mdsections/sections_manifest.jsonlThis skill is deterministic: it does not rewrite content or invent prose; it only merges already-generated artifacts.
目标:将以下内容组装成类论文格式的:
output/DRAFT.md- (按小节/子小节划分的文稿)
sections/ - (简短过渡内容;由
outline/transitions.md生成)transition-weaver - (面向读者的附录表格;由
outline/tables_appendix.md生成)appendix-table-writer
合并顺序由决定。若存在,则草稿标题取自该文件。是可选的诊断输入文件。
outline/outline.ymlGOAL.mdsections/sections_manifest.jsonl本工具是确定性的:它不会重写内容或生成新文稿,仅合并已生成的产物。
Transitions (injected text)
过渡内容(嵌入文本)
- By default, inserts only within-chapter H3->H3 transitions.
section-merger - Optional: if you want between-H2 transitions inserted too, create in the workspace.
outline/transitions.insert_h2.ok - Format contract: only lines matching are injected by default.
- 3.1 -> 3.2: <text> - Compatibility: is accepted, but
→is the preferred contract (avoids control-character encoding issues).-> - Treat transitions as injected draft text: run after merging, and route fixes back to
post-merge-voice-gate(do not patch the merged draft).outline/transitions.md
- 默认情况下,仅插入章节内H3到H3的过渡内容。
section-merger - 可选配置:若要同时插入H2之间的过渡内容,请在工作区中创建文件。
outline/transitions.insert_h2.ok - 格式约定:默认仅注入匹配格式的行。
- 3.1 -> 3.2: <文本> - 兼容性:支持符号,但推荐使用
→(避免控制字符编码问题)。-> - 过渡内容视为嵌入的草稿文本:合并后请运行,并将修改反馈至
post-merge-voice-gate(不要直接修改合并后的草稿)。outline/transitions.md
Tables (two layers)
表格(两层结构)
This pipeline uses two table layers:
-
(internal index; produced by
outline/tables_index.md)table-filler- planning/debugging artifact
- should NOT be inserted into the paper
-
(reader-facing Appendix tables; produced by
outline/tables_appendix.md)appendix-table-writer- publishable tables (clean layout + high information density)
- inserted by under a single Appendix heading
section-merger
本流水线使用两层表格结构:
-
(内部索引;由
outline/tables_index.md生成)table-filler- 用于规划/调试的产物
- 不应插入到论文中
-
(面向读者的附录表格;由
outline/tables_appendix.md生成)appendix-table-writer- 可发布的表格(布局整洁+信息密度高)
- 由插入到单一附录标题下
section-merger
Appendix insertion behavior
附录插入行为
- inserts
section-mergerat the end of the draft underoutline/tables_appendix.md.## Appendix: Tables - The inserted block is heading-free (any accidental headings inside the tables file are stripped).
# - Opt-out (rare): create in the workspace.
outline/tables.insert.off
- 会将
section-merger插入到草稿末尾,标题为outline/tables_appendix.md。## Appendix: Tables - 插入的内容不含标题(表格文件中若存在意外的标题将被移除)。
# - 可选关闭:若要关闭该功能,请在工作区中创建文件。
outline/tables.insert.off
Inputs
输入文件
- (drives section/subsection order)
outline/outline.yml - (required)
outline/transitions.md - (optional diagnostics)
sections/sections_manifest.jsonl - (optional title)
GOAL.md
For arxiv-survey pipelines (default contract):
- (required unless opted out)
outline/tables_appendix.md
- (决定小节/子小节顺序)
outline/outline.yml - (必填)
outline/transitions.md - (可选诊断文件)
sections/sections_manifest.jsonl - (可选标题来源)
GOAL.md
对于arxiv-survey流水线(默认约定):
- (必填,除非手动关闭该功能)
outline/tables_appendix.md
Outputs
输出文件
output/DRAFT.mdoutput/MERGE_REPORT.md
output/DRAFT.mdoutput/MERGE_REPORT.md
Script
脚本使用
Quick Start
快速开始
python .codex/skills/section-merger/scripts/run.py --helppython .codex/skills/section-merger/scripts/run.py --workspace workspaces/<ws>
python .codex/skills/section-merger/scripts/run.py --helppython .codex/skills/section-merger/scripts/run.py --workspace workspaces/<ws>
All Options
所有选项
- (required)
--workspace <workspace_dir> - (optional; used only for runner bookkeeping)
--unit-id <id> - (optional; override inputs; defaults are profile-aware)
--inputs <a;b;c> - (optional; defaults to
--outputs <draft_rel;report_rel>)output/DRAFT.md;output/MERGE_REPORT.md - (optional; ignored by the merger)
--checkpoint <C#>
- (必填)
--workspace <workspace_dir> - (可选;仅用于运行器记录)
--unit-id <id> - (可选;覆盖默认输入;默认值与配置文件关联)
--inputs <a;b;c> - (可选;默认值为
--outputs <draft_rel;report_rel>)output/DRAFT.md;output/MERGE_REPORT.md - (可选;合并工具会忽略该参数)
--checkpoint <C#>
Examples
示例
-
Merge with defaults (profile-aware table insertion):
python .codex/skills/section-merger/scripts/run.py --workspace workspaces/<ws> -
Merge with explicit outputs:
python .codex/skills/section-merger/scripts/run.py --workspace workspaces/<ws> --outputs output/DRAFT.md;output/MERGE_REPORT.md
-
使用默认配置合并(根据配置文件自动插入表格):
python .codex/skills/section-merger/scripts/run.py --workspace workspaces/<ws> -
自定义输出路径进行合并:
python .codex/skills/section-merger/scripts/run.py --workspace workspaces/<ws> --outputs output/DRAFT.md;output/MERGE_REPORT.md
Troubleshooting
故障排除
Issue: merge report says a subsection file is missing
问题:合并报告显示某个子小节文件缺失
Likely cause:
- A required file has not been written yet.
sections/*.md
Fix:
- Write the missing units under (typically via
sections/) and rerun merge.subsection-writer
可能原因:
- 所需的文件尚未生成。
sections/*.md
解决方法:
- 在目录下生成缺失的单元内容(通常通过
sections/工具),然后重新运行合并。subsection-writer
Issue: Appendix tables are missing in the merged draft
问题:合并后的草稿中缺少附录表格
Fix:
- Ensure exists and contains >=2 Markdown tables (no placeholders).
outline/tables_appendix.md - Ensure you did not create .
outline/tables.insert.off - Rerun .
section-merger
解决方法:
- 确保存在且包含至少2个Markdown表格(无占位符)。
outline/tables_appendix.md - 确认未创建文件。
outline/tables.insert.off - 重新运行。
section-merger