Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

docs(prompts): add drop-edit-embed task stack

Claude90419d20d05c
diff --git a/prompts/INDEX.md b/prompts/INDEX.md
index cd3138f63..0dcf918ef 100644
--- a/prompts/INDEX.md
+++ b/prompts/INDEX.md
@@ -16,6 +16,7 @@ Each band is a folder. Prompts inside a band can run in parallel unless they tou
- [wallet-auth/](./wallet-auth/) — band 1
- [selfie-onboarding/](./selfie-onboarding/) + [selfie-agent/](./selfie-agent/) + [avatar-platform/](./avatar-platform/) — band 2
- [avatar-editing/](./avatar-editing/) + [avatar-edit/](./avatar-edit/) — band 3
+- [drop-edit-embed/](./drop-edit-embed/) — band 4 (anyone-can-drop-and-embed their own GLB; closes the seam between the viewer/editor and the widget flow)
- [portable-embed/](./portable-embed/) + [embed/](./embed/) — band 4 (view + embed polish)
- [claude-lobehub/](./claude-lobehub/) + [lobehub-embed/](./lobehub-embed/) + [claude-artifact/](./claude-artifact/) — band 5 (chat-surface integration)
- [onchain/](./onchain/) — band 6
diff --git a/prompts/drop-edit-embed/00-README.md b/prompts/drop-edit-embed/00-README.md
new file mode 100644
index 000000000..cb6a394c6
--- /dev/null
+++ b/prompts/drop-edit-embed/00-README.md
@@ -0,0 +1,92 @@
+# Drop-Edit-Embed — task stack
+
+User flow this band ships:
+
+```
+[ user visits 3dagent.vercel.app ]
+ │
+ ▼
+[ drops a .glb / .gltf ] ──── or ────► [ #model=<url> deep link ]
+ │
+ ▼
+[ viewer loads — Editor auto-attaches ]
+ │ tweaks materials, textures,
+ │ toggles visibility, moves nodes
+ ▼
+[ clicks "📤 Publish as embed" ]
+ │
+ ▼
+[ Publish modal ]
+ ├── upload edited GLB to R2 (avatars/presign → PUT → /api/avatars)
+ ├── mint a widget of type=turntable (POST /api/widgets, is_public=true)
+ └── show 3 snippets + copy buttons
+ │
+ ▼
+[ user pastes into: ]
+ ├── any HTML page → iframe src="/w/<id>" or <agent-3d src="...">
+ ├── Slack / Discord / X / iMessage → OG + Twitter card unfurl
+ ├── WordPress / Ghost / Notion → oEmbed auto-expand
+ └── SperaxOS chat → iframe if it allows HTML, link preview otherwise
+```
+
+## Why a new band
+
+Most pieces already exist in the codebase:
+
+- Viewer + drag-drop: `src/app.js`, `src/viewer.js`
+- Editor (materials, textures, scene graph, GLB export): `src/editor/*`
+- Upload: `api/avatars/presign.js` + `api/avatars/index.js` (R2 + `avatars` table)
+- Widget CRUD: `api/widgets/index.js`, `api/widgets/[id].js`
+- Widget page: `/w/<id>` via `api/widgets/page.js` + `api/widgets/view.js`
+- Unfurl: `api/widgets/og.js` (Open Graph image), `api/widgets/oembed.js` (oEmbed)
+- `<agent-3d>` web component: `src/element.js`, `dist-lib/agent-3d.js`
+- Widget Studio: `public/studio/` (3-column picker)
+
+The gap is the **hand-off** — today a user who drops+edits a GLB in the viewer has no one-click path from "I just edited this" to "here is a shareable link." They have to download, go to Studio, upload, generate. This stack closes that seam.
+
+## Dispatch order
+
+Run 01 → 02 → 03 → 04 first; those ship the happy path. 05 → 06 harden it. 07 → 08 verify.
+
+| Prompt | Ships | Can parallel with |
+|---|---|---|
+| [01-editor-on-dropped-glb.md](./01-editor-on-dropped-glb.md) | Editor reliably attaches for drag-drop + `#model=` loads | — |
+| [02-publish-client.md](./02-publish-client.md) | `src/editor/publish.js` — one function that uploads + mints widget | 01 |
+| [03-publish-button-and-modal.md](./03-publish-button-and-modal.md) | "📤 Publish as embed" button in editor + share modal with 3 snippets | depends on 02 |
+| [04-publish-auth-gate.md](./04-publish-auth-gate.md) | Signed-out users get sent to `/login?next=...` with their edits preserved | depends on 03 |
+| [05-republish-existing.md](./05-republish-existing.md) | Loaded-from-a-widget re-edit → Update vs Create new | depends on 03 |
+| [06-size-and-cors-guards.md](./06-size-and-cors-guards.md) | Block >25 MB, catch CORS-blocked remote GLBs with a useful error | depends on 02 |
+| [07-widget-metadata.md](./07-widget-metadata.md) | Verify + polish OG card + oEmbed for `/w/<id>` | parallel with 01–06 |
+| [08-smoke-test.md](./08-smoke-test.md) | E2E manual checklist — drop, edit, publish, paste in each surface | last |
+
+## House rules for every prompt (inherits from `/CLAUDE.md`)
+
+- One deliverable per prompt, one PR per prompt.
+- No scope creep. If something outside the prompt needs fixing, note it in the reporting block — do not fix it.
+- Cite exact file paths and line numbers. Don't invent APIs; read the existing code.
+- Prefer editing existing files to creating new ones. New files only when the prompt names them.
+- Run `node --check` on every modified JS, then `npm run verify` (prettier + vite build). Report both outputs.
+- Respect `Files off-limits` in each prompt — parallel tasks may be editing them.
+- If an unrelated bug shows up, note it in the reporting block. Don't fix it in the same PR.
+- Never `forge script --broadcast`. On-chain is immutable.
+
+## Reporting block (required at the end of every task)
+
+```
+### Files changed
+- path/to/file.js (section X)
+- path/to/new.js (created)
+
+### Commands run
+- node --check … → output
+- npm run verify → output
+
+### Manual verification
+- <what you browser-tested, with exact URL + action>
+
+### Skipped / deferred
+- <anything deliberately not done>
+
+### Unrelated bugs noticed
+- <do not fix — just note>
+```
diff --git a/prompts/drop-edit-embed/01-editor-on-dropped-glb.md b/prompts/drop-edit-embed/01-editor-on-dropped-glb.md
new file mode 100644
index 000000000..ef81967b4
--- /dev/null
+++ b/prompts/drop-edit-embed/01-editor-on-dropped-glb.md
@@ -0,0 +1,72 @@
+# Task 01 — Editor attaches reliably on any imported GLB
+
+## Why this exists
+
+Every downstream task in this band assumes the Editor is available and wired to whatever GLB the user has loaded. Before we add a "Publish as embed" button, we need to confirm (and fix if needed) that the Editor actually attaches in all three import paths: drag-drop, URL-hash `#model=`, and file picker.
+
+The `Editor` class in [src/editor/index.js](../../src/editor/index.js) already exposes `attach()` (one-time) and `onContentChanged({ url, file, name })` (per load). It needs to be:
+
+1. Constructed once, after the `Viewer` is constructed.
+2. `attach()`'d once.
+3. Called `onContentChanged(...)` every time a model loads — drag-drop, URL, or internal re-load.
+
+## Shared context
+
+- [src/app.js](../../src/app.js) is the main SPA entry. It constructs the `Viewer` and handles the dropzone + URL hash.
+ - Search for where `new Viewer(...)` is called and where model loads happen (`view()`, `load()`).
+- The `Editor` import is `import { Editor } from './editor/index.js';` (already imported on app.js line ~4).
+- `EditorSession.reset({ url, file, name })` in [src/editor/session.js](../../src/editor/session.js) is what the editor uses to track the source for export. If `onContentChanged` isn't called, `session.getSourceBuffer()` will return null and GLB export fails silently later.
+- The editor renders into `viewer.gui` (dat.gui). If the viewer is in kiosk mode (no gui), the editor currently degrades gracefully (see `_addExportFolder()` early-return). Leave that as-is.
+
+## What to build
+
+### 1. Audit the current wiring
+
+Read [src/app.js](../../src/app.js) end-to-end and answer (in your reporting block):
+
+- Where is the Editor instantiated?
+- Is `editor.attach()` called once?
+- Is `editor.onContentChanged(...)` called in every code path that loads a model? Specifically: drag-drop (`load()`), URL-hash model (`view()`), and any internal re-load (`viewer.load()` that doesn't go through `App.view()`).
+
+### 2. Fix any missing calls
+
+Wire `editor.onContentChanged(...)` into every load path with the correct `{ url, file, name }`:
+
+- Drag-drop: `{ file: <File>, name: <file.name> }`
+- URL-hash / remote fetch: `{ url: <string>, name: <basename(url)> }`
+- Re-load after edit (if any): pass the current source
+
+Do **not** call `attach()` more than once.
+
+### 3. Do not regress kiosk mode
+
+If `this.options.kiosk` is true, the Editor should either not construct or not `attach()` — keep the old behavior. Look at how the viewer disables its GUI in kiosk mode and mirror that decision.
+
+### 4. Handle the "no source buffer" failure loudly (not silently)
+
+If `onContentChanged` ever gets called with neither `url` nor `file`, the export will fail later. Have `EditorSession.reset()` log a warning (`console.warn('[editor] no source — export disabled')`) and have the Editor disable its export control visually (gray it out) until a valid source lands. This unblocks Task 03, which otherwise can't tell why publish silently fails.
+
+## Files you own
+
+- Edit: [src/app.js](../../src/app.js) — add or move `onContentChanged(...)` calls into each load path.
+- Edit: [src/editor/session.js](../../src/editor/session.js) — add the warn + a getter like `isExportReady()`.
+- Edit: [src/editor/index.js](../../src/editor/index.js) — gray out the export control when `!session.isExportReady()`; update when `session.onChange` fires.
+
+## Files off-limits
+
+- `src/editor/glb-export.js` — owned by task 02 (publish client may change call signatures).
+- `src/editor/material-editor.js`, `src/editor/texture-inspector.js`, `src/editor/scene-explorer.js` — not in this task.
+- Any `api/*` file — not in this task.
+- `public/studio/*` — separate surface.
+
+## Acceptance
+
+- Load [http://localhost:3000](http://localhost:3000), drag a `.glb` onto the page → Editor folder appears, scene panel renders, export control is enabled.
+- Load [http://localhost:3000/#model=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Fox/glTF-Binary/Fox.glb](http://localhost:3000/#model=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Fox/glTF-Binary/Fox.glb) → Editor folder appears, export control is enabled.
+- Load [http://localhost:3000/#kiosk=true&model=…](http://localhost:3000/#kiosk=true&model=…) → no Editor folder, no errors.
+- Tweak a material color, click `💾 download GLB` → file saves correctly (regression check).
+- `window.VIEWER.editor.session.isExportReady()` returns `true` after any successful load.
+
+## Reporting
+
+Include the audit findings (what was broken) + the exact patches + the manual-verification outcomes. Use the reporting template in [00-README.md](./00-README.md).
diff --git a/prompts/drop-edit-embed/02-publish-client.md b/prompts/drop-edit-embed/02-publish-client.md
new file mode 100644
index 000000000..6c5aa0096
--- /dev/null
+++ b/prompts/drop-edit-embed/02-publish-client.md
@@ -0,0 +1,113 @@
+# Task 02 — `publishEditedGLB(session, opts)` client helper
+
+## Why this exists
+
+Task 03 adds a "📤 Publish as embed" button. That button needs a single async function it can call to turn the current editor session into a live shareable widget. Keep the transport logic out of the UI — put it in its own file so it's testable and reusable from the Widget Studio and anywhere else.
+
+## Shared context
+
+- The three endpoints you'll call — **read them before you wire** — are:
+ - `POST /api/avatars/presign` → [api/avatars/presign.js](../../api/avatars/presign.js). Returns `{ storage_key, upload_url, method: 'PUT', headers: { 'content-type' }, expires_in }`.
+ - `POST /api/avatars` → [api/avatars/index.js](../../api/avatars/index.js). Registers an avatar given `{ name, slug, storage_key, content_type, size_bytes, ... }`. Verifies R2 object exists via `headObject()`. Returns `{ avatar: { id, slug, url, ... } }`.
+ - `POST /api/widgets` → [api/widgets/index.js](../../api/widgets/index.js). Shape: `{ type: 'turntable', name, avatar_id, config, is_public }`. Returns `{ widget: { id, url, ... } }`.
+- Edit-to-bytes is already done: [src/editor/glb-export.js](../../src/editor/glb-export.js) exports `exportEditedGLB(session) → Uint8Array`.
+- The `EditorSession` exposes `sourceName` (the original filename or URL tail) — use that as the default avatar name, sanitized.
+- Auth is cookie-based for the browser flow (`credentials: 'include'`). The helper does **not** handle login — it throws a typed `AuthRequiredError` and lets the caller redirect. Task 04 wires the redirect.
+- Scope needed: `avatars:write` for avatar creation and widget creation (both accept the user session cookie).
+
+## What to build
+
+Create [src/editor/publish.js](../../src/editor/publish.js).
+
+```js
+/**
+ * Publish an edited GLB as a shareable widget.
+ *
+ * Steps (all fetch calls use credentials: 'include'):
+ * 1. exportEditedGLB(session) → Uint8Array
+ * 2. POST /api/avatars/presign → { storage_key, upload_url, headers }
+ * 3. PUT upload_url with the bytes
+ * 4. POST /api/avatars → { avatar }
+ * 5. POST /api/widgets { type:'turntable', avatar_id, ... } → { widget }
+ *
+ * Resolves: { widget, avatar, urls }
+ * urls = {
+ * page: `${origin}/w/${widget.id}`,
+ * iframe: `<iframe src="${origin}/w/${widget.id}" width="600" height="600" style="border:0"></iframe>`,
+ * element: `<script type="module" src="${origin}/dist-lib/agent-3d.js"></script>\n` +
+ * `<agent-3d src="${origin}/api/avatars/${avatar.id}" ...></agent-3d>`,
+ * }
+ *
+ * Rejects:
+ * - AuthRequiredError — 401 from any step
+ * - SizeTooLargeError — export exceeds MAX_BYTES (constant, 25 MB)
+ * - ExportFailedError — export buffer empty or glTF-Transform throws
+ * - PublishError (generic) — any other non-2xx with the server's error_description
+ */
+export async function publishEditedGLB(session, {
+ origin = location.origin,
+ widgetType = 'turntable',
+ widgetName, // defaults to sanitized session.sourceName
+ isPublic = true,
+ config = {}, // merged into widget.config
+ onStep = () => {}, // ({ step: 'export'|'presign'|'upload'|'register'|'widget', pct }) for progress UI
+} = {}) { … }
+
+export class AuthRequiredError extends Error { constructor(){ super('auth required'); this.name = 'AuthRequiredError'; } }
+export class SizeTooLargeError extends Error { constructor(bytes, limit){ super(`${bytes} > ${limit}`); this.name='SizeTooLargeError'; this.bytes=bytes; this.limit=limit; } }
+export class ExportFailedError extends Error { constructor(cause){ super(`export failed: ${cause?.message || cause}`); this.name='ExportFailedError'; this.cause=cause; } }
+export class PublishError extends Error { constructor(step, status, body){ super(`${step} failed: ${status} ${body?.error_description||''}`); this.name='PublishError'; this.step=step; this.status=status; this.body=body; } }
+
+export const MAX_BYTES = 25 * 1024 * 1024;
+```
+
+### Implementation notes
+
+- `slug` for the avatar POST: lowercase-kebab the session name + a short random suffix. `api/_lib/validate.js` exports `slug` / `slugSchema` — match that shape (validation will reject anything else).
+- `content_type`: `model/gltf-binary`.
+- `size_bytes`: `bytes.byteLength`.
+- The PUT step uses the exact `headers` the presign endpoint returned — **do not add others** (R2 will reject the signed URL). Use `fetch(upload_url, { method:'PUT', body: bytes, headers })`. Do **not** send `credentials: 'include'` on the PUT — the presigned URL carries its own auth.
+- On 401 from any step → throw `AuthRequiredError`. Do not retry.
+- On 413 from `/api/avatars` → throw `SizeTooLargeError(bytes, MAX_BYTES)`.
+- `onStep` emits:
+ - `{ step: 'export', pct: 0 }` then `{ step: 'export', pct: 1 }`
+ - `{ step: 'presign', pct: 1 }`
+ - `{ step: 'upload', pct: 0..1 }` — use `XMLHttpRequest` for real upload progress; `fetch` doesn't give you upload progress in browsers. If you'd rather keep `fetch`, emit `0` at start and `1` on completion — that's acceptable for this task.
+ - `{ step: 'register', pct: 1 }`
+ - `{ step: 'widget', pct: 1 }`
+- Widget `config`: the defaults for `turntable` are in [public/studio/studio.js](../../public/studio/studio.js) (`TYPE_DEFAULTS.turntable` = `{ rotationSpeed: 0.5 }`). Include `{ rotationSpeed: 0.5, autoRotate: true, showControls: true, background: '#0a0a0a', accent: '#8b5cf6' }` as the baseline; shallow-merge caller-supplied `config` on top.
+
+### Do NOT
+
+- Do not import anything from `public/studio/*` — that is intentionally un-transformed by Vite. Duplicate the two default constants locally with a comment pointing to the source.
+- Do not add any new dependency. `fetch` + `XMLHttpRequest` + existing `@gltf-transform/core` (via `glb-export.js`) are enough.
+- Do not handle auth redirects here — that's task 04.
+- Do not handle CORS / size guards client-side other than the `MAX_BYTES` check. Task 06 adds the smarter guards.
+
+## Files you own
+
+- Create: `src/editor/publish.js`
+
+## Files off-limits
+
+- `src/app.js`, `src/editor/index.js` — owned by tasks 01 and 03.
+- `src/editor/glb-export.js` — you may import `exportEditedGLB`; do not edit.
+- Any `api/*` file — endpoints exist and are stable.
+- `public/studio/*` — separate surface.
+
+## Acceptance
+
+- `node --check src/editor/publish.js` passes.
+- `npm run verify` passes.
+- Manual smoke in DevTools console after loading any model:
+ ```js
+ const { publishEditedGLB } = await import('/src/editor/publish.js');
+ const session = window.VIEWER.editor.session;
+ const result = await publishEditedGLB(session, { onStep: (s) => console.log(s) });
+ console.log(result.urls);
+ ```
+ Expected: progress events, resolves with a `{ widget, avatar, urls }` object where `urls.page` is a working `/w/<id>` URL. (You must be signed in; if not, expect `AuthRequiredError` — that's correct.)
+
+## Reporting
+
+Use the template in [00-README.md](./00-README.md). Include the console log from the manual smoke so reviewers can see the step sequence.
diff --git a/prompts/drop-edit-embed/03-publish-button-and-modal.md b/prompts/drop-edit-embed/03-publish-button-and-modal.md
new file mode 100644
index 000000000..7c16e8504
--- /dev/null
+++ b/prompts/drop-edit-embed/03-publish-button-and-modal.md
@@ -0,0 +1,128 @@
+# Task 03 — "📤 Publish as embed" button + share modal
+
+## Why this exists
+
+Tasks 01–02 built the plumbing. This one ships the user-visible piece: a button in the editor that turns the current scene into a shareable widget, and a modal with copy-ready snippets. After this lands, the "drop → edit → embed" loop is complete for signed-in users on the happy path.
+
+## Shared context
+
+- The editor's control folder is built in [src/editor/index.js](../../src/editor/index.js) `_addExportFolder()` — it currently adds `💾 download GLB`, `🗂 scene panel [T]`, `↺ revert all edits`. You add one more control here: `📤 publish as embed`.
+- [src/editor/publish.js](../../src/editor/publish.js) exists after task 02. It exports `publishEditedGLB(session, opts)` returning `{ widget, avatar, urls }` and a set of typed errors.
+- The modal should match the look of [src/avatar-creator.js](../../src/avatar-creator.js) (CSS class `.avatar-creator-overlay` / `.avatar-creator-modal` in [style.css](../../style.css)) — reuse that shell visually so this doesn't feel like a new design system. Copy the DOM structure; add a new class (`.publish-modal-*`) to avoid CSS collisions.
+- Progress UI: use the `onStep` callback from `publishEditedGLB` — render a 4-step row (`Export → Upload → Register → Widget`) with checkmarks and a spinner on the in-flight step.
+
+## What to build
+
+### 1. Add the control
+
+In [src/editor/index.js](../../src/editor/index.js) `_addExportFolder()`, after the `💾 download GLB` row, add:
+
+```js
+folder
+ .add({ publish: () => this._openPublishModal() }, 'publish')
+ .name('📤 publish as embed');
+```
+
+Store a reference (`this._publishCtrl = …`) so you can disable it while a publish is in-flight.
+
+Make `_openPublishModal()` a method on `Editor` that:
+
+1. Dynamic-imports `./publish.js` (keeps the main bundle lean).
+2. Constructs a `PublishModal` instance (new class, see below).
+3. Calls `publishEditedGLB(this.session, { onStep: modal.onStep })`.
+4. On resolve: `modal.showResult(result.urls)`.
+5. On `AuthRequiredError`: `modal.showAuthRequired()` — the UX is "Sign in to publish" with a button that goes to `/login?next=…`. Task 04 fills in `next=…` with edit-pending state; for now just go to `/login?next=${encodeURIComponent(location.href)}`.
+6. On `SizeTooLargeError`, `ExportFailedError`, `PublishError`: `modal.showError(err)`.
+
+Re-enable the publish control in a `finally`.
+
+### 2. New file: `src/editor/publish-modal.js`
+
+```js
+/**
+ * PublishModal — post-publish share UI.
+ *
+ * DOM structure mirrors avatar-creator.js:
+ * <div class="publish-overlay">
+ * <div class="publish-modal">
+ * <div class="publish-header"><span class="publish-title">…</span><button class="publish-close">×</button></div>
+ * <div class="publish-body">
+ * <!-- one of three states: "working" | "result" | "error" -->
+ * </div>
+ * </div>
+ * </div>
+ */
+export class PublishModal {
+ constructor(containerEl) { … }
+ open() { … } // mounts, shows "working" state
+ close() { … } // unmounts, removes listeners
+
+ /** progress callback compatible with publish.js */
+ onStep = ({ step, pct }) => { … } // update checkmarks/spinner in the "working" state
+
+ showResult(urls) { … } // renders the three snippets + copy buttons + QR-less link + "Open" button
+ showAuthRequired() { … } // renders a "Sign in" CTA
+ showError(err) { … } // renders the error name + .message + a Retry button
+}
+```
+
+Result state layout:
+
+```
+┌───────────────────────────────────────┐
+│ Published ✓ [×] │
+├───────────────────────────────────────┤
+│ Share link │
+│ [ https://…/w/wdgt_xxxxx ][ Copy ][Open]
+│ │
+│ Iframe snippet │
+│ [ <iframe src="…" … >…</iframe> ][ Copy ]
+│ │
+│ Web component snippet │
+│ [ <script …><agent-3d …>… ][ Copy ] │
+│ │
+│ [ Done ] │
+└───────────────────────────────────────┘
+```
+
+- Each "Copy" button: `navigator.clipboard.writeText(value)`. Flash the button text to "Copied ✓" for ~1.2 s, then revert.
+- "Open" button on the link row: `window.open(urls.page, '_blank', 'noopener')`.
+- ESC closes the modal. Click-outside the inner `.publish-modal` closes.
+- Focus trap: on open, focus the first Copy button; on ESC restore focus to the publish control in the editor folder.
+
+### 3. Styles
+
+Add to [style.css](../../style.css) at the end — a single scoped block keyed to `.publish-overlay`, `.publish-modal`, `.publish-body`, `.publish-snippet`, `.publish-copy-btn`, `.publish-step`, `.publish-step--done`, `.publish-step--active`, `.publish-step--pending`. Match the existing dark-theme colors (see `.avatar-creator-*` rules for the palette).
+
+Do not introduce new CSS variables. Match the existing `--accent` / `--panel-bg` if present; otherwise use the same hex values the avatar-creator modal uses.
+
+### 4. Accessibility
+
+- Root `<div class="publish-overlay">` gets `role="dialog"`, `aria-modal="true"`, `aria-labelledby="publish-title"`.
+- The "Working" state has `aria-live="polite"` on the progress row so screen readers hear step changes.
+- All three snippet `<pre>` blocks are `tabindex="0"` so keyboard users can select+copy manually.
+
+## Files you own
+
+- Edit: [src/editor/index.js](../../src/editor/index.js) — add control, add `_openPublishModal()` method (~30 LOC).
+- Create: `src/editor/publish-modal.js` (~220 LOC target — keep it tight).
+- Edit: [style.css](../../style.css) — append one new block at EOF.
+
+## Files off-limits
+
+- `src/editor/publish.js` — owned by task 02 (stable after 02 ships).
+- `src/editor/session.js`, `src/editor/glb-export.js`, `src/editor/material-editor.js`, `src/editor/texture-inspector.js`, `src/editor/scene-explorer.js` — not in this task.
+- `src/app.js` — task 01 territory.
+- Any `api/*` file.
+- `public/studio/*`, `public/widgets-gallery/*` — separate surfaces.
+
+## Acceptance
+
+- While signed in: drop a GLB → tweak one material → click `📤 publish as embed` → modal shows 4-step progress → lands on a result with three working snippets → Copy+Open on `.page` opens the widget correctly in a new tab.
+- While signed out: click publish → modal shows "Sign in to publish" state with a CTA going to `/login?next=<current URL>`.
+- Oversize (>25 MB exported): modal shows the `SizeTooLargeError` with a human-readable message including the actual size and limit. Task 06 will improve this copy later.
+- Keyboard: Tab through all three Copy buttons, ESC closes, focus returns to the editor folder.
+
+## Reporting
+
+Use the template in [00-README.md](./00-README.md). Include a screenshot of the result modal (paste into the PR description; your report can just say "attached").
diff --git a/prompts/drop-edit-embed/04-publish-auth-gate.md b/prompts/drop-edit-embed/04-publish-auth-gate.md
new file mode 100644
index 000000000..4d5c38c3f
--- /dev/null
+++ b/prompts/drop-edit-embed/04-publish-auth-gate.md
@@ -0,0 +1,123 @@
+# Task 04 — Auth-gate + preserve edits across login redirect
+
+## Why this exists
+
+After task 03, signed-out users who click Publish see a "Sign in" modal. If they click it, they go to `/login`, sign in, and are dumped back at the app root — their edits are gone. That's a conversion killer. This task preserves the session across the login round-trip so the publish resumes automatically.
+
+## Shared context
+
+- Login page is [public/login.html](../../public/login.html). It reads `?next=<url>` and redirects to it on success. Verify by reading the file — do not assume.
+- Session cookie is set by `/api/auth/login` ([api/auth/login.js](../../api/auth/login.js)) via `createSession` / `sessionCookie` from [api/_lib/auth.js](../../api/_lib/auth.js). The browser will have a valid cookie after login completes.
+- The Editor session state that needs to survive the round-trip:
+ - The loaded source (URL or the dropped file bytes)
+ - `session.materialEdits`, `session.transformEdits`, `session.visibilityEdits` from [src/editor/session.js](../../src/editor/session.js)
+- File bytes can't go in the URL. Dropped files are the hard case — browsers won't let us re-drop a file after navigation. We store dropped bytes in `IndexedDB` keyed by a short random id; URL-loaded models are re-fetched by URL after login.
+- Edits are small JSON — they can round-trip in `sessionStorage`.
+
+## What to build
+
+### 1. Edit persistence helper
+
+Create `src/editor/edit-persistence.js`. Two responsibilities:
+
+```js
+/**
+ * Stash current editor state so the user can continue after a round-trip (login).
+ * Returns a short token to be placed in the URL (e.g. ?resume=abc123).
+ */
+export async function stashSession(session) { … }
+
+/**
+ * Restore previously stashed state. Returns:
+ * { source: { url } | { file: File }, edits: { materialEdits, transformEdits, visibilityEdits } }
+ * or null if no valid stash.
+ */
+export async function restoreSession(token) { … }
+
+/** Delete the stash (after successful resume). */
+export async function clearStash(token) { … }
+```
+
+Implementation:
+
+- Stash id: `'edt_' + crypto.getRandomValues(new Uint8Array(6)) → base64url`.
+- JSON blob (edits + source-url if URL-loaded) → `sessionStorage.setItem('edt:' + id, JSON.stringify(blob))`.
+- If the source is a `File`, put the bytes in `IndexedDB` under db `3dagent`, store `edt-bytes`, key = id, value = `{ name, type, bytes: ArrayBuffer }`.
+- TTL: best-effort only. Overwrite prior stashes for the same session (`sessionStorage`), so cap is effectively 1.
+- On restore, if either the metadata or the bytes are missing, return `null` (don't throw).
+
+### 2. Hook stash on "Sign in to publish"
+
+In `src/editor/publish-modal.js` (task 03), `showAuthRequired()` currently redirects to `/login?next=<current URL>`. Replace with:
+
+```js
+import { stashSession } from './edit-persistence.js';
+
+async showAuthRequired() {
+ const token = await stashSession(this._session); // pass session in via constructor
+ const nextURL = new URL(location.href);
+ nextURL.searchParams.set('resume', token);
+ nextURL.searchParams.set('publish', '1'); // auto-open publish after resume
+ location.href = `/login?next=${encodeURIComponent(nextURL.toString())}`;
+}
+```
+
+The `PublishModal` needs the `session` reference — update its constructor / the call site in `src/editor/index.js` to pass it.
+
+### 3. Hook resume on boot
+
+In [src/app.js](../../src/app.js), after the Editor is constructed and attached, read `location.search` for `resume=`:
+
+```js
+const resumeToken = new URLSearchParams(location.search).get('resume');
+if (resumeToken) {
+ const stashed = await restoreSession(resumeToken);
+ if (stashed) {
+ if (stashed.source.url) await this.view(stashed.source.url, '', new Map());
+ else if (stashed.source.file) await this.load(new Map([[stashed.source.file.name, stashed.source.file]]));
+ // Replay edits into the new session.
+ this.editor.session.restoreEdits(stashed.edits);
+ // Auto-open Publish if &publish=1.
+ if (new URLSearchParams(location.search).get('publish') === '1') {
+ this.editor._openPublishModal();
+ }
+ await clearStash(resumeToken);
+ // Strip the query params so reloads don't loop.
+ const clean = new URL(location.href);
+ clean.searchParams.delete('resume');
+ clean.searchParams.delete('publish');
+ history.replaceState(null, '', clean.toString());
+ }
+}
+```
+
+Add `EditorSession.restoreEdits({ materialEdits, transformEdits, visibilityEdits })` in [src/editor/session.js](../../src/editor/session.js) — assigns the three maps, then emits `onChange` so the GUI re-renders via `materialEditor.rebuild()` etc. (The individual rebuilds are already called by `onContentChanged`; call `session.onChange` last to trigger the editor's internal re-read of labels.)
+
+### 4. Anonymous-publish alternative (deferred)
+
+For this task, **do not** build anonymous publish. The Widget Studio already requires auth, and we want to match that behavior. Note in your reporting block that this choice was intentional so a future task can reverse it if needed.
+
+## Files you own
+
+- Create: `src/editor/edit-persistence.js`
+- Edit: [src/editor/session.js](../../src/editor/session.js) — add `restoreEdits(...)`.
+- Edit: `src/editor/publish-modal.js` (from task 03) — swap `showAuthRequired()` to stash+redirect.
+- Edit: [src/app.js](../../src/app.js) — resume-on-boot block after editor attach.
+
+## Files off-limits
+
+- `src/editor/publish.js` — stable after task 02.
+- `src/editor/index.js` — you may change the modal call site to pass `session`, but nothing else.
+- Any `api/*` file — login already redirects by `?next=`.
+- `public/login.html` — verify it uses `?next=`; do not modify it.
+
+## Acceptance
+
+- Load `http://localhost:3000`, drop a GLB, change a material color, click Publish → you're signed out → you land on `/login?next=<url with resume + publish>`.
+- Sign in → you land back at `/`, the same model loads, your material edit is re-applied (verify by opening the Material Editor — the color still reflects your change), the Publish modal auto-opens and runs the full flow.
+- Reloading the page after the resume does NOT re-trigger the resume (the query params have been stripped).
+- Refreshing mid-login (before signing in) and going back to `/` still works — no orphan state.
+
+## Reporting
+
+Use the template in [00-README.md](./00-README.md). Mention both URL-loaded and file-dropped paths were tested.
diff --git a/prompts/drop-edit-embed/05-republish-existing.md b/prompts/drop-edit-embed/05-republish-existing.md
new file mode 100644
index 000000000..90d2be41e
--- /dev/null
+++ b/prompts/drop-edit-embed/05-republish-existing.md
@@ -0,0 +1,100 @@
+# Task 05 — Re-publish: Update existing widget vs Create new
+
+## Why this exists
+
+Once a user has published their first widget, they'll reload it (e.g. via `#widget=wdgt_abc123`), edit more, and want to publish again. Two possible semantics: overwrite the existing widget (same URL → same embed in every host it was pasted into) or spawn a new widget (original stays stable, the tweak becomes a sibling). Users need the choice — default should be Update, escape-hatch should be Create new.
+
+## Shared context
+
+- The viewer already accepts `#widget=wdgt_abc123` as a hash param (per README and [src/app.js](../../src/app.js) — verify the exact key and the fetch path it uses).
+- A loaded widget gives us:
+ - `widget.id`
+ - `widget.avatar_id`
+ - `widget.name`
+ - `widget.config`
+- `PATCH /api/widgets/:id` exists in [api/widgets/\[id\].js](../../api/widgets/[id].js). Verify its accepted body shape — expect `{ name?, config?, is_public?, avatar_id? }`. Do not assume; read the file.
+- **Avatar swap vs edit-in-place:** the edited GLB is always a new avatar (different bytes, different `storage_key`). Re-publish = upload new avatar, then either:
+ - (A) Update the widget to point at the new `avatar_id`, or
+ - (B) Mint a fresh widget.
+- Option A preserves the `/w/<id>` URL — critical for links already pasted elsewhere.
+
+## What to build
+
+### 1. Detect the loaded-widget context
+
+Wherever the app already loads from `#widget=…` (find it in [src/app.js](../../src/app.js)), expose the raw widget record on `this.loadedWidget`. If no widget context (plain drag-drop or `#model=url`), `this.loadedWidget = null`.
+
+Pass this through to the editor via a new `Editor.setContext({ widget })` method, or thread it through `onContentChanged`'s `name` param — whichever is cleaner for your read of the file. Do not add a global.
+
+### 2. Publish modal branching
+
+In [src/editor/publish-modal.js](../../src/editor/publish-modal.js) (task 03) `open()` state, if a widget context exists, show a two-choice row **before** starting the publish:
+
+```
+┌─────────────────────────────────────────┐
+│ Publish ✓ [×] │
+├─────────────────────────────────────────┤
+│ You're editing widget wdgt_abc123. │
+│ │
+│ (●) Update this widget (preserves URL) │
+│ ( ) Create a new widget │
+│ │
+│ [ Cancel ] [ Go ] │
+└─────────────────────────────────────────┘
+```
+
+If no widget context, skip this step and run the existing flow directly (task 03 behavior).
+
+`Go` calls either:
+
+- **Update:** a new `updateWidget()` function in [src/editor/publish.js](../../src/editor/publish.js) (task 02). Steps:
+ 1. `exportEditedGLB(session)` → bytes
+ 2. Upload → register new avatar (same as first-publish)
+ 3. `PATCH /api/widgets/:id` with `{ avatar_id: newAvatar.id }`
+ 4. Resolves `{ widget: updated, avatar: new, urls }` — same shape as `publishEditedGLB`.
+- **Create new:** the existing `publishEditedGLB(session, …)` — unchanged.
+
+Result modal shows:
+
+- On Update: header "Updated ✓" + a note "Paste hosts already showing wdgt_abc123 will pick up the new version on next load." Same three snippets (URL/iframe/component) — they're unchanged.
+- On Create new: header "Published ✓" + three snippets for the new id.
+
+### 3. Widget-not-yours guard
+
+A user can load any public widget (`#widget=<id>` works anonymously). If they try to Update a widget they don't own, `PATCH /api/widgets/:id` will 403. Catch that in `updateWidget()` and:
+
+- Show a friendly error in the modal: "You don't own this widget. Switching to 'Create new'."
+- Automatically flip the radio and keep the modal open so one click of `Go` publishes as a fresh widget.
+
+Do not auto-submit — give the user the chance to cancel.
+
+### 4. Tests / acceptance detail
+
+- Load `/#widget=<one you own>`, edit, click Publish → modal offers both radios → Update keeps the same id, the new avatar appears on next reload.
+- Same flow with Create new → new id, old widget untouched.
+- Load `/#widget=<someone else's public widget>`, edit, click Publish → try Update → error → radio flips to Create new → Go mints a fresh widget.
+- Plain `http://localhost:3000` drop → no radio shown, publish runs directly (no regression).
+
+## Files you own
+
+- Edit: [src/editor/publish.js](../../src/editor/publish.js) — add `updateWidget(session, widgetId, opts)` alongside the existing `publishEditedGLB`. Factor the upload+register steps into a private `uploadEditedAvatar(session, opts)` helper both call.
+- Edit: [src/editor/publish-modal.js](../../src/editor/publish-modal.js) — add pre-publish choice state.
+- Edit: [src/editor/index.js](../../src/editor/index.js) — add `Editor.setContext({ widget })` + plumb into `_openPublishModal()`.
+- Edit: [src/app.js](../../src/app.js) — on widget-loaded, call `editor.setContext({ widget })`.
+
+## Files off-limits
+
+- `api/widgets/*` — endpoints are stable.
+- `src/editor/edit-persistence.js` (task 04) — no need to touch; the stash carries nothing widget-specific.
+- `src/editor/glb-export.js`, `src/editor/session.js`, `src/editor/material-editor.js`, etc. — not in scope.
+
+## Acceptance
+
+- All three manual tests above pass.
+- `PATCH /api/widgets/:id` is called with exactly `{ avatar_id }` on Update — nothing else, to avoid clobbering a user's later config tweak from Studio.
+- `node --check` all modified files.
+- `npm run verify` passes.
+
+## Reporting
+
+Use the template in [00-README.md](./00-README.md). Call out any place in `api/widgets/[id].js` you had to read to confirm the body schema — include the line numbers.
diff --git a/prompts/drop-edit-embed/06-size-and-cors-guards.md b/prompts/drop-edit-embed/06-size-and-cors-guards.md
new file mode 100644
index 000000000..46e03bb5f
--- /dev/null
+++ b/prompts/drop-edit-embed/06-size-and-cors-guards.md
@@ -0,0 +1,102 @@
+# Task 06 — File size limits + CORS-blocked GLB handling
+
+## Why this exists
+
+Task 02 added a single 25 MB size check. That's the easy half. The harder failure modes live in two spots:
+
+1. **Server-side size policy** — plan quotas exist in the `plan_quotas` table. A free user may be under a stricter cap than 25 MB per avatar. Today the editor client doesn't know; it hits `/api/avatars/presign` and gets a cryptic 413.
+2. **Remote GLBs loaded via `#model=<url>`** — the editor *can* display them (the viewer fetches them), but the editor's `EditorSession.getSourceBuffer()` may or may not have kept the original bytes, and re-fetching cross-origin often fails at CORS. Exporting then fails silently or with a confusing error.
+
+We surface both failures with useful error copy, blocks them before users upload, and gives one clear remediation for each.
+
+## Shared context
+
+- Plan quotas live in the `plan_quotas` table ([api/_lib/schema.sql](../../api/_lib/schema.sql)) and are read by endpoints that need them — search for `plan_quotas` to see where.
+- [api/avatars/index.js](../../api/avatars/index.js) returns 413 with `error: 'payload_too_large'` and an `error_description` if size exceeds the user's plan.
+- `EditorSession` in [src/editor/session.js](../../src/editor/session.js) exposes `getSourceBuffer()`. Check whether it caches the bytes on load or re-fetches on demand; if it re-fetches, CORS will bite on cross-origin URLs loaded via `#model=`.
+- The viewer's load path goes through `GLTFLoader` which internally manages fetching. We need to capture the bytes *at load time* regardless of how the viewer fetched them, then hand them to the editor session.
+
+## What to build
+
+### 1. New endpoint: `GET /api/me/limits`
+
+Create [api/me/limits.js](../../api/me/limits.js). Returns the caller's avatar size limit:
+
+```json
+{
+ "max_avatars": 20,
+ "max_bytes_per_avatar": 26214400,
+ "max_total_bytes": 524288000,
+ "current_total_bytes": 48271934
+}
+```
+
+- Auth: session cookie or bearer with `avatars:read`.
+- Read `users.plan` → look up `plan_quotas` → count `avatars` bytes for this user.
+- Rate-limit via `limits.authIp(clientIp(req))`.
+- Use `json()`, `error()`, `wrap()`, `cors()` exactly like other endpoints.
+- Cache header: `private, max-age=60` (stat changes with every upload).
+
+Add the route to [vercel.json](../../vercel.json) next to the other `/api/me/*` routes. If there aren't any, add under the `/api/*` passthrough. Keep the edit to one or two lines.
+
+### 2. Prefetch on editor boot
+
+In [src/editor/index.js](../../src/editor/index.js) `attach()`, call `/api/me/limits` once and cache the result on `this.limits`. If the request fails (user signed out), leave `this.limits = null` — task 04 will still route them through login at publish time.
+
+### 3. Client guard in `publish.js`
+
+In [src/editor/publish.js](../../src/editor/publish.js), before POSTing presign:
+
+- If `opts.limits` is passed and `bytes.byteLength > opts.limits.max_bytes_per_avatar`, throw `SizeTooLargeError(bytes.byteLength, opts.limits.max_bytes_per_avatar)`.
+- Also keep the static `MAX_BYTES` fallback when `opts.limits` is absent.
+
+In [src/editor/index.js](../../src/editor/index.js) `_openPublishModal()`, pass `{ limits: this.limits }` through.
+
+### 4. Capture source bytes at load time
+
+Edit [src/editor/session.js](../../src/editor/session.js) `reset({ url, file, name })`:
+
+- If `file` is a `File` or `Blob` → read it once with `await file.arrayBuffer()` and cache on `this._sourceBytes`.
+- If `url` is provided → attempt one `fetch(url, { credentials: 'omit' })`; on success cache the `ArrayBuffer` in `this._sourceBytes`; on CORS / network failure, set `this._sourceBytes = null` and store the failure reason in `this._sourceBytesError = { url, reason }`.
+- Replace `getSourceBuffer()` with:
+ - If `_sourceBytes` → return it.
+ - Else if `_sourceBytesError` → throw a new typed `SourceFetchError` with copy: "Couldn't re-read the model bytes for export. Most often this is a CORS issue with the host. Try: (1) hosting the GLB on the same origin, or (2) drag-and-dropping the file directly."
+ - Else throw `new Error('No source buffer for export')` (existing behavior).
+
+Export `SourceFetchError` from `src/editor/session.js` so `publish.js` can wrap it as `ExportFailedError` with the same copy.
+
+### 5. Modal copy
+
+In [src/editor/publish-modal.js](../../src/editor/publish-modal.js) `showError(err)`:
+
+- `SizeTooLargeError` → "Your edited model is X MB, but your plan allows Y MB per avatar. Trim textures or decimate meshes, or upgrade your plan." Include a "How to trim" link — for now, link to [docs/DEVELOPMENT.md](../../docs/DEVELOPMENT.md) anchor `#compressing-gltf`; adding that anchor is out of scope for this task, so note it in the reporting block.
+- `SourceFetchError` (or `ExportFailedError` wrapping it) → the CORS copy from section 4.
+- Generic `PublishError` → `err.body?.error_description || err.message`, plus an unstyled "retry" button that just re-runs the same flow.
+
+## Files you own
+
+- Create: [api/me/limits.js](../../api/me/limits.js)
+- Edit: [vercel.json](../../vercel.json) — one or two route lines.
+- Edit: [src/editor/index.js](../../src/editor/index.js) — prefetch `/api/me/limits`; thread `limits` into publish call.
+- Edit: [src/editor/session.js](../../src/editor/session.js) — capture bytes on load; new error type.
+- Edit: [src/editor/publish.js](../../src/editor/publish.js) — honor `opts.limits`.
+- Edit: [src/editor/publish-modal.js](../../src/editor/publish-modal.js) — error copy.
+
+## Files off-limits
+
+- Other `api/*` endpoints — not in scope.
+- `api/_lib/schema.sql` — schema changes are a separate conversation. If `plan_quotas` is missing a column you need, ask, don't migrate.
+- Anything under `public/studio/*`, `public/widgets-gallery/*`.
+- `src/editor/material-editor.js`, `texture-inspector.js`, `scene-explorer.js`, `glb-export.js`.
+
+## Acceptance
+
+- Signed-in user hits `/api/me/limits` → gets JSON with their plan's numbers.
+- Drop a big GLB (synthesize one with `dd if=/dev/urandom of=fake.glb bs=1M count=30` for local testing — it will fail export but the size check hits first in step 3). The modal surfaces the plan cap and the size.
+- Load a cross-origin GLB that blocks CORS (e.g. `#model=https://somewhere-without-cors/foo.glb`) → try to publish → get the CORS-remediation copy, NOT a silent failure.
+- Load a same-origin GLB → publish works end-to-end as before.
+- Drag-and-drop path is unaffected (file bytes are cached straight from the `File`).
+
+## Reporting
+
+Use the template in [00-README.md](./00-README.md). Flag the docs anchor (`#compressing-gltf`) as a separate TODO — do not fix it in this PR.
diff --git a/prompts/drop-edit-embed/07-widget-metadata.md b/prompts/drop-edit-embed/07-widget-metadata.md
new file mode 100644
index 000000000..011dfc1b9
--- /dev/null
+++ b/prompts/drop-edit-embed/07-widget-metadata.md
@@ -0,0 +1,115 @@
+# Task 07 — Widget metadata: OG card + oEmbed + link preview polish
+
+## Why this exists
+
+When a freshly-published widget URL (`/w/wdgt_abc123`) gets pasted into Slack, Discord, X, iMessage, WordPress, Ghost, Notion, or SperaxOS chat, it should unfurl into a rich card with a thumbnail of the avatar and the widget's name. The infrastructure exists ([api/widgets/og.js](../../api/widgets/og.js), [api/widgets/oembed.js](../../api/widgets/oembed.js), the `/w/:id` page); this task verifies it works end-to-end for widgets created by the drop-edit-embed flow, and closes the gaps you find.
+
+This runs in parallel with 01–06. It's verification + targeted polish, not new construction.
+
+## Shared context
+
+- `/w/:id` is served by [api/widgets/page.js](../../api/widgets/page.js) (read it). It should render a full HTML shell with:
+ - `<title>` and `<meta name="description">` from `widget.name` / description
+ - `og:image` → `/api/widgets/:id/og`
+ - `og:url` → canonical `/w/:id`
+ - `twitter:card`, `twitter:image`
+ - `<link rel="alternate" type="application/json+oembed" href="/api/widgets/oembed?url=<encoded>">`
+ - An `<iframe>` or direct `<agent-3d>` that renders the avatar
+- [api/widgets/og.js](../../api/widgets/og.js) generates the preview image. Read it and determine:
+ - Does it 302 to the avatar's `thumbnail_url` when one exists?
+ - Does it generate a fallback SVG/PNG when there's no thumbnail? (New avatars from this flow won't have a thumbnail until we build thumbnail generation — out of scope here.)
+- [api/widgets/oembed.js](../../api/widgets/oembed.js) — verify it returns `type: 'rich'`, `html: '<iframe …>'`, `provider_name`, `thumbnail_url`, `width`/`height`.
+
+## What to build
+
+### 1. Audit first
+
+Read and record in your reporting block:
+
+- What exact meta tags does `api/widgets/page.js` emit today?
+- What exact JSON does `api/widgets/oembed.js` return today?
+- What happens in `api/widgets/og.js` when `avatar.thumbnail_url` is null? (Newly-published widgets from tasks 01–05 will have null thumbnails.)
+
+### 2. Fallback OG image for newly-published widgets
+
+For widgets with no avatar thumbnail:
+
+- Render a server-side SVG (served as `image/svg+xml`) with:
+ - Dark background `#0b0d10`.
+ - Widget name in large text (truncate at ~40 chars).
+ - A small `◎` glyph (match the `3D Agent` brand — same glyph used in the Widget Studio type-picker).
+ - Dimensions `1200x630` (Open Graph sweet spot).
+- Slack, Discord, X, and iMessage accept SVG for OG. WordPress sometimes strips SVG — acceptable trade-off; note it.
+- Cache header: `public, max-age=3600, s-maxage=86400`.
+- Do NOT add any image-processing dependency. No `sharp`, no canvas.
+
+This may already exist — if it does, leave it alone and move on. Do not rewrite for style.
+
+### 3. oEmbed payload sanity
+
+Verify the oEmbed endpoint returns, at minimum:
+
+```json
+{
+ "type": "rich",
+ "version": "1.0",
+ "provider_name": "3D Agent",
+ "provider_url": "https://3dagent.vercel.app",
+ "title": "<widget.name>",
+ "html": "<iframe src=\"https://3dagent.vercel.app/w/<id>\" width=\"600\" height=\"600\" frameborder=\"0\" allow=\"autoplay; fullscreen\" allowfullscreen></iframe>",
+ "width": 600,
+ "height": 600,
+ "thumbnail_url": "https://3dagent.vercel.app/api/widgets/<id>/og",
+ "thumbnail_width": 1200,
+ "thumbnail_height": 630,
+ "author_name": "<widget owner display name or empty>",
+ "cache_age": 900
+}
+```
+
+Add whichever of these are missing. Support `?format=xml` returning oEmbed XML — one-liner using tagged string.
+
+### 4. Link-preview bot allow-list
+
+Ensure the `/w/:id` page (and `/api/widgets/:id/og`) return a 200 for unauthenticated, no-cookie requests — Slackbot, Twitterbot, Discordbot, LinkedInBot etc. will never have your session. If the endpoint today requires auth even for public widgets, fix it (public widgets should be publicly readable by design).
+
+**Do not** add a bot-user-agent sniffing layer. Public widgets are public; no user-agent magic.
+
+### 5. Privacy: private widgets should NOT leak on unfurl
+
+If `widget.is_public === false`:
+
+- `/w/:id` returns 200 with a minimal shell and an `og:image` that says "Private widget." Do not include any title, description, or metadata about the underlying avatar.
+- `oembed` returns 404.
+- `og.js` returns the "Private" SVG fallback.
+
+The drop-edit-embed flow defaults to `is_public: true` (task 02), so this is a safety net for users who later flip privacy from the Studio.
+
+## Files you own
+
+- Edit: [api/widgets/page.js](../../api/widgets/page.js) — meta tags, privacy branch.
+- Edit: [api/widgets/og.js](../../api/widgets/og.js) — null-thumbnail fallback, privacy branch.
+- Edit: [api/widgets/oembed.js](../../api/widgets/oembed.js) — completeness, XML support, privacy 404.
+
+## Files off-limits
+
+- `api/widgets/index.js`, `api/widgets/[id].js`, `api/widgets/view.js`, `api/widgets/[id]/*` — not in this task.
+- `src/editor/*`, `src/app.js` — not in this task.
+- `public/widgets-gallery/*`, `public/studio/*` — not in this task.
+
+## Acceptance
+
+- Publish a new widget via tasks 01–05 flow → copy `/w/<id>`.
+- Paste in Slack, Discord, and X DMs (use real accounts or the bot-test tools below) → all three unfurl with a thumbnail + title.
+ - Slack debug: https://api.slack.com/reflection/tools/link-checker (or paste into a private channel)
+ - X debug: https://cards-dev.twitter.com/validator (deprecated but still works for some)
+ - Discord: just paste it; expect the same unfurl.
+ - Facebook sharing debugger: https://developers.facebook.com/tools/debug/ (also checks OG).
+- Paste in Notion → auto-embeds as iframe via oEmbed.
+- `curl -s https://<host>/api/widgets/oembed?url=https://<host>/w/<id>` returns the JSON above.
+- `curl -sI https://<host>/api/widgets/<id>/og` returns 200 with an `image/*` content-type.
+- Flip the widget to `is_public: false` via Studio → re-paste URL → preview says "Private widget," no avatar leak.
+
+## Reporting
+
+Use the template in [00-README.md](./00-README.md). Include the results of each `curl` and at least two screenshot URLs of unfurls (can describe textually if you can't attach images).
diff --git a/prompts/drop-edit-embed/08-smoke-test.md b/prompts/drop-edit-embed/08-smoke-test.md
new file mode 100644
index 000000000..9f6f9149e
--- /dev/null
+++ b/prompts/drop-edit-embed/08-smoke-test.md
@@ -0,0 +1,94 @@
+# Task 08 — E2E smoke test + findings report
+
+## Why this exists
+
+Tasks 01–07 ship the full flow. This one is the proof. Before we claim the band is done, an agent or human walks the whole thing end-to-end across every major paste surface, on desktop AND mobile, signed-in AND signed-out, with the worst-case models. Any failure becomes a new follow-up prompt — not a same-PR fix.
+
+This prompt is a checklist, not a build. The deliverable is a report posted in the PR (or as a GitHub issue) with pass/fail for every row.
+
+## Prerequisites
+
+- Branches/PRs for tasks 01–07 are merged to `main`.
+- `npm install && npm run build` succeeds locally.
+- You have a signed-in account (or can register one: `/register`) and one signed-out browser profile (Incognito / Private).
+- You have access to at least one paste surface per category below.
+
+## Golden path (required — this must pass)
+
+| # | Action | Expected | Pass/Fail |
+|---|---|---|---|
+| 1 | Load `http://localhost:3000` in Incognito | Default model loads, no editor folder (signed-out gates later) or editor visible with grayed-out publish — match task 01 decision | |
+| 2 | Drag a ~2 MB `.glb` onto the page | Model loads, editor folder appears, `📤 publish as embed` present | |
+| 3 | Change one material's base color via Material Editor | Color updates live in viewport | |
+| 4 | Click `📤 publish as embed` | Modal opens, shows "Sign in to publish" (task 04) | |
+| 5 | Click Sign in | Lands on `/login?next=…&resume=…&publish=1` | |
+| 6 | Sign in | Lands back on `/`, same model re-loads, your color edit is still applied | |
+| 7 | Publish modal auto-opens and runs through Export → Upload → Register → Widget steps | All four steps complete, result modal shows 3 snippets | |
+| 8 | Click `Copy` on the iframe snippet, paste into `test.html` locally, open in browser | Avatar renders | |
+| 9 | Click `Open` on the link row | `/w/<id>` opens in a new tab with the avatar | |
+| 10 | Paste the `/w/<id>` link into a Slack channel | Unfurls with an OG card (task 07) | |
+| 11 | Paste into a Notion page | Auto-embeds via oEmbed | |
+| 12 | Return to `/`, change the color again, click Publish | Modal offers `Update` vs `Create new` (task 05) — `Update` is the default radio | |
+| 13 | Click `Go` with Update | Result modal says "Updated ✓", same `/w/<id>` URL | |
+| 14 | Reload the Slack message / Notion block (where possible) | New color is visible | |
+
+## Edge cases (must be exercised; each becomes a follow-up prompt if it fails)
+
+| # | Action | Expected | Pass/Fail | Follow-up prompt name |
+|---|---|---|---|---|
+| E1 | Drop a 30 MB glb | Modal shows `SizeTooLargeError` with plan cap (task 06) | | 09-size-error-copy.md |
+| E2 | Load `#model=<cross-origin-CORS-blocked-url>`, edit, publish | `SourceFetchError` with the clear remediation copy (task 06) | | 09-cors-fallback.md |
+| E3 | Publish anonymously-public widget, set `is_public: false` via Studio, re-paste | Unfurl shows "Private widget," no leak (task 07) | | 09-private-unfurl.md |
+| E4 | Publish on `/` with kiosk mode on (`#kiosk=true`) | Editor + publish button are absent, no errors | | 09-kiosk-regression.md |
+| E5 | Load `#widget=<someone-else's-public-widget>`, edit, publish → Update | Server returns 403; modal flips to Create new with friendly copy | | 09-foreign-widget-copy.md |
+| E6 | Publish a widget whose GLB uses Draco + KTX2 compression | Export succeeds, published widget renders same as original | | 09-compressed-glb.md |
+| E7 | Refresh page mid-upload (step 3 of the 4-step progress) | No orphan avatar row; re-publish works | | 09-upload-abort-cleanup.md |
+| E8 | Two tabs publishing at once | Both succeed, no race on the slug generator | | 09-slug-race.md |
+
+## Paste-surface matrix (must cover at least one per row)
+
+For each surface, paste the `/w/<id>` URL and record unfurl behavior.
+
+| Surface | Expected | Pass/Fail |
+|---|---|---|
+| Slack channel | Full OG card + iframe preview (Slack may expand the iframe in unfurl; may not — just the card is OK) | |
+| Discord server | Embed with OG image + title + description | |
+| X (Twitter) post | Summary-large-image card | |
+| iMessage | Link preview with image | |
+| WhatsApp | Same | |
+| Notion page | oEmbed → auto-iframe | |
+| WordPress post | oEmbed → auto-iframe | |
+| Ghost post | oEmbed → auto-iframe | |
+| Raw `<iframe src="…/w/<id>">` in a vanilla HTML file | Renders | |
+| `<agent-3d src="…">` web-component snippet in a vanilla HTML file | Renders | |
+| Claude.ai artifact (paste iframe snippet in a conversation with HTML rendering) | Renders | |
+| LobeHub plugin slot | Renders | |
+| **SperaxOS chat** | Either an iframe render (if they allow HTML) or an OG-style preview (if they only render links) | |
+
+If SperaxOS doesn't render iframes and their link preview doesn't fire from oEmbed, file a follow-up (`09-sperax-preview-adapter.md`) describing the exact behavior you saw.
+
+## Mobile
+
+Run rows 1–10 above on at least one mobile browser (Safari iOS + Chrome Android ideally). GLB sizes should be smaller for mobile (you don't need a 30 MB file — 1 MB is enough). Report anything that differs from desktop.
+
+## Report structure
+
+At the end of this task, produce a single Markdown file `prompts/drop-edit-embed/SMOKE-REPORT.md` (or post as a GitHub issue and link). Include:
+
+- Date, commit SHA, build number.
+- Full filled-in tables above.
+- A "Follow-up prompts to create" list for every failing row, each pointing at the suggested filename.
+- Screenshots for each paste-surface unfurl (or note "couldn't test — why").
+
+## Files you own
+
+- Create: `prompts/drop-edit-embed/SMOKE-REPORT.md`
+- Create: any `09-*.md` follow-up prompts that the smoke exposes.
+
+## Files off-limits
+
+- Everything else. This task does not fix bugs — it finds them.
+
+## Reporting
+
+Point the reviewer at `SMOKE-REPORT.md`. Summarize in the PR description: total rows passed / failed / skipped, and link the biggest follow-ups.