D3 Design Centre — Phase 6 Loop Spec (§4.11.4 Compliant)¶
1. Goal¶
Every 18h, autonomously research trends → generate design → remove background → quality check → resize → upload to Printify → publish to Etsy + eBay. Zero human touch.
Product focus: Print-on-demand apparel (t-shirts, tank tops) via Printify → Etsy + eBay.
2. Context (Data Sources)¶
| Source | What | How | Freshness |
|---|---|---|---|
| Trend research | Season themes, trending topics | Gemini Flash prompt + deterministic fallback | Per cycle |
| Gemini Image | AI-generated PNG designs | gemini-2.5-flash-image API, 1024×1024 |
Real-time |
| rembg | Background removal (local, free) | rembg Python package, preserves size |
Real-time |
| PIL | Resize to 4500×5400 (t-shirt print size) | Bicubic upscaling from 1024×1024 | Real-time |
| Printify API | Upload image, create product, publish | printify_upload.py — REST API with retry |
Real-time |
| Etsy API | Listing creation | Via Printify publish (linked account) | Real-time |
| eBay API | Listing creation | Via Printify publish (linked account) | Real-time |
Critical rule: NEVER use remove.bg API (downsizes to 500×500). Always use rembg (local, preserves 1024×1024).
3. Evaluation (Verifier)¶
Verifier: verify_design.py (deterministic) + Claude (Tier-A) on escalation.
Checkable success conditions:
- Image ≥ 1000 px width and height
- File size > 50 KB
- MIME type = PNG (magic bytes check)
- Background removed (transparent PNG)
- Resize to 4500×5400 preserves aspect ratio
- Printify returns
image_idandproduct_id - Etsy/eBay publish returns success (no duplicate errors)
Fail-first: If ANY check fails → image deleted, cycle counts as failure, NO Printify API call.
4. Agent (Generator)¶
Generator: DesignAgent (autonomous_core/agents/d3_design/)
Pipeline:
_orient()— trend research → SEO brief_generate_prompt()— NO product names in prompts ("t-shirt", "hat" banned)gemini-2.5-flash-image— generate 1024×1024 PNGrembg— remove background (NOT remove.bg API!)verify_design()— all checks must passPIL.resize()— 4500×5400 for t-shirts- Printify upload → create product (12 variants: White/Black/Navy/Sport Grey)
- Publish to Etsy + eBay (per-platform anti-duplicate)
- Update
product_registry.json
Season logic:
- Summer (Jun–Aug): t-shirt + tank top
- Winter (Dec–Feb): hoodie + sweatshirt
- Transition months: mixed
5. Harness¶
Trigger: Cron every 18h (d3_design_schedule.json)
Stop conditions:
- 3 consecutive cycle failures → Telegram alert to Kris, loop halts
- Printify API rate limit → exponential backoff, max 3 retries
- Gemini image generation fails → skip cycle, try next theme
- Registry shows >20 unpublished designs → pause generation, focus on publishing backlog
DeepSeek tripwire number:
- N/A — D3 uses Gemini for images, not DeepSeek. Documented per §4.11.4.
- 3 consecutive failures (any stage) → pause + alert
- >5% image generation failure rate in rolling 10 cycles → review prompts
6. Memory (Persisted Across Cycles)¶
| What | Where | TTL |
|---|---|---|
| Product registry | output/product_registry.json |
Permanent |
| Published designs | Printify dashboard (source of truth) | Permanent |
| Generated images | output/designs/ |
30 days (cleaned by cron) |
| Prompt learning | autonomous_core/agents/d3_design_v6/memory/prompt_learning.json |
Continuous |
| Cost log | output/cost_log.json |
90 days |
7. Human Checkpoint¶
- Before new season: Kris approves season product mix (t-shirt vs hoodie)
- After 3 consecutive failures: Auto-pause + alert Kris
- Weekly: Check Etsy/eBay for rejected listings (bad titles, policy violations)
- Known issue (fixed 2026-08-01):
sanitize_etsy_title()now strips[,],&from Etsy titles. Commite45c983.
Known Issues¶
- rembg not installed: Design uploads fallback to "no background removal" warning. Install
rembgin workspace venv before next cycle. - Tank top blueprint: Need
GET /v1/catalog/blueprintsto find Bella+Canvas 3480 for summer products.