Agentic CLI for generating academic figures from research papers
Project description
paperfig
paperfig is a production-grade CLI that converts research papers (PDF or Markdown) into publication-ready academic figures using an agentic planning -> generation -> critique pipeline.
The core differentiator is that agent reasoning and architecture decisions are stored as versioned repo artifacts (architecture docs, flows, Mermaid diagrams, templates, audits) so humans and agents can evolve the system together.
Install
Warning
paperfigon PyPI is a different project; installpaperfigg. The CLI command remainspaperfig.
- Standard CLI + PNG export:
pip install "paperfigg[cli,png]"
- Developer tooling:
pip install "paperfigg[cli,png,dev,yaml,pdf,mcp]"
- CLI-first local install:
pipx install .uv tool install .- Published package name is
paperfigg; CLI command remainspaperfig.
Quickstart (Mock Mode, No Keys)
Mock mode is designed for instant local runs and realistic output artifacts.
pip install "paperfigg[cli,png]"
paperfig doctor
paperfig generate examples/sample_paper.md --mode mock
paperfig docs check
1-Minute Demo
pip install "paperfigg[cli,png]"
paperfig doctor
paperfig generate examples/sample_paper.md --mode mock
ls runs/*/figures/*/final/figure.svg
Full Mode (PaperBanana MCP)
Use full mode when you want real PaperBanana generation via MCP.
pip install "paperfigg[cli,png,mcp]"
export PAPERFIG_MCP_SERVER=paperbanana
export PAPERFIG_MCP_COMMAND="python -m your_mcp_server"
paperfig doctor --probe-mcp
paperfig generate examples/sample_paper.md --mode real
What's New In v0.3.0
- Contributor flywheel:
paperfig templates lintvalidates flow templates against JSON Schema.- Domain-pack loading supports directory or Python package packs via
--packand--template-pack. - Architecture critique supports rule plugins with
--list-rulesand--enable.
- Deterministic reproducibility:
paperfig rerun <run_id>replays a run deterministically from saved artifacts.paperfig diff <run_id_1> <run_id_2>compares run metrics and writesdiff.json.
- Contributor mode:
paperfig generate ... --contribwrites planner notes, critic notes,CONTRIBUTING_NOTES.md, andcontrib.log.
- Windows PNG enablement:
paperfig doctor --fix png --verifyprints guided setup and verification steps.- PNG export warnings point to
paperfig doctor --fix png.
What You Get
- Generated figures (SVG and optional transparent PNG)
- LaTeX include snippets
- Captions and figure plans
- Traceability mapping from figure elements to source text spans
- Governance artifacts (
docs_drift_report.json,architecture_critique.json,repro_audit.json)
Sample proof assets are committed in docs/gallery/sample_paper:
docs/gallery/sample_paper/fig-21a078a0.svgdocs/gallery/sample_paper/plan.jsondocs/gallery/sample_paper/repro_audit.jsondocs/gallery/sample_paper/architecture_critique.json
What It Does
- Parses papers and extracts methodology, system description, and results sections.
- Plans figures through reusable flow templates and fallback heuristics.
- Generates figures via PaperBanana MCP and iterates with critique feedback loops.
- Regenerates docs and gates on drift for architecture governance.
- Runs reproducibility audits and architecture critiques as first-class run artifacts.
- Provides a constrained autonomous lab scaffold for iterative research experiments.
How The Agentic System Works
The system uses specialized agents:
PlannerAgentchooses figures and template-aligned abstractions.GeneratorAgentcalls PaperBanana via MCP and emits traceable figure elements.CriticAgentscores faithfulness, readability, conciseness, and aesthetics.ArchitectureCriticAgentaudits run-level architecture quality and governance completeness.
Full architecture documentation and flow diagrams live in docs/architecture.
CLI Usage
paperfig generatepaperfig rerunpaperfig diffpaperfig critiquepaperfig exportpaperfig doctorpaperfig inspectpaperfig docs regeneratepaperfig docs checkpaperfig templates listpaperfig templates validatepaperfig templates lintpaperfig critique-architecturepaperfig auditpaperfig lab initpaperfig lab proposepaperfig lab runpaperfig lab reviewpaperfig lab status
Flow Template Pack
ablation_matrix(ablation)dataset_characteristics(dataset_overview)error_analysis_breakdown(error_analysis)limitations_threats_to_validity(limitations)methodology_pipeline(methodology)results_summary_plot(results_plot)system_overview(system_overview)training_compute_profile(compute_profile)
Outputs
Each run creates a runs/<run_id>/ workspace containing:
figures/<figure_id>/figure.svgfigures/<figure_id>/traceability.jsoncaptions.txtinspect.jsondocs_drift_report.jsonarchitecture_critique.jsonrepro_audit.jsonplanner_notes.md,CONTRIBUTING_NOTES.md, andcontrib.logwhen--contribis enabledexports/with PNG, SVG, LaTeX snippets, andexport_report.json
Configuration
Default config lives in paperfig.yaml:
- docs scope and manifest path (
docs/docs_manifest.yaml) - architecture critique mode and severity gate
- reproducibility audit mode (
softby default) - template pack (
expanded_v1) - lab registry path and sandbox policy (
config/lab_policy.yaml)
Verification
- Run unit/integration tests:
python3 -m unittest discover -s tests -v - Run docs drift check:
./scripts/check_docs_drift.sh - Run full quality checks:
./scripts/check_quality.sh
CI
- GitHub Actions pipeline:
.github/workflows/ci.yml - GitHub Actions docs drift gate:
.github/workflows/docs-drift.yml - GitHub Actions PyPI publish:
.github/workflows/publish.yml - Publish workflow uses PyPI Trusted Publishing (OIDC) with GitHub environment
pypi. - Manual
publish.ymlruns are dry-run by default; set workflow inputpublish=trueto actually upload. - GitLab pipeline:
.gitlab-ci.yml - All wrappers call shared scripts in
scripts/(no duplicated CI logic in YAML)
Community
- Changelog:
CHANGELOG.md - Contributing:
CONTRIBUTING.md - Code of conduct:
CODE_OF_CONDUCT.md - Citation metadata:
CITATION.cff
Architecture Docs
See:
docs/architecture/AI-Architecture-Analysis.mddocs/architecture/flows/index.mddocs/templates/HOW_TO_ADD_A_FLOW.mddocs/templates/DOMAIN_PACKS.mddocs/platform/WINDOWS_PNG.md
Publish Troubleshooting
- Package name on PyPI is
paperfigg(notpaperfig). - If publish fails with "file already exists", rerun is safe because publish uses
skip-existing: true. - If publish fails with OIDC/token project mismatch:
- verify Trusted Publisher is configured for project
paperfigg - owner/repo must be
oluwafemidiakhoa/paperfigg - workflow must be
publish.yml - environment name must be
pypi
- verify Trusted Publisher is configured for project
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paperfigg-0.3.0.tar.gz.
File metadata
- Download URL: paperfigg-0.3.0.tar.gz
- Upload date:
- Size: 58.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
149dead1fb45dce64678a8a5153994de1d1682706946459815bcef2d80b9a905
|
|
| MD5 |
560025742e5993dc0c12b5d083a96ea5
|
|
| BLAKE2b-256 |
e633ba30dd8a3899fe51b99e4ea334889dfcaa6ab4e76d6c3b7bb2ae7f9aedf0
|
File details
Details for the file paperfigg-0.3.0-py3-none-any.whl.
File metadata
- Download URL: paperfigg-0.3.0-py3-none-any.whl
- Upload date:
- Size: 67.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d6b92dc3b8713ad1da603c87f89fa7960a6c34d231207bf25457b5f0d45ec13
|
|
| MD5 |
4fa48f94a2f2b0b6860e2762b09feec9
|
|
| BLAKE2b-256 |
dc0e1f63167172cc43c1209737bc9304a489cb6baff0bd79495a63fa3ed33bdf
|