Skip to content

SouthBridgeAI/opusnana-comic-hank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comic Creator

A Hankweave pipeline that turns creative ideas into finished comic books.

Give it text about what you care about — blog posts, a manifesto, a one-liner — plus some inspiration images and a few sentences about what kind of comic you want. It reads everything deeply, designs characters, writes a story, generates the art, reviews and iterates, and assembles a PDF.

The output includes a self-contained rerun package. If a panel isn't right, you can regenerate just that panel without re-running the whole pipeline. You can also translate the comic by rewriting the prompts in another language and regenerating.

Quick Start

# 1. Create a template folder
./create-template.sh my-comic

# 2. Fill in my-comic/ideas.md
#    Drop writing, blog posts, anything into my-comic/inspiration/
#    Drop style reference images there too
#    (Optional) Add a logo.png to my-comic/assets/ for watermarking

# 3. Set your API keys
export GOOGLE_API_KEY="your-gemini-key"
export ANTHROPIC_API_KEY="your-anthropic-key"

# 4. Make the comic
./make-comic.sh my-comic

The richer your input, the better the output. A 5-line brief makes a decent comic. Blog posts, philosophy, and writing samples make a great one.

Requirements

  • bun (https://bun.sh) — runs the TypeScript scripts
  • Node.js v18+ — for npx/Hankweave
  • GOOGLE_API_KEY — for Gemini image generation (Nano Banana 2)
  • ANTHROPIC_API_KEY — for Claude (story writing, review, art direction)

How It Works

your ideas + writing + images
            │
            ▼
   ┌─ Read & Explore (Opus) ───────────┐
   │ Reads everything. Keeps a journal │
   │ of reactions, ideas, quotes.      │
   │ Generates 3 character + 3 story   │
   │ candidates.                       │
   └────────────────┬──────────────────┘
                    ▼
   ┌─ Diversity Review (Haiku) ────────┐
   │ Reviews as a child and an adult.  │
   │ Challenges assumptions.           │
   └────────────────┬──────────────────┘
                    ▼
   ┌─ Visualize (Opus + Nano) ────────┐
   │ Generates sample images of each  │
   │ character. Opus picks favorites.  │
   └────────────────┬──────────────────┘
                    ▼
   ┌─ Select, Merge & Spec (Opus) ────┐
   │ Picks the best character + story. │
   │ Writes a full production spec.    │
   │ Writes per-panel generation       │
   │ prompts with dialogue.            │
   └────────────────┬──────────────────┘
                    ▼
   ┌─ Story Review (Opus) ────────────┐
   │ Fresh eyes on the narrative.     │
   │ Cuts weak strips. Writes an      │
   │ emotional blueprint.             │
   └────────────────┬──────────────────┘
                    ▼
   ╔═ Generation Loop ×3 ═════════════╗
   ║ Rig: Generate panels via Gemini  ║
   ║ (multi-turn chat for character   ║
   ║ consistency across panels)       ║
   ║                                  ║
   ║ Opus: Review each panel against  ║
   ║ the spec + emotional blueprint.  ║
   ║ Update prompts. Pick best.       ║
   ╚════════════════╦═════════════════╝
                    ▼
   ┌─ Comic Review (Opus) ────────────┐
   │ Reads the finished comic cold.   │
   │ Catches text errors, visual      │
   │ problems, story gaps.            │
   └────────────────┬──────────────────┘
                    ▼
   ┌─ Post-Processing (rig + Sonnet) ─┐
   │ Normalize colors → Add borders → │
   │ Resize → Watermark → PDF         │
   │ Also creates the rerun package.  │
   └────────────────┬──────────────────┘
                    ▼
          comic.pdf + rerun/

Output

After a run completes, you get:

output/
├── comic.pdf           # The finished comic
├── panels/             # Individual panel images (1200×896)
├── summary.md          # Title, characters, story summary
└── rerun/
    ├── prompts/        # Per-panel generation prompts (editable!)
    ├── scripts/        # All processing scripts
    ├── cover-reference.png  # Style anchor for character consistency
    ├── spec.md         # The full production spec
    ├── regenerate.sh   # Regenerate ALL panels from prompts
    └── fix-panel.sh    # Fix specific panels by name

The Execution Directory

When Hankweave runs, it creates an execution directory (in ~/.hankweave-executions/ or wherever you specify with -e). Inside it:

agentRoot/
├── read_only_data_source/    # Your input data (symlinked, read-only)
├── scripts/                   # Rig scripts (copied at startup)
├── workspace/
│   ├── reading-journal.md     # Opus's notes from reading your input
│   ├── candidates/
│   │   ├── characters/        # 3 character options + sample images
│   │   └── stories/           # 3 story options + diversity reviews
│   ├── spec/
│   │   ├── current.md         # The production spec (the key artifact)
│   │   ├── story-review.md    # Fresh-eyes narrative review
│   │   └── emotional-blueprint.md  # Per-strip emotional intent
│   ├── generation/
│   │   ├── prompts/           # Per-panel generation prompts
│   │   ├── iteration-0/      # First generation (panels/ + review.md)
│   │   ├── iteration-1/      # Second generation
│   │   ├── iteration-2/      # Third generation
│   │   └── best-picks.md     # Which iteration won for each panel
│   ├── approved/              # Best version of each panel
│   ├── comic-review.md        # Fresh reader review of finished comic
│   └── post-processed/        # normalized/ → bordered/ → resized/ → final/
└── output/                    # Final deliverables (copied out by Hankweave)

The spec/current.md is the most important intermediate — it's the complete production spec that drives everything downstream. If you want to understand what the hank decided, start there.

The generation/best-picks.md shows which iteration produced the best version of each panel and why.

Fixing Individual Panels

The most common issue: a panel where the character looks different (older, different proportions) or text is duplicated/garbled. The rerun package handles this:

cd output/rerun/

# Fix specific panels — regenerates, re-runs post-processing, rebuilds PDF
./fix-panel.sh panel-07 panel-10

# Or edit a prompt first, then regenerate
vim prompts/panel-07.md
./fix-panel.sh panel-07

The cover image is used as a style reference for regeneration, keeping characters consistent.

You can also regenerate multiple candidates and pick the best:

cd output/rerun/scripts/
for i in 1 2 3; do
  bun run generate-panel.ts \
    --prompt-file ../prompts/panel-07.md \
    --output ../candidates/panel-07-v$i.png \
    --reference-images ../cover-reference.png \
    --size 2K --aspect-ratio 3:2
done
# Review the candidates, pick your favorite, copy to ../approved/panel-07.png

Translating a Comic

Once you have a comic, you can translate it by editing the prompts and regenerating. The art style and characters stay consistent (anchored by the cover reference) while the text changes. We've tested this with Korean — it works.

Step 1: Copy the rerun package

cp -r output/rerun/ korean-version/
cd korean-version/

Step 2: Translate the dialogue

In each prompt file, change ONLY the text inside Caption: and Speech bubble: lines:

# English:
Speech bubble (Weewoo): "What happened here?"
Caption: "She couldn't fix it. So she stayed."

# Korean:
Speech bubble (Weewoo): "여기서 무슨 일이 있었어?"
Caption: "고칠 수 없었어요. 그래서 곁에 있었어요."

Keep all art descriptions, character descriptions, and scene instructions in English — Nano understands these better in English and they don't appear as visible text.

Step 3: Translate the cover title

The cover prompt has title text — change it too:

# English:
Visible text at the top of the image: **"The Little Guardian"**
Visible text below the title, smaller: **"A Weewoo Story"**

# Korean:
Visible text at the top of the image: **"작은 수호자"**
Visible text below the title, smaller: **"위우 이야기"**

Step 4: Watch for prompt leakage

This is the biggest gotcha in translation. Some scene descriptions are written as narrative prose that Nano renders as visible text. Look for lines like:

# BAD — Nano will render this as a caption:
The corruption is still there. It hasn't been destroyed. But it's contained.

# GOOD — Nano treats this as a drawing instruction:
Draw the dark corrupted water visible behind the barrier, contained but present.

If a scene description reads like narration, rewrite it to start with "Draw..." or restructure as a visual instruction. Also check CRITICAL: lines — if they contain quoted English text, Nano may render it.

Step 5: Regenerate and review

mkdir -p generation output/panels
./regenerate.sh
# Review panels, fix any with duplicate text or English leaks:
./fix-panel.sh panel-07 panel-11

Tips

For better stories:

  • Give it blog posts, not briefs. The pipeline reads deeply — quotes, philosophy, and voice samples produce much richer characters and narratives than "make a comic about X."
  • The pipeline chooses the strip count (10-15). Tighter is usually better.
  • Not every strip needs a lesson. The prompt encourages breathing room — some strips should just be funny, or beautiful, or quiet.

For better art:

  • Drop style reference images in inspiration/. Even 2-3 references dramatically improve consistency.
  • Character reference images (poses, expressions) help more than environment references.
  • Action scenes tend to "age up" cute characters. This is a known Nano Banana behavior — the review loop catches most cases, and fix-panel.sh handles the rest.

For fixing issues:

  • Duplicate text in a panel → regenerate with fix-panel.sh
  • Character looks too old/different → regenerate with cover reference (fix-panel.sh does this automatically)
  • Speech bubble pointing to wrong character → edit the prompt to specify "Speech bubble pointing to [character] (the [description] on the [left/right])" then regenerate
  • Want multiple options → generate 2-3 candidates and pick the best

Known Limitations

  • Character consistency drifts across panels, especially in dramatic/action scenes. Multi-turn generation and cover references help significantly but don't eliminate it entirely.
  • Text duplication (same line appearing twice) happens occasionally (~10% of panels). The review loop catches most instances.
  • Speech bubble attribution can be ambiguous when multiple characters are close together.
  • Art style varies slightly between panels generated in different iterations.

All of these can be fixed per-panel using the rerun package.

File Inventory

hank.json              # The Hankweave config (8 codons, 1 loop, 1 sentinel)
prompts/               # 9 codon prompts
  system-final.md      # Global system prompt (craft rules, file structure)
  read-and-explore.md  # Opus reads input, keeps journal, generates candidates
  story-diversity.md   # Haiku reviews as child + adult
  visualize-candidates.md  # Opus reviews generated character samples
  select-merge-spec.md # Picks best, writes spec + generation prompts
  story-review.md      # Cuts weak strips, writes emotional blueprint
  generate-and-review.md  # Reviews panels, updates prompts per iteration
  comic-review.md      # Fresh reader quality gate
  post-processing.md   # Verify output, assemble PDF, create rerun package
scripts/               # 10 TypeScript rig scripts
  generate-all-panels.ts   # Multi-turn Gemini chat for panel generation
  generate-panel.ts        # Single panel generation
  generate-samples.ts      # Character candidate samples
  post-process-pipeline.ts # Full pipeline: normalize→border→resize→watermark
  normalize-images.ts      # Color/brightness normalization
  normalize-borders.ts     # Consistent white borders
  resize-images.ts         # Uniform dimensions
  watermark-images.ts      # Logo watermark overlay
  add-text-overlay.ts      # Deterministic text on images
  assemble-pdf.ts          # Images → PDF
sentinels/
  narrator.json        # Warm storytelling narrator (Haiku, watches progress)
create-template.sh     # Creates a blank input template
make-comic.sh          # Runs the hank on filled input
README.md              # This file

Built With

About

A Wonderful hank so we can all enjoy the creativity of opus and nanobanana. Inspired by the original [frognu] comic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors