> ## Documentation Index
> Fetch the complete documentation index at: https://hubify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Papers

> The paper pipeline takes experiment results through drafting, peer review, LaTeX compilation, and arXiv submission.

# Papers

Hubify Labs treats paper writing as a first-class workflow, not an afterthought. The **paper pipeline** takes raw experiment results and produces arXiv-ready PDFs through a structured, agent-assisted process.

## Paper Lifecycle

<Steps>
  <Step title="Results Collection">
    As experiments complete and pass QC, their results, figures, and metrics are tagged for inclusion in a paper. Agents organize results by paper section.
  </Step>

  <Step title="Outline & Claims">
    The Paper Lead drafts an outline and a **claims table**, a structured list of every scientific claim the paper makes, each linked to its supporting evidence.
  </Step>

  <Step title="Section Drafting">
    Agents draft individual sections (abstract, introduction, methods, results, discussion). Each section is reviewed by a different model before merging.
  </Step>

  <Step title="Cross-Model Peer Review">
    The full draft undergoes peer review from multiple AI models (Claude, GPT-4, Gemini). Reviews check scientific accuracy, logical flow, missing citations, and overstatements.
  </Step>

  <Step title="LaTeX Compilation">
    The manuscript is compiled using `revtex4-2` (Physical Review D format). Figures are embedded, cross-references resolved, and the bibliography generated.
  </Step>

  <Step title="Revision Rounds">
    Based on peer review feedback, agents iterate on the draft. Each revision round is logged with a diff showing exactly what changed and why.
  </Step>

  <Step title="Submission">
    The final PDF, source files, and supplementary data are packaged for arXiv submission.
  </Step>
</Steps>

## Paper Structure

Every paper in Hubify Labs follows a consistent structure:

```latex theme={null}
\documentclass[aps,prd,twocolumn,superscriptaddress]{revtex4-2}

\begin{document}
\title{Your Paper Title}
\author{Your Name}
\affiliation{Your Institution}

\begin{abstract}
...
\end{abstract}

\maketitle

\section{Introduction}
\section{Methods}
\section{Results}
\section{Discussion}
\section{Conclusions}

\bibliography{references}
\end{document}
```

<Warning>
  All papers use `revtex4-2`, not `aastex631`. Use `\cite{}`, not `\citep`/`\citet`. Use `ruledtabular`, not `deluxetable`.
</Warning>

## Claims Table

The claims table is a living document that maps every assertion to evidence:

| Claim                                   | Evidence                     | Confidence | Status       |
| --------------------------------------- | ---------------------------- | ---------- | ------------ |
| "Matter bounce predicts f\_NL = -4.375" | Branch V derivation, EXP-031 | High       | Verified     |
| "Quintom-B favored at 2.3 sigma"        | MCMC EXP-048, w0-wa chains   | Medium     | Under review |

Agents cannot write a claim without linking it to an experiment or derivation. This prevents hallucinated results from entering the manuscript.

## Readiness Tracking

Each paper has a **readiness percentage** that tracks progress across dimensions:

* **Content**, Are all sections drafted?
* **Figures**, Are all figures generated and placed?
* **Bibliography**, Are all citations resolved?
* **Claims**, Are all claims verified against evidence?
* **Compilation**, Does the LaTeX compile with zero errors?
* **Review**, Has the paper passed cross-model peer review?

## Version History

Every change to a paper is versioned. The version history shows:

* What changed (diff)
* Why it changed (review feedback, new results)
* Who changed it (which agent)
* When it changed (timestamp)

## CLI

```bash theme={null}
# Create a new paper
hubify paper create --title "Spin-Torsion Cosmology" --template prd

# Check paper status
hubify paper status paper-1

# Compile to PDF
hubify paper compile paper-1

# Run peer review
hubify paper review paper-1

# List revision history
hubify paper history paper-1
```

## Figure Management

Figures are automatically linked to experiments:

```bash theme={null}
# List figures for a paper
hubify paper figures paper-1

# Add a figure from an experiment
hubify paper add-figure paper-1 --experiment EXP-054 --file posterior.png --caption "Posterior distribution"
```

All figures must be in the same directory as the `.tex` file (or symlinked) for LaTeX compilation to embed them correctly.
