domains / research / paper-writing-pipeline / paper-writing
Both copies describe the same five-phase paper-writing pipeline (paper-plan → paper-figure → paper-write → paper-compile → auto-paper-improvement-loop) with the same constants and checkpoints, but they disagree on the reviewer model and the first copy adds a substantial optional style-reference pre-step and an ILLUSTRATION constant that the second copy lacks. The second copy includes more detailed phase-by-phase instructions (e.g., explicit GPT-5.4 review calls, figure scope, compilation attempts) that the first copy truncates. Crowning one would hide the other's unique steps and the conflicting reviewer model.
| Repository | Path |
|---|---|
| wanshuiyin/Auto-claude-code-research-in-sleep | skills/paper-writing/SKILL.md |
| brycewang-stanford/Auto-Empirical-Research-Skills | skills/42-wanshuiyin-ARIS/skills/paper-writing/SKILL.md |
| Role | Repository | Path |
|---|---|---|
| peer | wanshuiyin/Auto-claude-code-research-in-sleep | skills/paper-writing/SKILL.md |
| peer | brycewang-stanford/Auto-Empirical-Research-Skills | skills/42-wanshuiyin-ARIS/skills/paper-writing/SKILL.md |
| adapter | wanshuiyin/Auto-claude-code-research-in-sleep | skills/skills-codex/paper-writing/SKILL.md |
| adapter | wanshuiyin/Auto-claude-code-research-in-sleep | skills/skills-codex-gemini-review/paper-writing/SKILL.md |
| adapter | brycewang-stanford/Auto-Empirical-Research-Skills | skills/60-regisely-superpapers/skills/paper-writing/SKILL.md |
| adapter | brycewang-stanford/Auto-Empirical-Research-Skills | skills/42-wanshuiyin-ARIS/skills/skills-codex/paper-writing/SKILL.md |
| adapter | brycewang-stanford/Auto-Empirical-Research-Skills | skills/42-wanshuiyin-ARIS/skills/skills-codex-gemini-review/paper-writing/SKILL.md |
---
name: paper-writing
description: "Workflow 3: Full paper writing pipeline. Orchestrates paper-plan → paper-figure → paper-write → paper-compile → auto-paper-improvement-loop to go from a narrative report to a polished, submission-ready PDF. Use when user says \"写论文全流程\", \"write paper pipeline\", \"从报告到PDF\", \"paper writing\", or wants the complete paper generation workflow."
argument-hint: "[narrative-report-path-or-topic] [— style-ref: <source>]"
allowed-tools: Bash(*), Read, Write, Edit, Grep, Glob, Agent, Skill, mcp__codex__codex, mcp__codex__codex-reply
---
# Workflow 3: Paper Writing Pipeline
Orchestrate a complete paper writing workflow for: **$ARGUMENTS**
## Overview
This skill chains five sub-skills into a single automated pipeline:
```
/paper-plan → /paper-figure → /paper-write → /paper-compile → /auto-paper-improvement-loop
(outline) (plots) (LaTeX) (build PDF) (review & polish ×2)
```
Each phase builds on the previous one's output. The final deliverable is a polished, reviewed `paper/` directory with LaTeX source and compiled PDF.
## Constants
- **VENUE = `ICLR`** — Target venue. Options: `ICLR`, `NeurIPS`, `ICML`, `CVPR`, `ACL`, `AAAI`, `ACM`, `IEEE_JOURNAL`, `IEEE_CONF`. Affects style file, page limit, citation format.
- **MAX_IMPROVEMENT_ROUNDS = 2** — Number of review→fix→recompile rounds in the improvement loop.
- **REVIEWER_MODEL = `gpt-5.4`** — Model used via Codex MCP for plan review, figure review, writing review, and improvement loop. (Note: wanshuiyin/Auto-claude-code-research-in-sleep uses `gpt-6-astra`; choose per deployment.)
- **AUTO_PROCEED = true** — Auto-continue between phases. Set `false` to pause and wait for user approval after each phase.
- **HUMAN_CHECKPOINT = false** — When `true`, the improvement loop pauses after each round's review to let you see the score and provide custom modification instructions.
- **ILLUSTRATION = `figurespec`** — Architecture/illustration generator for Phase 2b: `figurespec` (default), `gemini`, `codex-image2`, `mermaid`, or `false` (skip Phase 2b).
> Override inline: `/paper-writing "NARRATIVE_REPORT.md" — venue: NeurIPS, illustration: gemini, human checkpoint: true`
## Inputs
This pipeline accepts one of:
1. **`NARRATIVE_REPORT.md`** (best) — structured research narrative with claims, experiments, results, figures
2. **Research direction + experiment results** — the skill will help draft the narrative first
3. **Existing `PAPER_PLAN.md`** — skip Phase 1, start from Phase 2
## Optional: Style reference (`— style-ref: <source>`, opt-in)
When `— style-ref: <source>` is in `$ARGUMENTS`, run the helper FIRST, before Phase 1:
```bash
cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" || exit 1
if [ -z "${ARIS_REPO:-}" ] && [ -f .aris/installed-skills.txt ]; then
ARIS_REPO=$(awk -F'\t' '$1=="repo_root"{print $2; exit}' .aris/installed-skills.txt 2>/dev/null) || true
fi
if [ -z "${ARIS_REPO:-}" ] && [ -f "$HOME/.aris/repo" ]; then
ARIS_REPO=$(cat "$HOME/.aris/repo" 2>/dev/null) || true
fi
STYLE_HELPER=".aris/tools/extract_paper_style.py"
[ -f "$STYLE_HELPER" ] || STYLE_HELPER="tools/extract_paper_style.py"
[ -f "$STYLE_HELPER" ] || { [ -n "${ARIS_REPO:-}" ] && STYLE_HELPER="$ARIS_REPO/tools/extract_paper_style.py"; }
[ -f "$STYLE_HELPER" ] || {
echo "ERROR: extract_paper_style.py not resolved." >&2
exit 1
}
STYLE_STATUS=0
CACHE=$(python3 "$STYLE_HELPER" --source "<source>") || STYLE_STATUS=$?
case "$STYLE_STATUS" in
0) ;;
2) echo "warning: style-ref skipped (missing optional dep)" >&2 ;;
3) echo "error: --style-ref source failed; aborting pipeline" >&2 ; exit 1 ;;
*) echo "error: helper failed unexpectedly; aborting pipeline" >&2 ; exit 1 ;;
esac
```
Then forward `— style-ref: <source>` only to the writer-side sub-skills: `/paper-plan`, `/paper-write`, and optionally `/paper-illustration`.
Sources accepted: local TeX dir/file, local PDF, arXiv id, http(s) URL. Overleaf URLs/IDs are rejected — clone via `/overleaf-sync setup <id>` first.
## Pipeline
### Phase 1: Paper Plan
Invoke `/paper-plan` to create the structural outline:
```
/paper-plan "$ARGUMENTS"
```
**What this does:**
- Parse NARRATIVE_REPORT.md for claims, evidence, and figure descriptions
- Build a **Claims-Evidence Matrix**
- Design section structure (5-8 sections)
- Plan figure/table placement with data sources
- Scaffold citation structure
- REVIEWER_MODEL reviews the plan for completeness
**Output:** `PAPER_PLAN.md` with section plan, figure plan, citation scaffolding.
**Checkpoint:** Present the plan summary to the user.
### Phase 2: Figure Generation
Invoke `/paper-figure` to generate data-driven plots and tables:
```
/paper-figure "PAPER_PLAN.md"
```
**What this does:**
- Read figure plan from PAPER_PLAN.md
- Generate matplotlib/seaborn plots from JSON/CSV data
- Generate LaTeX comparison tables
- Create `figures/latex_includes.tex`
- REVIEWER_MODEL reviews figure quality and captions
**Output:** `figures/` directory with PDFs, generation scripts, and LaTeX snippets.
> **Scope:** Auto-generates ~60% of figures (data plots, comparison tables). Architecture diagrams, pipeline figures, and qualitative result grids must be created manually.
**Checkpoint:** List generated vs manual figures.
### Phase 3: LaTeX Writing
Invoke `/paper-write` to generate section-by-section LaTeX:
```
/paper-write "PAPER_PLAN.md"
```
**What this does:**
- Write each section following the plan, with proper LaTeX formatting
- Insert figure/table references from `figures/latex_includes.tex`
- Build `references.bib` from citation scaffolding
- Clean stale files from previous section structures
- Automated bib cleaning (remove uncited entries)
- De-AI polish (remove "delve", "pivotal", "landscape"...)
- REVIEWER_MODEL reviews each section for quality
**Output:** `paper/` directory with `main.tex`, `sections/*.tex`, `references.bib`, `math_commands.tex`.
**Checkpoint:** Report section completion.
### Phase 4: Compilation
Invoke `/paper-compile` to build the PDF:
```
/paper-compile "paper/"
```
**What this does:**
- `latexmk -pdf` with automatic multi-pass compilation
- Auto-fix common errors (missing packages, undefined refs, BibTeX syntax)
- Up to 3 compilation attempts
- Post-compilation checks: undefined refs, page count, font embedding
**Output:** Compiled PDF in `paper/`.
**Checkpoint:** Report compilation status.
### Phase 5: Auto Paper Improvement Loop
Invoke `/auto-paper-improvement-loop` to review and polish:
```
/auto-paper-improvement-loop "paper/"
```
**What this does:**
- REVIEWER_MODEL reviews the full paper for quality, clarity, and completeness
- Apply fixes based on review feedback
- Recompile and re-review
- Repeat for MAX_IMPROVEMENT_ROUNDS rounds
**Output:** Polished `paper/` directory with final PDF.
**Checkpoint:** Present final score and summary.
## Conflicts
- **REVIEWER_MODEL**: wanshuiyin/Auto-claude-code-research-in-sleep uses `gpt-6-astra`; brycewang-stanford/Auto-Empirical-Research-Skills uses `gpt-5.4`. Choose per deployment.
- **ILLUSTRATION constant and style-ref pre-step**: Present in wanshuiyin/Auto-claude-code-research-in-sleep; absent in brycewang-stanford/Auto-Empirical-Research-Skills. Include if the deployment supports them.
- **allowed-tools**: wanshuiyin/Auto-claude-code-research-in-sleep includes `mcp__codex__codex` and `mcp__codex__codex-reply` but not `Agent`; brycewang-stanford/Auto-Empirical-Research-Skills includes `Agent` but not the mcp__codex tools. Include all for maximum compatibility.