2026-04-20 20:16:08 -05:00
# Complete Workflow
Full workflow for generating knowledge comics.
## Progress Checklist
Copy and track progress:
```
Comic Progress:
- [ ] Step 1: Setup & Analyze
2026-04-20 20:25:53 -05:00
- [ ] 1.1 Analyze content
- [ ] 1.2 Check existing ⚠️ REQUIRED
- [ ] Step 2: Confirmation - Style & options ⚠️ REQUIRED
2026-04-20 20:16:08 -05:00
- [ ] Step 3: Generate storyboard + characters
- [ ] Step 4: Review outline (conditional)
- [ ] Step 5: Generate prompts
- [ ] Step 6: Review prompts (conditional)
- [ ] Step 7: Generate images
- [ ] 7.1 Character sheet (if needed)
- [ ] 7.2 Generate pages
2026-04-20 22:37:47 -05:00
- [ ] Step 8: Completion report
2026-04-20 20:16:08 -05:00
```
## Flow Diagram
```
2026-04-20 22:37:47 -05:00
Input → Analyze → [Check Existing?] → [Confirm: Style + Reviews] → Storyboard → [Review Outline?] → Prompts → [Review Prompts?] → Images → Complete
2026-04-20 20:16:08 -05:00
```
---
## Step 1: Setup & Analyze
2026-04-20 20:25:53 -05:00
### 1.1 Analyze Content → `analysis.md`
2026-04-20 20:16:08 -05:00
Read source content, save it if needed, and perform deep analysis.
**Actions**:
1. **Save source content ** (if not already a file):
- If user provides a file path: use as-is
2026-04-20 22:37:47 -05:00
- If user pastes content: save to `source-{slug}.md` in the target directory using `write_file` , where `{slug}` is the kebab-case topic slug used for the output directory
- **Backup rule**: If `source-{slug}.md` already exists, rename it to `source-{slug}-backup-YYYYMMDD-HHMMSS.md` before writing
2026-04-20 20:16:08 -05:00
2. Read source content
3. **Deep analysis ** following `analysis-framework.md` :
- Target audience identification
- Value proposition for readers
- Core themes and narrative potential
- Key figures and their story arcs
4. Detect source language
5. **Determine language ** :
2026-04-20 20:25:53 -05:00
- If user specified a language → use it
- Else → use detected source language or user's conversation language
2026-04-20 20:16:08 -05:00
6. Determine recommended page count:
- Short story: 5-8 pages
- Medium complexity: 9-15 pages
- Full biography: 16-25 pages
7. Analyze content signals for art/tone/layout recommendations
2026-04-20 20:25:53 -05:00
8. **Save to `analysis.md` ** using `write_file`
2026-04-20 20:16:08 -05:00
**analysis.md Format**: YAML front matter (title, topic, time_span, source_language, user_language, aspect_ratio, recommended_page_count, recommended_art, recommended_tone) + sections for Target Audience, Value Proposition, Core Themes, Key Figures & Story Arcs, Content Signals, Recommended Approaches. See `analysis-framework.md` for full template.
2026-04-20 20:25:53 -05:00
### 1.2 Check Existing Content ⚠️ REQUIRED
2026-04-20 20:16:08 -05:00
**MUST execute before proceeding to Step 2.**
2026-04-20 20:25:53 -05:00
Check if the output directory exists (e.g., via `test -d "comic/{topic-slug}"` ).
2026-04-20 20:16:08 -05:00
2026-04-20 20:25:53 -05:00
**If directory exists**, use `clarify` :
2026-04-20 20:16:08 -05:00
```
2026-04-20 20:25:53 -05:00
question: "Existing content found at comic/{topic-slug}. How to proceed?"
2026-04-20 20:16:08 -05:00
options:
2026-04-20 20:25:53 -05:00
- "Regenerate storyboard — Keep images, regenerate storyboard and characters only"
- "Regenerate images — Keep storyboard, regenerate images only"
- "Backup and regenerate — Backup to {slug}-backup-{timestamp}, then regenerate all"
- "Exit — Cancel, keep existing content unchanged"
2026-04-20 20:16:08 -05:00
```
Save result and handle accordingly:
- **Regenerate storyboard**: Skip to Step 3, preserve `prompts/` and images
- **Regenerate images**: Skip to Step 7, use existing prompts
- **Backup and regenerate**: Move directory, start fresh from Step 2
- **Exit**: End workflow immediately
---
2026-04-20 20:25:53 -05:00
## Step 2: Confirmation - Style & Options ⚠️
2026-04-20 20:16:08 -05:00
**Purpose**: Select visual style + decide whether to review outline before generation. **Do NOT skip. **
2026-04-20 20:25:53 -05:00
**Display summary first**:
2026-04-20 20:16:08 -05:00
- Content type + topic identified
- Key figures extracted
- Time span detected
- Recommended page count
2026-04-20 20:25:53 -05:00
- Language (detected or user-specified)
2026-04-20 20:16:08 -05:00
- **Recommended style**: [art] + [tone] (based on content signals)
2026-04-20 20:25:53 -05:00
**Use `clarify` one question at a time**, in priority order:
2026-04-20 20:16:08 -05:00
2026-04-21 19:35:42 -07:00
> **Timeout handling (CRITICAL)**: if `clarify` returns `"The user did not provide a response within the time limit. Use your best judgement..."`, that is a per-question default, NOT blanket consent. Continue to the next question in the sequence — do not bail out of Step 2. Then, in your next user-visible message, explicitly surface every default that was taken (e.g. `"Defaulted style → ohmsha, narrative focus → concept explanation, audience → developers (clarify timed out on all three). Say the word to redirect."`). An unreported default is indistinguishable to the user from "the agent never asked."
2026-04-20 20:16:08 -05:00
### Question 1: Visual Style
If a preset is recommended (see `auto-selection.md` ), show it first:
```
question: "Which visual style for this comic?"
options:
2026-04-20 20:25:53 -05:00
- "[preset name] preset (Recommended) — [preset description] with special rules"
- "[recommended art] + [recommended tone] (Recommended) — Best match for your content"
- "ligne-claire + neutral — Classic educational, Logicomix style"
- "ohmsha preset — Educational manga with visual metaphors, gadgets, NO talking heads"
- "Custom — Specify your own art + tone or preset"
2026-04-20 20:16:08 -05:00
```
**Preset vs Art+Tone**: Presets include special rules beyond art+tone. `ohmsha` = manga + neutral + visual metaphor rules + character roles + NO talking heads. Plain `manga + neutral` does NOT include these rules.
2026-04-20 20:25:53 -05:00
### Question 2: Narrative Focus
2026-04-20 20:16:08 -05:00
```
2026-04-20 20:25:53 -05:00
question: "What should the comic emphasize? (Pick the primary focus; mention others in a follow-up if needed)"
2026-04-20 20:16:08 -05:00
options:
2026-04-20 20:25:53 -05:00
- "Biography/life story — Follow a person's journey through key life events"
- "Concept explanation — Break down complex ideas visually"
- "Historical event — Dramatize important historical moments"
- "Tutorial/how-to — Step-by-step educational guide"
2026-04-20 20:16:08 -05:00
```
### Question 3: Target Audience
```
question: "Who is the primary reader?"
options:
2026-04-20 20:25:53 -05:00
- "General readers — Broad appeal, accessible content"
- "Students/learners — Educational focus, clear explanations"
- "Industry professionals — Technical depth, domain knowledge"
- "Children/young readers — Simplified language, engaging visuals"
2026-04-20 20:16:08 -05:00
```
### Question 4: Outline Review
```
question: "Do you want to review the outline before image generation?"
options:
2026-04-20 20:25:53 -05:00
- "Yes, let me review (Recommended) — Review storyboard and characters before generating images"
- "No, generate directly — Skip outline review, start generating immediately"
2026-04-20 20:16:08 -05:00
```
### Question 5: Prompt Review
```
question: "Review prompts before generating images?"
options:
2026-04-20 20:25:53 -05:00
- "Yes, review prompts (Recommended) — Review image generation prompts before generating"
- "No, skip prompt review — Proceed directly to image generation"
2026-04-20 20:16:08 -05:00
```
2026-04-20 20:25:53 -05:00
**After responses**:
2026-04-20 20:16:08 -05:00
1. Update `analysis.md` with user preferences
2. **Store `skip_outline_review` ** flag based on Question 4 response
3. **Store `skip_prompt_review` ** flag based on Question 5 response
4. → Step 3
---
## Step 3: Generate Storyboard + Characters
Create storyboard and character definitions using the confirmed style from Step 2.
**Loading Style References**:
- Art style: `art-styles/{art}.md`
- Tone: `tones/{tone}.md`
2026-04-20 20:25:53 -05:00
- If preset (ohmsha/wuxia/shoujo/concept-story/four-panel): also load `presets/{preset}.md`
2026-04-20 20:16:08 -05:00
**Generate**:
1. **Storyboard ** (`storyboard.md` ):
- YAML front matter with art_style, tone, layout, aspect_ratio
- Cover design
- Each page: layout, panel breakdown, visual prompts
- **Written in user's preferred language** (from Step 1)
- Reference: `storyboard-template.md`
- **If using preset**: Load and apply preset rules from `presets/`
2. **Character definitions ** (`characters/characters.md` ):
- Visual specs matching the art style (in user's preferred language)
- Include Reference Sheet Prompt for later image generation
- Reference: `character-template.md`
- **If using ohmsha preset**: Use default Doraemon characters (see below)
2026-04-20 20:25:53 -05:00
**Ohmsha Default Characters** (use these unless user specifies custom characters):
2026-04-20 20:16:08 -05:00
| Role | Character | Visual Description |
|------|-----------|-------------------|
| Student | 大雄 (Nobita) | Japanese boy, 10yo, round glasses, black hair parted in middle, yellow shirt, navy shorts |
| Mentor | 哆啦 A 梦 (Doraemon) | Round blue robot cat, big white eyes, red nose, whiskers, white belly with 4D pocket, golden bell, no ears |
| Challenge | 胖虎 (Gian) | Stocky boy, rough features, small eyes, orange shirt |
| Support | 静香 (Shizuka) | Cute girl, black short hair, pink dress, gentle expression |
These are the canonical ohmsha-style characters. Do NOT create custom characters for ohmsha unless explicitly requested.
**After generation**:
- If `skip_outline_review` is true → Skip Step 4, go directly to Step 5
- If `skip_outline_review` is false → Continue to Step 4
---
## Step 4: Review Outline (Conditional)
**Skip this step** if user selected "No, generate directly" in Step 2.
**Purpose**: User reviews and confirms storyboard + characters before generation.
**Display**:
- Page count and structure
- Art style + Tone combination
- Page-by-page summary (Cover → P1 → P2...)
- Character list with brief descriptions
2026-04-20 20:25:53 -05:00
**Use `clarify` **:
2026-04-20 20:16:08 -05:00
```
question: "Ready to generate images with this outline?"
options:
2026-04-20 20:25:53 -05:00
- "Yes, proceed (Recommended) — Generate character sheet and comic pages"
- "Edit storyboard first — I'll modify storyboard.md before continuing"
- "Edit characters first — I'll modify characters/characters.md before continuing"
- "Edit both — I'll modify both files before continuing"
2026-04-20 20:16:08 -05:00
```
**After response**:
1. If user wants to edit → Wait for user to finish editing, then ask again
2. If user confirms → Continue to Step 5
---
## Step 5: Generate Prompts
Create image generation prompts for all pages.
**Style Reference Loading**:
- Read `art-styles/{art}.md` for rendering guidelines
- Read `tones/{tone}.md` for mood/color adjustments
- If preset: Read `presets/{preset}.md` for special rules
**For each page (cover + pages)**:
1. Create prompt following art style + tone guidelines
2026-04-20 22:37:47 -05:00
2. **Embed character descriptions ** inline (copy relevant traits from `characters/characters.md` ) — `image_generate` is prompt-only, so the prompt text is the sole vehicle for character consistency
2026-04-20 20:25:53 -05:00
3. Save to `prompts/NN-{cover|page}-[slug].md` using `write_file`
2026-04-20 20:16:08 -05:00
- **Backup rule**: If prompt file exists, rename to `prompts/NN-{cover|page}-[slug]-backup-YYYYMMDD-HHMMSS.md`
**Prompt File Format**:
```markdown
# Page NN: [Title]
## Visual Style
Art: [art style] | Tone: [tone] | Layout: [layout type]
2026-04-20 22:37:47 -05:00
## Character Reference (embedded inline — maintain exact traits below)
- [Character A]: [detailed visual traits from characters/characters.md]
- [Character B]: [detailed visual traits from characters/characters.md]
2026-04-20 20:16:08 -05:00
## Panel Breakdown
[From storyboard.md - panel descriptions, actions, dialogue]
## Generation Prompt
2026-04-20 20:25:53 -05:00
[Combined prompt passed to image_generate]
2026-04-20 20:16:08 -05:00
```
**After generation**:
- If `skip_prompt_review` is true → Skip Step 6, go directly to Step 7
- If `skip_prompt_review` is false → Continue to Step 6
---
## Step 6: Review Prompts (Conditional)
**Skip this step** if user selected "No, skip prompt review" in Step 2.
**Purpose**: User reviews and confirms prompts before image generation.
**Display prompt summary table**:
| Page | Title | Key Elements |
|------|-------|--------------|
| Cover | [title] | [main visual] |
| P1 | [title] | [key elements] |
| ... | ... | ... |
2026-04-20 20:25:53 -05:00
**Use `clarify` **:
2026-04-20 20:16:08 -05:00
```
question: "Ready to generate images with these prompts?"
options:
2026-04-20 20:25:53 -05:00
- "Yes, proceed (Recommended) — Generate all comic page images"
- "Edit prompts first — I'll modify prompts/*.md before continuing"
- "Regenerate prompts — Regenerate all prompts with different approach"
2026-04-20 20:16:08 -05:00
```
**After response**:
1. If user wants to edit → Wait for user to finish editing, then ask again
2. If user wants to regenerate → Go back to Step 5
3. If user confirms → Continue to Step 7
---
## Step 7: Generate Images
2026-04-20 22:37:47 -05:00
With confirmed prompts from Step 5/6, use the `image_generate` tool. The tool accepts only `prompt` and `aspect_ratio` (`landscape` | `portrait` | `square` ) and **returns a URL ** — it does not accept reference images and does not write local files. Every invocation must be followed by a download step.
2026-04-20 20:25:53 -05:00
2026-04-20 22:37:47 -05:00
**Aspect ratio mapping** — map the storyboard's `aspect_ratio` to the tool's enum:
2026-04-20 20:25:53 -05:00
| Storyboard ratio | `image_generate` format |
|------------------|-------------------------|
| `3:4` , `9:16` , `2:3` | `portrait` |
| `4:3` , `16:9` , `3:2` | `landscape` |
| `1:1` | `square` |
2026-04-20 20:16:08 -05:00
2026-04-20 22:37:47 -05:00
**Download procedure** (run after every successful `image_generate` call):
1. Extract the `url` field from the tool result
2. Fetch it to disk, e.g. `curl -fsSL "<url>" -o comic/{slug}/<target>.png`
3. Verify the file is non-empty (`test -s <target>.png` ); on failure, retry the generation once
2026-04-20 20:16:08 -05:00
### 7.1 Generate Character Reference Sheet (conditional)
Character sheet is recommended for multi-page comics with recurring characters, but **NOT required ** for all presets.
**When to generate**:
| Condition | Action |
|-----------|--------|
| Multi-page comic with detailed/recurring characters | Generate character sheet (recommended) |
| Preset with simplified characters (e.g., four-panel minimalist) | Skip — prompt descriptions are sufficient |
| Single-page comic | Skip unless characters are complex |
**When generating**:
1. Use Reference Sheet Prompt from `characters/characters.md`
2. **Backup rule ** : If `characters/characters.png` exists, rename to `characters/characters-backup-YYYYMMDD-HHMMSS.png`
2026-04-20 22:37:47 -05:00
3. Call `image_generate` with `landscape` format
4. Download the returned URL → save to `characters/characters.png`
2026-04-20 22:43:59 -05:00
**Important**: the downloaded sheet is a **human-facing review artifact ** (so the user can visually verify character design) and a reference for later regenerations or manual prompt edits. It does **not ** drive Step 7.2 — page prompts were already written in Step 5 from the text descriptions in `characters/characters.md` . `image_generate` cannot accept images as visual input, so the text is the sole cross-page consistency mechanism.
2026-04-20 20:16:08 -05:00
### 7.2 Generate Comic Pages
**Before generating any page**:
2026-04-20 20:25:53 -05:00
1. Confirm each prompt file exists at `prompts/NN-{cover|page}-[slug].md`
2026-04-20 22:37:47 -05:00
2. Confirm that each prompt has character descriptions embedded inline (see Step 5). `image_generate` is prompt-only, so the prompt text is the sole consistency mechanism.
2026-04-20 20:16:08 -05:00
2026-04-20 22:43:59 -05:00
**Page Generation Strategy**: every page prompt must embed character descriptions (sourced from `characters/characters.md` ) inline. This is done during Step 5, uniformly whether or not the PNG sheet was produced in 7.1 — the PNG is only a review/regeneration aid, never a generation input.
2026-04-20 20:16:08 -05:00
2026-04-20 22:37:47 -05:00
**Example embedded prompt** (`prompts/01-page-xxx.md` ):
2026-04-20 20:16:08 -05:00
```markdown
2026-04-20 22:37:47 -05:00
# Page 01: [Title]
2026-04-20 20:16:08 -05:00
2026-04-20 22:37:47 -05:00
## Character Reference (embedded inline — maintain consistency)
- 大雄: Japanese boy, round glasses, yellow shirt, navy shorts, worried expression...
- 哆啦 A 梦: Round blue robot cat, white belly, red nose, golden bell, 4D pocket...
2026-04-20 20:16:08 -05:00
## Page Content
2026-04-20 22:37:47 -05:00
[Original page prompt body — panels, dialogue, visual metaphors]
2026-04-20 20:16:08 -05:00
```
**For each page (cover + pages)**:
1. Read prompt from `prompts/NN-{cover|page}-[slug].md`
2. **Backup rule ** : If image file exists, rename to `NN-{cover|page}-[slug]-backup-YYYYMMDD-HHMMSS.png`
2026-04-20 22:37:47 -05:00
3. Call `image_generate` with the prompt text and mapped aspect ratio
4. Download the returned URL → save to `NN-{cover|page}-[slug].png`
2026-04-20 20:16:08 -05:00
5. Report progress after each generation: "Generated X/N: [page title]"
---
2026-04-20 22:37:47 -05:00
## Step 8: Completion Report
2026-04-20 20:16:08 -05:00
```
Comic Complete!
Title: [title] | Art: [art] | Tone: [tone] | Pages: [count] | Aspect: [ratio] | Language: [lang]
Location: [path]
2026-04-20 22:37:47 -05:00
✓ source-{slug}.md (if content was pasted)
2026-04-20 20:16:08 -05:00
✓ analysis.md
✓ characters.png (if generated)
✓ 00-cover-[slug].png ... NN-page-[slug].png
```
---
## Page Modification
| Action | Steps |
|--------|-------|
2026-04-20 22:37:47 -05:00
| **Edit ** | Update prompt → Regenerate image → Download new PNG |
| **Add ** | Create prompt at position → Generate image → Download PNG → Renumber subsequent (NN+1) → Update storyboard |
| **Delete ** | Remove files → Renumber subsequent (NN-1) → Update storyboard |
2026-04-20 20:16:08 -05:00
**File naming**: `NN-{cover|page}-[slug].png` (e.g., `03-page-enigma-machine.png` )
- Slugs: kebab-case, unique, derived from content
- Renumbering: Update NN prefix only, slugs unchanged