Files
chrnx-dev-wp/docs/superpowers/plans/2026-08-11-chrnx-alter-ego-assets.md
2026-08-11 13:28:34 -05:00

376 lines
15 KiB
Markdown

# CHRNX Alter Ego Assets Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Create and approve six transparent topic portraits that extend the existing CHRNX musician into one coherent visual character.
**Architecture:** Treat `assets/images/the-no-names-musician-cutout.png` as the identity and style reference. Generate one subject per approved topic on a flat chroma-key background, remove the key locally, validate alpha and dimensions, then obtain one human approval for the complete set. Keep all work non-destructive and preserve the existing music source, chroma intermediate, and cutout.
**Tech Stack:** Built-in `image_gen`, local `remove_chroma_key.py`, Python 3.13, Pillow, pytest, PNG/RGBA.
---
## Scope and execution order
Run this plan after Task 1 of the theme plan initializes the local Git repository. Finish the approval checkpoint in Task 8 before the theme plan references the six new files in templates or patterns.
Version one creates exactly:
- `assets/images/alter-ego-code.png`
- `assets/images/alter-ego-literature.png`
- `assets/images/alter-ego-research.png`
- `assets/images/alter-ego-podcasts.png`
- `assets/images/alter-ego-life.png`
- `assets/images/alter-ego-gaming.png`
Do not create the deferred historical-assassin variant. Never overwrite:
- `assets/images/the-no-names-collage.jpeg`
- `assets/images/the-no-names-musician-chroma.png`
- `assets/images/the-no-names-musician-cutout.png`
## Shared generation invariants
Every prompt must include these constraints:
```text
Image 1 is the identity and style reference. Preserve the same illustrated person: facial structure, asymmetrical black hair, triangular headband, distressed screen-print linework, collage grain, body proportions, and orange-black-cream-teal palette. Change only wardrobe, props, and pose required by the topic. One person only. No brand logos, franchise insignia, copyrighted costume replicas, readable code, readable book text, watermark, or extra limbs.
Place the complete subject on a perfectly flat solid #FF00FF chroma-key background. The background must contain no shadow, gradient, texture, reflection, floor, or lighting variation. Keep generous padding and a crisp continuous silhouette. Do not use #FF00FF in the subject.
```
Use the built-in image tool, not the CLI fallback. After each generation, copy the selected output into `tmp/imagegen/`, remove the key with:
```bash
python /Users/chrnx/.codex/skills/.system/imagegen/scripts/remove_chroma_key.py \
--input tmp/imagegen/<topic>-chroma.png \
--out assets/images/alter-ego-<topic>.png \
--auto-key border \
--soft-matte \
--transparent-threshold 12 \
--opaque-threshold 220 \
--despill
```
If hair or textured edges fail chroma removal, stop and ask before using the CLI true-transparency fallback. Do not silently change models.
### Task 1: Asset contract and automated validation
**Files:**
- Create: `tests/assets/test_alter_ego_assets.py`
- Create: `scripts/build-alter-ego-contact-sheet.py`
- Create: `tmp/imagegen/.gitkeep`
- Modify: `.gitignore`
- [ ] **Step 1: Add the failing asset inventory test**
```python
from pathlib import Path
from PIL import Image
ROOT = Path(__file__).resolve().parents[2]
EXPECTED = (
"alter-ego-code.png",
"alter-ego-literature.png",
"alter-ego-research.png",
"alter-ego-podcasts.png",
"alter-ego-life.png",
"alter-ego-gaming.png",
)
def test_alter_ego_inventory_is_complete():
missing = [
name
for name in EXPECTED
if not (ROOT / "assets" / "images" / name).is_file()
]
assert not missing, f"missing: {', '.join(missing)}"
def test_alter_ego_assets_have_useful_transparency():
for name in EXPECTED:
image = Image.open(ROOT / "assets" / "images" / name)
assert image.mode == "RGBA"
assert image.width >= 1000
assert image.height >= 1200
alpha = image.getchannel("A")
low, high = alpha.getextrema()
assert (low, high) == (0, 255)
corners = ((0, 0), (image.width - 1, 0), (0, image.height - 1), (image.width - 1, image.height - 1))
assert all(alpha.getpixel(point) == 0 for point in corners)
opaque = sum(value >= 250 for value in alpha.getdata())
coverage = opaque / (image.width * image.height)
assert 0.18 <= coverage <= 0.80
```
- [ ] **Step 2: Run the inventory test and verify red**
Run:
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
```
Expected: FAIL naming all six missing PNG files.
- [ ] **Step 3: Add the contact-sheet script**
Implement a Pillow script that reads the six files in `EXPECTED` order, composites each over both `#0D1117` and `#F6F2E9`, labels the topic outside the artwork, and writes `docs/visual-reviews/alter-ego-v1.png`. It must fail with a clear message if any input is missing.
- [ ] **Step 4: Ignore disposable chroma sources**
Add `tmp/imagegen/*.png` to `.gitignore`, but keep `tmp/imagegen/.gitkeep`. Final RGBA assets remain tracked.
- [ ] **Step 5: Commit the validation contract**
```bash
git add .gitignore tmp/imagegen/.gitkeep tests/assets/test_alter_ego_assets.py scripts/build-alter-ego-contact-sheet.py
git commit -m "test: define alter ego asset contract"
```
### Task 2: Code portrait
**Files:**
- Create: `assets/images/alter-ego-code.png`
- [ ] **Step 1: Inspect the identity reference**
Use `view_image` on `assets/images/the-no-names-musician-cutout.png` before generation.
- [ ] **Step 2: Generate the code variant**
Use the shared invariants plus:
```text
Use case: stylized-concept
Asset type: CHRNX Code section portrait
Subject: the same person as a nocturnal full-stack programmer, seated three-quarter view at a worn desk, one hand on a compact keyboard, the other holding a pencil over a notebook; abstract terminal windows, dependency graph lines, and data nodes integrated into the clothing and silhouette as non-readable collage marks
Wardrobe: dark overshirt and plain black T-shirt; preserve the triangular headband
Mood: focused, overstimulated, awake too late; intelligent without corporate polish
Composition: portrait orientation, complete upper body and both hands visible, isolated silhouette
```
- [ ] **Step 3: Remove chroma and inspect both themes**
Run the shared removal command with `<topic>=code`. Composite it temporarily over `#0D1117` and `#F6F2E9`; inspect hair, fingers, keyboard, and chair edges.
- [ ] **Step 4: Run the targeted test**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
```
Expected: still FAIL for five missing assets; no failure for `alter-ego-code.png`.
- [ ] **Step 5: Commit**
```bash
git add assets/images/alter-ego-code.png
git commit -m "feat: add CHRNX code alter ego"
```
### Task 3: Literature portrait
**Files:**
- Create: `assets/images/alter-ego-literature.png`
- [ ] **Step 1: Generate with the shared invariants**
```text
Use case: stylized-concept
Asset type: CHRNX Literature section portrait
Subject: the same person as an original gothic writer at a small desk, holding a fountain pen over an unreadable manuscript, with one raven perched on the chair back and loose ink strokes forming abstract page shapes
Wardrobe: black nineteenth-century-inspired coat simplified into modern grunge layers; preserve the triangular headband
Mood: introspective, macabre, literary; evoke public-domain gothic atmosphere without reproducing Edgar Allan Poe's face or a specific portrait
Composition: portrait orientation, upper body, both hands, pen, manuscript, and raven inside the silhouette boundary
```
- [ ] **Step 2: Remove chroma and inspect**
Use `<topic>=literature`. Reject extra fingers, readable manuscript text, duplicated ravens, or a face that no longer matches the reference.
- [ ] **Step 3: Run the targeted test and commit**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
git add assets/images/alter-ego-literature.png
git commit -m "feat: add CHRNX literature alter ego"
```
Expected: only four assets remain missing.
### Task 4: Research portrait
**Files:**
- Create: `assets/images/alter-ego-research.png`
- [ ] **Step 1: Generate with the shared invariants**
```text
Use case: stylized-concept
Asset type: CHRNX Research section portrait
Subject: the same person as an independent game-AI researcher, holding one chess piece above a compact board while abstract decision trees, probability curves, and emotion-state nodes appear as unreadable collage marks around the torso
Wardrobe: dark cardigan over plain shirt; preserve the triangular headband
Mood: rigorous, curious, human; no laboratory coat and no science-fiction holograms
Composition: portrait orientation, upper body, both hands and chessboard visible, isolated silhouette
```
- [ ] **Step 2: Remove chroma, inspect, test, and commit**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
git add assets/images/alter-ego-research.png
git commit -m "feat: add CHRNX research alter ego"
```
Expected: only three assets remain missing.
### Task 5: Podcast portrait
**Files:**
- Create: `assets/images/alter-ego-podcasts.png`
- [ ] **Step 1: Generate with the shared invariants**
```text
Use case: stylized-concept
Asset type: CHRNX Podcasts section portrait
Subject: the same person hosting at a broadcast microphone with closed-back headphones resting partly over the asymmetrical hair, one hand adjusting a compact mixer, simple waveform marks woven into the jacket texture
Wardrobe: dark casual overshirt; preserve the visible triangular headband
Mood: conversational, intelligent, relaxed with friends; no radio-station branding
Composition: portrait orientation, upper body, both hands, microphone and compact mixer visible, one person only
```
- [ ] **Step 2: Remove chroma, inspect, test, and commit**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
git add assets/images/alter-ego-podcasts.png
git commit -m "feat: add CHRNX podcast alter ego"
```
Expected: only two assets remain missing.
### Task 6: Life portrait
**Files:**
- Create: `assets/images/alter-ego-life.png`
- [ ] **Step 1: Generate with the shared invariants**
```text
Use case: stylized-concept
Asset type: CHRNX Life section portrait
Subject: the same person at a kitchen table with a cold coffee, open notebook, one game controller pushed aside, a pet paw just entering the bottom edge as a non-identifying detail
Wardrobe: soft worn hoodie; preserve the triangular headband
Mood: warm, tired, funny, ordinary; fatherhood implied through lived-in responsibility but no children, family photos, names, school objects, addresses, or identifiable private details
Composition: portrait orientation, upper body and both hands visible, isolated silhouette
```
- [ ] **Step 2: Remove chroma, inspect privacy, test, and commit**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
git add assets/images/alter-ego-life.png
git commit -m "feat: add CHRNX life alter ego"
```
Expected: only the gaming asset remains missing.
### Task 7: Gaming portrait
**Files:**
- Create: `assets/images/alter-ego-gaming.png`
- [ ] **Step 1: Generate with the shared invariants**
```text
Use case: stylized-concept
Asset type: CHRNX Gaming section portrait
Subject: the same person as an original gothic creature hunter carrying a practical leather whip and a short weathered sword, with abstract castle arches and a crescent shape integrated only as collage texture inside the clothing
Wardrobe: original dark travel coat and boots with no copied costume geometry; preserve the triangular headband
Mood: determined, nocturnal, dangerous but not gory; broad vampire-hunter archetype only
Composition: portrait orientation, three-quarter full body, both hands and complete original weapons visible, isolated silhouette
Avoid: Belmont likeness, Assassin's Creed hood, hidden blade, franchise symbols, game logos, copied armor, recognizable castle layouts
```
- [ ] **Step 2: Remove chroma and inspect IP boundaries**
Reject any recognizable franchise emblem, costume, face, weapon design, or architecture.
- [ ] **Step 3: Run the complete asset test and commit**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
git add assets/images/alter-ego-gaming.png
git commit -m "feat: add CHRNX gaming alter ego"
```
Expected: PASS, six files validated.
### Task 8: Contact sheet and human approval gate
**Files:**
- Create: `docs/visual-reviews/alter-ego-v1.png`
- Modify: any rejected asset, one at a time
- [ ] **Step 1: Build the contact sheet**
```bash
uv run --with pillow python scripts/build-alter-ego-contact-sheet.py
```
Expected: one sheet showing every portrait on dark and light surfaces.
- [ ] **Step 2: Inspect the sheet and all originals**
Use `view_image` on the sheet, then on each full-resolution PNG. Check identity, hands, props, transparent edges, headband continuity, palette, and topic clarity.
- [ ] **Step 3: Present the set to the user and pause**
Ask for approval of the complete set. Do not let the theme reference unapproved variants.
- [ ] **Step 4: Apply revisions individually**
For each rejected portrait, run one targeted image edit that restates identity invariants and changes only the named defect. Re-run the asset test and rebuild the contact sheet after every revision round.
- [ ] **Step 5: Commit the approved review artifact**
```bash
git add assets/images/alter-ego-*.png docs/visual-reviews/alter-ego-v1.png
git commit -m "docs: approve CHRNX alter ego set"
```
### Task 9: Final asset verification
- [ ] **Step 1: Run the complete asset suite fresh**
```bash
uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q
```
Expected: PASS with no missing file, alpha, corner, dimension, or coverage failure.
- [ ] **Step 2: Verify originals were preserved**
```bash
shasum -a 256 assets/images/the-no-names-collage.jpeg assets/images/the-no-names-musician-chroma.png assets/images/the-no-names-musician-cutout.png
```
Expected hashes from the design baseline:
```text
8f4a37c6b59067ccba566c1cc58ba62689623634a86ca2f5b2302354417fdd0c assets/images/the-no-names-collage.jpeg
256dc5ac69cffcd807ebaeec304c62543f97f1ccf3fea4ff244ee48bb401bace assets/images/the-no-names-musician-chroma.png
f7800c1577134a92376c38f40cc0426111a1984ce9694c421b4f7e6e3503aed4 assets/images/the-no-names-musician-cutout.png
```
- [ ] **Step 3: Confirm a clean local commit state**
```bash
git status --short
```
Expected: no uncommitted asset-plan changes.