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.
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.
Each phase builds on the previous one's output. The final deliverable is a polished, reviewed paper/ directory with LaTeX source and compiled PDF.
In this hybrid pack, the pipeline itself is unchanged, but paper-plan and paper-write use Orchestra-adapted shared references for stronger story framing and prose guidance.
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.
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 (Phase 5) pauses after each round's review to let you see the score and provide custom modification instructions. When false (default), the loop runs fully autonomously. Passed through to /auto-paper-improvement-loop.
ILLUSTRATION = gemini — AI illustration mode: gemini (default, needs GEMINI_API_KEY), mermaid (free, no API key), or false (skip, manual only).
When illustration: false — skip entirely. Architecture diagrams must be created manually (draw.io, Figma, TikZ).
Checkpoint: List generated vs manual figures.
📊 Figures complete:
- Data plots (auto): [list]
- AI illustrations (auto): [list, if illustration ≠ false]
- Manual (need your input): [list]
- LaTeX snippets: figures/latex_includes.tex
[If manual figures needed]: Please add them to figures/ before I proceed.
[If all auto]: Shall I proceed with LaTeX writing?
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
The external reviewer reviews each section for quality
Output:paper/ directory with main.tex, sections/*.tex, references.bib, math_commands.tex.
Checkpoint: Report section completion.
✍️ LaTeX writing complete:
- Sections: [N] written ([list])
- Citations: [N] unique keys in references.bib
- Stale files cleaned: [list, if any]
Shall I proceed with compilation?
Phase 4: Compilation
Invoke /paper-compile to build the PDF:
/paper-compile "paper/"
What this does:
Run _utils/compile_utils.sh for pre-compile cleanup (special chars, path fix, hidelinks)
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:paper/main.pdf
Checkpoint: Report compilation results.
🔨 Compilation complete:
- Status: SUCCESS
- Pages: [X] (main body) + [Y] (references) + [Z] (appendix)
- Within page limit: YES/NO
- Undefined references: 0
- Undefined citations: 0
Shall I proceed with the improvement loop?
Phase 5: Auto Improvement Loop
Invoke /auto-paper-improvement-loop to polish the paper:
/auto-paper-improvement-loop "paper/"
What this does (2 rounds):
Round 1: The external reviewer reviews the full paper → identifies CRITICAL/MAJOR/MINOR issues → Claude Code implements fixes → recompile → save main_round1.pdf
Round 2: The external reviewer re-reviews with conversation context → identifies remaining issues → Claude Code implements fixes → recompile → save main_round2.pdf
Typical improvements:
Fix assumption-model mismatches
Soften overclaims to match evidence
Add missing interpretations and notation
Strengthen limitations section
Add theory-aligned experiments if needed
Output: Three PDFs for comparison + PAPER_IMPROVEMENT_LOG.md.
Format check (included in improvement loop Step 8): After final recompilation, auto-detect and fix overfull hboxes (content exceeding margins), verify page count vs venue limit, and ensure compact formatting. Any overfull > 10pt is fixed before generating the final PDF.
Phase 6: Final Report
# Paper Writing Pipeline Report**Input**: [NARRATIVE_REPORT.md or topic]
**Venue**: [ICLR/NeurIPS/ICML]
**Date**: [today]
## Pipeline Summary
| Phase | Status | Output |
|-------|--------|--------|
| 1. Paper Plan | ✅ | PAPER_PLAN.md |
| 2. Figures | ✅ | figures/ ([N] auto + [M] manual) |
| 3. LaTeX Writing | ✅ | paper/sections/*.tex ([N] sections, [M] citations) |
| 4. Compilation | ✅ | paper/main.pdf ([X] pages) |
| 5. Improvement | ✅ | [score0]/10 → [score2]/10 |
## Improvement Scores
| Round | Score | Key Changes |
|-------|-------|-------------|
| Round 0 | X/10 | Baseline |
| Round 1 | Y/10 | [summary] |
| Round 2 | Z/10 | [summary] |
## Deliverables
- paper/main.pdf — Final polished paper
- paper/main_round0_original.pdf — Before improvement
- paper/main_round1.pdf — After round 1
- paper/main_round2.pdf — After round 2
- paper/PAPER_IMPROVEMENT_LOG.md — Full review log
## Remaining Issues (if any)
- [items from final review that weren't addressed]
## Next Steps
- [ ] Visual inspection of PDF
- [ ] Add any missing manual figures
- [ ] Submit to [venue] via OpenReview / CMT / HotCRP
Key Rules
Large file handling: For long output files (reports, reviews, etc.), ALWAYS use Bash heredoc (cat << 'EOF' > file and cat << 'EOF' >> file) to write in chunks instead of the Write tool. The Write tool may silently fail on large content due to output token limits, causing empty parameters. Do NOT use the Write tool for files longer than ~150 lines.
Don't skip phases. Each phase builds on the previous one — skipping leads to errors.
Checkpoint between phases when AUTO_PROCEED=false. Present results and wait for approval.
Manual figures first. If the paper needs architecture diagrams or qualitative results, the user must provide them before Phase 3.
Compilation must succeed before entering the improvement loop. Fix all errors first.
Preserve all PDFs. The user needs round0/round1/round2 for comparison.
Document everything. The pipeline report should be self-contained.
Respect page limits. If the paper exceeds the venue limit, suggest specific cuts before the improvement loop.
Composing with Other Workflows
/idea-discovery "direction" ← Workflow 1: find ideas
implement ← write code
/run-experiment ← deploy experiments
/auto-review-loop "paper topic" ← Workflow 2: iterate research
/paper-writing "NARRATIVE_REPORT.md" ← Workflow 3: you are here
submit! 🎉
Or use /research-pipeline for the Workflow 1+2 end-to-end flow,
then /paper-writing for the final writing step.
Typical Timeline
Phase
Duration
Can sleep?
1. Paper Plan
5-10 min
No
2. Figures
5-15 min
No
3. LaTeX Writing
15-30 min
Yes ✅
4. Compilation
2-5 min
No
5. Improvement
15-30 min
Yes ✅
Total: ~45-90 min for a full paper from narrative report to polished PDF.