Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍌 openclaw-paperbanana

An OpenClaw skill that generates publication-quality academic diagrams and statistical plots from text descriptions using PaperBanana.

Turn methodology descriptions into professional figures. Turn data into publication-ready plots. All from chat.

Demo

All figures below were generated by this skill from text prompts and JSON data:

Architecture Diagram Performance Comparison Training Convergence
Architecture Comparison Convergence
gpt-5.2 + gpt-image-1.5 gpt-5.2 + Matplotlib gpt-5.2 + Matplotlib

The full demo paper (demo/paper.pdf) was compiled from these figures with LaTeX.

Features

  • πŸ“ Diagram Generation β€” Methodology figures, architecture diagrams, pipeline illustrations from text descriptions
  • πŸ“Š Plot Generation β€” Bar charts, line plots, scatter plots from CSV/JSON data using Matplotlib code generation
  • πŸ”„ Iterative Refinement β€” AI critic evaluates each iteration and provides feedback for improvement
  • πŸ“ Evaluation β€” Compare generated diagrams against human references (Faithfulness, Readability, Conciseness, Aesthetics)
  • πŸ”§ Run Continuation β€” Refine previous generations with natural language feedback
  • πŸ€– Auto-Triggering β€” OpenClaw automatically invokes the skill when you ask to generate figures

Supported Providers

Provider Env Var Cost Quality
Google Gemini GOOGLE_API_KEY Paid/Free Tier Best
OpenAI OPENAI_API_KEY Paid Great (gpt-5.2 + gpt-image-1.5)
OpenRouter OPENROUTER_API_KEY Paid Any model

Auto-detection priority: Gemini β†’ OpenAI β†’ OpenRouter. Override with --provider.

Installation

1. Clone to your skills directory

cd /path/to/your/openclaw/workspace/skills
git clone https://github.com/GoatInAHat/openclaw-paperbanana.git paperbanana

2. Configure API keys

Add to ~/.openclaw/openclaw.json:

{
  skills: {
    entries: {
      "paperbanana": {
        enabled: true,
        env: {
          // Pick one (or multiple for fallback):

          // Google Gemini β€” free, good quality
          GOOGLE_API_KEY: "AIzaSy...",

          // OpenAI β€” paid, best quality
          // OPENAI_API_KEY: "sk-...",

          // OpenRouter β€” paid, access to any model
          // OPENROUTER_API_KEY: "sk-or-...",
        }
      }
    }
  }
}

3. Verify uv is installed

The skill uses uv for zero-config dependency management. Install if needed:

curl -LsSf https://astral.sh/uv/install.sh | sh

That's it. No pip install, no virtual environments β€” uv handles everything automatically on first run.

Usage

Once installed, OpenClaw will automatically invoke the skill when you ask to generate diagrams or plots. You can also call the scripts directly.

Generate a Diagram

uv run scripts/generate.py \
  --context "Our framework uses a three-stage pipeline: an encoder, attention module, and decoder..." \
  --caption "Overview of the proposed architecture" \
  --iterations 3

From a file:

uv run scripts/generate.py \
  --input method_section.txt \
  --caption "System architecture overview"

Options:

Flag Default Description
--iterations N 3 Refinement rounds
--auto-refine off Loop until critic is satisfied
--provider auto gemini, openai, or openrouter
--format png png, jpeg, or webp
--no-optimize off Disable input optimization

Generate a Plot

uv run scripts/plot.py \
  --data '{"Model":["A","B","C"],"Accuracy":[85.2,91.3,88.7]}' \
  --intent "Bar chart comparing model accuracy"

From CSV:

uv run scripts/plot.py \
  --data-file results.csv \
  --intent "Line plot showing loss over epochs"

Evaluate a Diagram

uv run scripts/evaluate.py \
  --generated output.png \
  --reference human_drawn.png \
  --context "The methodology text..." \
  --caption "Figure caption"

Refine a Previous Generation

# Continue the most recent run with feedback
uv run scripts/generate.py \
  --continue \
  --feedback "Make the arrows thicker and use more distinct colors"

# Continue a specific run
uv run scripts/generate.py \
  --continue-run run_20260228_143022_a1b2c3 \
  --feedback "Add labels to each component"

How It Works

PaperBanana uses a multi-agent pipeline:

Input Text β†’ Retriever β†’ Planner β†’ Stylist β†’ Visualizer β†’ Critic
                                                  ↑          ↓
                                                  ← Feedback ←
  1. Retriever β€” Finds relevant reference diagrams from the built-in example set
  2. Planner β€” Generates a detailed diagram description from your methodology text
  3. Stylist β€” Refines the description with academic styling guidelines
  4. Visualizer β€” Generates the diagram image (or Matplotlib code for plots)
  5. Critic β€” Evaluates the output and suggests improvements for the next iteration

For methodology diagrams, the Visualizer uses image generation models (DALL-E 3, gpt-image-1.5, or Gemini). For statistical plots, the Visualizer generates and executes Matplotlib code β€” producing true vector graphics.

Model Configuration

Override default models via environment variables:

# OpenAI
OPENAI_VLM_MODEL=gpt-5.2          # Vision-Language Model for planning/critique
OPENAI_IMAGE_MODEL=gpt-image-1.5  # Image generation model

# Gemini
GEMINI_VLM_MODEL=gemini-2.0-flash
GEMINI_IMAGE_MODEL=gemini-2.0-flash-preview-image-generation

# OpenRouter
OPENROUTER_VLM_MODEL=google/gemini-2.0-flash-001
OPENROUTER_IMAGE_MODEL=google/gemini-2.0-flash-001

OpenClaw Integration

This skill follows the OpenClaw AgentSkills format. When installed:

  • Auto-triggering: OpenClaw reads the SKILL.md description and automatically invokes the skill when you ask to "generate a diagram", "create a figure", "make a plot", etc.
  • Output delivery: Scripts print MEDIA:/path/to/image.png which OpenClaw auto-attaches to the chat response.
  • API key injection: Keys configured in skills.entries.paperbanana.env are injected into the script environment automatically.
  • Zero-install deps: uv with PEP 723 inline script metadata handles all Python dependencies in isolated environments.

Project Structure

paperbanana/
β”œβ”€β”€ SKILL.md              # OpenClaw skill definition (frontmatter + instructions)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ generate.py       # Diagram generation + run continuation
β”‚   β”œβ”€β”€ plot.py           # Statistical plot generation
β”‚   └── evaluate.py       # Diagram quality evaluation
β”œβ”€β”€ references/
β”‚   └── providers.md      # Provider comparison + configuration reference
β”œβ”€β”€ demo/
β”‚   β”œβ”€β”€ paper.tex         # Demo LaTeX paper
β”‚   β”œβ”€β”€ paper.pdf         # Compiled demo paper
β”‚   β”œβ”€β”€ architecture.png  # Generated architecture diagram
β”‚   β”œβ”€β”€ comparison.png    # Generated bar chart
β”‚   └── convergence.png   # Generated line plot
β”œβ”€β”€ LICENSE               # MIT
└── README.md             # This file

Requirements

  • OpenClaw (any version with skill support)
  • uv β‰₯ 0.4 (install)
  • Python β‰₯ 3.10
  • At least one API key (Gemini is free)

License

MIT β€” see LICENSE.

About

🍌 OpenClaw skill for generating publication-quality academic diagrams and plots from text using PaperBanana

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages