Skip to main content
Glama

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.

  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 \inputs, undefined \ref/\eqref/\cref, duplicate \labels, 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):

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:

PYTHONPATH=src python3 -m paper_ops --version

Related MCP server: Gumi-MCP

Plug into Codex & Antigravity (AGY)

Print ready-to-paste config snippets:

paper-ops install-config --host all --repo-dir /path/to/paper-ops

1. Codex (~/.codex/config.toml)

[mcp_servers.paper_ops]
command = "paper-ops"
args = ["mcp"]
startup_timeout_sec = 15

2. Antigravity (~/.gemini/config/mcp_config.json)

{
  "mcpServers": {
    "paper-ops": {
      "command": "paper-ops",
      "args": ["mcp"]
    }
  }
}
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

# 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)

{
  "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

PYTHONPATH=src python3 -m unittest discover -s tests -v

License

MIT — see LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides read-only repository health scanning tools for drift detection, module reachability, prompt bloat, evidence calibration, and registration completeness, enabling agents to diagnose repositories via MCP.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to safely inspect a local repository's code and metadata while blocking private data from leaving the machine, providing read-only tools for search, change tracking, and integrity verification.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to query a repository's verified semantic model, including capabilities, ownership, contracts, constraints, impact, health, and verification status, without re-deriving project facts. It exposes read-only tools for inspecting, reasoning about, and verifying the provenance-tracked surface.
      2
      Apache 2.0