Lambenthan/empiricalwiki / i18n/en/skills/paper-draft
paper-draft
VerifiedDraft a LaTeX paper from PAPER_PLAN — write each section from wiki sources + generate figures/tables + BibTeX verification + de-AI polish
/paper-draft
Draft a complete LaTeX paper from the PAPER_PLAN.md generated by /paper-plan. Write section by section: each section draws material from wiki claims/experiments/papers/concepts, generates LaTeX + figures + tables. BibTeX is fetched from DBLP/CrossRef (following citation-verification). Apply de-AI polish after completion (following academic-writing). Optional per-section Review LLM review. Output a compilable paper/ directory.
Inputs
plan: path to PAPER_PLAN.md (e.g.wiki/outputs/paper-plan-sparse-lora-2026-04-08.md)--review(optional): enable per-section Review LLM review--sections(optional): write only specified sections (e.g.--sections 3,4writes only Method + Experiments); used for incremental writing
Outputs
paper/directory (under the wiki project root):paper/main.tex— master file (includes each section)paper/sections/introduction.texpaper/sections/related_work.texpaper/sections/method.texpaper/sections/experiments.texpaper/sections/conclusion.texpaper/sections/appendix.tex(if applicable)paper/figures/— generated figures (PDF/PNG)paper/tables/— standalone table files (optional)paper/math_commands.tex— shared math symbol definitionspaper/references.bib— verified BibTeX entries
wiki/log.md— appended log entry
Wiki Interaction
Reads
wiki/outputs/paper-plan-*.md— PAPER_PLAN (section outline, evidence map, figure plan, citation plan)wiki/claims/*.md— Statement, Evidence summary, Conditions of target claimswiki/experiments/*.md— Results, Analysis, key_result, metrics datawiki/papers/*.md— Method, Results, Related (as citation content and baseline reference)wiki/concepts/*.md— Definition, Formal notation, Variants (supports Method writing)wiki/topics/*.md— Overview, Timeline, SOTA tracker (supports Introduction context)wiki/ideas/*.md— Motivation, Hypothesis (supports gap narrative in Introduction)wiki/people/*.md— author names and institutions (citation formatting)wiki/graph/edges.jsonl— relationship graph (build argumentative logic chain)wiki/graph/open_questions.md— known limitations (write Limitations and Future Work).claude/skills/shared-references/academic-writing.md— writing standards.claude/skills/shared-references/citation-verification.md— citation discipline
Writes
paper/directory (all files)wiki/log.md— appended operation log
Graph edges created
- None (paper-plan already created derived_from edges)
Workflow
Precondition: confirm the working directory is the wiki project root (the directory containing wiki/, raw/, tools/).
Step 1: Initialize Paper Directory
- Read PAPER_PLAN.md; extract venue, title, section list
- If
paper/directory already exists:- Back up as
paper.bak-{timestamp}/ - Prompt user to confirm overwrite
- Back up as
- Create directory structure:
paper/ ├── main.tex ├── math_commands.tex ├── references.bib ├── sections/ └── figures/ - Copy venue template from
templates/if it exists:templates/{venue}.styortemplates/{venue}/- If no template: use generic article class; note in main.tex that the official template must be substituted
- Generate
math_commands.tex:- Collect all Formal notation from wiki/concepts/
- Unify symbol definitions (vectors, matrices, sets, common operators)
- Generate
main.texskeleton:\documentclass{article} % replace with venue template \input{math_commands} % packages \usepackage{booktabs,graphicx,amsmath,hyperref} \title{<title>} \author{} % leave empty for anonymous submission \begin{document} \maketitle \begin{abstract} % generated in Step 3 \end{abstract} \input{sections/introduction} \input{sections/related_work} \input{sections/method} \input{sections/experiments} \input{sections/conclusion} \bibliography{references} \bibliographystyle{plain} % replace with venue-required style % \input{sections/appendix} % uncomment if needed \end{document}
Step 2: Generate Figures and Tables
For each entry in the Figure Plan from PAPER_PLAN:
-
Diagram type (architecture diagrams, etc.):
- Use TikZ or pgfplots to generate native LaTeX figures
- If too complex: generate a matplotlib Python script → output PDF
- Save to
paper/figures/{figure-name}.pdf
-
Plot type (experimental result charts):
- Extract data from
wiki/experiments/{slug}.md - Generate matplotlib script (following figure design standards in academic-writing):
- Colorblind-safe palette
- Font size >= 8pt
- Error bars / confidence bands
- Clear legend
- Execute script to generate PDF:
python3 paper/figures/plot_{name}.py - Save to
paper/figures/{figure-name}.pdf
- Extract data from
-
Table type:
- Use booktabs style (toprule, midrule, bottomrule)
- Best result bold, second-best underline
- Embed directly in section .tex file (small tables) or standalone
paper/tables/{name}.tex(large tables)
Step 3: Write Sections
For each section (in the outline order from PAPER_PLAN); if --sections is specified, write only those sections:
3a. Collect Material
From the section definition in PAPER_PLAN, extract:
- the claims this section supports
- the list of corresponding wiki pages
- planned figures/tables
- citation list
Read the relevant portions of all related wiki pages:
- Introduction → wiki/ideas/{idea}.md#Motivation + wiki/topics/{topic}.md#Overview
- Related Work → wiki/papers/.md#Related + wiki/concepts/.md#Comparison
- Method → wiki/concepts/*.md#Formal_notation + wiki/claims/{claim}.md#Statement
- Experiments → wiki/experiments/.md#Results + wiki/experiments/.md#Analysis
- Conclusion → wiki/graph/open_questions.md + wiki/claims/*.md#Open_questions
3b. Write LaTeX
Following shared-references/academic-writing.md:
- Write according to the paragraph plan for that section
- Insert
\cite{key}citations (keys mapped from citation plan) - Insert
\ref{fig:name}/\ref{tab:name}references to figures/tables - Use symbols defined in
math_commands.tex - Begin each paragraph with a topic sentence
- Experiments section: claim-first structure ("We claim X. To verify, we...")
3c. De-AI Polish
Apply de-AI polish to each written section (per academic-writing.md):
- Scan and replace AI-signature vocabulary (delve, leverage, utilize, comprehensive...)
- Remove excessive hedging
- Vary sentence openings (avoid consecutive identical sentence structures)
- Remove filler sentences (sentences that add no information)
- Ensure active voice predominates
- Check notation consistency
3d. Optional Review LLM Review (--review)
If --review is enabled, for each section:
mcp__llm-review__chat:
system: "You are a senior ML researcher reviewing one section of a paper draft.
Focus on: clarity, logical flow, claim-evidence alignment, notation consistency.
Point out any remaining AI-sounding language patterns.
Suggest specific rewrites for unclear passages."
message: |
## Section: {section name}
{LaTeX content}
## Claims this section should support
{claims from matrix}
## Review this section for:
1. Does it clearly support its target claims?
2. Is the writing clear and precise?
3. Any AI-generated language patterns remaining?
4. Is the notation consistent with other sections?
5. Missing content that reviewers will expect?
Revise the section based on Review LLM feedback (inline edits; do not rewrite the entire section).
Step 4: Build Bibliography
Following shared-references/citation-verification.md:
- Collect all
\cite{key}citations used across sections - For each citation, retrieve BibTeX from the PAPER_PLAN's citation plan:
- Verified: write directly to
references.bib - [UNCONFIRMED]: write to the bottom of
references.bibwith a% [UNCONFIRMED]comment
- Verified: write directly to
- Exclude unused entries (do not use
\nocite{*}) - Validate BibTeX format correctness (each entry has title, author, year)
- Output bibliography statistics:
references.bib: {N} entries, {M} verified, {K} [UNCONFIRMED]
Step 5: Full-Paper Cross-Review
After all sections are complete:
mcp__llm-review__chat:
system: "You are a senior ML researcher performing a final review of a complete paper draft.
Focus on: cross-section coherence, claim-evidence thread (does the paper prove what it claims?),
narrative flow, notation consistency across sections, figure/table referencing.
This is NOT a line-by-line review — focus on structural and argumentative issues."
message: |
## Full Paper Draft
{concatenated LaTeX of all sections}
## Evidence Map
{from PAPER_PLAN}
## Review Focus
1. Does the paper tell a coherent story from Introduction to Conclusion?
2. Are all claims from the matrix adequately supported in the text?
3. Is there notation inconsistency between sections?
4. Are all figures/tables referenced and discussed?
5. Any redundancy between sections?
6. Overall readiness for submission (1-10)?
Make final adjustments based on Review LLM feedback.
Step 6: Finalize Output
- Confirm all files are written to the
paper/directory - Verify basic integrity:
- all files referenced by
\input{sections/X}exist - all files referenced by
\includegraphics{figures/X}exist - all
\cite{key}keys have a corresponding entry in references.bib - all
\ref{label}have a corresponding\label{label}
- all files referenced by
- Append log:
python3 tools/research_wiki.py log wiki/ \ "paper-draft | drafted {venue} paper '{title}' | {N} sections, {M} figures, {K} citations ({V} verified)" - Print to terminal:
# Paper Write Complete ## Files - paper/main.tex (master file) - paper/sections/ ({N} section files) - paper/figures/ ({M} figure files) - paper/references.bib ({K} entries, {V_count} [UNCONFIRMED]) - paper/math_commands.tex ## Status - Sections written: {list} - De-AI polish: applied - Review LLM review: {yes/no, if yes: overall score} - [UNCONFIRMED] citations: {count} (resolve before /paper-compile) ## Next Steps - Run `/paper-compile paper/` to compile and verify - Resolve [UNCONFIRMED] citations manually - Run `/refine paper/main.tex --focus writing` for further polish
Constraints
- Each section draws from wiki: do not generate content from nothing; every technical claim must trace back to a wiki page
- BibTeX follows citation-verification.md: fetch from DBLP/CrossRef/S2; do not generate from LLM memory
- De-AI polish is mandatory: each section must receive a polish pass after writing; cannot be skipped
- Figures follow academic-writing.md: colorblind-safe, font size >= 8pt, vector format preferred
- Anonymous submission: do not write author names, institutions, or acknowledgements (per venue anonymity requirements)
- \nocite{*} is forbidden: only cite entries actually used
- Notation consistency: all sections use unified symbols from math_commands.tex
- Back up existing paper/ before overwriting: do not overwrite directly; back up first
- Wikilink → \cite conversion: [[slug]] references in PAPER_PLAN are converted to \cite{key} in LaTeX
- Tables use booktabs: no vertical lines or full grid
Error Handling
- PAPER_PLAN not found: error; suggest running /paper-plan first
- PAPER_PLAN format incomplete: list missing sections; suggest re-running /paper-plan
- Wiki page not found (claim/experiment/paper referenced in plan does not exist): warn and skip that reference; annotate as missing
- Figure generation failed (matplotlib error): output placeholder
% TODO: generate figure {name}; continue with other sections - All BibTeX fetches failed: use [UNCONFIRMED] placeholders; report the count requiring manual handling in the terminal
- Review LLM unavailable (--review mode): skip section review and cross-review; annotate as "unreviewed"
- Venue template not found: use generic article class; note in main.tex
- Section too long (exceeds plan page budget): warn; suggest moving to appendix or compressing
Dependencies
Tools(via Bash)
python3 tools/research_wiki.py log wiki/ "<message>"— append logpython3 tools/fetch_s2.py search "<title>"— BibTeX fallback (S2 search)python3— execute matplotlib figure scripts
MCP Servers
mcp__llm-review__chat— per-section review (optional, --review) + full-paper cross-review (Step 5)
Claude Code Native
Read— read wiki pages and PAPER_PLANGlob— find wiki pagesWrite— write files to paper/ directoryBash— execute figure scripts, create directoriesWebFetch— DBLP / CrossRef BibTeX fetch
Shared References
.claude/skills/shared-references/academic-writing.md— writing standards + de-AI polish rules + figure design.claude/skills/shared-references/citation-verification.md— BibTeX fetch workflow + [UNCONFIRMED] protocol
Called by
/researchStage 5 (paper writing stage)- Manual user invocation
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |
| add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |
| diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |
| fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |