Section Drafting Protocol
Inputs
- •Section Name: (e.g., "Methods", "Results", "Introduction") provided by the user or plan.
- •Context Files: The list of code/data files identified in
manuscript/outline.md.
Workflow
- •Read Outline: Read
manuscript/outline.mdto understand section requirements and evidence files. - •Load Context: Read the specified code/data files. DO NOT read unrelated files to save tokens.
- •Load Citations: Read
references.bibormanuscript/literature_citations.bibto find relevant citation keys. - •Drafting: Write the text in Markdown.
- •Use LaTeX for math (e.g.,
$x^2$). - •Use [Key] format for citations (e.g.,
[smith2020]). - •Style: Formal academic prose. Passive voice for Methods; Active voice for Results.
- •Use LaTeX for math (e.g.,
Fact-Checking Requirement
CRITICAL: You must verify all numerical claims.
- •Before finalizing a sentence containing a number, locate that number in the source file (
*.csvor*.log). - •If the number involves a calculation (e.g., mean, p-value), generate a temporary Python script to compute it from the raw data and verify your claim.
- •Command:
python scripts/rrwrite-verify-stats.py --file <PATH> --col [NAME] --op [mean/max/min]
Figure referencing
- •Ensure every Figure mentioned is referenced as "Figure X" (capitalized).
- •Describe the figure content based on the generating script's logic (e.g., "Figure 1 visualizes the t-SNE projection...").
Output and Naming (per schema: schemas/manuscript.yaml)
Write the section to manuscript/SECTIONNAME.md where SECTIONNAME is:
- •
abstract.mdfor Abstract - •
introduction.mdfor Introduction - •
methods.mdfor Methods - •
results.mdfor Results - •
discussion.mdfor Discussion - •
conclusion.mdfor Conclusion
Validation
After drafting, validate the section:
bash
python scripts/rrwrite-validate-manuscript.py --file manuscript/SECTIONNAME.md --type section
State Update
After successful validation, update workflow state:
python
import sys
from pathlib import Path
sys.path.insert(0, str(Path('scripts').resolve()))
from rrwrite_state_manager import StateManager
manager = StateManager()
manager.add_section_completed("SECTIONNAME") # e.g., "methods", "results"
Display updated progress:
bash
python scripts/rrwrite-status.py
Report validation status and updated workflow progress. If validation fails, fix issues and re-validate.