# AIE Stitch Stability Plan — 2026-06-10

## Current diagnosis

Latest official Stitch brand-fix project:
- projectId: `12841845184823160443`
- desktop: `home-desktop-brandfix` / `c0871a3eaade4b3c913a8a78f36a7f0e`
- mobile: `home-mobile-brandfix` / `6e57c846f5574ce5b179012776caa743`

The brand drift (`LensEdit`) is removed in fresh exported HTML, but Stitch still has major contract drift:

1. Homepage nav highlights `Editor`; homepage should have no active nav item.
2. Hero primary CTA became `Explore Library`; contract says `Copy Prompt` is primary, `Open/Upload in Editor` secondary.
3. Hero upload CTA label is `Upload Photo`; acceptable only if secondary and tied to provider-state disclosure. It currently reads like a live upload product.
4. Pricing is incomplete/wrongly shaped: only Free + Creator Pro visible. PRD pricing contract expects Free / Pro / Business or explicit Business Contact/Waitlist if backend not live.
5. Desktop uses `₹499/mo`; if pricing contract source is not INR or not approved for this pass, this is model invention. It must be copied from pricing contract, not generated.
6. Pro features include `Premium support line` / `High-res exports`; these are not clearly in the pricing contract and should be treated as hallucinated unless present upstream.
7. Mobile FAQ says `copy a limited number of prompts for free`; contract says Free = `Copy all public prompts`. This is a direct contradiction.
8. `Secure Provider Pipeline` / `generation profile live` style language implies operational/provider readiness. Contract requires provider state before generate and no fake live claims.

## Root cause

Stitch is being asked to design and preserve contracts in one generative step. It tends to optimize for plausible landing-page patterns:
- highlights a nav item because most templates do;
- invents pricing tiers/features;
- rewrites CTA hierarchy;
- adds “secure pipeline” language;
- changes legal/provider nuance;
- creates slightly different page structure on each generation/edit.

This is expected model behavior. The fix is not “write a longer prompt”; it is to reduce the model's freedom and add deterministic post-generation gates.

## Stabilized process

### 1. Separate visual generation from contract rendering

Do not ask Stitch to invent/nav/pricing/legal semantics.

Before Stitch, create machine-readable contracts:
- `design/contracts/nav.json`
- `design/contracts/pricing.json`
- `design/contracts/cta-policy.json`
- `design/contracts/provider-state.json`
- `design/contracts/seo-copy.json`

Stitch prompt should reference these as immutable content, not prose suggestions.

### 2. Use locked content blocks in prompt

Put exact text blocks inside `LOCKED_CONTENT` fences:

```text
LOCKED_NAV:
brand: AI Editor RSP
items: Prompt Library | RSP Prompts | Editor | Pricing
active_item: none
right_cta: Sign in

LOCKED_CTA_ORDER:
primary: Copy Prompt
secondary: Open in Editor
tertiary: Upload Photo only inside editor/upload module and only with provider state shown

LOCKED_PRICING:
Free:
- Copy all public prompts
- Standard community support
- Web preview access
Pro:
- 200 successful edits/month
- [exact contract benefits]
Business:
- Contact / Waitlist
Forbidden:
- Unlimited
- Premium support line unless present in contract
- High-res exports unless present in contract
```

Then instruct Stitch: visual layout may vary; locked content may not.

### 3. Stop using broad regeneration for fixes

For contract drift, do not regenerate the whole page. Use one narrow edit at a time:
- pass 1: fix nav active item only
- pass 2: fix CTA labels/order only
- pass 3: fix pricing cards only
- pass 4: fix provider/legal wording only

After each edit, re-export and run the gate. If the edit introduces new drift, reject that screen and retry narrower.

### 4. Add a deterministic contract checker

Create `scripts/aie-design-contract-check.mjs` that parses exported HTML and fails if:
- `LensEdit` exists
- homepage nav has active/highlight on any item
- hero primary CTA is not `Copy Prompt`
- `Explore Library` appears above fold as primary CTA
- `Unlimited` exists
- Free block does not contain `Copy all public prompts`
- Pro block does not contain `200 successful edits/month`
- Business/Contact/Waitlist block missing when pricing is present
- mobile contains `limited number of prompts for free`
- forbidden invented claims exist: `Premium support line`, `High-res exports`, `Secure Provider Pipeline`, `generation profile live`, unless explicitly whitelisted

The checker output becomes `nav-seo-audit.json` / `contract-audit.json`. A Stitch screen cannot be accepted without checker PASS.

### 5. Keep visual score separate from contract score

Each screen gets two independent verdicts:

```json
{
  "visual_verdict": "PASS|REVISION_REQUIRED",
  "contract_verdict": "PASS|FAIL",
  "truth_verdict": "OFFICIAL_STITCH|LOCAL_PATCH_ONLY_BLOCKED"
}
```

A good-looking screen with contract FAIL is not acceptable. A contract-correct but ugly screen is also not acceptable. Both must pass.

### 6. Use component-level screen anchors

Instead of one giant homepage, generate smaller official Stitch anchors first:
- `nav-header-contract-desktop`
- `hero-task-chain-desktop`
- `prompt-card-grid-desktop`
- `pricing-contract-desktop`
- `provider-state-strip-desktop`

Then compose homepage direction from these. This reduces hallucination because each screen has fewer responsibilities.

### 7. Freeze accepted components

Once a component passes, record:
- screenId
- HTML snippet selector / visual screenshot
- accepted content hash
- allowed variants

Later edits must not regenerate accepted components unless the task explicitly says so.

### 8. Reject local patch as design proof

Local HTML patch is allowed only as a diagnostic or frontend implementation note. It cannot prove Stitch design is fixed.

If a local patch is used:
- mark `truth_verdict=LOCAL_PATCH_ONLY_BLOCKED`
- create a follow-up official Stitch edit/generate task
- do not say DESIGN_GO

## Immediate recommendation for current AIE task

Current screen should be marked `CONTRACT_DRIFT_REQUIRES_STITCH_EDIT`, not GO.

Next narrow edits:
1. Fix homepage nav active: no item highlighted.
2. Fix hero CTA: primary `Copy Prompt`, secondary `Open in Editor`, upload as module action only.
3. Fix pricing: use exact pricing contract; include Business Contact/Waitlist or remove pricing from direction review if not in scope.
4. Fix mobile FAQ: remove `limited number of prompts for free`; use `Copy all public prompts`.
5. Remove invented claims: `Premium support line`, `High-res exports`, `Secure Provider Pipeline`, any live provider implication.
6. Re-export official Stitch HTML/image and run deterministic checker.

## Benchmark rule

Stitch is a visual generator, not the contract authority. Contracts must be validated by code, not by the model's self-report or by visual inspection alone.
