Foundation
Workflows
How execution happens. The autonomous pipeline + role-gated lock flow.
Workflows · How Execution Happens
The autonomous pipeline from intake → live brand domain. Wall-clock targets in minutes. Role-gated review between AI work.
The full chain
T+0:00 Intake submit (37 fields)
↓ POST /api/brand-os/intake
↓ Insert brand · auto-fire foundation
↓ brand.config.intake.poc_email captured
T+0:01 Generate Foundation
↓ POST /api/install/generate-foundation
↓ 4-step Claude Opus chain (SP + P1→P2→P3→P4)
↓ Persist 13-key foundation JSON to brand.config.engine.foundation
↓ ~3-4 min
T+0:04 Generate Components (auto-fired after foundation)
↓ POST /api/install/generate-components
↓ 6 slices from foundation + 8 fresh Claude gens (parallel)
↓ Persist 14 content_json blocks to brand.config.engine.components[slug]
↓ ~80s
T+0:05 Generate LOFI Doc
↓ Google Docs auto-created · 14 component sections · H1 outline nav
↓ Store doc_url in brand.config.engine.lofi_doc_url
↓ Telegram alert to POC
T+0:05 → T+QA COPY REVIEW (POC role)
↓ POC opens Doc · Suggesting mode
↓ Edits + scores per component
↓ POST /api/install/sync-edits (pulls suggestions → content_json patches)
↓ POC says "lock copy #NN" per component
↓ POST /api/install/lock-component { stage: "copy" }
↓ copy_status = copy_locked · copy_locked_at = ISO
T+QA+10 HIFI BUILD (only on copy_locked components)
↓ POST /api/install/render-hifi
↓ Per component: load locked content_json · render via Master template · brand vars
↓ Hosts at /studio/[slug]/install/preview/<component>
↓ ~30s
T+QA+10 → T+QA+30 HIFI REVIEW (POC role)
↓ POC reviews each rendered page in browser
↓ POC says "lock hifi #NN"
↓ POST /api/install/lock-component { stage: "hifi" }
T+QA+30 PUBLISH (POC explicit "publish" command only)
↓ POST /api/install/publish
↓ Auto: DNS pre-flight check (Namecheap getHosts Status=OK · record count ≥20)
↓ Vercel alias flip · staging → brand domain
↓ brand.config.engine.status = livePer-component lock gate
draft → copy_locked → hifi_locked → live
(POC QA Doc) (POC QA preview) (POC says publish)Score ≠ approval. Edits ≠ approval. "Looks good" ≠ approval. Only explicit "lock it" from POC → I call the lock endpoint.
Role routing per action
| Action | Role |
|---|---|
| "lock copy #NN" for brand X | POC of brand X |
| "lock hifi #NN" for brand X | POC of brand X |
| "publish" brand X | POC of brand X (+ Auto checks pass) |
| "approve new master template" | Reviewer |
| "update voice rule for brand X" | POC of brand X |
| "add new system rule" | Reviewer |
| "first-time install for new brand" | Reviewer (until proven) |
| Strategy or architecture dispute | Founder (escalation) |
| Compliance violation (em-dash, fabrication) | Auto blocks · Reviewer can override |
Sync edits from Doc → Supabase
1. POC edits LOFI Doc in Suggesting mode
2. Each suggestion = textRun with suggestedInsertionIds / suggestedDeletionIds
3. POST /api/install/sync-edits { brand_slug }
4. Parser walks doc paragraphs · tracks current ▸ FIELD context · classifies:
· score / notes / field_label / content / pure_delete / pure_insert
5. Applies edits to brand.config.engine.components[slug] per field path
6. Field-context fallback: if before-text drifted, overwrite by field path
7. Returns { applied, captured, skipped, report[] }
8. POC reviews report · re-fires Doc gen if neededLibrary refs power pattern extraction
At gen time for each fresh-gen component:
1. Pull rated 4-5/5 references from library table (Reviewer-curated)
2. Slug aliases (e.g., landing → landing, landing_page, marketing_website)
3. For each ref: Claude extracts headline_pattern, cta_pattern, structure_pattern,
voice_pattern, trust_pattern, anti_patterns_observed
4. Inject patterns into prompt as RULES (not verbatim examples)
5. Cache patterns in PATTERN_CACHE (in-memory session)
6. Output reflects patterns applied to current brand's voiceThis is why curating refs improves output quality across ALL future gens — pattern extraction compounds.
API surface (callable by AI + humans)
| Endpoint | Status | Purpose |
|---|---|---|
POST /api/brand-os/intake | 🟢 | Insert brand row · auto-fire foundation |
POST /api/install/generate-foundation | 🟢 | 4-step Claude chain |
POST /api/install/generate-components | 🟢 | 14 components gen |
POST /api/install/sync-edits | 🟢 | Doc → Supabase patches |
POST /api/install/lock-component | 🟢 | Copy or HIFI lock per stage |
POST /api/landing/capture | 🟢 | Million Verifier · Twilio · Resend |
POST /api/install/build-doc | 🔴 | Auto LOFI Doc generation (script exists) |
POST /api/install/render-hifi | 🔴 | Build HIFI from locked copy |
POST /api/install/publish | 🔴 | Alias flip · DNS check |
POST /api/chat/{turn,capture,escalate,poc-reply} | 🔴 | AI chat widget backend |
POST /api/agent/voice-call | 🔴 | VAPI integration |
Video Post-Production & Repurposing (SOP)
Canonical SOP (verbatim): Post-Production SOP doc. Transcribe → speaker-attribute → strip filler → correct transcript → timestamp key moments → signature + micro-content.
Timestamp-label legend (from the SOP): EM emotional · QM quotable · TM teachable · @ mention · (blank = chapter header).
MCM caption & name correction glossary (Steve-verified, canonical)
Auto-transcription (whisper/OpusClip) mis-hears these every time. Apply on EVERY MCM clip before publish:
| Canonical | Notes |
|---|---|
| Phyliss Filderman | client — Steve spells it Phyliss (overrides "Phyllis") |
| Stan and Ann (Marvers) | clients — captions read "Stan and Ann" |
| Esther | Phyliss's caregiver — auto-heard as "Western/Wester" |
| Fatima | Stan & Ann's caregiver — auto-heard as "fatigue" / mislabeled "the team" |
| Christina | the nurse practitioner |
Mis-hear → fix: Western/Wester → Esther · fatigue / "the team" → Fatima · nerves → nurse · Yetis → Yiddish · writing → providing · "Doctor Fuss" → the Doctor · "paid" → "recommendations MCM personnel gave to us". Recurring QC: clips often cut off at the end — extend the out-point so the sentence completes. Never ship auto-captions unverified.
Source memory
project_role_taxonomyproject_install_checklistproject_two_stage_lockproject_72hr_clients_outputsproject_canonical_install_deliverablesproject_curation_library_triple_playfeedback_no_lock_without_mk_qafeedback_no_publish_without_approvalfeedback_dns_safety_protocolfeedback_vercel_promote_alias_gotcha