---
name: pelican-bicycle-svg
version: 2
description: Generate the best possible hand-written SVG depicting a pelican riding a bicycle, with iterative self-refinement.
agent: claude-code
model: anthropic/claude-sonnet-5
model_provider: openrouter
parameters:
  max_rounds:
    type: integer
    default: 3
    description: Number of refinement rounds (each round = critique previous + write improved)
  results_dir:
    type: string
    default: /app/results
secrets:
  openrouter:
    env: OPENROUTER_API_KEY
    description: OpenRouter key (collection environment variable) used by the agent's model calls
evaluation:
  pattern: self-judge
---

# Pelican Riding a Bicycle — SVG Runbook

## Mission

Produce the highest-quality hand-written SVG depicting **a pelican riding a bicycle**. Both subjects must be unmistakably recognizable, the composition coherent (pelican IS interacting with the bicycle, not floating next to it), and the file should be pure XML SVG (no `<image>` tags, no base64 data, no external rasters).

## Hard constraints

- Pure SVG XML — use `<path>`, `<circle>`, `<ellipse>`, `<rect>`, `<polygon>`, `<line>`, `<g>`, `<defs>`, `<linearGradient>`, etc.
- **No** `<image>` elements with external or base64 data
- Must validate as well-formed XML and render in any modern browser
- viewBox approximately `0 0 800 600` (landscape) — adjust if you have a specific reason
- Total file size under 50KB

## INPUTS

- `max_rounds` = **3** (override only if explicitly told otherwise)
- `results_dir` = `/app/results`

## Steps

### 1. Setup

```bash
mkdir -p {{results_dir}}/rounds
cd {{results_dir}}
```

Check that `rsvg-convert` or an SVG rasterizer is available:

```bash
which rsvg-convert || which inkscape || which convert
```

If none are available, install one:

```bash
apt-get update && apt-get install -y librsvg2-bin || true
```

### 2. Round 1 — first draft

Write your best first attempt to `{{results_dir}}/rounds/v1.svg`. Aim to depict:

- **Pelican**: long beak with throat pouch (the iconic pelican silhouette), body, eye, wings, legs/feet
- **Bicycle**: two wheels with spokes, frame (top tube + down tube + seat tube), handlebars, seat, pedals
- **Riding**: pelican's body is on the seat, feet on or near pedals, "hands" (wing tips) on handlebars

Render it:

```bash
cd {{results_dir}}
rsvg-convert -w 800 rounds/v1.svg -o rounds/v1.png
```

### 3. Self-critique + refinement loop

For each round R from 1 to `max_rounds - 1`:

1. **Inspect** `rounds/v${R}.png` visually (read it as an image).
2. **Score** on four axes, 0–10 each:
   - **Pelican recognizability** — would a stranger immediately say "that's a pelican"?
   - **Bicycle recognizability** — would they say "that's a bicycle"?
   - **Composition / riding** — is the pelican clearly riding the bike?
   - **Aesthetic polish** — line quality, color, balance
3. **Identify the lowest-scoring axis** and write down 2-3 concrete fixes.
4. **Write** `rounds/v$((R+1)).svg` applying those fixes. Keep what worked; rewrite what didn't.
5. **Render** `rounds/v$((R+1)).png`.
6. If the total (sum of 4 axes) is ≥ 36/40 — early-exit the loop.

### 4. Finalize

After the loop, pick the round with the highest total score (break ties by preferring later rounds since they had more iteration).

```bash
cp {{results_dir}}/rounds/vBEST.svg {{results_dir}}/final.svg
cp {{results_dir}}/rounds/vBEST.png {{results_dir}}/final.png
```

Write `{{results_dir}}/report.md` containing:

```markdown
# Pelican-Bicycle SVG Report

## Per-round scores
| Round | Pelican | Bicycle | Composition | Polish | Total |
|-------|---------|---------|-------------|--------|-------|
| 1 | ? | ? | ? | ? | ? |
| 2 | ? | ? | ? | ? | ? |
| 3 | ? | ? | ? | ? | ? |

## Best round: vN (Total: X/40)

## What worked
- ...

## What didn't work
- ...

## SVG technique notes
- viewBox used:
- Total path / shape count:
- File size:
```

## Final checklist

- [ ] `{{results_dir}}/final.svg` exists, is valid XML, renders in a browser, has no `<image>` tags
- [ ] `{{results_dir}}/final.png` exists (rasterized version)
- [ ] `{{results_dir}}/rounds/v*.svg` and `v*.png` exist for every round attempted
- [ ] `{{results_dir}}/report.md` exists with per-round score table and a notes section
- [ ] File size of `final.svg` is under 50KB
