Skip to content

Stage 6: Writing

The writing stage produces the paper draft. The Writer agent works in clean, isolated sessions, receiving curated context from the Orchestrator for each section.

Entering This Stage

What you have:

  • Complete analysis with paper framing (experiments/exp-001/analysis.md)
  • All figures generated (papers/figures/)
  • Related work summaries from Scout (papers/related_work/)
  • Paper outline from Planner (papers/outline.md)

What you don't have yet:

  • Paper text
  • LaTeX document
  • Final bibliography

Steps

mermaid
graph TD
    A[1. Outline Refinement] --> B[2. Related Work Prep]
    B --> C[3. Section Writing]
    C --> D[4. Integration]
    D --> E[5. Internal Review]
    E --> F{Quality OK?}
    F -->|Yes| G[Gate: Advance to Review]
    F -->|No| C

    style A fill:#f9f0ff,stroke:#7c3aed
    style B fill:#ecfdf5,stroke:#059669
    style C fill:#ede9fe,stroke:#7c3aed
    style E fill:#fef3c7,stroke:#d97706

1. Outline Refinement

Agent: Orchestrator (Claude Opus) with Planner

The Orchestrator refines the paper outline based on actual results (which may differ from the original plan):

markdown
# papers/outline.md (refined)
## 1. Introduction (1 page)
- Problem: Attention is O(n^2), limiting long-sequence modeling
- Key insight: Flash attention tiling + recurrent formulation
- Contributions (3 bullets)

## 2. Related Work (1 page)
- Efficient attention methods
- Recurrent approaches to attention
- Hardware-aware optimization

## 3. Method (2 pages)
- 3.1 Preliminaries: Retention mechanism
- 3.2 Flash-Recurrent Attention
- 3.3 Analysis: Complexity and memory

## 4. Experiments (2 pages)
- 4.1 Setup
- 4.2 Main Results (Table 1)
- 4.3 Ablation Study (Table 2)
- 4.4 Scaling Analysis (Figure 2)

## 5. Discussion (0.5 pages)
- Limitations
- Future work

## 6. Conclusion (0.5 pages)

Agent: Scout (Gemini)

The Scout ensures all cited papers have proper summaries and BibTeX entries:

  • Verify all baselines have entries
  • Add any papers discovered during analysis
  • Cross-check with analysis.md for completeness

Output: Updated papers/related_work/summaries.yaml and papers/related_work/papers.bib

3. Section Writing

Agent: Writer (Claude Opus, clean session per section)

The core writing phase. Each major section gets a fresh Writer session:

SectionContext ProvidedKey Challenge
IntroductionOutline, contributions, related work overviewMotivating the problem clearly
Related WorkPre-digested summaries, positioning notesConnecting prior work to ours
MethodAlgorithm description, pseudocode, complexity analysisTechnical precision + clarity
ExperimentsResults tables, figures, statistical testsHonest presentation of results
DiscussionAnalysis synthesis, known limitationsBalanced assessment
ConclusionFull paper context (if space allows)Concise, forward-looking
AbstractFull paper (written last)Compress everything into 200 words

Sections are written in dependency order

Introduction and Method can be written in parallel. Experiments depends on having the Method section (for consistent notation). Discussion depends on Experiments. Abstract is written last.

mermaid
graph LR
    I[Introduction] --> E[Experiments]
    M[Method] --> E
    RW[Related Work] --> E
    E --> D[Discussion]
    D --> C[Conclusion]
    C --> A[Abstract]

    style A fill:#fef3c7,stroke:#d97706

4. Integration

Agent: Orchestrator (Claude Opus)

The Orchestrator integrates all sections into a single LaTeX document:

  • Verify notation consistency across sections
  • Check cross-references (figures, tables, equations)
  • Ensure page limit is respected
  • Compile LaTeX to verify it builds

Output: papers/drafts/v1.tex (complete first draft)

Integration is not just concatenation

The Orchestrator reads through the integrated draft looking for inconsistencies: a variable named differently in Method vs. Experiments, a claim in the Introduction not supported in Experiments, a related work paper cited but not discussed.

5. Internal Review

Agent: Orchestrator (Claude Opus)

Before the formal review stage, the Orchestrator does a self-check:

  • Does the paper tell a coherent story?
  • Are all claims supported by data?
  • Is the contribution clearly stated?
  • Are limitations acknowledged?

If issues are found, specific sections are re-dispatched to the Writer with revision instructions.

Gate

Gate TypeRecommendedBehavior
humanYesUser reads the draft before formal review
auto-judgePossibleJudge does a quick quality check
autoNot recommendedPaper quality deserves review

Read your paper before review

The writing stage gate is a critical human checkpoint. Reading your own paper draft takes 30-60 minutes and often catches issues that no automated review can find — you know your story better than any LLM.

Error Handling

ErrorRecovery
Writer context fills mid-sectionStart new session, provide partial draft
Section too long for page limitOrchestrator gives Writer a word budget
LaTeX compilation errorCoder fixes LaTeX syntax
Notation inconsistencyRe-dispatch affected section to Writer
Missing citationScout fetches paper, Writer integrates

Writer Context Management

The Writer's clean context is critical for quality. Here's how it works per section:

Session starts (100% context available)
├── Outline loaded (2%)
├── Section spec loaded (3%)
├── Relevant results loaded (10%)
├── Related work summaries loaded (5%)
├── Style guidelines loaded (2%)
├── [78% available for writing]
└── Section written → saved to disk
Session ends
What if 78% isn't enough?

For very long sections (e.g., a 4-page experiments section), the Orchestrator splits it into subsections. Each subsection gets a fresh Writer session. The integration step then ensures coherence across subsections.

Outputs Summary

FileContents
papers/drafts/v1.texComplete first draft
papers/drafts/current.texSymlink to latest version
papers/related_work/papers.bibComplete bibliography
papers/figures/All figures referenced in paper

Next Stage

When the gate passes, the pipeline advances to Review with a complete paper draft.

AutoResearch — Multi-agent Deep Learning Research System