Inspiration

Coordinating outfits for a group performance is a group optimization problem, not a one-person styling problem. Each performer owns different clothes, photos arrive separately, and an organizer must compare color, tone, pattern, recent use, individual preferences, and how the whole ensemble will look on stage.

I encountered this problem through real music events. Ensemble AI extends my existing Costume Coordinator so choirs, chamber groups, orchestras, dance groups, wedding parties, and other teams can coordinate complete looks from clothes they already own.

What it does

  1. An organizer creates an event and defines its visual theme.
  2. Participants join through an invitation link and register garments from photos.
  3. On-device Canvas processing suggests primary and secondary colors, tone, and only conservative pattern matches.
  4. The user reviews and edits every suggestion before saving. Garment type, silhouette, and formality are never guessed automatically.
  5. Participants can save favorite complete outfits such as a suit + shirt + tie, or a blouse + skirt + brooch.
  6. If no favorite exists, deterministic rules propose complete outfits from registered pieces and explain their compatibility.
  7. The existing deterministic optimizer selects one complete outfit per person across the group.
  8. The result displays every selected component, a harmony score, and short selection reasons.

Manual entry always remains available. A failed or uncertain photo analysis never blocks registration.

What existed before Build Week

Before July 13, Costume Coordinator already had:

  • single-garment registration and wardrobe search
  • event themes and invitation links
  • online participant submission through Cloudflare
  • a deterministic group assignment engine
  • local Canvas color extraction
  • PWA and optional cloud backup foundations

What we built and extended during Build Week

The Build Week extension adds:

  • a reviewed, photo-first registration flow with explicit success, uncertainty, failure, retry, and manual states
  • improved on-device color extraction that prioritizes the garment and suppresses common backgrounds
  • conservative pattern suggestions with confidence and warnings
  • blouse, top, skirt, trouser, and accessory-aware garment modeling
  • favorite complete outfits containing up to three physical pieces
  • automatic complete-outfit proposals when no favorite is saved
  • deterministic scoring using color, tone, pattern, season, and tags
  • one virtual optimization candidate that preserves every physical component ID and photo
  • component exclusivity, so the same brooch or skirt cannot be assigned to two people
  • usage history for every physical piece in a selected outfit
  • multi-item online submission with validated metadata in D1 and ordered photos in R2
  • retry-safe submission, legacy single-item compatibility, and authenticated stale-proposal cleanup
  • result screens that show all component photos and explain the deterministic decision

How it works

The client is a React and TypeScript PWA built with Vite. Wardrobe data and local outfits live in IndexedDB. Photo suggestions and automatic outfit proposals run in the browser using deterministic Canvas and TypeScript logic.

For optional online event sharing, a Cloudflare Worker validates participant access, image type, magic bytes, byte size, and outfit component metadata. D1 stores event and costume metadata; R2 stores only photos explicitly submitted to an event.

Saved and automatically proposed outfits are converted at the optimizer boundary into virtual costume candidates. Each candidate retains the IDs of its real pieces. This preserves the existing optimizer while preventing duplicate physical assignments and tracking real usage correctly.

How GPT-5.6 and Codex were used

GPT-5.6 was used throughout the development process inside this Codex session—not as a runtime API feature.

  • GPT-5.6 Sol: project management, requirements, product decisions, privacy and security decisions, review, and verification
  • GPT-5.6 Luna: implementation across the React, TypeScript, optimization, submission, and Worker code
  • Codex: repository and Git-history audit, code editing, test execution, production builds, browser validation, technical documentation, and traceable commits

Codex made it practical to work across frontend UX, data contracts, deterministic algorithms, Cloudflare boundaries, tests, demo preparation, and documentation as one connected workflow.

The core session ID is: 019f6be7-2f41-7673-bbf2-a31419a9ac90.

Key human decisions

The human product owner decided that:

  • final group assignment must remain deterministic and explainable
  • users must confirm or correct photo-derived suggestions
  • the product should not incur a token charge every time someone adds a garment
  • runtime images should not be sent to an external AI service for analysis
  • existing online submission behavior and user data must remain backward compatible

These decisions led us to use GPT-5.6 and Codex to build and validate the system, while keeping runtime photo input and outfit proposal local and free of per-use AI costs.

Privacy and fallback

The public app contains no OpenAI API key and makes no runtime OpenAI API call. Photos used for local attribute suggestions stay on the device. Only garments a participant explicitly submits to an online event are sent through the authenticated Cloudflare path.

Image validation occurs both in the browser and at the Worker boundary. R2 image responses are private and no-store. If analysis is uncertain or fails, the user can continue with ordinary manual input.

Challenges

The hardest part was changing the meaning of an optimizer candidate from “one garment ID” to “one complete look” without replacing the proven deterministic engine.

We also had to preserve physical identity across virtual outfits. Two differently named looks may still share the same tie or brooch, so candidate IDs alone are not enough. The optimizer now enforces exclusivity using every underlying component ID.

Online retry behavior required similar care: partial multi-photo uploads must resume safely, edited photos must not reuse stale R2 slots, and old single-item rows must continue to work.

Verification

The final Build Week branch passes:

  • TypeScript type checking
  • the production Vite build
  • Cloudflare Worker type checking
  • 424 automated tests across 56 files
  • focused coverage for photo input, confidence and fallback states, favorite outfits, automatic proposals, physical-component exclusivity, usage history, online retries, image security boundaries, and optimizer regression

The demo uses privacy-safe synthetic garment images and shows a dress, a saved suit outfit, and an automatically proposed blouse/skirt/brooch outfit selected for three participants.

What's next

After the reviewed production rollout, the next steps are real-world evaluation with performance groups, better organizer feedback tools, and additional explainable coordination rules—while preserving local processing, manual control, and deterministic final decisions.

Built With

  • cloudflare-d1
  • cloudflare-r2
  • cloudflare-workers
  • codex
  • gpt-5.6
  • indexeddb
  • pwa
  • react
  • typescript
  • vite
Share this project:

Updates