generate-figure

generate-figure is a command for Claude Code from TobiasBlask/open-paper-machine. It costs 30 tokens per session (311 once invoked), scanned B, original, MIT.

A command for creating an academic diagram from a text description, such as a paper section or methodology. It uses PaperBanana and saves the resulting publication-ready image as a PNG file.

In plain words
What is it for?
Creating methodology diagrams and other academic figures from paper text, with an optional caption and output filename.
Why use it?
It turns a written explanation into a figure without requiring the user to draw the diagram manually. It also produces a LaTeX figure snippet for adding the image to a paper.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: reads .claude/ paths.

Part of the open-academic-paper-machine plugin — 33 skills, 21 commands, 4 agents shipped together

Good fit Creating methodology diagrams and other academic figures from paper text, with an optional caption and output filename.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/tobiasblask/open-paper-machine/generate-figure
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TobiasBlask/open-paper-machine

Made for: Claude Code.

Or install open-academic-paper-machine, the plugin that ships this one along with the rest of its 33 skills, 21 commands, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for generate-figure

README.md
[![agentmods](https://agentmods.dev/badge/commands/tobiasblask/open-paper-machine/generate-figure.svg)](https://agentmods.dev/commands/tobiasblask/open-paper-machine/generate-figure)
Your own site
<a href="https://agentmods.dev/commands/tobiasblask/open-paper-machine/generate-figure"><img src="https://agentmods.dev/badge/commands/tobiasblask/open-paper-machine/generate-figure.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 311 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00311
Opus 5 $0.00015 $0.00156
Sonnet 5 $0.00006 $0.00062
Haiku 4.5 $0.00003 $0.00031

Measured 8d ago against content hash 1932e360dcac, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade B, and why

generate-figure scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

PB_SCRIPT="$(find ~/.claude/plugins -name paperbanana_direct.py -path '*/open-academic-paper-machine/*' 2>/dev/null | head -1)" && \
commands/generate-figure.md · 27 lines

What it actually says

Generate Figure: $ARGUMENTS

Read the figure-engine skill first.

Steps

  1. Parse $ARGUMENTS — extract the source text or file reference and optional caption
  2. If a file path is given, read it. If inline text, use it directly.
  3. Write the source context to /tmp/pb_source_context.txt if it's long
  4. PRIMARY: Use the direct Python API via paperbanana_direct.py script:
    PB_SCRIPT="$(find ~/.claude/plugins -name paperbanana_direct.py -path '*/open-academic-paper-machine/*' 2>/dev/null | head -1)" && \
    python3 "$PB_SCRIPT" diagram \
      --source-context "$(cat /tmp/pb_source_context.txt)" \
      --caption "Figure N: Caption" \
      --output-dir figures/ \
      --filename "fig_section_name.png" \
      --iterations 3
    
  5. If the script is not found, FALLBACK: generate using Python (matplotlib + graphviz/networkx)
  6. Save output PNG to figures/ in the workspace
  7. Provide the LaTeX \begin{figure} snippet ready for inclusion
  8. Show the user the generated figure using the Read tool on the PNG path
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 27 lines · 30 tokens per session scan B 1932e360dcac

Subscribe to this mod's changes

generate-figure is a command published in the GitHub repository TobiasBlask/open-paper-machine (18 stars, last pushed 5mo ago), licensed MIT. It adds 30 tokens to every session and 311 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.