Front Matter Writer (compatibility router)
Triggers & routing
- Trigger: front matter writer, introduction writer, related work writer, abstract writer, discussion writer, conclusion writer, 引言, 相关工作, 摘要, 讨论, 结论.
Purpose: produce the paper-level shell while preserving the current output contract and approval gate.
Load Order
Always read:
Read by task:
references/abstract_archetypes.md for sections/abstract.md
references/context_projection.md when adjusting how chapter briefs are projected into Introduction / Related Work context
references/introduction_jobs.md for Introduction body files
references/related_work_positioning.md for Related Work body files
references/discussion_conclusion_patterns.md for sections/discussion.md and sections/conclusion.md
references/forbidden_stems.md before revising any reader-facing prose
references/examples_good.md and references/examples_bad.md for calibration only
Machine-readable assets:
assets/front_matter_context.schema.json
assets/front_matter_context_schema.json (compatibility alias for checklist-aligned naming)
assets/front_matter_contract.json
assets/front_matter_templates.json
assets/front_matter_context_projection.json
Inputs
Required:
DECISIONS.md with Approve C2
outline/outline.yml
outline/mapping.tsv
citations/ref.bib
Optional but useful:
GOAL.md
queries.md
papers/retrieval_report.md
papers/core_set.csv
outline/coverage_report.md
outline/writer_context_packs.jsonl
Outputs
Keep the current output contract:
sections/abstract.md
sections/S<sec_id>.md for front-matter H2 bodies
sections/discussion.md
sections/conclusion.md
output/FRONT_MATTER_REPORT.md
output/FRONT_MATTER_CONTEXT.json, including the base template bank, any
selected domain overlay, and their repository-relative SHA-256 hashes
Compatibility mode
Current mode is reference-first with script compatibility:
- writing guidance lives in
references/
- the structured job contract lives in
assets/front_matter_contract.json
- the hook bank used by the script lives in
assets/front_matter_templates.json
scripts/run.py still owns approval checks, metadata parsing, deterministic hook selection, file emission, and context-sidecar writing
That means:
- preserve current file shapes and approval behavior
- treat the assets as the active semantic source for section jobs, hook banks, and render guardrails
- avoid moving prose policy back into
SKILL.md
Script boundary
Use scripts/run.py as a deterministic helper for:
- approval gate enforcement
- front-matter file discovery / path selection
- metadata extraction
- rendering from
assets/front_matter_contract.json + assets/front_matter_templates.json
- writing the report and context sidecar
Do not treat the script as the main place for long-form writing guidance.
Output shape rules
Keep these stable:
sections/abstract.md starts with ## Abstract or ## 摘要
- Introduction / Related Work
sections/S<sec_id>.md files are body-only
sections/discussion.md includes ## Discussion
sections/conclusion.md includes ## Conclusion
- methodology note appears once in normal prose, not as pipeline/process narration
Quick Start
uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>
Troubleshooting
- If the front matter sounds narrated, reload
references/forbidden_stems.md and references/examples_bad.md.
- If Related Work turns into a survey list, reload
references/related_work_positioning.md.
- If the asset and the references drift, fix the asset/routing inside this skill package rather than expanding
SKILL.md again.
Execution notes
When running this skill in compatibility mode, scripts/run.py currently reads these inputs directly:
DECISIONS.md for Approve C2
outline/outline.yml to resolve Introduction / Related Work section ids
outline/mapping.tsv for front-matter citation placement context
citations/ref.bib for citation-key scope
GOAL.md, queries.md, papers/retrieval_report.md, papers/core_set.csv, outline/coverage_report.md, and outline/writer_context_packs.jsonl as optional context sources
Script
Quick Start
uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>
All Options
--workspace <dir>
--unit-id <id>
--inputs <path1;path2>
--outputs <path1;path2>
--checkpoint <C*>
Examples
uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>
Troubleshooting
- If
DECISIONS.md lacks Approve C2, the script will write a checkpoint block and exit.
- If
citations/ref.bib or outline/outline.yml is missing, restore those inputs before rerunning.
- If the front matter feels too template-like, inspect the hook banks / section job graph before touching the script.
1---2name: front-matter-writer3description: Write the survey's front matter files (Abstract, Introduction, Related Work, Discussion, Conclusion) in paper voice, with high citation density and a single evidence-policy paragraph.4---56# Front Matter Writer (compatibility router)78## Triggers & routing910- **Trigger**: front matter writer, introduction writer, related work writer, abstract writer, discussion writer, conclusion writer, 引言, 相关工作, 摘要, 讨论, 结论.111213Purpose: produce the paper-level shell while preserving the current output contract and approval gate.1415## Load Order1617Always read:18- `references/overview.md`1920Read by task:21- `references/abstract_archetypes.md` for `sections/abstract.md`22- `references/context_projection.md` when adjusting how chapter briefs are projected into Introduction / Related Work context23- `references/introduction_jobs.md` for Introduction body files24- `references/related_work_positioning.md` for Related Work body files25- `references/discussion_conclusion_patterns.md` for `sections/discussion.md` and `sections/conclusion.md`26- `references/forbidden_stems.md` before revising any reader-facing prose27- `references/examples_good.md` and `references/examples_bad.md` for calibration only2829Machine-readable assets:30- `assets/front_matter_context.schema.json`31- `assets/front_matter_context_schema.json` (compatibility alias for checklist-aligned naming)32- `assets/front_matter_contract.json`33- `assets/front_matter_templates.json`34- `assets/front_matter_context_projection.json`3536## Inputs3738Required:39- `DECISIONS.md` with `Approve C2`40- `outline/outline.yml`41- `outline/mapping.tsv`42- `citations/ref.bib`4344Optional but useful:45- `GOAL.md`46- `queries.md`47- `papers/retrieval_report.md`48- `papers/core_set.csv`49- `outline/coverage_report.md`50- `outline/writer_context_packs.jsonl`5152## Outputs5354Keep the current output contract:55- `sections/abstract.md`56- `sections/S<sec_id>.md` for front-matter H2 bodies57- `sections/discussion.md`58- `sections/conclusion.md`59- `output/FRONT_MATTER_REPORT.md`60- `output/FRONT_MATTER_CONTEXT.json`, including the base template bank, any61 selected domain overlay, and their repository-relative SHA-256 hashes6263## Compatibility mode6465Current mode is reference-first with script compatibility:66- writing guidance lives in `references/`67- the structured job contract lives in `assets/front_matter_contract.json`68- the hook bank used by the script lives in `assets/front_matter_templates.json`69- `scripts/run.py` still owns approval checks, metadata parsing, deterministic hook selection, file emission, and context-sidecar writing7071That means:72- preserve current file shapes and approval behavior73- treat the assets as the active semantic source for section jobs, hook banks, and render guardrails74- avoid moving prose policy back into `SKILL.md`7576## Script boundary7778Use `scripts/run.py` as a deterministic helper for:79- approval gate enforcement80- front-matter file discovery / path selection81- metadata extraction82- rendering from `assets/front_matter_contract.json` + `assets/front_matter_templates.json`83- writing the report and context sidecar8485Do not treat the script as the main place for long-form writing guidance.8687## Output shape rules8889Keep these stable:90- `sections/abstract.md` starts with `## Abstract` or `## 摘要`91- Introduction / Related Work `sections/S<sec_id>.md` files are body-only92- `sections/discussion.md` includes `## Discussion`93- `sections/conclusion.md` includes `## Conclusion`94- methodology note appears once in normal prose, not as pipeline/process narration9596## Quick Start9798- `uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>`99100## Troubleshooting101102- If the front matter sounds narrated, reload `references/forbidden_stems.md` and `references/examples_bad.md`.103- If Related Work turns into a survey list, reload `references/related_work_positioning.md`.104- If the asset and the references drift, fix the asset/routing inside this skill package rather than expanding `SKILL.md` again.105106107## Execution notes108109When running this skill in compatibility mode, `scripts/run.py` currently reads these inputs directly:110- `DECISIONS.md` for `Approve C2`111- `outline/outline.yml` to resolve Introduction / Related Work section ids112- `outline/mapping.tsv` for front-matter citation placement context113- `citations/ref.bib` for citation-key scope114- `GOAL.md`, `queries.md`, `papers/retrieval_report.md`, `papers/core_set.csv`, `outline/coverage_report.md`, and `outline/writer_context_packs.jsonl` as optional context sources115116## Script117118### Quick Start119120- `uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>`121122### All Options123124- `--workspace <dir>`125- `--unit-id <id>`126- `--inputs <path1;path2>`127- `--outputs <path1;path2>`128- `--checkpoint <C*>`129130### Examples131132- `uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>`133134## Troubleshooting135136- If `DECISIONS.md` lacks `Approve C2`, the script will write a checkpoint block and exit.137- If `citations/ref.bib` or `outline/outline.yml` is missing, restore those inputs before rerunning.138- If the front matter feels too template-like, inspect the hook banks / section job graph before touching the script.