section-merger
Original:🇺🇸 English
Translated
1 scripts
Deterministically merge per-section files under `sections/` into `output/DRAFT.md`, preserving outline order and weaving transitions from `outline/transitions.md`. **Trigger**: merge sections, merge draft, combine section files, sections/ -> output/DRAFT.md, 合并小节, 拼接草稿. **Use when**: you have per-unit prose files under `sections/` and want a single `output/DRAFT.md` for polishing/review/LaTeX. **Skip if**: section files are missing or still contain scaffolding markers (fix `subsection-writer` first). **Network**: none. **Guardrail**: deterministic merge only (no new facts/citations); preserve section order from `outline/outline.yml`.
9installs
Added on
NPX Install
npx skill4agent add willoscar/research-units-pipeline-skills section-mergerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Section 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.
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
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
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
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
Outputs
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>
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#>
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
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
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