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/lobehub-embed): add fork-sidebar fast-path + audit

Claude1d91ceb4489a
diff --git a/prompts/lobehub-embed/00-fork-sidebar-fastpath.md b/prompts/lobehub-embed/00-fork-sidebar-fastpath.md
new file mode 100644
index 000000000..6435f0b7e
--- /dev/null
+++ b/prompts/lobehub-embed/00-fork-sidebar-fastpath.md
@@ -0,0 +1,287 @@
+# Task 00 — FAST PATH: mount the avatar in your LobeHub fork's right sidebar
+
+## Why this exists
+
+Tasks 01–08 build a **first-class LobeHub plugin** for the marketplace — iframes-in-chat-bubbles, handshake, auth handoff, bidirectional action relay, SDK, mention autocomplete, marketplace submission. That's the long game and it's weeks of work.
+
+This task is the short game: **your own LobeHub fork, one iframe, persistent right sidebar, ship today.** No marketplace. No autocomplete. No mention parser. Just "when I open the app, my avatar is in the sidebar, and when chat messages come in, it reacts."
+
+Run this **before** touching 01–08. It unblocks the experience now; the rest polishes it into a public product.
+
+## Context
+
+- Repo: this repo (`nirholas/3D-Agent`). The user has a **LobeHub fork** checked out separately.
+- We do NOT edit this repo in most of the task — we edit the fork. The one edit here is optional: an opt-in URL parameter on our embed to dim/brighten when chat is idle vs. streaming.
+- Our embed URL already works: `https://3dagent.vercel.app/agent/:id/embed?bg=transparent`. See [public/agent/embed.html](../../public/agent/embed.html).
+- LobeHub is Next.js 14+ / React 18 / Zustand / Ant Design. Layout lives in `src/app/(main)/` (or `packages/web/src/` in some forks — read the fork's `package.json` and `next.config.js` before assuming).
+
+## Goal
+
+After this task ships, the user opens their LobeHub fork in the browser and sees:
+
+- A **right-hand sidebar panel** (fixed width, collapsible) that renders their 3D agent inside an iframe for the whole session.
+- The avatar reacts to the currently active chat: when the LLM streams a token, the avatar mouths / sways; when the user sends, the avatar does a subtle acknowledgment.
+- The panel has a header with the agent's name + a chevron to collapse/expand + a gear icon that opens the full agent page in a new tab.
+- Closing/reopening the app remembers collapsed state (localStorage).
+
+This is not a plugin. It's a fork modification. Power users can paste their `agentId` into a settings field; defaults to a demo agent if unset.
+
+## Deliverable
+
+### 1. Side-panel component in the LobeHub fork
+
+File: depends on the fork layout. Identify it by running (in the fork, not this repo):
+
+```bash
+grep -rE '(Sidebar|RightPanel|Aside|ChatLayout)' src/ app/ packages/ --include='*.tsx' | head -20
+```
+
+Create `src/features/AgentDock/index.tsx` (or wherever the fork groups feature components). Target ~120 LOC.
+
+```tsx
+'use client';
+import { useEffect, useRef, useState } from 'react';
+import { useAgentDockStore } from './store';
+
+const ORIGIN = process.env.NEXT_PUBLIC_AGENT_ORIGIN ?? 'https://3dagent.vercel.app';
+
+export function AgentDock() {
+ const { agentId, collapsed, toggleCollapsed } = useAgentDockStore();
+ const iframeRef = useRef<HTMLIFrameElement>(null);
+
+ // Forward chat state → avatar via postMessage.
+ useChatStreamBridge(iframeRef, ORIGIN);
+
+ if (!agentId) return null;
+
+ return (
+ <aside className={`agent-dock ${collapsed ? 'agent-dock--collapsed' : ''}`}>
+ <header className="agent-dock__header">
+ <button onClick={toggleCollapsed} aria-label={collapsed ? 'Expand' : 'Collapse'}>
+ {collapsed ? '‹' : '›'}
+ </button>
+ <span className="agent-dock__name">{/* populated from ready event */}</span>
+ <a href={`${ORIGIN}/agent/${agentId}`} target="_blank" rel="noopener">⚙</a>
+ </header>
+ {!collapsed && (
+ <iframe
+ ref={iframeRef}
+ src={`${ORIGIN}/agent/${agentId}/embed?bg=transparent&host=lobehub`}
+ title="3D Agent"
+ allow="autoplay; microphone"
+ style={{ border: 0, width: '100%', height: '100%', background: 'transparent' }}
+ />
+ )}
+ </aside>
+ );
+}
+```
+
+### 2. Zustand store for dock state
+
+File: `src/features/AgentDock/store.ts`
+
+```ts
+import { create } from 'zustand';
+import { persist } from 'zustand/middleware';
+
+interface AgentDockState {
+ agentId: string | null;
+ collapsed: boolean;
+ setAgentId: (id: string | null) => void;
+ toggleCollapsed: () => void;
+}
+
+export const useAgentDockStore = create<AgentDockState>()(
+ persist(
+ (set) => ({
+ agentId: null,
+ collapsed: false,
+ setAgentId: (id) => set({ agentId: id }),
+ toggleCollapsed: () => set((s) => ({ collapsed: !s.collapsed })),
+ }),
+ { name: 'agent-dock' },
+ ),
+);
+```
+
+### 3. Chat → avatar bridge
+
+File: `src/features/AgentDock/useChatStreamBridge.ts`
+
+Purpose: listen to LobeHub's chat-stream state (find it via the fork's Zustand store — commonly `useChatStore`) and post minimal events to the iframe so the avatar reacts.
+
+```ts
+import { RefObject, useEffect } from 'react';
+import { useChatStore } from '@/store/chat'; // path depends on fork — confirm first
+
+export function useChatStreamBridge(iframeRef: RefObject<HTMLIFrameElement>, origin: string) {
+ useEffect(() => {
+ const post = (type: string, payload: Record<string, unknown> = {}) => {
+ iframeRef.current?.contentWindow?.postMessage(
+ { __agent: true, v: 1, ns: '3d-agent', type, payload },
+ origin,
+ );
+ };
+
+ const unsubSend = useChatStore.subscribe(
+ (s) => s.lastUserMessageId,
+ () => post('gesture', { name: 'nod', duration: 800 }),
+ );
+
+ const unsubStream = useChatStore.subscribe(
+ (s) => s.isStreaming,
+ (isStreaming) => post(isStreaming ? 'thinking' : 'idle'),
+ );
+
+ // Optional: when the assistant finishes, forward the final text.
+ const unsubDone = useChatStore.subscribe(
+ (s) => s.lastAssistantMessage,
+ (msg) => msg && post('speak', { text: msg.content, sentiment: detectSentiment(msg.content) }),
+ );
+
+ return () => { unsubSend(); unsubStream(); unsubDone(); };
+ }, [iframeRef, origin]);
+}
+
+function detectSentiment(text: string): number {
+ // Cheap heuristic; Empathy Layer does the real work. -1..1.
+ const positive = /\b(great|awesome|yes|thanks|good|nice|love|perfect)\b/gi;
+ const negative = /\b(error|fail|sorry|broken|bad|no|wrong)\b/gi;
+ const p = (text.match(positive) || []).length;
+ const n = (text.match(negative) || []).length;
+ return Math.max(-1, Math.min(1, (p - n) * 0.3));
+}
+```
+
+The exact store path/names depend on the fork's version. **Read the fork's chat store first** — grep for `isStreaming`, `lastMessage`, `sendMessage` — and adjust. Do not invent store keys.
+
+### 4. Layout integration
+
+Mount `<AgentDock />` inside the main chat layout component. In most LobeHub forks this is `src/app/(main)/layout.tsx` or `src/layouts/ChatLayout.tsx`. Place it as a fixed-position sibling of the main chat area.
+
+CSS (in `src/features/AgentDock/dock.module.css` or a global stylesheet — match the fork's convention):
+
+```css
+.agent-dock {
+ position: fixed;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ width: 360px;
+ background: rgba(10, 10, 10, 0.6);
+ backdrop-filter: blur(10px);
+ border-left: 1px solid rgba(255, 255, 255, 0.08);
+ display: flex;
+ flex-direction: column;
+ transition: transform 0.25s ease;
+ z-index: 40;
+}
+.agent-dock--collapsed { transform: translateX(calc(100% - 32px)); }
+.agent-dock__header {
+ display: flex; align-items: center; gap: 8px;
+ padding: 10px 12px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
+}
+.agent-dock__name { font-size: 13px; opacity: 0.7; flex: 1; }
+.agent-dock iframe { flex: 1; min-height: 0; }
+@media (max-width: 900px) { .agent-dock { display: none; } } /* hide on mobile for now */
+```
+
+Push the main content left by `360px` when the dock is expanded (search the fork's main layout for `margin-right` / CSS variable control — follow the existing pattern).
+
+### 5. Settings entry point
+
+Add an input in the fork's settings page for the user to set their `agentId`. Persisting via the Zustand store above. One-line addition in the existing Settings form — do not build a whole settings panel.
+
+```tsx
+<SettingsField label="3D Agent ID">
+ <input
+ type="text"
+ placeholder="agt_xxxxx"
+ defaultValue={agentId ?? ''}
+ onBlur={(e) => setAgentId(e.target.value || null)}
+ />
+</SettingsField>
+```
+
+### 6. Demo agent fallback
+
+Hard-code a `DEFAULT_DEMO_AGENT_ID` constant (e.g. `agt_demo`) in `src/features/AgentDock/index.tsx`. If `agentId` is unset, render with that id so first-run users see the avatar without configuring anything. Put a small "← set your own agent" link under the avatar.
+
+### 7. (Optional, this repo) — dim on idle
+
+In [public/agent/embed.html](../../public/agent/embed.html), accept an optional `?host=lobehub` param. When set, listen for `{ type: 'idle' }` and `{ type: 'thinking' }` messages and reduce/boost the exposure by ~10% so the host can signal stream state without changing the avatar's actual emotion state. Graceful no-op on unknown hosts.
+
+Keep the change to under 25 lines. Do **not** change the `AgentAvatar` decay rates.
+
+## Audit checklist
+
+- **Fork path discovery.** Before writing a single line, grep the fork for chat-store and layout files. Paste your findings in the reporting block so whoever reviews this can trace your decisions.
+- **Empathy Layer untouched.** You do not edit [src/agent-avatar.js](../../src/agent-avatar.js). The dim-on-idle is a viewer-exposure tweak, not an emotion change.
+- **Origin discipline on postMessage.** Target origin is always `ORIGIN`, never `'*'`. Inbound listeners (if you add any) check `event.origin`.
+- **Mobile hidden, not broken.** The `@media (max-width: 900px)` rule hides the dock entirely so the LobeHub chat stays usable on phones. Flag a follow-up for a proper mobile treatment — don't build it here.
+- **CSP compatibility.** LobeHub likely sets a strict CSP. Verify `3dagent.vercel.app` is allowed in `frame-src` and `connect-src`. If not, add it in the fork's `next.config.js` CSP headers. Paste the CSP you saw before editing.
+- **Dark-mode first.** Match the fork's dark theme. If the fork has light mode, the dock's background should inherit via CSS variables — don't hard-code `rgba(10,10,10,0.6)` if a theme variable exists.
+- **Collapsed affordance.** The collapsed state must still show a visible grab tab (the `‹` button remains visible) — otherwise users lose the dock forever.
+
+## Constraints
+
+- **This task lives in the FORK, not this repo** — with the single optional exception of step 7.
+- No new dependencies in the fork beyond what it already ships. Zustand is already there. If `zustand/middleware` isn't imported anywhere else, use the fork's existing persistence pattern instead.
+- No runtime fetch to our API other than the iframe load. This is session-boot lightweight.
+- Match the fork's code style (ESLint/Prettier configs in the fork). Run the fork's lint before committing.
+- No changes to the LobeHub chat pipeline or message model. We read chat state; we do not write to it.
+
+## Verification
+
+1. Start the fork locally (`pnpm dev` or `npm run dev` depending on the fork).
+2. Open the app → dock is visible on the right with the demo agent.
+3. Open browser devtools → Network tab → filter by `3dagent.vercel.app` → iframe loaded, `/agent/:id/embed` returns 200.
+4. Click the collapse chevron → dock slides right, grab tab remains visible.
+5. Reload → collapsed state persists (localStorage).
+6. Send a chat message → avatar does a small nod (inbound `gesture` event).
+7. While assistant streams → avatar in "thinking" subtle motion.
+8. Open settings → set a different agent id → dock re-mounts with the new agent.
+9. Mobile breakpoint (DevTools responsive mode) → dock hidden, chat fully usable.
+10. `pnpm lint && pnpm build` in the fork passes (whatever the fork's verify command is).
+
+## Scope boundaries — do NOT do these
+
+- Do **not** build the LobeHub plugin manifest — that's task [01](./01-plugin-manifest.md).
+- Do **not** build a message-level mention renderer — that's task [07](./07-message-renderer.md).
+- Do **not** build mention autocomplete — that's task [08](./08-mention-autocomplete.md).
+- Do **not** package `@3dagent/embed` here — that's task [06](./06-host-sdk-package.md). For this fast-path, you iframe directly.
+- Do **not** implement wallet auth handoff — that's task [03](./03-host-auth-handoff.md). Anon viewer is fine for sidebar.
+- Do **not** submit to any marketplace.
+
+## Files you own
+
+In the fork:
+- `src/features/AgentDock/index.tsx` (create)
+- `src/features/AgentDock/store.ts` (create)
+- `src/features/AgentDock/useChatStreamBridge.ts` (create)
+- `src/features/AgentDock/dock.module.css` (create, or inline per fork convention)
+- The main layout file (minimal edit: mount the dock)
+- The settings form (minimal edit: add one field)
+- `next.config.js` CSP (if edits required — flag if so)
+
+In this repo (optional, step 7 only):
+- [public/agent/embed.html](../../public/agent/embed.html) — tiny `?host=lobehub` branch. No other edits.
+
+## Files off-limits
+
+- Anything under [src/](../../src/) in this repo except the one optional embed.html tweak.
+- [src/agent-avatar.js](../../src/agent-avatar.js) — Empathy Layer never touched.
+- LobeHub chat pipeline, message store shape, server actions — read only.
+- Tasks 01–08 deliverables — this fast-path explicitly short-circuits them.
+
+## Reporting
+
+Use the reporting template from [../drop-edit-embed/00-README.md](../drop-edit-embed/00-README.md). Additionally:
+
+- Exact fork path + commit SHA you built against.
+- Grep output identifying the chat store and layout file (paste the first few matches).
+- CSP rules before + after (if you edited `next.config.js`).
+- Screen recording or 3-frame screenshot strip: dock visible / collapsed / mobile-hidden.
+- Any `TODO(lobehub-fork)` flags for things that didn't match the expected shape.
diff --git a/prompts/lobehub-embed/AUDIT.md b/prompts/lobehub-embed/AUDIT.md
new file mode 100644
index 000000000..55c80bff0
--- /dev/null
+++ b/prompts/lobehub-embed/AUDIT.md
@@ -0,0 +1,162 @@
+# LobeHub-embed audit — findings against the current codebase
+
+Read this before dispatching any of the 01–08 tasks. Everything below is a factual delta between the tasks as written and what actually exists in the repo today (and in the broader workflow). Nothing here fixes the tasks — it tells the doing-agent what to correct inline.
+
+Commit reference at audit time: `main` HEAD.
+
+## Summary
+
+The 8 existing tasks are well-structured but carry six categories of drift: **stale repo path**, **missing "which fork" config**, **broken internal numbering**, **uneven ordering** (06/07/08 depend on each other and aren't obvious), **a missing fast-path** (now added — [00-fork-sidebar-fastpath.md](./00-fork-sidebar-fastpath.md)), and **deferred `lobehub-spec` unknowns** that should be resolved before the stack runs. Tasks 01–05 are internally consistent; 06–08 are a second sub-stack that should be marked as such.
+
+## Findings
+
+### 1. Stale repo path (01–05)
+
+Tasks 01–05 state `Repo: /workspaces/3D`. That path was from a GitHub Codespaces config that's no longer canonical — the working path on local dev machines and this harness is `/home/user/3D-Agent` or wherever the clone lives.
+
+**Impact:** low. Any agent will clone to its own path and ignore this. But it's a trust signal — if one fact is stale, others might be too.
+
+**Fix (for the doing-agent):** ignore `/workspaces/3D`; use the actual working directory. Do not "correct" the prompts as part of an implementation task — that's a docs-only PR.
+
+### 2. "The user's LobeHub fork" is undefined
+
+Every task references "the user's LobeHub fork" (01, 02, 03, 04, 05) but never points at it: repo URL, branch, version pin, whether it's on disk.
+
+**Impact:** high. Tasks 02, 04, 07, 08 require the fork to test against. Without it, they fall back to a mock.
+
+**Fix:** before starting any of 01–08, capture these three facts in the PR description:
+
+```
+LobeHub fork: <url>
+Branch: <branch>
+Checked out at: <local path>
+LobeHub version: <pnpm ls lobe-chat or package.json version>
+```
+
+If the fork is unavailable, note explicitly that the `mock-host.html` fallback from task 05 is being used — and flag that smoke results are therefore partial.
+
+### 3. Task numbering collision (06, 07, 08)
+
+Files in the folder are `06-host-sdk-package.md`, `07-message-renderer.md`, `08-mention-autocomplete.md`. Their in-file headers say `Task 01`, `Task 03`, `Task 04` respectively. They were clearly authored as a separate 01–04 series ("host SDK sub-stack") and copied in without renumbering.
+
+Evidence:
+- [06-host-sdk-package.md:1](./06-host-sdk-package.md) → `# Task 01 — @3dagent/embed host SDK package`
+- [07-message-renderer.md:1](./07-message-renderer.md) → `# Task 03 — In-chat message renderer`
+- [08-mention-autocomplete.md:1](./08-mention-autocomplete.md) → `# Task 04 — @ autocomplete for agents`
+
+**Impact:** medium. An agent dispatched "task 01" may open the wrong file. "Depends on task 03" inside 08 means "depends on 07."
+
+**Fix:** rename internal headers to match filenames, OR re-scope the two sub-stacks explicitly. See **finding 5** below for the recommended resolution.
+
+### 4. Task 07 references a non-existent task ("from task 01")
+
+[07-message-renderer.md](./07-message-renderer.md) says `Depends on: Task 01 (SDK) shipped or pinned via git URL.` But task 01 in this folder is `01-plugin-manifest.md`, not an SDK task.
+
+The intended dependency is **task 06** (`@3dagent/embed` SDK package, labeled "Task 01" inside its own file).
+
+**Impact:** medium. Confusing. An agent reading 07 will pick up 01 and get misled.
+
+**Fix:** in a docs PR, rewrite the dependency line to `Depends on: 06-host-sdk-package.md (@3dagent/embed SDK)`. Do not fix during an implementation task.
+
+### 5. Two sub-stacks mixed in one folder
+
+Looking at the files end-to-end, there are actually **two separate deliverables** smashed into this folder:
+
+- **Plugin stack (01–05)** — ship a LobeHub marketplace plugin. Iframe-in-chat-bubble. `postMessage` handshake. Marketplace PR.
+- **Host SDK + mention stack (06–08)** — ship `@3dagent/embed` npm package, a React renderer for `@mentions` in chat messages, and the `@`-autocomplete. This is adjacent work that lives in the fork, not in the marketplace plugin.
+
+They overlap (both iframe our embed, both use `postMessage`) but they ship to different consumers: the plugin ships to LobeHub's marketplace; the SDK ships to npm + is consumed by the fork itself.
+
+**Impact:** medium. Running 01–05 gives you a plugin. Running 06–08 gives you a fork mod. Running both gives you plugin-plus-fork-mod. The README orders them as a single 01–08 sequence which implies they compose linearly. They don't.
+
+**Fix (recommended):** split into two series. Either:
+
+- (a) Move 06–08 to a new folder `prompts/lobehub-fork-mods/`, or
+- (b) Keep the folder but re-letter 06–08 as `A-host-sdk-package.md`, `B-message-renderer.md`, `C-mention-autocomplete.md` so the filename alphabetics signal "separate sub-stack." Keep their existing "Task 01/03/04" internal headers after renaming the file series.
+
+Option (a) is cleaner. Blocked on user preference — flag in the reporting block.
+
+### 6. Unresolved `TODO(lobehub-spec)` flags
+
+Tasks 01, 02, 03, 05 are peppered with `TODO(lobehub-spec): confirm against https://lobehub.com/docs/usage/plugins/development` for plugin format, user-context envelope, submission format, etc.
+
+**Impact:** high. Whole tasks can't complete without these resolved. Running task 01 without confirmed plugin format produces a manifest that may fail to load in LobeHub.
+
+**Fix:** add a new **task 00a — resolve LobeHub spec unknowns** before the 01–05 sequence runs. Its deliverable is a single markdown answer sheet (committed to this folder as `SPEC-NOTES.md`) enumerating every `TODO(lobehub-spec)` flag and its resolution, sourced from the live docs. Each doing-agent for 01–05 reads `SPEC-NOTES.md` first.
+
+This task is **not** created in this audit — it's on the user's todo list to dispatch before plugin work starts. Consider it a blocking dependency for 01.
+
+### 7. Task 02 assumes an old embed.html structure
+
+[02-iframe-handshake.md](./02-iframe-handshake.md) says the embed.html "already... listens for `{ __agent, type: 'action', action }` messages and relays them to agent-protocol." Verified via reading [public/agent/embed.html](../../public/agent/embed.html) — **true**. Structure matches.
+
+**Impact:** none. No action.
+
+### 8. Task 06 references `vite.lib.config.js` which doesn't exist
+
+[06-host-sdk-package.md:19](./06-host-sdk-package.md) says `vite.lib.config.js if it exists, or whatever npm run build:lib uses`. The actual config is a single `vite.config.js` that switches via `TARGET=lib` env var. See [vite.config.js:118-134](../../vite.config.js).
+
+**Impact:** low. The task includes the "or whatever" escape hatch, so an agent will find the right file.
+
+**Fix:** update the line to reference `vite.config.js`'s `libConfig` branch directly. Docs-only.
+
+### 9. No fast-path for "just put an avatar in my fork's sidebar"
+
+The most natural user ask — "I have a fork, I want an avatar in the sidebar, right now" — has no task that ships that by itself. Each of 01–08 is part of a larger plan.
+
+**Impact:** high. This is the demo that sells the feature.
+
+**Fix:** [00-fork-sidebar-fastpath.md](./00-fork-sidebar-fastpath.md) now exists, created alongside this audit. Dispatch that FIRST; then decide whether to continue into 01–05 (plugin) or 06–08 (mentions) or both.
+
+### 10. Empathy Layer discipline is correctly enforced
+
+Every task that touches the embed restates the rule "do not flatten the Empathy Layer" — 02, 03, 04, 05. That rule is the product's actual moat and the prompts correctly protect it. **Keep doing this.**
+
+**Impact:** positive. No action needed beyond reinforcement.
+
+### 11. `prompts/claude-lobehub/` is empty except for a README
+
+Sibling folder has only `00-README.md` and no task files. That's fine if the claude-artifact path is being handled elsewhere, but worth noting so an agent looking for a full claude-lobehub stack doesn't think they're missing files.
+
+**Impact:** none. No action here.
+
+## Recommended dispatch order after this audit
+
+```
+00-fork-sidebar-fastpath.md ← ships the sidebar demo TODAY
+ (lives in fork; no marketplace plumbing)
+
+ --- (decide: ship as plugin too?) ---
+
+00a-spec-notes.md ← new task: resolve TODO(lobehub-spec) flags
+ (you dispatch this; audit doesn't author it)
+01-plugin-manifest.md ← marketplace plugin begins here
+02-iframe-handshake.md
+03-host-auth-handoff.md
+04-action-passthrough.md
+05-plugin-submission.md
+
+ --- (parallel: ship the host SDK + @mention UX) ---
+
+06-host-sdk-package.md ← @3dagent/embed npm package
+07-message-renderer.md ← inline agent mentions in chat messages
+08-mention-autocomplete.md ← @ trigger menu
+```
+
+## What an agent doing any 01–08 task should verify first
+
+1. LobeHub fork is accessible and checked out — capture url/branch/version.
+2. `SPEC-NOTES.md` exists or all `TODO(lobehub-spec)` flags in the task are acceptable-to-leave as-is (ask if unsure).
+3. The sibling task's "Files off-limits" list.
+4. The repo-path mismatch (`/workspaces/3D` → actual) is ignored, not corrected inline.
+5. If your task sits in the 06–08 sub-stack, read [06-host-sdk-package.md](./06-host-sdk-package.md) even if you're doing 07 or 08 — they share an SDK surface.
+
+## What's NOT in scope for this audit
+
+- Rewriting any of the 01–08 tasks to fix these findings. Each fix is its own trivial docs PR.
+- Sourcing LobeHub's plugin spec from the live docs — that's the `SPEC-NOTES.md` task.
+- Creating the missing `SPEC-NOTES.md` task. Flagged as a blocker for the user to dispatch.
+
+---
+
+Last reviewed against repo HEAD at the time of authoring. Re-audit recommended after any of 01–08 ships or after the LobeHub fork version changes materially.
diff --git a/prompts/lobehub-embed/README.md b/prompts/lobehub-embed/README.md
index 3a70ef2e6..e361903bd 100644
--- a/prompts/lobehub-embed/README.md
+++ b/prompts/lobehub-embed/README.md
@@ -2,27 +2,35 @@
Priority 5 in the [top-level stack](../README.md). One of two parallel host-integration series; the other is [claude-artifact/](../claude-artifact/).
-## Why this series matters
+> **Before dispatching any 01–08 task, read [AUDIT.md](./AUDIT.md).** It flags stale paths, confusing numbering, two sub-stacks mixed in one folder, and spec unknowns that block plugin work.
-LobeHub is the **primary** integration target for embodied-agent rendering inside a host chat. When a LobeHub chat talks to a 3D Agent, the agent should render **embodied** — a 3D avatar driven by the [Empathy Layer](../../src/agent-avatar.js) — inside the chat UI, not as invisible JSON.
+## Two parallel deliverables in this folder
+
+| Deliverable | Ships to | Tasks |
+|---|---|---|
+| **Fast path** — mount the avatar in your own LobeHub fork's right sidebar | your fork only, not public | [00-fork-sidebar-fastpath.md](./00-fork-sidebar-fastpath.md) |
+| **Plugin stack** — marketplace plugin so anyone's LobeHub can install | LobeHub plugin marketplace | [01](./01-plugin-manifest.md) → [05](./05-plugin-submission.md) |
+| **Host SDK + mention UX** — `@3dagent/embed` npm package + inline `@mentions` + autocomplete | npm + your fork | [06](./06-host-sdk-package.md) → [08](./08-mention-autocomplete.md) |
-The user has a LobeHub fork. We are building a first-class plugin that:
+Dispatch **task 00 first** — it ships the demo today. Then pick plugin, SDK, or both.
-1. Declares a LobeHub plugin manifest pointing at our hosted [public/agent/embed.html](../../public/agent/embed.html).
-2. Handshakes with the LobeHub chat host via `postMessage`.
-3. Passes the chat model's tool calls and messages **into** our [agent-protocol](../../src/agent-protocol.js) so the avatar speaks, gestures, and reacts emotionally in real time.
-4. Passes signed agent actions **back out** to LobeHub so the chat history records what the avatar did.
-5. Ships to the LobeHub plugin marketplace.
+## Why this series matters
+
+LobeHub is the **primary** integration target for embodied-agent rendering inside a host chat. When a LobeHub chat talks to a 3D Agent, the agent should render **embodied** — a 3D avatar driven by the [Empathy Layer](../../src/agent-avatar.js) — inside the chat UI, not as invisible JSON.
-## Tasks — execute in order
+## Task index
-| # | File | Ships |
-|---|---|---|
-| 01 | [01-plugin-manifest.md](./01-plugin-manifest.md) | LobeHub plugin JSON manifest; hosted at a public URL; declares iframe + API surface |
-| 02 | [02-iframe-handshake.md](./02-iframe-handshake.md) | `postMessage` protocol between host and embed: init, agent-id resolution, action relay, resize, errors |
-| 03 | [03-host-auth-handoff.md](./03-host-auth-handoff.md) | Identify LobeHub viewer; optional wallet link via SIWE; graceful anon path |
-| 04 | [04-action-passthrough.md](./04-action-passthrough.md) | Chat → protocol relay (speak, gesture, emote); avatar-signed actions → chat |
-| 05 | [05-plugin-submission.md](./05-plugin-submission.md) | Package, local-test against LobeHub dev instance, marketplace submission PR |
+| # | File | What it ships | Blocks on |
+|---|---|---|---|
+| 00 | [00-fork-sidebar-fastpath.md](./00-fork-sidebar-fastpath.md) | Iframe mounted in the fork's right sidebar; persistent; reacts to chat stream | nothing |
+| 01 | [01-plugin-manifest.md](./01-plugin-manifest.md) | `.well-known/lobehub-plugin.json` manifest hosted publicly | resolving `TODO(lobehub-spec)` flags (see AUDIT.md §6) |
+| 02 | [02-iframe-handshake.md](./02-iframe-handshake.md) | Versioned `postMessage` bridge module `src/embed-host-bridge.js` | 01 |
+| 03 | [03-host-auth-handoff.md](./03-host-auth-handoff.md) | Anon / host-user / wallet-linked identity tiers with opt-in SIWE prompt | 02 |
+| 04 | [04-action-passthrough.md](./04-action-passthrough.md) | Bidirectional chat-tool ↔ protocol relay `src/embed-action-relay.js` | 02, 03 |
+| 05 | [05-plugin-submission.md](./05-plugin-submission.md) | Marketplace submission bundle + smoke test fixtures | 01–04 |
+| 06 | [06-host-sdk-package.md](./06-host-sdk-package.md) | `@3dagent/embed` npm package (`packages/embed/`) | nothing (can parallel 01–05) |
+| 07 | [07-message-renderer.md](./07-message-renderer.md) | Inline `<AgentMention>` React component for @-tokens in chat | 06 |
+| 08 | [08-mention-autocomplete.md](./08-mention-autocomplete.md) | `@`-trigger suggest menu + `GET /api/agents/suggest` endpoint | 07 |
## Rules that apply to every task in this series
@@ -31,7 +39,7 @@ The user has a LobeHub fork. We are building a first-class plugin that:
- No new runtime dependencies unless the task file explicitly allows them.
- No new docs files (README.md, CLAUDE.md) unless the task says so.
- `node --check` every modified JS file.
-- `npx vite build` and report result. Pre-existing `@avaturn/sdk` warning is unrelated — ignore.
+- `npm run verify` (prettier + vite build) and report result. Pre-existing `@avaturn/sdk` warning is unrelated — ignore.
- The [Empathy Layer](../../src/agent-avatar.js) is the novel selling point. **Every task must protect its behavior.** Do not disable, bypass, or flatten emotion blending for "embed mode". The embed context is where it shines.
- `.well-known/agent-card.json` is an A2A card; LobeHub may or may not natively consume it. Treat as auxiliary, not primary.
- [ERC-8004 identity](../../src/erc8004/) is wired but **must be optional** for the embed to work. Anon LobeHub users should get a functional avatar.