paper-ops
by WhoJay0609
README.md
# paper-ops
**Zero-dependency paper lifecycle toolkit & MCP server for Codex and Antigravity (AGY).**
Built from real multi-wave ML/systems research workflows to stop the five recurring paper-engineering failures:
1. **Living-doc context bloat (`docs-check` / `docs-compact`)**: Multi-wave research logs (`PLAN.md`, `RESULTS.md`, `METHOD.md`, `GOAL.md`, `RELATED.md`) quietly grow past 500 KB and blow up agent context windows. `docs-compact` losslessly archives older `## ` waves into `archive/<stem>_archive_<YYYYMMDD>.md`, writes an indexed `archive/ARCHIVE_MAP.md` with SHA-256 digests, and inserts a compact pointer table in the live doc. Dry-run by default; requires `--apply`.
2. **Artifact-to-LaTeX number drift (`sync-macros` / `verify-claims`)**: Generates `\newcommand` macros directly from experiment `.json` artifacts plus a SHA-256 `numbers_provenance.json`, and detects stale macros or mutated source artifacts before submission.
3. **Incomplete timing & correctness disclosures (`audit-timing`)**: Audits `.tex` (recursively via `\input`/`\include`) and `.md` reports against 7 mandatory dimensions (hardware/precision/stack, warmup/repeats/sync/workload, variance/seeds/statistics, isolation/shared-host contention, baseline parity, paired quality/correctness, scope/limitations) and optionally validates `timing_attestation.json` generated by [`lab-gpu-steward`](https://github.com/WhoJay0609/lab-gpu-steward).
4. **4-Gate Pre-Submission Audit (`gate`)**:
- **Gate 1 — Citations & Provenance**: Undefined `\cite*` keys, incomplete `.bib` entries, and `CITATION_PROVENANCE.md` coverage.
- **Gate 2 — Claims, Cross-Refs, Macros & Placeholders**: Missing `\input`s, undefined `\ref`/`\eqref`/`\cref`, duplicate `\label`s, unresolved `TBD`/`TODO`/`FIXME`/`XXX`/`??`/`\todo{}`, and optional manifest macro drift.
- **Gate 3 — Timing & Correctness Disclosure**: 7-dimension audit + optional `timing_attestation.json`.
- **Gate 4 — Build Log & Rendered PDF Hygiene**: Inspects `.log` for fatal errors, undefined control sequences/refs/cites, multiply-defined labels, and severe `Overfull \hbox`; verifies `.pdf` header, non-zero size, staleness vs `.tex`/`.bib`, and page count (when `pdfinfo` is available).
5. **Grounded Review Gate (`audit-review`)**: Verifies that review, revision, or rebuttal Markdown reports cite real local artifact paths on disk, concrete Section/Table/Figure anchors, and avoid unanchored sweeping verdicts.
---
## Installation
Pure Python 3.11+ standard library (zero third-party dependencies):
```bash
git clone https://github.com/WhoJay0609/paper-ops.git
cd paper-ops
pip install --no-build-isolation --no-deps -e .
```
Or run directly without installing:
```bash
PYTHONPATH=src python3 -m paper_ops --version
```
---
## Plug into Codex & Antigravity (AGY)
Print ready-to-paste config snippets:
```bash
paper-ops install-config --host all --repo-dir /path/to/paper-ops
```
### 1. Codex (`~/.codex/config.toml`)
```toml
[mcp_servers.paper_ops]
command = "paper-ops"
args = ["mcp"]
startup_timeout_sec = 15
```
### 2. Antigravity (`~/.gemini/config/mcp_config.json`)
```json
{
"mcpServers": {
"paper-ops": {
"command": "paper-ops",
"args": ["mcp"]
}
}
}
```
### 3. Agent Skill Symlinks (Both Hosts)
```bash
ln -sfn "/path/to/paper-ops" "$HOME/.codex/skills/paper-ops"
ln -sfn "/path/to/paper-ops" "$HOME/.gemini/config/skills/paper-ops"
```
---
## Quick Examples
```bash
# 1. Check living-doc size budgets
paper-ops docs-check /path/to/paper-repo --max-kb 100
# 2. Preview lossless compaction (dry-run by default)
paper-ops docs-compact --doc doc/RESULTS.md --keep-recent 4 --json
# Apply compaction
paper-ops docs-compact --doc doc/RESULTS.md --keep-recent 4 --apply
# 3. Sync JSON artifacts -> LaTeX macros + SHA-256 provenance
paper-ops sync-macros --manifest paper/paper_ops_macros.json
paper-ops verify-claims --manifest paper/paper_ops_macros.json --tex paper/main.tex --json
# 4. Run 4-Gate Pre-Submission Audit
paper-ops gate --tex paper/main.tex --json
# 5. Audit 7-dimension timing disclosure + GPU timing attestation
paper-ops audit-timing paper/main.tex --attestation runs/timing_attestation.json --json
# 6. Grounded Review Gate
paper-ops audit-review --report paper/report.md --project-root paper --json
```
### Manifest Format (`paper_ops_macros.json`)
```json
{
"output_tex": "generated/numbers.tex",
"provenance_json": "generated/numbers_provenance.json",
"macros": [
{
"name": "SpeedupMain",
"source": "../results/summary.json",
"key": "decode.speedup_vs_dense",
"format": "{:.2f}\\times",
"description": "End-to-end decode speedup on A800"
}
]
}
```
---
## MCP Tools
The built-in pure-stdlib stdio MCP server (`paper-ops mcp`) supports both newline-delimited JSON-RPC and `Content-Length` framing and exposes 6 read-only tools:
- `paper_ops_docs_check`
- `paper_ops_compact_preview`
- `paper_ops_verify_claims`
- `paper_ops_audit_timing`
- `paper_ops_gate`
- `paper_ops_audit_review`
## Testing
```bash
PYTHONPATH=src python3 -m unittest discover -s tests -v
```
## License
MIT — see [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues