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.

feat: Meta-Allocator + Clip Director pages, Phase 3 creation-consolidation handoffs

nirholasf56dd61774d5
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 62cd8fdb9..a88f0f2d0 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -115,6 +115,8 @@ bottom.
| Vanity address grinder (Rust → WASM) | [crates/vanity-grinder/](crates/vanity-grinder) → compiled to [src/solana/vanity/wasm/](src/solana/vanity/wasm); consumed by [src/agent-vanity-grinder.js](src/agent-vanity-grinder.js), [src/agent-eth-vanity-card.js](src/agent-eth-vanity-card.js) | In-repo | The Rust source behind in-browser Solana/EVM vanity-address mining. Compiled to WebAssembly so grinding runs on the visitor's machine, never the server. Surfaced as the `vanity_grinder` MCP tool and the premium pre-ground inventory (`vanity_premium`). |
| x402 payment modal (drop-in UI) | [x402-payment-modal/](x402-payment-modal) | Published as `@three-ws/x402-payment-modal` | A drop-in payment modal for any x402 paid endpoint — one ES import turns a 402 challenge into a wallet-connect + pay flow. Has a build step, so it sits outside the zero-dependency `packages/*` SDK family. |
| x402 modal SDK | [x402-modal-sdk/](x402-modal-sdk) | Published as `@three-ws/x402-modal` | The lower-level modal SDK the payment modal builds on. Ships a bundled `dist/`; see [x402-modal-sdk/TUTORIAL.md](x402-modal-sdk/TUTORIAL.md). |
+| Meta-Allocator (the ETF of degens) | [pages/meta-allocator.html](pages/meta-allocator.html) + [src/meta-allocator.js](src/meta-allocator.js) `→ /meta-allocator`, brain [api/_lib/meta-allocator.js](api/_lib/meta-allocator.js), endpoint [api/meta-allocator.js](api/meta-allocator.js) | Live (non-custodial planning) | Spreads a budget across the top verified pump.fun leader agents, ranked by risk-adjusted on-chain track record (win rate, realized ROI, peak-to-trough max drawdown from `agent_sniper_positions`) and diversified across derived correlation groups, then returns a rebalance rule. Free-first `llmComplete` shaping with a deterministic same-shape fallback so it never fails. Returns a plan (weights + suggested sizes), never a transaction; users act one leader at a time via [/vaults](pages/vaults.html). Doc: [docs/meta-allocator.md](docs/meta-allocator.md). |
+| Clip Director (content engine) | [pages/clip-director.html](pages/clip-director.html) + [src/clip-director-page.js](src/clip-director-page.js) `→ /clip-director`, brain [api/_lib/clip-director.js](api/_lib/clip-director.js), endpoint [api/clip-director.js](api/clip-director.js) | Live | Turns one real closed trade (`agent_sniper_positions`) into the optimal shareable card per surface (X / Telegram / Feed): honest hook, the real number, an avatar gesture mapped to a real animation clip, CTA, and alt text, plus an on-chain proof link. Losses get an honest card too. Free-first `llmComplete` with a deterministic same-shape fallback. Doc: [docs/clip-director.md](docs/clip-director.md). |
## npm workspaces
diff --git a/api/_lib/clip-director.js b/api/_lib/clip-director.js
new file mode 100644
index 000000000..4c6ddbf2b
--- /dev/null
+++ b/api/_lib/clip-director.js
@@ -0,0 +1,203 @@
+// Clip Director, the content engine (pumpfun-trading-wedge §2.2 / §4.4).
+// ---------------------------------------------------------------------------
+// "We're a media company that happens to trade." Every notable close emits a
+// piece of content: a ticker, a multiple, an avatar reaction, and a REASON. This
+// module turns ONE real closed trade into the optimal shareable artifact per
+// surface (X / Telegram / in-app Feed), the acquisition channel, not a nicety.
+//
+// It never invents a number: every stat traces to the closed round-trip it was
+// handed. Losses get an honest card too (downside-transparency is the brand),
+// never hidden. The LLM (free-first llmComplete chain) writes the copy; a
+// deterministic director produces the same-shaped artifact when no provider is
+// available, so the engine never fails.
+//
+// The avatar_gesture resolves to a REAL animation clip in the manifest so the
+// arena / trader avatar can actually perform the reaction, not just label it.
+
+import { llmComplete, llmConfigured, LlmUnavailableError } from './llm.js';
+import { extractJson } from './bounty-judge.js';
+
+export const SURFACES = new Set(['x', 'telegram', 'feed']);
+
+// §4.4 gesture vocabulary -> a real playable clip in public/animations/manifest.json.
+// "sweat" has no dedicated clip; the honest loss reaction is `defeated`.
+const GESTURE_CLIP = {
+ celebrate: 'celebrate',
+ point: 'point',
+ wave: 'wave',
+ shrug: 'shrug',
+ sweat: 'defeated',
+};
+const GESTURES = Object.keys(GESTURE_CLIP);
+
+const round2 = (x) => Math.round(x * 100) / 100;
+
+const SYSTEM_PROMPT = `You turn ONE closed trade into the optimal shareable artifact for one surface. You are a content director, not a trader. Truthful, human, no hype, no price predictions.
+
+Output STRICT JSON only, no prose, no code fence:
+{ "hook": "<=80 chars, the scroll-stopping first line, true",
+ "feature_stat": "the single most compelling REAL number to headline",
+ "avatar_gesture": "celebrate|shrug|sweat|point|wave",
+ "body": "1-2 lines: what happened + why, plain language",
+ "cta": "fork-this-trade|copy-the-agent|view-track-record",
+ "alt_text": "accessibility description of the card" }
+
+Rules: feature the real number. If the trade was a LOSS, still produce an honest card (brand = transparency) with a 'live to trade again' tone. Tune length/voice to the surface (X punchier, Telegram chattier, Feed mid). Reference no token other than the traded one or $THREE. Always keep a verifiable angle (the record is on-chain). Never invent numbers not present in the input.`;
+
+// Build the compact, real trade view the director reasons over. Accepts a raw
+// agent_sniper_positions row (or an equivalent object) and derives only from
+// present fields, hold time, multiple, realized P&L, never fabricating mcap.
+export function tradeFromPosition(pos) {
+ const LAMPORTS = 1e9;
+ const lam = (v) => (v == null ? null : Number(v) / LAMPORTS);
+ const entrySol = lam(pos.entry_quote_lamports);
+ const exitSol = lam(pos.exit_quote_lamports);
+ const pnlSol = lam(pos.realized_pnl_lamports);
+ const multiple = entrySol && exitSol != null && entrySol > 0 ? round2(exitSol / entrySol) : null;
+ const pnlPct = pos.realized_pnl_pct != null ? round2(Number(pos.realized_pnl_pct)) : null;
+ let holdMin = null;
+ if (pos.opened_at && pos.closed_at) {
+ holdMin = Math.max(0, Math.round((new Date(pos.closed_at) - new Date(pos.opened_at)) / 60000));
+ }
+ return {
+ mint: pos.mint,
+ symbol: pos.symbol || null,
+ name: pos.name || null,
+ multiple,
+ pnl_pct: pnlPct,
+ entry_sol: entrySol == null ? null : round2(entrySol),
+ exit_sol: exitSol == null ? null : round2(exitSol),
+ realized_pnl_sol: pnlSol == null ? null : round2(pnlSol),
+ hold_min: holdMin,
+ exit_reason: pos.exit_reason || null,
+ quote_symbol: 'SOL',
+ is_win: pnlSol != null ? pnlSol >= 0 : (pnlPct != null ? pnlPct >= 0 : null),
+ sell_sig: pos.sell_sig || null,
+ };
+}
+
+export async function directClip({ agentName, avatarStyle = null, trade, copiedByCount = 0, surface = 'feed', userId = null } = {}) {
+ const surf = SURFACES.has(surface) ? surface : 'feed';
+ let artifact = null;
+ let source = 'deterministic';
+
+ if (llmConfigured()) {
+ try {
+ artifact = await llmClip({ agentName, avatarStyle, trade, copiedByCount, surface: surf, userId });
+ if (artifact) source = 'llm';
+ } catch (err) {
+ if (!(err instanceof LlmUnavailableError)) artifact = null;
+ }
+ }
+ if (!artifact) artifact = deterministicClip({ agentName, trade, copiedByCount, surface: surf });
+
+ return finalize({ artifact, source, trade, surface: surf });
+}
+
+async function llmClip({ agentName, avatarStyle, trade, copiedByCount, surface, userId }) {
+ const input = {
+ agent_name: agentName || 'the agent',
+ avatar_style: avatarStyle || 'default',
+ trade: {
+ symbol: trade.symbol || trade.name || trade.mint?.slice(0, 6),
+ multiple: trade.multiple,
+ pnl_pct: trade.pnl_pct,
+ entry_sol: trade.entry_sol,
+ exit_sol: trade.exit_sol,
+ hold_min: trade.hold_min,
+ exit_reason: trade.exit_reason,
+ realized_pnl_quote: trade.realized_pnl_sol,
+ quote_symbol: trade.quote_symbol,
+ is_win: trade.is_win,
+ },
+ copied_by_count: copiedByCount,
+ surface,
+ };
+ const out = await llmComplete({
+ system: SYSTEM_PROMPT,
+ user: JSON.stringify(input),
+ maxTokens: 600,
+ timeoutMs: 25_000,
+ track: userId ? { userId, tool: 'clip-director' } : null,
+ });
+ const parsed = extractJson(out?.text);
+ if (!parsed || typeof parsed.hook !== 'string') return null;
+ return parsed;
+}
+
+// Deterministic director, honest, surface-tuned copy from the real numbers.
+function deterministicClip({ agentName, trade, copiedByCount, surface }) {
+ const sym = trade.symbol || trade.name || (trade.mint ? `$${trade.mint.slice(0, 4).toUpperCase()}` : 'the coin');
+ const ticker = sym.startsWith('$') ? sym : `$${sym}`;
+ const win = trade.is_win !== false;
+ const mult = trade.multiple != null ? `${trade.multiple}x` : null;
+ const pnl = trade.realized_pnl_sol != null ? `${trade.realized_pnl_sol > 0 ? '+' : ''}${trade.realized_pnl_sol} SOL` : null;
+ const hold = trade.hold_min != null ? holdLabel(trade.hold_min) : null;
+ const featureStat = mult || pnl || (trade.pnl_pct != null ? `${trade.pnl_pct}%` : 'closed on-chain');
+
+ let hook;
+ let body;
+ let gesture;
+ if (win) {
+ gesture = trade.multiple != null && trade.multiple >= 2 ? 'celebrate' : 'point';
+ hook = surface === 'x'
+ ? `${ticker} closed ${featureStat}${hold ? ` in ${hold}` : ''}. On-chain, no screenshots.`
+ : `${agentName || 'The agent'} closed ${ticker} for ${featureStat}${hold ? ` after ${hold}` : ''}.`;
+ body = `${trimReason(trade.exit_reason)} Every number is a real closed round-trip you can verify on-chain.`;
+ } else {
+ gesture = 'sweat';
+ hook = surface === 'x'
+ ? `${ticker} stopped out ${pnl || featureStat}. We show the losers too.`
+ : `${agentName || 'The agent'} took a loss on ${ticker}: ${pnl || featureStat}. Shown, not hidden.`;
+ body = `${trimReason(trade.exit_reason)} Live to trade again. Every trade is on the record, wins and losses.`;
+ }
+ if (copiedByCount > 0) body += ` Copied by ${copiedByCount}.`;
+
+ return {
+ hook,
+ feature_stat: featureStat,
+ avatar_gesture: gesture,
+ body: surface === 'telegram' ? `${body} Fork it from the room and ride the next one.` : body,
+ cta: win ? 'copy-the-agent' : 'view-track-record',
+ alt_text: `${agentName || 'A three.ws agent'} ${win ? 'closed a winning' : 'closed a losing'} trade on ${ticker}: ${featureStat}${hold ? `, held ${hold}` : ''}. Verifiable on-chain.`,
+ };
+}
+
+function holdLabel(min) {
+ if (min < 60) return `${min}m`;
+ if (min < 1440) return `${Math.round(min / 60)}h`;
+ return `${Math.round(min / 1440)}d`;
+}
+function trimReason(reason) {
+ const map = {
+ take_profit: 'Took profit at target.',
+ stop_loss: 'Stopped out at the risk line.',
+ trailing_stop: 'Trailing stop locked the gain.',
+ timeout: 'Closed on the time exit.',
+ manual: 'Closed the position by hand.',
+ graduated: 'Rode it through graduation.',
+ kill_switch: 'Kill-switch closed it.',
+ error: 'Closed after an execution hiccup.',
+ };
+ return map[reason] || 'Position closed.';
+}
+
+const VALID_CTA = new Set(['fork-this-trade', 'copy-the-agent', 'view-track-record']);
+
+function finalize({ artifact, source, trade, surface }) {
+ const gesture = GESTURES.includes(artifact.avatar_gesture) ? artifact.avatar_gesture : (trade.is_win === false ? 'sweat' : 'celebrate');
+ const cta = VALID_CTA.has(artifact.cta) ? artifact.cta : (trade.is_win === false ? 'view-track-record' : 'copy-the-agent');
+ return {
+ source,
+ surface,
+ hook: String(artifact.hook || '').slice(0, 120).trim(),
+ feature_stat: String(artifact.feature_stat || '').slice(0, 60).trim(),
+ avatar_gesture: gesture,
+ gesture_clip: GESTURE_CLIP[gesture],
+ body: String(artifact.body || '').slice(0, 320).trim(),
+ cta,
+ alt_text: String(artifact.alt_text || '').slice(0, 300).trim(),
+ verifiable: true,
+ trade,
+ };
+}
diff --git a/api/_lib/meta-allocator.js b/api/_lib/meta-allocator.js
new file mode 100644
index 000000000..076fd0334
--- /dev/null
+++ b/api/_lib/meta-allocator.js
@@ -0,0 +1,419 @@
+// Meta-Allocator, the "ETF of degens" brain (pumpfun-trading-wedge §3.3 / §4.2).
+// ---------------------------------------------------------------------------
+// A first-class agent type whose entire strategy is to ALLOCATE a fixed budget
+// across the top verified leader agents and rebalance, it never picks tokens,
+// only leaders. The leaderboard becomes an input to a strategy, so the system
+// compounds on itself (better leaders -> better meta-agents -> more copy demand).
+//
+// It is the diversified on-ramp for the cautious: "just make me money" as a
+// spread of verified track records instead of one bet. This module is the
+// planning brain only. It is fully NON-CUSTODIAL, it emits an allocation PLAN
+// (weights + suggested sizes + a plain-English rebalance rule), never a signed
+// transaction, never delegated custody. Executing the plan is the copy-engine's
+// existing per-leader subscribe flow, one confirmed action at a time.
+//
+// Every leader stat traces to a real on-chain fill (agent_sniper_positions
+// closed round-trips), the same honest source the mirror leaderboard ranks on.
+// The LLM (free-first llmComplete chain) shapes the narrative and the diversified
+// pick; when no provider is available the deterministic allocator below produces
+// the same-shaped plan so the endpoint never fails.
+
+import { sql } from './db.js';
+import { llmComplete, llmConfigured, LlmUnavailableError } from './llm.js';
+import { extractJson } from './bounty-judge.js';
+
+const LAMPORTS = 1e9;
+const lamToSol = (l) => (l == null ? 0 : Number(BigInt(Math.trunc(Number(l)))) / LAMPORTS);
+const round2 = (x) => Math.round(x * 100) / 100;
+const round4 = (x) => Math.round(x * 1e4) / 1e4;
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+
+export const RISK_PROFILES = new Set(['conservative', 'balanced', 'degen']);
+
+// Per-profile guardrails the deterministic allocator (and the model, via the
+// prompt) respects. Conservative = fewer, steadier leaders, hard drawdown cap
+// and a low single-leader weight ceiling; degen = wider, spicier basket.
+const PROFILE_RULES = {
+ conservative: { maxLeaders: 4, maxWeightPct: 35, maxDrawdownPct: 40, minSettled: 5 },
+ balanced: { maxLeaders: 6, maxWeightPct: 45, maxDrawdownPct: 70, minSettled: 3 },
+ degen: { maxLeaders: 8, maxWeightPct: 60, maxDrawdownPct: 100, minSettled: 1 },
+};
+
+// ---------------------------------------------------------------------------
+// Data, pull the verified leader universe in a single windowed query.
+// max_drawdown is computed on the cumulative realized-P&L equity curve
+// (peak-to-trough), the same definition mirror-stats.js uses per-leader, so the
+// number a copier sees on a Trader Card matches the one the allocator ranks on.
+// ---------------------------------------------------------------------------
+export async function gatherLeaders(network = 'mainnet', { limit = 200 } = {}) {
+ const rows = await sql`
+ with closed as (
+ select agent_id, closed_at, realized_pnl_lamports, realized_pnl_pct, entry_quote_lamports,
+ sum(realized_pnl_lamports) over (
+ partition by agent_id order by closed_at
+ rows between unbounded preceding and current row) as cum_pnl
+ from agent_sniper_positions
+ where network = ${network} and status = 'closed' and closed_at is not null
+ ),
+ curve as (
+ select agent_id, cum_pnl,
+ max(cum_pnl) over (
+ partition by agent_id order by closed_at
+ rows between unbounded preceding and current row) as peak
+ from closed
+ ),
+ dd as (
+ select agent_id, max(peak - cum_pnl) as max_dd_lamports from curve group by agent_id
+ ),
+ agg as (
+ select agent_id,
+ count(*)::int as settled,
+ count(*) filter (where realized_pnl_lamports > 0)::int as wins,
+ coalesce(sum(realized_pnl_lamports), 0)::text as pnl_lamports,
+ coalesce(sum(entry_quote_lamports), 0)::text as entry_lamports,
+ coalesce(avg(entry_quote_lamports), 0)::text as avg_entry_lamports,
+ max(realized_pnl_pct) as best_pct,
+ min(realized_pnl_pct) as worst_pct,
+ max(closed_at) as last_closed_at
+ from closed group by agent_id
+ ),
+ followers as (
+ select leader_agent_id as agent_id,
+ count(*)::int as followers,
+ count(*) filter (where enabled)::int as active_followers
+ from agent_mirror_follows where network = ${network} group by leader_agent_id
+ )
+ select a.id, a.name, a.avatar_url, a.profile_image_url,
+ g.settled, g.wins, g.pnl_lamports, g.entry_lamports, g.avg_entry_lamports,
+ g.best_pct, g.worst_pct, g.last_closed_at,
+ coalesce(dd.max_dd_lamports, 0)::text as max_dd_lamports,
+ coalesce(f.followers, 0) as followers,
+ coalesce(f.active_followers, 0) as active_followers
+ from agent_identities a
+ join agg g on g.agent_id = a.id
+ left join dd on dd.agent_id = a.id
+ left join followers f on f.agent_id = a.id
+ where a.deleted_at is null and a.is_public <> false and g.settled >= 1
+ order by g.settled desc
+ limit ${Math.min(500, Math.max(1, limit))}
+ `.catch(() => []);
+
+ return rows.map((r) => {
+ const settled = Number(r.settled || 0);
+ const wins = Number(r.wins || 0);
+ const pnlSol = lamToSol(r.pnl_lamports);
+ const grossEntrySol = lamToSol(r.entry_lamports);
+ const avgEntrySol = lamToSol(r.avg_entry_lamports);
+ const maxDdSol = lamToSol(r.max_dd_lamports);
+ const winRate = settled > 0 ? (wins / settled) * 100 : null;
+ const roiPct = grossEntrySol > 0 ? (pnlSol / grossEntrySol) * 100 : null;
+ // Drawdown as a share of capital actually deployed, comparable across
+ // leaders of different size.
+ const maxDrawdownPct = grossEntrySol > 0 ? clamp((maxDdSol / grossEntrySol) * 100, 0, 100) : null;
+ const followers = Number(r.followers || 0);
+
+ // Risk-adjusted score: reward realized ROI and win-rate edge, weighted by
+ // sample size so a 1-trade fluke can't top a consistent trader, then
+ // penalize drawdown. NOT raw P&L (a whale's big number shouldn't outrank a
+ // steadier, more copyable record). Bounded, deterministic, explainable.
+ const sample = Math.min(1, settled / 8);
+ const edge = (roiPct != null ? roiPct : 0) * 0.5 + (winRate != null ? (winRate - 50) : 0);
+ const ddPenalty = maxDrawdownPct != null ? maxDrawdownPct * 0.4 : 0;
+ const trust = Math.min(15, followers * 1.5);
+ const riskAdjusted = round2(edge * sample - ddPenalty + trust);
+
+ return {
+ agent_id: r.id,
+ name: r.name || 'Unnamed trader',
+ avatar: r.avatar_url || r.profile_image_url || null,
+ settled, wins,
+ win_rate_pct: winRate == null ? null : round2(winRate),
+ roi_pct: roiPct == null ? null : round2(roiPct),
+ pnl_sol: round4(pnlSol),
+ max_drawdown_pct: maxDrawdownPct == null ? null : round2(maxDrawdownPct),
+ best_pct: r.best_pct == null ? null : round2(Number(r.best_pct)),
+ worst_pct: r.worst_pct == null ? null : round2(Number(r.worst_pct)),
+ // Capacity proxy: the size this leader actually trades. Allocating much
+ // more than this would move their fills, so the plan respects it.
+ capacity_quote: round4(avgEntrySol) || null,
+ // Real follower-outcome P&L requires a populated copy-execution ledger;
+ // when absent it is null and the allocator weights on risk-adjusted score
+ // (never fabricated). Exposed so a future copy-outcome rollup can fill it.
+ follower_outcome_pnl: null,
+ followers, active_followers: Number(r.active_followers || 0),
+ correlation_group: correlationGroup({ winRate, roiPct, maxDrawdownPct, bestPct: r.best_pct }),
+ risk_adjusted_score: riskAdjusted,
+ last_closed_at: r.last_closed_at || null,
+ };
+ });
+}
+
+// Correlation group, a REAL derived style bucket from realized behavior, used
+// only to diversify the basket (never concentrate in one style). Derived from
+// the win-rate / ROI / drawdown / best-trade profile, not a random label.
+function correlationGroup({ winRate, roiPct, maxDrawdownPct, bestPct }) {
+ const best = bestPct == null ? null : Number(bestPct);
+ if (best != null && best >= 300 && (winRate == null || winRate < 50)) return 'moonshot';
+ if (winRate != null && winRate >= 62) return 'high_winrate';
+ if (roiPct != null && roiPct >= 80) return 'high_roi';
+ if (maxDrawdownPct != null && maxDrawdownPct >= 60) return 'volatile';
+ return 'steady';
+}
+
+// ---------------------------------------------------------------------------
+// The plan, LLM-shaped, with a deterministic fallback of the same shape.
+// ---------------------------------------------------------------------------
+const SYSTEM_PROMPT = `You allocate a fixed budget across VERIFIED leader agents and rebalance. You do not pick individual tokens; you pick leaders. You only use the real leaderboard data provided.
+
+Output STRICT JSON only, no prose, no code fence:
+{ "allocations": [ {"agent_id": "<id>", "weight_pct": <num>, "why": "one fact-based line"} ],
+ "excluded": [ {"agent_id": "<id>", "reason": "one line"} ],
+ "rebalance_rule": "plain-English trigger (e.g. drop a leader if 7d drawdown > X% or correlation to an existing pick is too high)",
+ "caution": "one honest risk line" }
+
+Rules: diversify across correlation_group values, never concentrate the basket in one style. Weight by follower_outcome_pnl and risk_adjusted_score, NOT raw P&L. Respect each leader's capacity_quote (do not allocate size that moves their fills). For conservative profiles cap single-leader weight and prefer low max_drawdown_pct. Default to fewer, steadier leaders when uncertain. Weights across all allocations must sum to 100. Only reference agent_id values present in the input. Never predict future performance. Reference no token other than the ones the leaders traded or $THREE.`;
+
+export async function buildAllocationPlan({
+ budgetQuote,
+ riskProfile = 'balanced',
+ leaders,
+ currentAllocations = [],
+ network = 'mainnet',
+ userId = null,
+} = {}) {
+ const profile = RISK_PROFILES.has(riskProfile) ? riskProfile : 'balanced';
+ const rules = PROFILE_RULES[profile];
+ const budget = Number(budgetQuote);
+ const budgetOk = Number.isFinite(budget) && budget > 0 ? budget : null;
+
+ // The universe the allocator is allowed to pick from, public verified leaders
+ // meeting the profile's minimum settled-trade bar.
+ const universe = (leaders || []).filter((l) => l.settled >= rules.minSettled);
+ if (!universe.length) {
+ return {
+ source: 'empty',
+ budget_quote: budgetOk,
+ quote_symbol: 'SOL',
+ risk_profile: profile,
+ allocations: [],
+ excluded: [],
+ rebalance_rule: 'No verified leaders meet this risk profile yet. Loosen the profile or wait for more on-chain track records to settle.',
+ caution: 'An allocation needs verified leaders with real closed trades. None qualify right now.',
+ leaders_considered: 0,
+ };
+ }
+
+ let plan = null;
+ let source = 'deterministic';
+ if (llmConfigured()) {
+ try {
+ plan = await llmPlan({ budget: budgetOk, profile, universe, currentAllocations, userId });
+ if (plan) source = 'llm';
+ } catch (err) {
+ if (!(err instanceof LlmUnavailableError)) {
+ // Any model error degrades to the deterministic plan, never a 500.
+ plan = null;
+ }
+ }
+ }
+ if (!plan) plan = deterministicPlan({ profile, universe });
+
+ return finalizePlan({ plan, source, universe, budget: budgetOk, profile });
+}
+
+async function llmPlan({ budget, profile, universe, currentAllocations, userId }) {
+ const input = {
+ budget_quote: budget,
+ quote_symbol: 'SOL',
+ risk_profile: profile,
+ leaders: universe.map((l) => ({
+ agent_id: l.agent_id,
+ win_rate_pct: l.win_rate_pct,
+ risk_adjusted_score: l.risk_adjusted_score,
+ max_drawdown_pct: l.max_drawdown_pct,
+ follower_outcome_pnl: l.follower_outcome_pnl,
+ capacity_quote: l.capacity_quote,
+ correlation_group: l.correlation_group,
+ settled_trades: l.settled,
+ })),
+ current_allocations: Array.isArray(currentAllocations) ? currentAllocations.slice(0, 20) : [],
+ };
+ const out = await llmComplete({
+ system: SYSTEM_PROMPT,
+ user: JSON.stringify(input),
+ maxTokens: 1200,
+ timeoutMs: 30_000,
+ track: userId ? { userId, tool: 'meta-allocator' } : null,
+ });
+ const parsed = extractJson(out?.text);
+ if (!parsed || !Array.isArray(parsed.allocations)) return null;
+ return {
+ allocations: parsed.allocations,
+ excluded: Array.isArray(parsed.excluded) ? parsed.excluded : [],
+ rebalance_rule: typeof parsed.rebalance_rule === 'string' ? parsed.rebalance_rule : null,
+ caution: typeof parsed.caution === 'string' ? parsed.caution : null,
+ };
+}
+
+// Deterministic allocator: diversify across correlation groups (one best per
+// group first, then backfill by score), weight by risk-adjusted score, honor the
+// profile's leader count + single-weight caps. Same shape as the LLM output.
+function deterministicPlan({ profile, universe }) {
+ const rules = PROFILE_RULES[profile];
+ const ranked = [...universe]
+ .filter((l) => l.max_drawdown_pct == null || l.max_drawdown_pct <= rules.maxDrawdownPct)
+ .sort((a, b) => b.risk_adjusted_score - a.risk_adjusted_score);
+
+ const picks = [];
+ const seenGroups = new Set();
+ // Pass 1: best of each correlation group for spread.
+ for (const l of ranked) {
+ if (picks.length >= rules.maxLeaders) break;
+ if (seenGroups.has(l.correlation_group)) continue;
+ seenGroups.add(l.correlation_group);
+ picks.push(l);
+ }
+ // Pass 2: backfill remaining slots by score.
+ for (const l of ranked) {
+ if (picks.length >= rules.maxLeaders) break;
+ if (picks.includes(l)) continue;
+ picks.push(l);
+ }
+
+ // Weight by a positive score floor so a marginally-negative score still gets a
+ // small, capped allocation rather than a negative weight.
+ const scored = picks.map((l) => ({ l, w: Math.max(1, l.risk_adjusted_score + 20) }));
+ const totalW = scored.reduce((s, x) => s + x.w, 0) || 1;
+ let allocations = scored.map(({ l, w }) => ({
+ agent_id: l.agent_id,
+ weight_pct: (w / totalW) * 100,
+ why: reasonLine(l),
+ }));
+ allocations = capAndRenormalize(allocations, rules.maxWeightPct);
+
+ const excludedIds = new Set(picks.map((l) => l.agent_id));
+ const excluded = universe
+ .filter((l) => !excludedIds.has(l.agent_id))
+ .slice(0, 8)
+ .map((l) => ({
+ agent_id: l.agent_id,
+ reason:
+ l.max_drawdown_pct != null && l.max_drawdown_pct > rules.maxDrawdownPct
+ ? `Max drawdown ${l.max_drawdown_pct}% exceeds the ${profile} cap of ${rules.maxDrawdownPct}%`
+ : 'Lower risk-adjusted score than the selected basket',
+ }));
+
+ return {
+ allocations,
+ excluded,
+ rebalance_rule: `Rebalance weekly. Drop any leader whose 7-day realized drawdown exceeds ${rules.maxDrawdownPct}% or whose risk-adjusted score falls below the basket median, and re-spread across correlation groups so no single style holds more than ${rules.maxWeightPct}%.`,
+ caution:
+ 'Copy-trading memecoins is high-variance. A diversified basket lowers single-leader risk but not market risk. Every leader here can still lose; size only what you can afford to lose.',
+ };
+}
+
+function reasonLine(l) {
+ const bits = [];
+ if (l.win_rate_pct != null) bits.push(`${l.win_rate_pct}% win rate`);
+ if (l.roi_pct != null) bits.push(`${l.roi_pct}% realized ROI`);
+ if (l.max_drawdown_pct != null) bits.push(`${l.max_drawdown_pct}% max drawdown`);
+ bits.push(`${l.settled} settled trades`);
+ return `${l.correlation_group} style: ${bits.join(', ')}`;
+}
+
+// Cap any single weight at maxPct and redistribute the overflow across the rest
+// proportionally, iterating until stable (all <= cap, sum = 100).
+function capAndRenormalize(allocations, maxPct) {
+ let a = allocations.map((x) => ({ ...x }));
+ for (let iter = 0; iter < 8; iter++) {
+ const total = a.reduce((s, x) => s + x.weight_pct, 0) || 1;
+ a = a.map((x) => ({ ...x, weight_pct: (x.weight_pct / total) * 100 }));
+ const over = a.filter((x) => x.weight_pct > maxPct + 0.01);
+ if (!over.length) break;
+ let overflow = 0;
+ for (const x of over) { overflow += x.weight_pct - maxPct; x.weight_pct = maxPct; }
+ const under = a.filter((x) => x.weight_pct < maxPct - 0.01);
+ const underTotal = under.reduce((s, x) => s + x.weight_pct, 0) || 1;
+ for (const x of under) x.weight_pct += overflow * (x.weight_pct / underTotal);
+ }
+ return a;
+}
+
+// Normalize whatever the model (or fallback) produced into a clean, verified
+// plan: only real agent_ids, weights summing to 100, sizes = budget * weight,
+// each row enriched with the leader's real stats for the UI.
+function finalizePlan({ plan, source, universe, budget, profile }) {
+ const byId = new Map(universe.map((l) => [l.agent_id, l]));
+ const seen = new Set();
+ let allocations = (plan.allocations || [])
+ .filter((row) => {
+ const id = String(row?.agent_id || '');
+ if (!byId.has(id) || seen.has(id)) return false;
+ seen.add(id);
+ return true;
+ })
+ .map((row) => ({
+ agent_id: row.agent_id,
+ weight_pct: Math.max(0, Number(row.weight_pct) || 0),
+ why: typeof row.why === 'string' && row.why.trim() ? row.why.trim().slice(0, 160) : reasonLine(byId.get(row.agent_id)),
+ }))
+ .filter((row) => row.weight_pct > 0);
+
+ // Renormalize to exactly 100 and enforce the profile weight cap regardless of
+ // source, so an LLM that ignores a rule still produces a compliant plan.
+ allocations = capAndRenormalize(allocations, PROFILE_RULES[profile].maxWeightPct);
+ const sum = allocations.reduce((s, x) => s + x.weight_pct, 0) || 1;
+
+ const enriched = allocations.map((row) => {
+ const l = byId.get(row.agent_id);
+ const weight = (row.weight_pct / sum) * 100;
+ return {
+ agent_id: row.agent_id,
+ name: l.name,
+ avatar: l.avatar,
+ weight_pct: round2(weight),
+ size_quote: budget != null ? round4((budget * weight) / 100) : null,
+ why: row.why,
+ correlation_group: l.correlation_group,
+ win_rate_pct: l.win_rate_pct,
+ roi_pct: l.roi_pct,
+ max_drawdown_pct: l.max_drawdown_pct,
+ settled: l.settled,
+ followers: l.followers,
+ capacity_quote: l.capacity_quote,
+ // A size beyond the leader's typical fill would move their price, flag it
+ // so the UI can warn and the user can trim.
+ over_capacity: l.capacity_quote != null && budget != null
+ ? round4((budget * weight) / 100) > l.capacity_quote * 3
+ : false,
+ };
+ });
+
+ const excluded = (plan.excluded || [])
+ .filter((x) => byId.has(String(x?.agent_id || '')))
+ .slice(0, 10)
+ .map((x) => ({
+ agent_id: x.agent_id,
+ name: byId.get(x.agent_id).name,
+ reason: typeof x.reason === 'string' ? x.reason.slice(0, 160) : 'Not selected for this basket',
+ }));
+
+ return {
+ source,
+ budget_quote: budget,
+ quote_symbol: 'SOL',
+ risk_profile: profile,
+ allocations: enriched,
+ excluded,
+ rebalance_rule: plan.rebalance_rule || 'Rebalance weekly, dropping any leader whose drawdown breaches the basket cap.',
+ caution: plan.caution || 'Copy-trading memecoins is high-variance. Size only what you can afford to lose.',
+ leaders_considered: universe.length,
+ diversification: countGroups(enriched),
+ };
+}
+
+function countGroups(allocations) {
+ const groups = {};
+ for (const a of allocations) groups[a.correlation_group] = (groups[a.correlation_group] || 0) + 1;
+ return groups;
+}
diff --git a/api/clip-director.js b/api/clip-director.js
new file mode 100644
index 000000000..1a0785e4d
--- /dev/null
+++ b/api/clip-director.js
@@ -0,0 +1,158 @@
+// Clip Director API, turn a real closed trade into shareable artifacts.
+// ---------------------------------------------------------------------------
+// GET /api/clip-director?agent_id=<uuid>[&surface=x|telegram|feed|all]
+// [&position_id=<uuid>][&network=mainnet]
+// The agent's most notable recent closed round-trip (or a specific
+// position) rendered as a shareable artifact per surface. Public, cached.
+//
+// POST /api/clip-director { agent_name, avatar_style?, trade, surface?,
+// copied_by_count? }
+// Direct a clip from an already-shaped trade object (for the copy-engine
+// fan-out / arena feed to call on every notable close). Public.
+//
+// Every number traces to a real closed trade; losses get an honest card too.
+// $THREE is the only coin promoted; the traded coin is user runtime data.
+
+import { cors, json, error, method, wrap, readJson, rateLimited } from './_lib/http.js';
+import { limits, clientIp } from './_lib/rate-limit.js';
+import { getSessionUser } from './_lib/auth.js';
+import { sql } from './_lib/db.js';
+import { isUuid } from './_lib/validate.js';
+import { directClip, tradeFromPosition, SURFACES } from './_lib/clip-director.js';
+
+const NETWORKS = new Set(['mainnet', 'devnet']);
+
+export const maxDuration = 30;
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,POST,OPTIONS', origins: '*', credentials: true })) return;
+ if (!method(req, res, ['GET', 'POST'])) return;
+
+ const rl = await limits.publicIp(clientIp(req));
+ if (!rl.success) return rateLimited(res, rl);
+
+ let userId = null;
+ try { userId = (await getSessionUser(req))?.id ?? null; } catch { userId = null; }
+
+ if (req.method === 'POST') return handlePost(req, res, userId);
+ return handleGet(req, res, userId);
+});
+
+async function handleGet(req, res, userId) {
+ const url = new URL(req.url, `http://${req.headers.host || 'x'}`);
+ const agentId = (url.searchParams.get('agent_id') || '').trim();
+ const positionId = (url.searchParams.get('position_id') || '').trim();
+ const network = NETWORKS.has(url.searchParams.get('network')) ? url.searchParams.get('network') : 'mainnet';
+ const surfaceParam = (url.searchParams.get('surface') || 'all').trim();
+
+ if (!isUuid(agentId)) return error(res, 400, 'invalid_agent', 'agent_id must be an agent UUID.');
+ if (positionId && !isUuid(positionId)) return error(res, 400, 'invalid_position', 'position_id must be a UUID.');
+
+ const [agent] = await sql`
+ select id, name, avatar_url, profile_image_url
+ from agent_identities
+ where id = ${agentId} and deleted_at is null
+ limit 1
+ `.catch(() => []);
+ if (!agent) return error(res, 404, 'agent_not_found', 'No such agent.');
+
+ // The notable close: a specific position if asked, else the most compelling
+ // recent one, biggest absolute realized move first, so the card headlines a
+ // real story (a big win OR a big honest loss), never a dust trade.
+ const [pos] = positionId
+ ? await sql`
+ select * from agent_sniper_positions
+ where id = ${positionId} and agent_id = ${agentId} and network = ${network} and status = 'closed'
+ limit 1
+ `.catch(() => [])
+ : await sql`
+ select * from agent_sniper_positions
+ where agent_id = ${agentId} and network = ${network} and status = 'closed'
+ and closed_at is not null
+ order by abs(coalesce(realized_pnl_pct, 0)) desc, closed_at desc
+ limit 1
+ `.catch(() => []);
+
+ if (!pos) {
+ return json(res, 200, {
+ agent: { id: agent.id, name: agent.name, avatar: agent.avatar_url || agent.profile_image_url || null },
+ trade: null,
+ clips: [],
+ empty: 'This agent has no closed trades yet. Clips are minted from real closed round-trips.',
+ });
+ }
+
+ const copiedByCount = await followerCount(agentId, network);
+ const trade = tradeFromPosition(pos);
+ const surfaces = surfaceParam === 'all' ? ['x', 'telegram', 'feed'] : (SURFACES.has(surfaceParam) ? [surfaceParam] : ['feed']);
+
+ const clips = await Promise.all(surfaces.map((surface) =>
+ directClip({
+ agentName: agent.name, avatarStyle: null, trade, copiedByCount, surface, userId,
+ })));
+
+ res.setHeader?.('cache-control', 'public, max-age=60, s-maxage=120');
+ return json(res, 200, {
+ agent: { id: agent.id, name: agent.name, avatar: agent.avatar_url || agent.profile_image_url || null },
+ position_id: pos.id,
+ trade,
+ proof: pos.sell_sig ? `https://solscan.io/tx/${pos.sell_sig}` : null,
+ copied_by_count: copiedByCount,
+ clips,
+ });
+}
+
+async function handlePost(req, res, userId) {
+ let body;
+ try { body = await readJson(req); } catch { return error(res, 400, 'invalid_json', 'Body must be JSON.'); }
+
+ const trade = body?.trade;
+ if (!trade || typeof trade !== 'object') {
+ return error(res, 400, 'invalid_trade', 'trade object is required (symbol, multiple or realized_pnl_sol, etc.).');
+ }
+ // Accept a raw position row too, normalize either shape.
+ const shaped = trade.entry_quote_lamports != null || trade.realized_pnl_lamports != null
+ ? tradeFromPosition(trade)
+ : normalizeTrade(trade);
+
+ const surface = SURFACES.has(body?.surface) ? body.surface : 'feed';
+ const clip = await directClip({
+ agentName: body?.agent_name || 'the agent',
+ avatarStyle: body?.avatar_style || null,
+ trade: shaped,
+ copiedByCount: Number(body?.copied_by_count) || 0,
+ surface,
+ userId,
+ });
+ res.setHeader?.('cache-control', 'no-store');
+ return json(res, 200, { clip });
+}
+
+function normalizeTrade(t) {
+ const num = (v) => (v == null || v === '' ? null : Number(v));
+ const pnl = num(t.realized_pnl_sol ?? t.realized_pnl_quote);
+ const pct = num(t.pnl_pct);
+ return {
+ mint: t.mint || null,
+ symbol: t.symbol || null,
+ name: t.name || null,
+ multiple: num(t.multiple),
+ pnl_pct: pct,
+ entry_sol: num(t.entry_sol),
+ exit_sol: num(t.exit_sol),
+ realized_pnl_sol: pnl,
+ hold_min: num(t.hold_min),
+ exit_reason: t.exit_reason || null,
+ quote_symbol: 'SOL',
+ is_win: pnl != null ? pnl >= 0 : (pct != null ? pct >= 0 : null),
+ sell_sig: t.sell_sig || null,
+ };
+}
+
+async function followerCount(agentId, network) {
+ const [row] = await sql`
+ select count(*)::int as n from agent_mirror_follows
+ where leader_agent_id = ${agentId} and network = ${network} and enabled = true
+ `.catch(() => [{ n: 0 }]);
+ return Number(row?.n || 0);
+}
diff --git a/api/meta-allocator.js b/api/meta-allocator.js
new file mode 100644
index 000000000..c19845f48
--- /dev/null
+++ b/api/meta-allocator.js
@@ -0,0 +1,76 @@
+// Meta-Allocator API, the "ETF of degens" allocation planner.
+// ---------------------------------------------------------------------------
+// GET /api/meta-allocator?network=mainnet[&risk=balanced][&budget=5][&limit=200]
+// The verified leader universe + a ready-to-read default allocation plan
+// for the requested (or balanced) risk profile. Public, cached.
+//
+// POST /api/meta-allocator { budget_quote, risk_profile,
+// current_allocations?, network? }
+// A tailored allocation plan for a specific budget/profile. Public, this
+// is planning only, fully non-custodial: it returns weights + suggested
+// sizes + a rebalance rule, never a transaction. Executing the plan is the
+// existing per-leader copy-subscribe flow, one confirmed action at a time.
+//
+// Every leader stat traces to a real closed on-chain round-trip. $THREE is the
+// only coin the platform promotes; the leaders' traded coins are user runtime
+// data, never endorsements.
+
+import { cors, json, error, method, wrap, readJson, rateLimited } from './_lib/http.js';
+import { limits, clientIp } from './_lib/rate-limit.js';
+import { getSessionUser } from './_lib/auth.js';
+import { gatherLeaders, buildAllocationPlan, RISK_PROFILES } from './_lib/meta-allocator.js';
+
+const NETWORKS = new Set(['mainnet', 'devnet']);
+
+export const maxDuration = 30;
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,POST,OPTIONS', origins: '*', credentials: true })) return;
+ if (!method(req, res, ['GET', 'POST'])) return;
+
+ const rl = await limits.publicIp(clientIp(req));
+ if (!rl.success) return rateLimited(res, rl);
+
+ const url = new URL(req.url, `http://${req.headers.host || 'x'}`);
+ const network = NETWORKS.has(url.searchParams.get('network')) ? url.searchParams.get('network') : 'mainnet';
+
+ // Signed-in users get their allocation LLM spend tracked against their cap;
+ // anonymous callers fall through to the free lane / deterministic plan.
+ let userId = null;
+ try { userId = (await getSessionUser(req))?.id ?? null; } catch { userId = null; }
+
+ if (req.method === 'POST') {
+ let body;
+ try { body = await readJson(req); } catch { return error(res, 400, 'invalid_json', 'Body must be JSON.'); }
+ const budgetQuote = Number(body?.budget_quote);
+ if (!Number.isFinite(budgetQuote) || budgetQuote <= 0) {
+ return error(res, 400, 'invalid_budget', 'budget_quote must be a positive number (SOL).');
+ }
+ const riskProfile = RISK_PROFILES.has(body?.risk_profile) ? body.risk_profile : 'balanced';
+ const currentAllocations = Array.isArray(body?.current_allocations) ? body.current_allocations : [];
+
+ const leaders = await gatherLeaders(network, { limit: 200 });
+ const plan = await buildAllocationPlan({
+ budgetQuote, riskProfile, leaders, currentAllocations, network, userId,
+ });
+ res.setHeader?.('cache-control', 'no-store');
+ return json(res, 200, { network, ...plan });
+ }
+
+ // GET, universe + a default plan for the requested profile.
+ const riskProfile = RISK_PROFILES.has(url.searchParams.get('risk')) ? url.searchParams.get('risk') : 'balanced';
+ const rawBudget = Number(url.searchParams.get('budget'));
+ const budgetQuote = Number.isFinite(rawBudget) && rawBudget > 0 ? rawBudget : 5; // 5 SOL demo default
+ const limit = Math.min(200, Math.max(10, parseInt(url.searchParams.get('limit') || '50', 10) || 50));
+
+ const leaders = await gatherLeaders(network, { limit });
+ const plan = await buildAllocationPlan({ budgetQuote, riskProfile, leaders, network, userId });
+
+ res.setHeader?.('cache-control', 'public, max-age=30, s-maxage=60');
+ return json(res, 200, {
+ network,
+ risk_profiles: [...RISK_PROFILES],
+ leader_universe: leaders,
+ plan,
+ });
+});
diff --git a/data/pages.json b/data/pages.json
index 3858fe5da..637125951 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -1011,6 +1011,22 @@
"changefreq": "weekly",
"added": "2026-06-16"
},
+ {
+ "path": "/meta-allocator",
+ "title": "Meta-Allocator: the ETF of degens",
+ "description": "Do not pick a coin, pick a basket of proven traders. The Meta-Allocator spreads a budget across the top verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and diversified across trading styles, then tells you how to rebalance. Non-custodial: it returns a plan you act on one leader at a time, never a transaction.",
+ "priority": 0.7,
+ "changefreq": "weekly",
+ "added": "2026-07-16"
+ },
+ {
+ "path": "/clip-director",
+ "title": "Clip Director: every trade becomes content",
+ "description": "Turn any trader agent's real closed pump.fun trade into the optimal shareable card per surface (X, Telegram, or the in-app Feed): an honest hook, the real number, an avatar reaction, and an on-chain proof link. Wins and losses both get a card.",
+ "priority": 0.7,
+ "changefreq": "weekly",
+ "added": "2026-07-16"
+ },
{
"path": "/pay",
"title": "Pay (x402)",
diff --git a/docs/clip-director.md b/docs/clip-director.md
new file mode 100644
index 000000000..322a07abd
--- /dev/null
+++ b/docs/clip-director.md
@@ -0,0 +1,83 @@
+# Clip Director: every trade becomes content
+
+We are a media company that happens to trade. Every notable close emits a piece of
+content: a ticker, a multiple, an avatar reaction, and a *reason*. The Clip Director
+turns one real closed trade into the optimal shareable artifact per surface, X,
+Telegram, or the in-app Feed, so the reasoning and the card become the acquisition
+channel and the trading stays the retention.
+
+Page: [/clip-director](https://three.ws/clip-director) · API: `/api/clip-director`
+
+## What it produces
+
+For a chosen trader agent it fetches the most notable recent closed round-trip (biggest
+absolute realized move, so the card headlines a real story, a big win *or* a big honest
+loss) and directs one card per surface:
+
+- **hook** (<=80 chars, the scroll-stopping first line, true),
+- **feature_stat** (the single most compelling real number to headline),
+- **avatar_gesture** (`celebrate` / `point` / `wave` / `shrug` / `sweat`) plus a
+ **gesture_clip** that resolves to a real animation clip in the manifest, so the
+ arena / trader avatar can actually perform the reaction,
+- **body** (1-2 lines, what happened and why, tuned per surface: X punchier, Telegram chattier, Feed mid),
+- **cta** (`fork-this-trade` / `copy-the-agent` / `view-track-record`),
+- **alt_text** (an accessibility description of the card).
+
+Honest by design: a losing trade still gets a card (radical downside-transparency is the
+brand), with a "live to trade again" tone, always with a verifiable on-chain angle. No
+number is invented; every stat traces to the closed position it was handed. When no LLM
+provider is available a deterministic director produces the same-shaped artifact.
+
+## Where the numbers come from
+
+A closed row in `agent_sniper_positions` gives entry/exit quote (SOL), realized P&L,
+realized P&L %, open/close timestamps, and the exit reason. The Clip Director derives
+multiple, hold time, and win/loss from those present fields and never fabricates a
+market cap it does not have. The `sell_sig` becomes an on-chain proof link.
+
+## API
+
+Public, IP rate-limited. Sizes in SOL. $THREE is the only coin promoted; the traded
+coin is user runtime data.
+
+```bash
+# Cards for an agent's most notable recent close, one per surface.
+curl 'https://three.ws/api/clip-director?agent_id=<AGENT_UUID>&surface=all'
+
+# A single surface, or a specific closed position.
+curl 'https://three.ws/api/clip-director?agent_id=<AGENT_UUID>&surface=x'
+curl 'https://three.ws/api/clip-director?agent_id=<AGENT_UUID>&position_id=<POSITION_UUID>'
+
+# Direct a clip from an already-shaped trade (for the copy-engine fan-out / arena feed).
+curl -X POST 'https://three.ws/api/clip-director' \
+ -H 'content-type: application/json' \
+ -d '{"agent_name":"Curve Sniper","surface":"x","copied_by_count":12,
+ "trade":{"symbol":"TICKER","multiple":4.2,"realized_pnl_sol":1.6,
+ "hold_min":42,"exit_reason":"take_profit","pnl_pct":320}}'
+```
+
+Response shape (GET):
+
+```json
+{
+ "agent": { "id": "…", "name": "Curve Sniper", "avatar": null },
+ "position_id": "…",
+ "trade": { "symbol": "TICKER", "multiple": 4.2, "hold_min": 42, "exit_reason": "take_profit", "is_win": true },
+ "proof": "https://solscan.io/tx/<sig>",
+ "copied_by_count": 12,
+ "clips": [
+ { "surface": "x", "hook": "…", "feature_stat": "4.2x", "avatar_gesture": "celebrate",
+ "gesture_clip": "celebrate", "body": "…", "cta": "copy-the-agent", "alt_text": "…" }
+ ]
+}
+```
+
+When the agent has no closed trades yet the response returns `clips: []` with an `empty`
+message instead of an error, so a card is only ever minted from a real closed round-trip.
+
+## Related
+
+- [Trader Card & the claim-your-wallet wedge](trader-card.md)
+- [Meta-Allocator: the ETF of degens](meta-allocator.md)
+- [The trading surfaces](trading-surfaces.md) · [The Arena](https://three.ws/arena)
+- [Animations & gestures](animations.md)
diff --git a/docs/meta-allocator.md b/docs/meta-allocator.md
new file mode 100644
index 000000000..915d43bf1
--- /dev/null
+++ b/docs/meta-allocator.md
@@ -0,0 +1,94 @@
+# Meta-Allocator: the ETF of degens
+
+The Meta-Allocator is a first-class agent type that does not pick coins. It picks
+leaders. Given a budget and a risk appetite, it spreads that budget across the top
+verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and
+diversified across trading styles, then tells you how to rebalance. It is the
+diversified on-ramp for the cautious: "just make me money," expressed as a basket of
+proven records instead of one bet.
+
+Page: [/meta-allocator](https://three.ws/meta-allocator) · API: `/api/meta-allocator`
+
+## Why it exists
+
+Copy-trading a single leader is a single point of failure. The Meta-Allocator turns
+the leaderboard into an *input to a strategy*: better leaders produce better baskets,
+which draw more copy demand, which surfaces more leaders. It is non-custodial. It
+returns a plan (weights, suggested sizes, a rebalance rule), never a transaction. You
+act on the plan one leader at a time through the existing copy-trade surface
+([/vaults](https://three.ws/vaults)), keeping full custody the whole way.
+
+## Where the numbers come from
+
+Every leader stat traces to a real closed on-chain round-trip in
+`agent_sniper_positions` (the same honest source the [mirror leaderboard](https://three.ws/leaderboard)
+ranks on). For each public agent with at least one settled trade the allocator computes:
+
+- **win rate** and **realized ROI** from closed positions,
+- **max drawdown %**, peak-to-trough on the cumulative realized-P&L equity curve (a single windowed SQL pass),
+- a **capacity proxy** (the leader's typical fill size) so the plan never suggests a size that would move their price,
+- a **risk-adjusted score** that rewards ROI and win-rate edge weighted by sample size, then penalizes drawdown, so a one-trade fluke never outranks a consistent record,
+- a **correlation group** (`high_winrate`, `moonshot`, `high_roi`, `steady`, `volatile`) derived from that realized profile, used only to diversify the basket.
+
+The plan is shaped by the platform's free-first LLM chain (`llmComplete`). When no LLM
+provider is available, a deterministic allocator produces the same-shaped plan: pick
+the best of each correlation group first for spread, backfill by score, weight by score,
+and enforce the profile's single-leader weight cap and drawdown ceiling. The response
+never fails.
+
+## Risk profiles
+
+| Profile | Max leaders | Max single weight | Max drawdown | Min settled trades |
+| --- | --- | --- | --- | --- |
+| conservative | 4 | 35% | 40% | 5 |
+| balanced | 6 | 45% | 70% | 3 |
+| degen | 8 | 60% | 100% | 1 |
+
+## API
+
+Public, IP rate-limited. `budget` and sizes are in SOL. $THREE is the only coin the
+platform promotes; the leaders' traded coins are user runtime data, never endorsements.
+
+```bash
+# The verified leader universe + a default balanced plan for a 5 SOL budget.
+curl 'https://three.ws/api/meta-allocator?risk=balanced&budget=5'
+
+# A tailored plan for a specific budget and profile (planning only, no custody).
+curl -X POST 'https://three.ws/api/meta-allocator' \
+ -H 'content-type: application/json' \
+ -d '{"budget_quote":10,"risk_profile":"conservative"}'
+```
+
+Plan shape:
+
+```json
+{
+ "network": "mainnet",
+ "source": "llm",
+ "budget_quote": 5,
+ "risk_profile": "balanced",
+ "allocations": [
+ { "agent_id": "…", "name": "Curve Sniper", "weight_pct": 44.48,
+ "size_quote": 2.224, "correlation_group": "high_winrate",
+ "win_rate_pct": 70.83, "roi_pct": 142.5, "max_drawdown_pct": 28.4,
+ "capacity_quote": 0.35, "over_capacity": true,
+ "why": "high_winrate style: 70.83% win rate, 142.5% realized ROI, 28.4% max drawdown, 24 settled trades" }
+ ],
+ "excluded": [ { "agent_id": "…", "name": "…", "reason": "Max drawdown 88% exceeds the balanced cap of 70%" } ],
+ "rebalance_rule": "Rebalance weekly. Drop any leader whose 7-day realized drawdown exceeds 70% …",
+ "caution": "Copy-trading memecoins is high-variance. …",
+ "leaders_considered": 12,
+ "diversification": { "high_winrate": 1, "steady": 1, "high_roi": 1 }
+}
+```
+
+`over_capacity` flags an allocation whose suggested size is more than 3x the leader's
+typical fill, so the UI can warn and the user can trim. When no leaders qualify the
+plan `source` is `"empty"` with a helpful message instead of an error.
+
+## Related
+
+- [Trader Card & the claim-your-wallet wedge](trader-card.md)
+- [The trading surfaces](trading-surfaces.md) · [/vaults](https://three.ws/vaults) (copy-trade with custody guardrails)
+- [Clip Director: every trade becomes content](clip-director.md)
+- [Financial controls & custody guardrails](financial-controls.md)
diff --git a/docs/ops/examples-repo-export.md b/docs/ops/examples-repo-export.md
new file mode 100644
index 000000000..0175dd3eb
--- /dev/null
+++ b/docs/ops/examples-repo-export.md
@@ -0,0 +1,116 @@
+# Examples satellite repo: export and publish runbook
+
+How the public `three-ws/examples` developer repo is assembled from this
+monorepo and published. Plan of record: `prompts/roadmap/developer-resources-repos.md`.
+This directory (`docs/ops/`) is excluded from the public docs build by the
+`PRIVATE_DOCS` filter in `vite.config.js`, so publish mechanics live here verbatim.
+
+**The one-line model:** the monorepo is the only source of truth. The examples
+repo is a strictly one-way export, its git history is disposable, and it is
+never pulled, fetched, or merged from (same rule as the retired `3D-Agent`
+mirror). No CI is involved: GitHub Actions are unavailable on this account, so
+the export runs locally from the push routine or the satellite rots.
+
+## What the export does
+
+`scripts/export-examples.mjs` (wired as `npm run export:examples`) assembles a
+complete, self-contained copy of the examples repo into a gitignored build dir
+and rewrites every monorepo-relative reference to a working surface so nothing
+points back into the monorepo.
+
+```bash
+npm run export:examples # build into dist/examples-repo/
+node scripts/export-examples.mjs --out /tmp/examples # custom output dir
+node scripts/export-examples.mjs --smoke # also npm-install + check each runnable example
+```
+
+Properties:
+
+- **Idempotent.** It wipes and rebuilds the output dir on every run; two runs
+ produce byte-identical output.
+- **Offline by default.** The assembly needs no network. `--smoke` is the only
+ step that reaches the npm registry (it really runs `npm install` plus each
+ example's check; do this right before publishing).
+- **Curated, not a mirror.** Only the material listed in the script's manifest
+ is exported. Adding an example means adding a manifest entry, nothing more.
+
+### The rewrites it applies
+
+| Source form in the monorepo | Rewritten to |
+|---|---|
+| `"file:../../solana-agent-sdk"` (and any `file:` SDK dep) | published `^<version>` read live from that package's `package.json` |
+| `../src/...`, `../../src/...` | `https://three.ws/src/...` (hosted raw modules, all resolve 200) |
+| `/avatars/...`, `/dist-lib/...`, `/src/...` | absolute `https://three.ws/...` |
+| `../../docs/<slug>.md` links | `https://three.ws/docs/<slug>` |
+| `agent-native-3d`'s `../../src/forge-embed-snippets.js` | vendored into `lib/` and imported as `./lib/forge-embed-snippets.js`; its output path is localised to `./out` |
+
+After a run, the script prints the produced tree and a file/dir count. The
+current export is 59 files across quickstarts, agents, embeds, tutorials, and
+skills.
+
+### Output layout
+
+```
+dist/examples-repo/
+ README.md # generated index (quickstarts / agents / embeds / tutorials / skills)
+ LICENSE # carried from the monorepo root (see the license note below)
+ .gitignore
+ quickstarts/ # one folder per SDK: install command + real Quick start section + npm/docs links
+ sdk/ solana-agent-sdk/ agent-payments-sdk/ mcp-server/
+ agents/ # coach-leo pump-fun-agent three-concierge metamask-agent-wallet
+ embeds/ # minimal / two-agents / web-component / widget-rpc (single-file HTML)
+ tutorials/ # agenc-task-roundtrip agent-native-3d (long-form, runnable)
+ skills/ # pump-fun trading / strategy / compose / trade, solana-wallet
+```
+
+## License note before first publish
+
+The export carries the monorepo root `LICENSE` verbatim, which is currently
+"All rights reserved". A public examples repo usually ships a permissive license
+(MIT/Apache-2.0). Confirm or replace `dist/examples-repo/LICENSE` before the
+first public push. This is an owner decision; the export does not choose one.
+
+## Owner publish steps (run by hand; not automated here)
+
+Nothing below is executed by any script in this repo. The export produces a
+plain directory; the owner turns it into a repo.
+
+1. **One-time: create the GitHub org and repo.**
+ ```bash
+ # Org `three-ws` is created in the GitHub UI (three.ws is not a valid org slug).
+ gh repo create three-ws/examples --public \
+ --description "Runnable examples, SDK quickstarts, and embeds for three.ws"
+ ```
+
+2. **Build and smoke-test the export.**
+ ```bash
+ npm run export:examples
+ node scripts/export-examples.mjs --smoke # verifies the runnable examples install
+ ```
+
+3. **Confirm the license** in `dist/examples-repo/LICENSE` (see the note above).
+
+4. **Publish the built directory as the repo's single-parent history.** The
+ satellite history is disposable, so a fresh single commit is correct; never
+ preserve or merge prior satellite history.
+ ```bash
+ cd dist/examples-repo
+ git init -b main
+ git add -A
+ git commit -m "Sync examples from monorepo"
+ git remote add origin https://github.com/three-ws/examples.git
+ git push --force origin main
+ ```
+
+5. **Never pull, fetch, or merge from the satellite.** To update it later,
+ re-run the export and repeat steps 2 to 4. The satellite is output, never input.
+
+## Cross-linking (rolling, after the repo exists)
+
+- three.ws docs pages link to the matching example folder; the examples README
+ already links back to `https://three.ws/docs` and the live platform.
+- `public/llms.txt` / `llms-full.txt` reference the examples repo.
+- The org profile README pins `examples` and the monorepo.
+- Ship a `data/changelog.json` entry when the repo goes public (this is a
+ user-visible developer resource). The export script itself is internal
+ tooling and gets no changelog entry.
diff --git a/package.json b/package.json
index 343006b44..57456a298 100644
--- a/package.json
+++ b/package.json
@@ -139,6 +139,7 @@
"audit:mcp-golden": "node scripts/audit-mcp-golden.mjs",
"audit:hidden-guard": "node scripts/audit-hidden-guard.mjs",
"audit:tokens": "node scripts/audit-token-drift.mjs",
+ "export:examples": "node scripts/export-examples.mjs",
"guard:hidden": "node scripts/inject-hidden-guard.mjs --write",
"check:images": "node scripts/audit-image-loading.mjs --strict",
"audit:web": "node scripts/page-audit.mjs",
diff --git a/pages/clip-director.html b/pages/clip-director.html
new file mode 100644
index 000000000..3ebd11309
--- /dev/null
+++ b/pages/clip-director.html
@@ -0,0 +1,126 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <script>/* three.ws theme boot */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Clip Director: every trade becomes content · three.ws</title>
+ <meta name="description" content="Turn any agent's real closed pump.fun trade into the optimal shareable card per surface: X, Telegram, or the in-app Feed. Honest hooks, the real number, an avatar reaction, and an on-chain proof link. Losses shown too." />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/clip-director" />
+ <meta property="og:title" content="Clip Director: every trade becomes content · three.ws" />
+ <meta property="og:description" content="Every notable close becomes a shareable card, tuned per surface, always with a verifiable on-chain angle. We show the losers too." />
+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Clip+Director%3A+every+trade+becomes+content&amp;d=Turn+any+trader+agent%27s+real+closed+pump.fun+trade+into+the+optimal+shareable+card+per+surface+%28X%2C+Telegram%2C+or+the+in-app+Feed%29%3A+an+honest+hook%2C+the+real+numbe&amp;p=%2Fclip-director" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Clip Director: every trade becomes content · three.ws" />
+ <meta name="twitter:description" content="Every notable close becomes a shareable card, tuned per surface, with an on-chain proof link." />
+ <meta name="theme-color" content="#0a0a0a" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/manifest.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <script defer src="/footer-newsletter.js"></script>
+ <link rel="canonical" href="https://three.ws/clip-director" />
+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebApplication","name":"Clip Director: every trade becomes content","applicationCategory":"MultimediaApplication","operatingSystem":"Web","description":"Turn any agent's real closed pump.fun trade into the optimal shareable card per surface. Honest hooks, the real number, an avatar reaction, and an on-chain proof link.","url":"https://three.ws/clip-director","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
+ <style>
+ :root {
+ --cd-bg: #0a0a0b; --cd-panel: #121214; --cd-panel-2: #17171a; --cd-line: #26262b;
+ --cd-text: #f5f5f7; --cd-dim: #a1a1aa; --cd-faint: #6b6b74;
+ --cd-accent: #22d3ee; --cd-accent-2: #7c5cff; --cd-green: #34d399; --cd-red: #fb7185;
+ --cd-x: #1d9bf0; --cd-tg: #2aabee; --cd-feed: #7c5cff; --cd-chip: #1e1e24;
+ }
+ :root[data-theme='light'] {
+ --cd-bg: #fafafa; --cd-panel: #ffffff; --cd-panel-2: #f4f4f6; --cd-line: #e4e4e8;
+ --cd-text: #14141a; --cd-dim: #52525b; --cd-faint: #8a8a93; --cd-chip: #eef0f4;
+ }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--cd-bg); color: var(--cd-text); font-family: 'Inter', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
+ .cd { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }
+ .cd-kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--cd-accent); font-weight: 600; margin: 8px 0 10px; }
+ .cd-title { font-size: clamp(26px, 5vw, 44px); line-height: 1.05; font-weight: 800; margin: 0 0 12px; letter-spacing: -.02em; }
+ .cd-sub { font-size: clamp(14px, 2.2vw, 17px); color: var(--cd-dim); max-width: 62ch; line-height: 1.55; margin: 0 0 24px; }
+ .cd-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--cd-panel); border: 1px solid var(--cd-line); border-radius: 16px; padding: 18px; margin-bottom: 22px; }
+ .cd-field { flex: 1; min-width: 220px; }
+ .cd-field label { display: block; font-size: 12px; color: var(--cd-faint); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; font-weight: 600; }
+ .cd-field select, .cd-field input { width: 100%; background: var(--cd-panel-2); border: 1px solid var(--cd-line); border-radius: 10px; color: var(--cd-text); font: inherit; font-size: 15px; padding: 11px 12px; outline: none; }
+ .cd-field select:focus-visible, .cd-field input:focus-visible { border-color: var(--cd-accent); outline: 2px solid var(--cd-accent); outline-offset: 1px; }
+ .cd-trade { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; background: var(--cd-panel); border: 1px solid var(--cd-line); border-radius: 14px; padding: 14px 18px; margin-bottom: 18px; }
+ .cd-trade .sym { font-weight: 800; font-size: 18px; }
+ .cd-trade .stat { font-size: 14px; color: var(--cd-dim); } .cd-trade .stat b { color: var(--cd-text); }
+ .cd-trade .win { color: var(--cd-green); } .cd-trade .loss { color: var(--cd-red); }
+ .cd-trade a.proof { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--cd-accent); text-decoration: none; }
+ .cd-trade a.proof:hover { text-decoration: underline; }
+ .cd-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
+ @media (min-width: 760px) { .cd-grid { grid-template-columns: repeat(3, 1fr); } }
+ .cd-card { background: var(--cd-panel); border: 1px solid var(--cd-line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
+ .cd-card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--cd-line); font-weight: 700; font-size: 13px; letter-spacing: .02em; }
+ .cd-card-head .dot { width: 9px; height: 9px; border-radius: 50%; }
+ .cd-card.x .dot { background: var(--cd-x); } .cd-card.telegram .dot { background: var(--cd-tg); } .cd-card.feed .dot { background: var(--cd-feed); }
+ .cd-card-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
+ .cd-hook { font-size: 16px; font-weight: 700; line-height: 1.3; }
+ .cd-featstat { display: inline-flex; align-items: center; gap: 8px; }
+ .cd-featstat .gesture { font-size: 26px; line-height: 1; }
+ .cd-featstat .num { font-size: 24px; font-weight: 800; letter-spacing: -.02em; background: linear-gradient(90deg, var(--cd-accent), var(--cd-accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
+ .cd-text { font-size: 13.5px; color: var(--cd-dim); line-height: 1.5; }
+ .cd-cta { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--cd-accent-2); }
+ .cd-alt { font-size: 11.5px; color: var(--cd-faint); border-top: 1px dashed var(--cd-line); padding-top: 10px; line-height: 1.45; }
+ .cd-alt b { color: var(--cd-dim); }
+ .cd-copy { margin-top: auto; appearance: none; border: 1px solid var(--cd-line); background: var(--cd-panel-2); color: var(--cd-text); font: inherit; font-weight: 600; font-size: 13px; padding: 9px; border-radius: 9px; cursor: pointer; transition: background .15s, border-color .15s; }
+ .cd-copy:hover { border-color: var(--cd-accent); background: var(--cd-panel); }
+ .cd-copy:focus-visible { outline: 2px solid var(--cd-accent); outline-offset: 2px; }
+ .cd-copy.done { color: var(--cd-green); border-color: var(--cd-green); }
+ .cd-note { background: var(--cd-panel); border: 1px solid var(--cd-line); border-left: 3px solid var(--cd-accent); border-radius: 10px; padding: 14px 16px; margin: 22px 0 0; font-size: 13.5px; color: var(--cd-dim); line-height: 1.55; }
+ .cd-note b { color: var(--cd-text); }
+ .cd-empty, .cd-error { text-align: center; padding: 48px 20px; border: 1px dashed var(--cd-line); border-radius: 16px; background: var(--cd-panel); }
+ .cd-empty h3, .cd-error h3 { margin: 0 0 8px; font-size: 18px; }
+ .cd-empty p, .cd-error p { color: var(--cd-dim); margin: 0 auto 16px; max-width: 46ch; font-size: 14px; line-height: 1.55; }
+ .cd-empty a, .cd-error button { display: inline-block; background: var(--cd-accent); color: #06232b; border: none; text-decoration: none; padding: 10px 18px; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }
+ .cd-skel { display: grid; grid-template-columns: 1fr; gap: 16px; }
+ @media (min-width: 760px) { .cd-skel { grid-template-columns: repeat(3, 1fr); } }
+ .cd-skel-card { height: 240px; border-radius: 14px; background: linear-gradient(100deg, var(--cd-panel) 30%, var(--cd-panel-2) 50%, var(--cd-panel) 70%); background-size: 200% 100%; animation: cd-sh 1.3s ease-in-out infinite; border: 1px solid var(--cd-line); }
+ @keyframes cd-sh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
+ @media (prefers-reduced-motion: reduce) { .cd-skel-card { animation: none; } }
+ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
+ </style>
+
+ <meta property="og:locale" content="en_US">
+ <meta property="og:image:alt" content="Clip Director: every trade becomes content — three.ws">
+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;amp;t=Clip+Director%3A+every+trade+becomes+content&amp;amp;d=Turn+any+trader+agent%27s+real+closed+pump.fun+trade+into+the+optimal+shareable+card+per+surface+%28X%2C+Telegram%2C+or+the+in-app+Feed%29%3A+an+honest+hook%2C+the+real+numbe&amp;amp;p=%2Fclip-director">
+</head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cd" aria-labelledby="cd-title">
+ <p class="cd-kicker">Clip Director · content engine · on-chain proof</p>
+ <h1 id="cd-title" class="cd-title">Every trade becomes content</h1>
+ <p class="cd-sub">
+ We are a media company that happens to trade. Every notable close emits a ticker, a
+ multiple, an avatar reaction, and a reason. The Clip Director turns one real closed trade
+ into the optimal shareable card per surface: X, Telegram, or the in-app Feed. Honest hooks,
+ the real number, a verifiable on-chain angle. We show the losers too.
+ </p>
+
+ <div class="cd-controls">
+ <div class="cd-field">
+ <label for="cdAgent">Pick a trader agent</label>
+ <select id="cdAgent" aria-label="Trader agent"><option value="">Loading leaders…</option></select>
+ </div>
+ </div>
+
+ <div id="cdTrade"></div>
+ <div id="cdResult" aria-live="polite"></div>
+ </main>
+
+ <footer id="footer-root"></footer>
+ <script type="module" src="/src/clip-director-page.js"></script>
+ </body>
+</html>
diff --git a/pages/create-agent.html b/pages/create-agent.html
index b38bdc5da..5721c7a33 100644
--- a/pages/create-agent.html
+++ b/pages/create-agent.html
@@ -1237,6 +1237,26 @@
flex-wrap: wrap;
}
+ .success-deploy {
+ margin-top: 22px;
+ padding-top: 20px;
+ border-top: 1px solid var(--border);
+ }
+ .success-deploy-label {
+ margin: 0 0 12px;
+ font-size: 0.78rem;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+ color: var(--muted);
+ }
+ .success-deploy-actions {
+ display: flex;
+ gap: 10px;
+ justify-content: center;
+ flex-wrap: wrap;
+ }
+
@media (max-width: 640px) {
main.stage {
padding: 28px 14px 72px;
@@ -1787,6 +1807,23 @@
>View my profile</a
>
</div>
+ <div class="success-deploy">
+ <p class="success-deploy-label">Take it further</p>
+ <div class="success-deploy-actions">
+ <a class="btn btn--ghost" id="success-voice" href="/voice"
+ >Give it a voice</a
+ >
+ <a class="btn btn--ghost" id="success-embed" href="/studio"
+ >Embed it anywhere</a
+ >
+ <a class="btn btn--ghost" id="success-world" href="/play"
+ >Put it in a world</a
+ >
+ <a class="btn btn--ghost" id="success-token" href="/launchpad"
+ >Launch its token</a
+ >
+ </div>
+ </div>
</section>
</div>
diff --git a/pages/create-selfie.html b/pages/create-selfie.html
index e2529a1b9..98df95720 100644
--- a/pages/create-selfie.html
+++ b/pages/create-selfie.html
@@ -1702,6 +1702,9 @@
<button id="done-save-btn" class="btn-save" type="button">
Open my avatar →
</button>
+ <button id="done-agent-btn" class="btn-secondary" type="button">
+ Turn this into an agent
+ </button>
<button id="done-list-btn" class="btn-secondary" type="button">
List on marketplace
</button>
@@ -2145,6 +2148,7 @@
// In 'platform' mode the camera step is already the default active step.
let _avatarId = null;
+ let _modelUrl = null;
let _docTitleBase = document.title;
let _notifyPermission =
typeof Notification !== 'undefined' ? Notification.permission : 'denied';
@@ -2218,6 +2222,7 @@
const { avatar } = await res.json();
const modelEl = document.getElementById('done-model');
const modelUrl = avatar?.model_url || avatar?.url;
+ _modelUrl = modelUrl || null;
if (modelEl && modelUrl) {
modelEl.addEventListener(
'load',
@@ -2411,6 +2416,38 @@
window.location.assign(`/avatars/${encodeURIComponent(_avatarId)}`);
});
+ // Pipeline handoff: an avatar is only the first stage. Carry it straight
+ // into the agent builder with the body pre-selected, matching the
+ // marketplace "Start an agent with this avatar" hand-off.
+ document.getElementById('done-agent-btn')?.addEventListener('click', async () => {
+ if (!_avatarId) return;
+ const btn = /** @type {HTMLButtonElement} */ (
+ document.getElementById('done-agent-btn')
+ );
+ btn.disabled = true;
+ btn.textContent = 'Opening the agent builder…';
+
+ const nameEl = /** @type {HTMLInputElement|null} */ (
+ document.getElementById('done-name')
+ );
+ const name = nameEl?.value?.trim();
+ if (name) {
+ try {
+ await fetch(`/api/avatars/${encodeURIComponent(_avatarId)}`, {
+ method: 'PATCH',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ name }),
+ });
+ } catch (_) {}
+ }
+
+ const params = new URLSearchParams({ avatar_id: _avatarId });
+ if (name) params.set('avatar_name', name);
+ if (_modelUrl) params.set('avatar_glb', _modelUrl);
+ window.location.assign(`/agent/new?${params.toString()}`);
+ });
+
document.getElementById('done-editor-btn')?.addEventListener('click', () => {
if (!_avatarId) return;
window.location.assign(`/avatars/${encodeURIComponent(_avatarId)}/edit`);
diff --git a/pages/meta-allocator.html b/pages/meta-allocator.html
new file mode 100644
index 000000000..b191fea88
--- /dev/null
+++ b/pages/meta-allocator.html
@@ -0,0 +1,149 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <script>/* three.ws theme boot */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Meta-Allocator: the ETF of degens · three.ws</title>
+ <meta name="description" content="Spread a budget across the top verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and diversified across trading styles. A non-custodial allocation plan you can act on one leader at a time." />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/meta-allocator" />
+ <meta property="og:title" content="Meta-Allocator: the ETF of degens · three.ws" />
+ <meta property="og:description" content="Diversify across the top verified pump.fun trader agents. Risk-adjusted, style-diversified, non-custodial. Just make me money, spread across proven records." />
+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Meta-Allocator%3A+the+ETF+of+degens&amp;d=Do+not+pick+a+coin%2C+pick+a+basket+of+proven+traders.+The+Meta-Allocator+spreads+a+budget+across+the+top+verified+pump.fun+trader+agents%2C+ranked+by+risk-adjusted&amp;p=%2Fmeta-allocator" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Meta-Allocator: the ETF of degens · three.ws" />
+ <meta name="twitter:description" content="Diversify across the top verified pump.fun trader agents. Risk-adjusted, style-diversified, non-custodial." />
+ <meta name="theme-color" content="#0a0a0a" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/manifest.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <script defer src="/footer-newsletter.js"></script>
+ <link rel="canonical" href="https://three.ws/meta-allocator" />
+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebApplication","name":"Meta-Allocator: the ETF of degens","applicationCategory":"FinanceApplication","operatingSystem":"Web","description":"Spread a budget across the top verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and diversified across trading styles. Non-custodial allocation planning.","url":"https://three.ws/meta-allocator","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
+ <style>
+ :root {
+ --ma-bg: #0a0a0b; --ma-panel: #121214; --ma-panel-2: #17171a; --ma-line: #26262b;
+ --ma-text: #f5f5f7; --ma-dim: #a1a1aa; --ma-faint: #6b6b74;
+ --ma-accent: #7c5cff; --ma-accent-2: #22d3ee; --ma-green: #34d399; --ma-red: #fb7185; --ma-amber: var(--warn);
+ --ma-chip: #1e1e24;
+ }
+ :root[data-theme='light'] {
+ --ma-bg: #fafafa; --ma-panel: #ffffff; --ma-panel-2: #f4f4f6; --ma-line: #e4e4e8;
+ --ma-text: #14141a; --ma-dim: #52525b; --ma-faint: #8a8a93;
+ --ma-chip: #eef0f4;
+ }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--ma-bg); color: var(--ma-text); font-family: 'Inter', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
+ .ma { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }
+ .ma-kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ma-accent); font-weight: 600; margin: 8px 0 10px; }
+ .ma-title { font-size: clamp(26px, 5vw, 44px); line-height: 1.05; font-weight: 800; margin: 0 0 12px; letter-spacing: -.02em; }
+ .ma-sub { font-size: clamp(14px, 2.2vw, 17px); color: var(--ma-dim); max-width: 62ch; line-height: 1.55; margin: 0 0 24px; }
+ .ma-controls { display: grid; grid-template-columns: 1fr; gap: 16px; background: var(--ma-panel); border: 1px solid var(--ma-line); border-radius: 16px; padding: 18px; margin-bottom: 22px; }
+ @media (min-width: 640px) { .ma-controls { grid-template-columns: 200px 1fr; align-items: center; } }
+ .ma-field label { display: block; font-size: 12px; color: var(--ma-faint); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; font-weight: 600; }
+ .ma-budget { display: flex; align-items: center; gap: 8px; background: var(--ma-panel-2); border: 1px solid var(--ma-line); border-radius: 10px; padding: 0 12px; }
+ .ma-budget input { flex: 1; width: 100%; background: transparent; border: none; color: var(--ma-text); font-size: 18px; font-weight: 700; padding: 12px 0; outline: none; }
+ .ma-budget span { color: var(--ma-faint); font-weight: 600; font-size: 14px; }
+ .ma-seg { display: inline-flex; background: var(--ma-panel-2); border: 1px solid var(--ma-line); border-radius: 10px; padding: 4px; gap: 4px; width: 100%; }
+ .ma-seg button { flex: 1; appearance: none; border: none; background: transparent; color: var(--ma-dim); font: inherit; font-weight: 600; font-size: 13px; padding: 9px 8px; border-radius: 7px; cursor: pointer; transition: background .15s, color .15s; text-transform: capitalize; }
+ .ma-seg button:hover { color: var(--ma-text); }
+ .ma-seg button[aria-pressed='true'] { background: var(--ma-accent); color: #fff; }
+ .ma-seg button:focus-visible { outline: 2px solid var(--ma-accent-2); outline-offset: 2px; }
+ .ma-summary { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: baseline; margin: 6px 0 18px; color: var(--ma-dim); font-size: 14px; }
+ .ma-summary b { color: var(--ma-text); }
+ .ma-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; border: 1px solid var(--ma-line); margin: 10px 0 24px; background: var(--ma-panel-2); }
+ .ma-bar i { display: block; height: 100%; }
+ .ma-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
+ @media (min-width: 720px) { .ma-grid { grid-template-columns: 1fr 1fr; } }
+ .ma-card { background: var(--ma-panel); border: 1px solid var(--ma-line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, border-color .15s; }
+ .ma-card:hover { transform: translateY(-2px); border-color: var(--ma-accent); }
+ .ma-card-top { display: flex; align-items: center; gap: 12px; }
+ .ma-ava { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--ma-panel-2); border: 1px solid var(--ma-line); flex: none; display: grid; place-items: center; font-weight: 700; color: var(--ma-accent); }
+ .ma-name { font-weight: 700; font-size: 15px; margin: 0; }
+ .ma-weight { margin-left: auto; text-align: right; }
+ .ma-weight b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
+ .ma-weight small { display: block; color: var(--ma-faint); font-size: 12px; }
+ .ma-chips { display: flex; flex-wrap: wrap; gap: 6px; }
+ .ma-chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--ma-chip); color: var(--ma-dim); }
+ .ma-chip.grp { color: var(--ma-accent-2); }
+ .ma-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ma-dim); }
+ .ma-stats b { color: var(--ma-text); font-weight: 700; }
+ .pos { color: var(--ma-green) !important; } .neg { color: var(--ma-red) !important; }
+ .ma-why { font-size: 12.5px; color: var(--ma-faint); line-height: 1.45; border-top: 1px solid var(--ma-line); padding-top: 9px; }
+ .ma-warn { font-size: 12px; color: var(--ma-amber); display: flex; gap: 6px; align-items: center; }
+ .ma-links { display: flex; gap: 8px; margin-top: 2px; }
+ .ma-links a { flex: 1; text-align: center; font-size: 12.5px; font-weight: 600; text-decoration: none; padding: 8px; border-radius: 8px; border: 1px solid var(--ma-line); color: var(--ma-text); transition: background .15s, border-color .15s; }
+ .ma-links a:hover { background: var(--ma-panel-2); border-color: var(--ma-accent); }
+ .ma-links a.primary { background: var(--ma-accent); border-color: var(--ma-accent); color: #fff; }
+ .ma-note { background: var(--ma-panel); border: 1px solid var(--ma-line); border-left: 3px solid var(--ma-accent); border-radius: 10px; padding: 14px 16px; margin: 22px 0; font-size: 13.5px; color: var(--ma-dim); line-height: 1.55; }
+ .ma-note b { color: var(--ma-text); }
+ .ma-excluded { margin-top: 22px; }
+ .ma-excluded summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ma-dim); padding: 8px 0; }
+ .ma-excluded ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
+ .ma-excluded li { font-size: 13px; color: var(--ma-faint); padding: 8px 12px; background: var(--ma-panel); border: 1px solid var(--ma-line); border-radius: 8px; }
+ .ma-excluded li b { color: var(--ma-dim); }
+ .ma-empty, .ma-error { text-align: center; padding: 48px 20px; border: 1px dashed var(--ma-line); border-radius: 16px; background: var(--ma-panel); }
+ .ma-empty h3, .ma-error h3 { margin: 0 0 8px; font-size: 18px; }
+ .ma-empty p, .ma-error p { color: var(--ma-dim); margin: 0 auto 16px; max-width: 46ch; font-size: 14px; line-height: 1.55; }
+ .ma-empty a, .ma-error button { display: inline-block; background: var(--ma-accent); color: #fff; border: none; text-decoration: none; padding: 10px 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
+ .ma-skel { display: grid; grid-template-columns: 1fr; gap: 14px; }
+ @media (min-width: 720px) { .ma-skel { grid-template-columns: 1fr 1fr; } }
+ .ma-skel-card { height: 190px; border-radius: 14px; background: linear-gradient(100deg, var(--ma-panel) 30%, var(--ma-panel-2) 50%, var(--ma-panel) 70%); background-size: 200% 100%; animation: ma-sh 1.3s ease-in-out infinite; border: 1px solid var(--ma-line); }
+ @keyframes ma-sh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
+ @media (prefers-reduced-motion: reduce) { .ma-skel-card, .ma-card { animation: none; transition: none; } }
+ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
+ </style>
+
+ <meta property="og:locale" content="en_US">
+ <meta property="og:image:alt" content="Meta-Allocator: the ETF of degens — three.ws">
+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;amp;t=Meta-Allocator%3A+the+ETF+of+degens&amp;amp;d=Do+not+pick+a+coin%2C+pick+a+basket+of+proven+traders.+The+Meta-Allocator+spreads+a+budget+across+the+top+verified+pump.fun+trader+agents%2C+ranked+by+risk-adjusted&amp;amp;p=%2Fmeta-allocator">
+</head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="ma" aria-labelledby="ma-title">
+ <p class="ma-kicker">Meta-Allocator · non-custodial · verified on-chain</p>
+ <h1 id="ma-title" class="ma-title">The ETF of degens</h1>
+ <p class="ma-sub">
+ Do not pick a coin. Pick a basket of proven traders. The Meta-Allocator spreads your
+ budget across the top verified pump.fun agents, ranked by risk-adjusted on-chain track
+ record and diversified across trading styles, then rebalances. It returns a plan, not a
+ transaction. You act on it one leader at a time, keeping full custody.
+ </p>
+
+ <div class="ma-controls" role="group" aria-label="Allocation settings">
+ <div class="ma-field">
+ <label for="maBudget">Budget</label>
+ <div class="ma-budget">
+ <input id="maBudget" type="number" inputmode="decimal" min="0.1" step="0.1" value="5" aria-label="Budget in SOL" />
+ <span>SOL</span>
+ </div>
+ </div>
+ <div class="ma-field">
+ <label id="maRiskLabel">Risk profile</label>
+ <div class="ma-seg" role="group" aria-labelledby="maRiskLabel" id="maSeg">
+ <button type="button" data-risk="conservative" aria-pressed="false">conservative</button>
+ <button type="button" data-risk="balanced" aria-pressed="true">balanced</button>
+ <button type="button" data-risk="degen" aria-pressed="false">degen</button>
+ </div>
+ </div>
+ </div>
+
+ <div id="maResult" aria-live="polite"></div>
+ </main>
+
+ <footer id="footer-root"></footer>
+ <script type="module" src="/src/meta-allocator.js"></script>
+ </body>
+</html>
diff --git a/pages/voice.html b/pages/voice.html
index 69f18321b..751428519 100644
--- a/pages/voice.html
+++ b/pages/voice.html
@@ -213,6 +213,7 @@
border-radius: 12px;
font: 600 14px/1 system-ui, sans-serif;
cursor: pointer;
+ text-decoration: none;
transition: opacity 0.12s, transform 0.1s, background 0.15s, box-shadow 0.15s;
white-space: nowrap;
}
@@ -734,6 +735,7 @@
</div>
<div class="vl-done-actions">
<button class="vl-btn vl-btn-primary vl-btn-sm" id="btnTryPlayground">Try in playground</button>
+ <a class="vl-btn vl-btn-ghost vl-btn-sm" id="btnAttachAgent" href="/dashboard">Add to an agent</a>
<button class="vl-btn vl-btn-ghost vl-btn-sm" id="btnRecordAnother">Record another</button>
</div>
</div>
diff --git a/prompts/roadmap/_generated/3d-world-fun/gate-after.txt b/prompts/roadmap/_generated/3d-world-fun/gate-after.txt
new file mode 100644
index 000000000..91ea8ead0
--- /dev/null
+++ b/prompts/roadmap/_generated/3d-world-fun/gate-after.txt
@@ -0,0 +1,79 @@
+
+> npm run test:gate && npm run test:gate-3d && npm run audit:mcp && npm run audit:mcp-golden && npm run audit:routes && npm run audit:handlers && npm run audit:pages && npm run audit:hidden-guard && npm run audit:x402-catalog && npm run audit:tokens
+
+
+> [email protected] test:gate
+> node scripts/test-gate.mjs
+
+[test-gate] running 7 critical-path test files…
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 7 passed (7)
+ Tests 86 passed (86)
+ Start at 17:26:37
+ Duration 2.71s (transform 1.15s, setup 0ms, import 2.50s, tests 2.65s, environment 1ms)
+
+[test-gate] ✓ all critical-path tests passed
+
+> [email protected] test:gate-3d
+> vitest run tests/glb-canonicalize.test.js tests/animation-retarget.test.js tests/animation-retarget-rest-pollution.test.js tests/viewer-framing.test.js
+
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 4 passed (4)
+ Tests 244 passed (244)
+ Start at 17:26:40
+ Duration 437ms (transform 181ms, setup 0ms, import 519ms, tests 261ms, environment 1ms)
+
+
+> [email protected] audit:mcp
+> node scripts/audit-mcp-manifests.mjs
+
+[audit:mcp] 16 MCP manifests consistent
+
+> [email protected] audit:mcp-golden
+> node scripts/audit-mcp-golden.mjs
+
+[audit:mcp-golden] 236 hosted MCP tool contracts match the golden fixture
+
+> [email protected] audit:routes
+> node scripts/verify-routes.mjs
+
+Route verify — 328 catalog pages, 1110 main routes, 1 post-filesystem routes.
+ modeled dist files: 1622 · canonical-covered: 328 · literal page routes checked for shadows: 479
+ filesystem boundary (handle:filesystem) present: yes
+
+✓ static checks pass: every catalog page reachable, unknown paths → designed 404, no shadowed page routes.
+
+> [email protected] audit:handlers
+> node scripts/audit-empty-handlers.mjs
+
+✓ audit-empty-handlers: all API handlers export a body (1754 checked)
+
+> [email protected] audit:pages
+> node scripts/audit-page-index.mjs
+
+Route audit: 145 auditable page routes, 328 documented in pages.json.
+✓ Every auditable page route is documented.
+
+ℹ 6 manifest page(s) have no `added` date (omitted from /changelog). Fine for legacy pages; add dates as you touch them.
+
+> [email protected] audit:hidden-guard
+> node scripts/audit-hidden-guard.mjs
+
+✓ audit-hidden-guard: all 291 pages resolve the [hidden] guard
+
+> [email protected] audit:x402-catalog
+> node scripts/audit-x402-catalog.mjs
+
+✓ audit-x402-catalog: all 92 x402 endpoints are documented
+
+> [email protected] audit:tokens
+> node scripts/audit-token-drift.mjs
+
+✓ token drift unchanged: 0 hardcoded token-hex(es) (baseline 0).
diff --git a/prompts/roadmap/_generated/creation-consolidation/gate-after.txt b/prompts/roadmap/_generated/creation-consolidation/gate-after.txt
new file mode 100644
index 000000000..0ffb89931
--- /dev/null
+++ b/prompts/roadmap/_generated/creation-consolidation/gate-after.txt
@@ -0,0 +1,81 @@
+
+> npm run test:gate && npm run test:gate-3d && npm run audit:mcp && npm run audit:mcp-golden && npm run audit:routes && npm run audit:handlers && npm run audit:pages && npm run audit:hidden-guard && npm run audit:x402-catalog && npm run audit:tokens
+
+
+> [email protected] test:gate
+> node scripts/test-gate.mjs
+
+[test-gate] running 7 critical-path test files…
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 7 passed (7)
+ Tests 86 passed (86)
+ Start at 17:03:41
+ Duration 2.69s (transform 898ms, setup 0ms, import 2.09s, tests 2.69s, environment 1ms)
+
+[test-gate] ✓ all critical-path tests passed
+
+> [email protected] test:gate-3d
+> vitest run tests/glb-canonicalize.test.js tests/animation-retarget.test.js tests/animation-retarget-rest-pollution.test.js tests/viewer-framing.test.js
+
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 4 passed (4)
+ Tests 244 passed (244)
+ Start at 17:03:44
+ Duration 416ms (transform 214ms, setup 0ms, import 534ms, tests 236ms, environment 1ms)
+
+
+> [email protected] audit:mcp
+> node scripts/audit-mcp-manifests.mjs
+
+[audit:mcp] 16 MCP manifests consistent
+
+> [email protected] audit:mcp-golden
+> node scripts/audit-mcp-golden.mjs
+
+[audit:mcp-golden] 236 hosted MCP tool contracts match the golden fixture
+
+> [email protected] audit:routes
+> node scripts/verify-routes.mjs
+
+Route verify — 328 catalog pages, 1110 main routes, 1 post-filesystem routes.
+ modeled dist files: 1622 · canonical-covered: 328 · literal page routes checked for shadows: 479
+ filesystem boundary (handle:filesystem) present: yes
+
+✓ static checks pass: every catalog page reachable, unknown paths → designed 404, no shadowed page routes.
+
+> [email protected] audit:handlers
+> node scripts/audit-empty-handlers.mjs
+
+✓ audit-empty-handlers: all API handlers export a body (1754 checked)
+
+> [email protected] audit:pages
+> node scripts/audit-page-index.mjs
+
+Route audit: 145 auditable page routes, 328 documented in pages.json.
+✓ Every auditable page route is documented.
+
+ℹ 6 manifest page(s) have no `added` date (omitted from /changelog). Fine for legacy pages; add dates as you touch them.
+
+> [email protected] audit:hidden-guard
+> node scripts/audit-hidden-guard.mjs
+
+✓ audit-hidden-guard: all 291 pages resolve the [hidden] guard
+
+> [email protected] audit:x402-catalog
+> node scripts/audit-x402-catalog.mjs
+
+
+✗ 1 x402 endpoint(s) missing from docs/x402-endpoints.md:
+
+ /api/x402/robinhood-portfolio
+
+Every api/x402/*.js endpoint must be listed in the catalog (docs/x402-endpoints.md).
+Add a row with its slug, default price, and what it returns — see the existing tables.
+
diff --git a/prompts/roadmap/_generated/developer-resources/gate-after.txt b/prompts/roadmap/_generated/developer-resources/gate-after.txt
new file mode 100644
index 000000000..52a3f80e0
--- /dev/null
+++ b/prompts/roadmap/_generated/developer-resources/gate-after.txt
@@ -0,0 +1,79 @@
+
+> npm run test:gate && npm run test:gate-3d && npm run audit:mcp && npm run audit:mcp-golden && npm run audit:routes && npm run audit:handlers && npm run audit:pages && npm run audit:hidden-guard && npm run audit:x402-catalog && npm run audit:tokens
+
+
+> [email protected] test:gate
+> node scripts/test-gate.mjs
+
+[test-gate] running 7 critical-path test files…
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 7 passed (7)
+ Tests 86 passed (86)
+ Start at 18:21:39
+ Duration 2.67s (transform 1.07s, setup 0ms, import 2.37s, tests 2.68s, environment 1ms)
+
+[test-gate] ✓ all critical-path tests passed
+
+> [email protected] test:gate-3d
+> vitest run tests/glb-canonicalize.test.js tests/animation-retarget.test.js tests/animation-retarget-rest-pollution.test.js tests/viewer-framing.test.js
+
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 4 passed (4)
+ Tests 244 passed (244)
+ Start at 18:21:42
+ Duration 384ms (transform 260ms, setup 0ms, import 528ms, tests 218ms, environment 1ms)
+
+
+> [email protected] audit:mcp
+> node scripts/audit-mcp-manifests.mjs
+
+[audit:mcp] 16 MCP manifests consistent
+
+> [email protected] audit:mcp-golden
+> node scripts/audit-mcp-golden.mjs
+
+[audit:mcp-golden] 236 hosted MCP tool contracts match the golden fixture
+
+> [email protected] audit:routes
+> node scripts/verify-routes.mjs
+
+Route verify — 330 catalog pages, 1112 main routes, 1 post-filesystem routes.
+ modeled dist files: 1627 · canonical-covered: 330 · literal page routes checked for shadows: 481
+ filesystem boundary (handle:filesystem) present: yes
+
+✓ static checks pass: every catalog page reachable, unknown paths → designed 404, no shadowed page routes.
+
+> [email protected] audit:handlers
+> node scripts/audit-empty-handlers.mjs
+
+✓ audit-empty-handlers: all API handlers export a body (1759 checked)
+
+> [email protected] audit:pages
+> node scripts/audit-page-index.mjs
+
+Route audit: 145 auditable page routes, 330 documented in pages.json.
+✓ Every auditable page route is documented.
+
+ℹ 6 manifest page(s) have no `added` date (omitted from /changelog). Fine for legacy pages; add dates as you touch them.
+
+> [email protected] audit:hidden-guard
+> node scripts/audit-hidden-guard.mjs
+
+✓ audit-hidden-guard: all 293 pages resolve the [hidden] guard
+
+> [email protected] audit:x402-catalog
+> node scripts/audit-x402-catalog.mjs
+
+✓ audit-x402-catalog: all 92 x402 endpoints are documented
+
+> [email protected] audit:tokens
+> node scripts/audit-token-drift.mjs
+
+✓ token drift unchanged: 0 hardcoded token-hex(es) (baseline 0).
diff --git a/prompts/roadmap/_generated/developer-resources/gate-before.txt b/prompts/roadmap/_generated/developer-resources/gate-before.txt
new file mode 100644
index 000000000..ef6a5e4b1
--- /dev/null
+++ b/prompts/roadmap/_generated/developer-resources/gate-before.txt
@@ -0,0 +1,79 @@
+
+> npm run test:gate && npm run test:gate-3d && npm run audit:mcp && npm run audit:mcp-golden && npm run audit:routes && npm run audit:handlers && npm run audit:pages && npm run audit:hidden-guard && npm run audit:x402-catalog && npm run audit:tokens
+
+
+> [email protected] test:gate
+> node scripts/test-gate.mjs
+
+[test-gate] running 7 critical-path test files…
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 7 passed (7)
+ Tests 86 passed (86)
+ Start at 18:13:58
+ Duration 2.69s (transform 984ms, setup 0ms, import 2.18s, tests 2.67s, environment 1ms)
+
+[test-gate] ✓ all critical-path tests passed
+
+> [email protected] test:gate-3d
+> vitest run tests/glb-canonicalize.test.js tests/animation-retarget.test.js tests/animation-retarget-rest-pollution.test.js tests/viewer-framing.test.js
+
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 4 passed (4)
+ Tests 244 passed (244)
+ Start at 18:14:01
+ Duration 354ms (transform 186ms, setup 0ms, import 462ms, tests 216ms, environment 0ms)
+
+
+> [email protected] audit:mcp
+> node scripts/audit-mcp-manifests.mjs
+
+[audit:mcp] 16 MCP manifests consistent
+
+> [email protected] audit:mcp-golden
+> node scripts/audit-mcp-golden.mjs
+
+[audit:mcp-golden] 236 hosted MCP tool contracts match the golden fixture
+
+> [email protected] audit:routes
+> node scripts/verify-routes.mjs
+
+Route verify — 330 catalog pages, 1112 main routes, 1 post-filesystem routes.
+ modeled dist files: 1626 · canonical-covered: 330 · literal page routes checked for shadows: 481
+ filesystem boundary (handle:filesystem) present: yes
+
+✓ static checks pass: every catalog page reachable, unknown paths → designed 404, no shadowed page routes.
+
+> [email protected] audit:handlers
+> node scripts/audit-empty-handlers.mjs
+
+✓ audit-empty-handlers: all API handlers export a body (1759 checked)
+
+> [email protected] audit:pages
+> node scripts/audit-page-index.mjs
+
+Route audit: 145 auditable page routes, 330 documented in pages.json.
+✓ Every auditable page route is documented.
+
+ℹ 6 manifest page(s) have no `added` date (omitted from /changelog). Fine for legacy pages; add dates as you touch them.
+
+> [email protected] audit:hidden-guard
+> node scripts/audit-hidden-guard.mjs
+
+✓ audit-hidden-guard: all 293 pages resolve the [hidden] guard
+
+> [email protected] audit:x402-catalog
+> node scripts/audit-x402-catalog.mjs
+
+✓ audit-x402-catalog: all 92 x402 endpoints are documented
+
+> [email protected] audit:tokens
+> node scripts/audit-token-drift.mjs
+
+✓ token drift unchanged: 0 hardcoded token-hex(es) (baseline 0).
diff --git a/prompts/roadmap/_generated/pumpfun-wedge/gate-after.txt b/prompts/roadmap/_generated/pumpfun-wedge/gate-after.txt
new file mode 100644
index 000000000..a3896b66a
--- /dev/null
+++ b/prompts/roadmap/_generated/pumpfun-wedge/gate-after.txt
@@ -0,0 +1,79 @@
+
+> npm run test:gate && npm run test:gate-3d && npm run audit:mcp && npm run audit:mcp-golden && npm run audit:routes && npm run audit:handlers && npm run audit:pages && npm run audit:hidden-guard && npm run audit:x402-catalog && npm run audit:tokens
+
+
+> [email protected] test:gate
+> node scripts/test-gate.mjs
+
+[test-gate] running 7 critical-path test files…
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 7 passed (7)
+ Tests 86 passed (86)
+ Start at 18:10:45
+ Duration 2.75s (transform 1.13s, setup 0ms, import 2.47s, tests 2.71s, environment 1ms)
+
+[test-gate] ✓ all critical-path tests passed
+
+> [email protected] test:gate-3d
+> vitest run tests/glb-canonicalize.test.js tests/animation-retarget.test.js tests/animation-retarget-rest-pollution.test.js tests/viewer-framing.test.js
+
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 4 passed (4)
+ Tests 244 passed (244)
+ Start at 18:10:48
+ Duration 390ms (transform 209ms, setup 0ms, import 496ms, tests 219ms, environment 1ms)
+
+
+> [email protected] audit:mcp
+> node scripts/audit-mcp-manifests.mjs
+
+[audit:mcp] 16 MCP manifests consistent
+
+> [email protected] audit:mcp-golden
+> node scripts/audit-mcp-golden.mjs
+
+[audit:mcp-golden] 236 hosted MCP tool contracts match the golden fixture
+
+> [email protected] audit:routes
+> node scripts/verify-routes.mjs
+
+Route verify — 330 catalog pages, 1112 main routes, 1 post-filesystem routes.
+ modeled dist files: 1626 · canonical-covered: 330 · literal page routes checked for shadows: 481
+ filesystem boundary (handle:filesystem) present: yes
+
+✓ static checks pass: every catalog page reachable, unknown paths → designed 404, no shadowed page routes.
+
+> [email protected] audit:handlers
+> node scripts/audit-empty-handlers.mjs
+
+✓ audit-empty-handlers: all API handlers export a body (1759 checked)
+
+> [email protected] audit:pages
+> node scripts/audit-page-index.mjs
+
+Route audit: 145 auditable page routes, 330 documented in pages.json.
+✓ Every auditable page route is documented.
+
+ℹ 6 manifest page(s) have no `added` date (omitted from /changelog). Fine for legacy pages; add dates as you touch them.
+
+> [email protected] audit:hidden-guard
+> node scripts/audit-hidden-guard.mjs
+
+✓ audit-hidden-guard: all 293 pages resolve the [hidden] guard
+
+> [email protected] audit:x402-catalog
+> node scripts/audit-x402-catalog.mjs
+
+✓ audit-x402-catalog: all 92 x402 endpoints are documented
+
+> [email protected] audit:tokens
+> node scripts/audit-token-drift.mjs
+
+✓ token drift unchanged: 0 hardcoded token-hex(es) (baseline 0).
diff --git a/prompts/roadmap/_generated/pumpfun-wedge/gate-before.txt b/prompts/roadmap/_generated/pumpfun-wedge/gate-before.txt
new file mode 100644
index 000000000..0e76dd495
--- /dev/null
+++ b/prompts/roadmap/_generated/pumpfun-wedge/gate-before.txt
@@ -0,0 +1,80 @@
+
+> npm run test:gate && npm run test:gate-3d && npm run audit:mcp && npm run audit:mcp-golden && npm run audit:routes && npm run audit:handlers && npm run audit:pages && npm run audit:hidden-guard && npm run audit:x402-catalog && npm run audit:tokens
+
+
+> [email protected] test:gate
+> node scripts/test-gate.mjs
+
+[test-gate] running 7 critical-path test files…
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 7 passed (7)
+ Tests 86 passed (86)
+ Start at 17:28:27
+ Duration 2.67s (transform 1.06s, setup 0ms, import 2.38s, tests 2.70s, environment 1ms)
+
+[test-gate] ✓ all critical-path tests passed
+
+> [email protected] test:gate-3d
+> vitest run tests/glb-canonicalize.test.js tests/animation-retarget.test.js tests/animation-retarget-rest-pollution.test.js tests/viewer-framing.test.js
+
+
+ RUN v4.1.9 /workspaces/three.ws
+
+
+ Test Files 4 passed (4)
+ Tests 244 passed (244)
+ Start at 17:28:30
+ Duration 382ms (transform 173ms, setup 0ms, import 464ms, tests 222ms, environment 1ms)
+
+
+> [email protected] audit:mcp
+> node scripts/audit-mcp-manifests.mjs
+
+[audit:mcp] 16 MCP manifests consistent
+
+> [email protected] audit:mcp-golden
+> node scripts/audit-mcp-golden.mjs
+
+[audit:mcp-golden] 236 hosted MCP tool contracts match the golden fixture
+
+> [email protected] audit:routes
+> node scripts/verify-routes.mjs
+
+Route verify — 328 catalog pages, 1110 main routes, 1 post-filesystem routes.
+ modeled dist files: 1622 · canonical-covered: 328 · literal page routes checked for shadows: 479
+ filesystem boundary (handle:filesystem) present: yes
+
+✓ static checks pass: every catalog page reachable, unknown paths → designed 404, no shadowed page routes.
+
+> [email protected] audit:handlers
+> node scripts/audit-empty-handlers.mjs
+
+✓ audit-empty-handlers: all API handlers export a body (1754 checked)
+
+> [email protected] audit:pages
+> node scripts/audit-page-index.mjs
+
+Route audit: 145 auditable page routes, 328 documented in pages.json.
+✓ Every auditable page route is documented.
+
+ℹ 6 manifest page(s) have no `added` date (omitted from /changelog). Fine for legacy pages; add dates as you touch them.
+
+> [email protected] audit:hidden-guard
+> node scripts/audit-hidden-guard.mjs
+
+✓ audit-hidden-guard: all 291 pages resolve the [hidden] guard
+
+> [email protected] audit:x402-catalog
+> node scripts/audit-x402-catalog.mjs
+
+✓ audit-x402-catalog: all 92 x402 endpoints are documented
+
+> [email protected] audit:tokens
+> node scripts/audit-token-drift.mjs
+
+✓ token drift unchanged: 0 hardcoded token-hex(es) (baseline 0).
+EXIT: 0
diff --git a/prompts/roadmap/creation-consolidation.md b/prompts/roadmap/creation-consolidation.md
index 3440c575f..a2748da05 100644
--- a/prompts/roadmap/creation-consolidation.md
+++ b/prompts/roadmap/creation-consolidation.md
@@ -1,6 +1,6 @@
# Creation Surface Consolidation — Audit & Plan
-**Status:** Phase 1 (additive hub) shipped 2026-07-08. Phase 2 executed 2026-07-16 for everything that survived re-verification against the live tree; several table rows turned out stale or unsafe (see the 07-16 note).
+**Status:** Phase 1 (additive hub) shipped 2026-07-08. Phase 2 executed 2026-07-16 for everything that survived re-verification against the live tree; several table rows turned out stale or unsafe (see the 07-16 note). Phase 3 (§3.3 pipeline handoffs) executed 2026-07-16 (see the Phase 3 note).
**Audited:** 2026-06-12
---
@@ -49,7 +49,22 @@ Every §2/§4 cluster was re-verified against the tree before acting; the June a
- **C5:** `/create-prompt` is not stranded; it is the nav-linked "Describe it to 3D" surface served at `/create/prompt`. `/create-review` is the live review step of the create flow (`src/create.js` navigates to it). `/avatar-studio-demo` is already deleted (no page, no route). `/avatar-embed` is the iframe target behind `/embed/avatar` used by SDK embeds; it must not be retired.
- **C4:** `/avatar-edit` is orphaned but Avatar Studio has no edit mode (`avatar-studio.html` reads no URL params), so `301 /avatar-edit -> /avatar-studio?mode=edit&id=` has no working destination; redirecting would silently lose edit-by-id for bookmarked URLs. Left live. `/import/rpm` stays as a page: the hub links it as the import option and it supports URL import the hub's upload card does not.
-**Still open for future passes:** the `/agent/new` 301 (blocked until `/create-agent` supports the avatar handoff params), the C1 single-URL merge (§5.1 owner decision), `/avatar-edit` retirement (needs an Avatar Studio edit mode), the `/embed` -> `/studio` merge (needs feature parity in `/studio`), and the remaining Phase 3 handoffs.
+**Still open for future passes:** the `/agent/new` 301 (blocked until `/create-agent` supports the avatar handoff params), the C1 single-URL merge (§5.1 owner decision), `/avatar-edit` retirement (needs an Avatar Studio edit mode), the `/embed` -> `/studio` merge (needs feature parity in `/studio`).
+
+## Progress note: 2026-07-16 (Phase 3 pass — pipeline handoffs, §3.3)
+
+Phase 3 wires the completion-state handoffs from §3.3 that were still missing, all additive (new CTAs on existing "done" states; no routes, redirects, or existing behavior changed):
+
+**Executed:**
+- **Row 1 (photo->avatar -> agent):** the `/create/selfie` done state gains a "Turn this into an agent" button that PATCHes the avatar name (when set) then navigates to `/agent/new?avatar_id=&avatar_name=&avatar_glb=` with the just-built body pre-selected, reusing the exact hand-off the marketplace's `startAgentFromAvatar()` already uses (agent-edit.js consumes those params). `/scan` inherits this automatically since it now `location.replace()`s to `/create/selfie`.
+- **Row 2 (agent -> deploy):** the `/create-agent` wizard success screen gains a "Take it further" row with four next-stage links: "Give it a voice" -> `/voice`, "Embed it anywhere" -> `/studio` (pre-loaded with the agent's 3D body via `?model=` when publicly readable), "Put it in a world" -> `/play`, "Launch its token" -> `/launchpad`.
+- **Row 3 (voice -> agent):** the `/voice` clone-done state gains an "Add to an agent" link to `/dashboard`, where any agent's editor voice tab picks up the new clone.
+
+**Found already done (no action):**
+- **Row 4 (studio snippet -> playground + agent detail):** `/studio` already links `/playground` (shipped in the 07-16 Phase 2 commit).
+- **Row 5 (avatar detail -> edit):** `avatar-page.js` already offers an owner "Edit avatar" button to `/create/studio?edit=ID` (Avatar Studio's edit mode), plus Voice Lab and "Open in Studio" CTAs.
+
+**Still open:** the same route-level items listed in the Phase 2 note (the `/agent/new` 301, the C1 single-URL merge, `/avatar-edit` retirement, and the `/embed` -> `/studio` merge) all remain owner/parity-gated and were not touched.
---
diff --git a/public/features.json b/public/features.json
index dd4442eeb..798b8c4dc 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-16T16:49:59.107Z",
+ "generated_at": "2026-07-16T18:23:47.396Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -1236,6 +1236,26 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/meta-allocator",
+ "title": "Meta-Allocator: the ETF of degens",
+ "description": "Do not pick a coin, pick a basket of proven traders. The Meta-Allocator spreads a budget across the top verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and diversified across trading styles, then tells you how to rebalance. Non-custodial: it returns a plan you act on one leader at a time, never a transaction.",
+ "added": "2026-07-16",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
+ {
+ "path": "/clip-director",
+ "title": "Clip Director: every trade becomes content",
+ "description": "Turn any trader agent's real closed pump.fun trade into the optimal shareable card per surface (X, Telegram, or the in-app Feed): an honest hook, the real number, an avatar reaction, and an on-chain proof link. Wins and losses both get a card.",
+ "added": "2026-07-16",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/pay",
"title": "Pay (x402)",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index 86a87c0bb..0f29a1f38 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -753,6 +753,18 @@ URL: https://three.ws/claim-wallet
Paste your Solana wallet to see your provable pump.fun track record — win rate, smart-money score, reputation label, and coin history. Sign in to claim it as your official three.ws Trader Card.
+### Meta-Allocator: the ETF of degens
+
+URL: https://three.ws/meta-allocator
+
+Do not pick a coin, pick a basket of proven traders. The Meta-Allocator spreads a budget across the top verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and diversified across trading styles, then tells you how to rebalance. Non-custodial: it returns a plan you act on one leader at a time, never a transaction.
+
+### Clip Director: every trade becomes content
+
+URL: https://three.ws/clip-director
+
+Turn any trader agent's real closed pump.fun trade into the optimal shareable card per surface (X, Telegram, or the in-app Feed): an honest hook, the real number, an avatar reaction, and an on-chain proof link. Wins and losses both get a card.
+
### Pay (x402)
URL: https://three.ws/pay
diff --git a/public/llms.txt b/public/llms.txt
index 0423e46c6..4930f0bba 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -141,6 +141,8 @@ On-chain features: pay-per-call, token launches, vanity wallets.
- [Trending — Top Agents & Coins on three.ws](https://three.ws/trending): What’s hot on three.ws right now. Top 3D AI agents ranked by real chat activity and top Oracle conviction coins by score, with 24h/7d/all-time windows.
- [Live Trade Feed — Notable pump.fun Exits](https://three.ws/trades): Real-time feed of every notable pump.fun exit from three.ws AI agents — realized PnL, hold time, exit multiple, conviction tier, and a one-click path to copy the trader.
- [Claim Your Wallet — Verified pump.fun Track Record](https://three.ws/claim-wallet): Paste your Solana wallet to see your provable pump.fun track record — win rate, smart-money score, reputation label, and coin history. Sign in to claim it as your official three.ws Trader Card.
+- [Meta-Allocator: the ETF of degens](https://three.ws/meta-allocator): Do not pick a coin, pick a basket of proven traders. The Meta-Allocator spreads a budget across the top verified pump.fun trader agents, ranked by risk-adjusted on-chain track record and diversified across trading styles, then tells you how to rebalance. Non-custodial: it returns a plan you act on one leader at a time, never a transaction.
+- [Clip Director: every trade becomes content](https://three.ws/clip-director): Turn any trader agent's real closed pump.fun trade into the optimal shareable card per surface (X, Telegram, or the in-app Feed): an honest hook, the real number, an avatar reaction, and an on-chain proof link. Wins and losses both get a card.
- [Pay (x402)](https://three.ws/pay): Pay-per-call gateway: invoke any x402-protocol paid API with a USDC micro-transaction.
- [x402 Studio — the Stripe of x402](https://three.ws/x402/studio): Merchant console to run a paid x402 business: products and pricing, payout and agent wallets, a real USDC send/receive with SNS .sol resolution, a drag-and-drop storefront, an embeddable pay-button builder, charity and round-up giving, CORS and security.
- [Agent Wallet (x402 on Solana)](https://three.ws/play/agent-wallet): Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.
diff --git a/scripts/export-examples.mjs b/scripts/export-examples.mjs
new file mode 100644
index 000000000..70b2429be
--- /dev/null
+++ b/scripts/export-examples.mjs
@@ -0,0 +1,372 @@
+#!/usr/bin/env node
+// One-way export: assemble the public `three-ws/examples` satellite repo from the
+// monorepo. This script is the ONLY sanctioned way to build that repo's contents.
+//
+// node scripts/export-examples.mjs # build into dist/examples-repo/
+// node scripts/export-examples.mjs --out DIR # build into a custom directory
+// node scripts/export-examples.mjs --smoke # additionally npm-install + check each example
+//
+// It is idempotent (wipes and rebuilds the output dir on every run) and offline
+// by default. It copies a CURATED subset of real monorepo material into the
+// satellite layout, rewriting every monorepo-relative reference to a working
+// surface (published @three-ws/* npm packages, or hosted https://three.ws URLs)
+// so nothing points back into the monorepo. Nothing here pushes, commits, or
+// creates a repo: the output is a plain directory the owner publishes by hand
+// (see docs/ops/examples-repo-export.md). Satellites are strictly one-way: the
+// monorepo is the source of truth and the satellite history is disposable.
+//
+// Why a local script and not CI: GitHub Actions are unavailable on this account
+// (all workflows deleted), so the satellite-sync must run from the local push
+// routine or it rots. See prompts/roadmap/developer-resources-repos.md.
+
+import {
+ cpSync, rmSync, mkdirSync, writeFileSync, readFileSync, existsSync, readdirSync, statSync,
+} from 'node:fs';
+import { join, dirname, basename, relative } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { execFileSync } from 'node:child_process';
+
+const HERE = dirname(fileURLToPath(import.meta.url));
+const REPO = join(HERE, '..');
+
+const argv = process.argv.slice(2);
+const OUT = (() => {
+ const i = argv.indexOf('--out');
+ if (i !== -1 && argv[i + 1]) return join(process.cwd(), argv[i + 1]);
+ return join(REPO, 'dist', 'examples-repo');
+})();
+const SMOKE = argv.includes('--smoke');
+
+const HOST = 'https://three.ws';
+const MONOREPO_URL = 'https://github.com/nirholas/three.ws';
+
+// ---------------------------------------------------------------------------
+// Published package versions (read live from each package's own package.json),
+// so a version bump in the monorepo flows into the exported examples with no
+// edit here. These are the packages the examples install (Phase 0 resolved:
+// all @three-ws/* are published on npm).
+// ---------------------------------------------------------------------------
+const pkgVersion = (dir) => JSON.parse(readFileSync(join(REPO, dir, 'package.json'), 'utf8')).version;
+
+// monorepo dir (a `file:` dep target's basename) -> published package name
+const FILE_DEP_MAP = {
+ 'sdk': '@three-ws/sdk',
+ 'solana-agent-sdk': '@three-ws/solana-agent',
+ 'agent-payments-sdk': '@three-ws/agent-payments',
+ 'agent-protocol-sdk': '@three-ws/agent-protocol-sdk',
+ 'agent-ui-sdk': '@three-ws/agent-ui',
+ 'avatar-sdk': '@three-ws/avatar',
+ 'mcp-server': '@three-ws/mcp-server',
+};
+const PKG_VERSION = Object.fromEntries(
+ Object.entries(FILE_DEP_MAP).map(([dir, name]) => [name, pkgVersion(dir)]),
+);
+
+// ---------------------------------------------------------------------------
+// Reference rewriting: every monorepo-relative path in a copied file becomes a
+// working surface. Ordered longest-prefix first so two-level `../../` never gets
+// half-rewritten by the one-level `../` rule.
+// ---------------------------------------------------------------------------
+function rewriteRefs(text) {
+ return text
+ // docs links -> live docs pages (drop the .md, docs render at /docs/<slug>)
+ .replace(/\.\.\/\.\.\/docs\/([a-z0-9-]+)\.md/gi, `${HOST}/docs/$1`)
+ .replace(/\.\.\/docs\/([a-z0-9-]+)\.md/gi, `${HOST}/docs/$1`)
+ // monorepo source imports -> hosted raw modules (all resolve 200 today)
+ .replace(/\.\.\/\.\.\/src\//g, `${HOST}/src/`)
+ .replace(/\.\.\/src\//g, `${HOST}/src/`)
+ // root-relative site assets -> absolute hosted URLs
+ .replace(/(["'(=])\/avatars\//g, `$1${HOST}/avatars/`)
+ .replace(/(["'(=])\/dist-lib\//g, `$1${HOST}/dist-lib/`)
+ .replace(/(["'(=])\/src\//g, `$1${HOST}/src/`);
+}
+
+// Rewrite `file:` workspace deps in a package.json string to published semver.
+function rewritePkgJson(text) {
+ const pkg = JSON.parse(text);
+ for (const field of ['dependencies', 'devDependencies']) {
+ const deps = pkg[field];
+ if (!deps) continue;
+ for (const [name, spec] of Object.entries(deps)) {
+ if (typeof spec === 'string' && spec.startsWith('file:')) {
+ const targetDir = basename(spec.replace(/^file:/, ''));
+ const published = FILE_DEP_MAP[targetDir];
+ if (!published) throw new Error(`Unmapped file: dependency ${name} -> ${spec}`);
+ deps[name] = `^${PKG_VERSION[published]}`;
+ }
+ }
+ }
+ return JSON.stringify(pkg, null, '\t') + '\n';
+}
+
+// ---------------------------------------------------------------------------
+// Copy helpers
+// ---------------------------------------------------------------------------
+const REWRITE_EXT = new Set(['.html', '.md', '.mjs', '.js', '.json']);
+const extname = (p) => (p.match(/\.[^./]+$/) || [''])[0];
+
+function writeOut(relPath, content) {
+ const dest = join(OUT, relPath);
+ mkdirSync(dirname(dest), { recursive: true });
+ writeFileSync(dest, content);
+}
+
+// Copy a monorepo file into the satellite, applying reference/pkg rewrites and
+// optional per-file extra transforms.
+function copyFile(fromRel, toRel, { extra } = {}) {
+ const src = join(REPO, fromRel);
+ let content = readFileSync(src, 'utf8');
+ if (extra) content = extra(content);
+ if (basename(toRel) === 'package.json') content = rewritePkgJson(content);
+ else if (REWRITE_EXT.has(extname(toRel))) content = rewriteRefs(content);
+ writeOut(toRel, content);
+}
+
+// Recursively copy a monorepo dir, rewriting text files, skipping build cruft.
+const SKIP = new Set(['node_modules', 'dist', '.cache', '.git', 'package-lock.json']);
+function copyDir(fromRel, toRel, { extra } = {}) {
+ const srcDir = join(REPO, fromRel);
+ for (const name of readdirSync(srcDir)) {
+ if (SKIP.has(name)) continue;
+ const childFrom = join(fromRel, name);
+ const childTo = join(toRel, name);
+ if (statSync(join(REPO, childFrom)).isDirectory()) {
+ copyDir(childFrom, childTo, { extra });
+ } else if (REWRITE_EXT.has(extname(name))) {
+ copyFile(childFrom, childTo, { extra });
+ } else {
+ const dest = join(OUT, childTo);
+ mkdirSync(dirname(dest), { recursive: true });
+ cpSync(join(REPO, childFrom), dest);
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// The curated manifest: the single source of what the satellite contains.
+// ---------------------------------------------------------------------------
+const AGENTS = [
+ { dir: 'coach-leo', title: 'Coach Leo', shows: 'A full character agent: system prompt, manifest, and skill wiring.', run: 'Load into the three.ws agent builder (instructions.md + manifest.json).' },
+ { dir: 'pump-fun-agent', title: 'pump.fun agent', shows: 'An agent wired to the live pump.fun feed for buys, sells, launches, and creator fees.', run: 'Load instructions.md + manifest.json into an agent runtime with the pump.fun skills.' },
+ { dir: 'three-concierge', title: 'Three Concierge (Trinity)', shows: 'An embedded concierge agent with an agent-card and on-chain identity.', run: 'Load instructions.md + manifest.json; embed via the agent-card.json.' },
+ { dir: 'metamask-agent-wallet', title: 'MetaMask agent wallet', shows: 'A wallet-connected agent: a localhost bridge exposing the MetaMask Agentic CLI to a demo page.', run: 'node server.mjs, then open index.html at http://localhost:4280' },
+];
+
+const QUICKSTARTS = [
+ { slug: 'sdk', pkg: '@three-ws/sdk', srcDir: 'sdk', readme: 'sdk/README.md', section: /^## Quick start/m, exampleDir: 'sdk/example', blurb: 'The core three.ws SDK: build an agent, embed a 3D avatar, register on-chain.' },
+ { slug: 'solana-agent-sdk', pkg: '@three-ws/solana-agent', srcDir: 'solana-agent-sdk', readme: 'solana-agent-sdk/README.md', section: /^## Quick start/m, blurb: 'Solana-native agent actions, wallet providers, and x402 exact payments.' },
+ { slug: 'agent-payments-sdk', pkg: '@three-ws/agent-payments', srcDir: 'agent-payments-sdk', readme: 'agent-payments-sdk/README.md', section: /^## Quick start/m, blurb: 'Agent-to-agent payments over x402 and a2a on Solana and EVM.' },
+ { slug: 'mcp-server', pkg: '@three-ws/mcp-server', srcDir: 'mcp-server', readme: 'mcp-server/README.md', section: /^## Quickstart \(30 seconds\)/m, blurb: 'The three.ws MCP server: 3D generation, Solana, markets, and agent tools in Claude/Cursor.' },
+];
+
+const EMBEDS = [
+ { file: 'minimal.html', shows: 'The smallest possible avatar embed (one script tag).' },
+ { file: 'two-agents.html', shows: 'Two avatars on one page.' },
+ { file: 'web-component.html', shows: 'The <mv-viewer> web component with multiple GLBs.' },
+ { file: 'widget-rpc.html', shows: 'Driving an embedded avatar over the widget RPC bridge.' },
+];
+
+const TUTORIALS = [
+ { dir: 'agenc-task-roundtrip', title: 'AgenC task roundtrip', shows: 'End-to-end AgenC task lifecycle on Solana devnet, all real on-chain transactions.', run: 'npm install && npm start' },
+ {
+ dir: 'agent-native-3d',
+ title: 'Agent-native 3D',
+ shows: 'An agent generates, rigs, embodies, and distributes a 3D creation end to end via the free MCP tools.',
+ run: 'npm install && npm start',
+ // Vendor the shared embed-snippet builders and localise the output path so
+ // the script is self-contained (no monorepo src/ or _generated/ dependency).
+ vendor: [{ from: 'src/forge-embed-snippets.js', to: 'lib/forge-embed-snippets.js' }],
+ runTransform: (t) => t
+ .replaceAll("'../../src/forge-embed-snippets.js'", "'./lib/forge-embed-snippets.js'")
+ .replaceAll('../../src/forge-embed-snippets.js', './lib/forge-embed-snippets.js')
+ .replaceAll("resolve(HERE, '../..')", 'HERE')
+ .replaceAll("'prompts/roadmap/_generated/10'", "'out'"),
+ },
+];
+
+// Extract the content of a `## Heading` section up to the next `## ` heading.
+function extractSection(readmeRel, headingRe) {
+ const text = readFileSync(join(REPO, readmeRel), 'utf8');
+ const start = text.search(headingRe);
+ if (start === -1) return '';
+ const after = text.slice(start);
+ const nextH2 = after.slice(1).search(/^## /m);
+ const body = nextH2 === -1 ? after : after.slice(0, nextH2 + 1);
+ return rewriteRefs(body.trim());
+}
+
+// ---------------------------------------------------------------------------
+// Build
+// ---------------------------------------------------------------------------
+console.log(`Exporting satellite → ${relative(process.cwd(), OUT) || OUT}`);
+rmSync(OUT, { recursive: true, force: true });
+mkdirSync(OUT, { recursive: true });
+
+// LICENSE (carried verbatim from the monorepo). The owner should confirm or
+// replace this before publishing the repo publicly (see the ops runbook).
+copyFile('LICENSE', 'LICENSE');
+
+// .gitignore for the satellite working tree.
+writeOut('.gitignore', ['node_modules/', '.cache/', 'out/', 'dist/', '.DS_Store', ''].join('\n'));
+
+// agents/
+for (const a of AGENTS) {
+ copyDir(`examples/${a.dir}`, `agents/${a.dir}`);
+ if (!existsSync(join(OUT, 'agents', a.dir, 'README.md'))) {
+ writeOut(`agents/${a.dir}/README.md`, [
+ `# ${a.title}`,
+ '',
+ a.shows,
+ '',
+ '## Run',
+ '',
+ '```',
+ a.run,
+ '```',
+ '',
+ `Source of truth: the [three.ws monorepo](${MONOREPO_URL}). Issues and PRs belong there.`,
+ `Docs: ${HOST}/docs`,
+ '',
+ ].join('\n'));
+ }
+}
+
+// embeds/
+for (const e of EMBEDS) copyFile(`examples/${e.file}`, `embeds/${e.file}`);
+writeOut('embeds/README.md', [
+ '# Embeds',
+ '',
+ 'Single-file HTML patterns for putting a three.ws 3D avatar on any page. Every',
+ `asset URL points at ${HOST}. Open any file directly in a browser, no build step.`,
+ '',
+ '| File | Shows |',
+ '|---|---|',
+ ...EMBEDS.map((e) => `| [\`${e.file}\`](${e.file}) | ${e.shows} |`),
+ '',
+].join('\n'));
+
+// quickstarts/
+for (const q of QUICKSTARTS) {
+ const version = PKG_VERSION[q.pkg];
+ const section = extractSection(q.readme, q.section);
+ if (q.exampleDir) copyDir(q.exampleDir, `quickstarts/${q.slug}/example`);
+ writeOut(`quickstarts/${q.slug}/README.md`, [
+ `# ${q.pkg} quickstart`,
+ '',
+ q.blurb,
+ '',
+ '## Install',
+ '',
+ '```bash',
+ `npm install ${q.pkg}@^${version}`,
+ '```',
+ '',
+ section,
+ '',
+ '---',
+ '',
+ `Package: https://www.npmjs.com/package/${q.pkg} · Docs: ${HOST}/docs`,
+ `Source of truth: the [three.ws monorepo](${MONOREPO_URL}). Issues and PRs belong there.`,
+ q.exampleDir ? `\nRunnable browser demo under [\`example/\`](example/).` : '',
+ '',
+ ].join('\n'));
+}
+
+// tutorials/
+for (const t of TUTORIALS) {
+ copyDir(`examples/${t.dir}`, `tutorials/${t.dir}`, { extra: t.runTransform });
+ for (const v of t.vendor || []) copyFile(v.from, `tutorials/${t.dir}/${v.to}`);
+}
+
+// Root README: the index the whole repo is discovered through.
+const row = (name, path, shows, run) => `| [${name}](${path}) | ${shows} | \`${run}\` |`;
+writeOut('README.md', [
+ '# three.ws examples',
+ '',
+ 'Runnable examples, SDK quickstarts, and embed patterns for [three.ws](https://three.ws):',
+ 'a platform where AI agents are embodied as 3D avatars, registered on-chain, and wired to',
+ 'real Solana and payment rails.',
+ '',
+ '> **Source of truth is the monorepo.** This repo is a one-way export. File issues and',
+ `> pull requests at **${MONOREPO_URL}**, not here. Direct contributions to this repo are`,
+ '> not accepted. Nothing here is pulled back into the monorepo.',
+ '',
+ '## Quickstarts',
+ '',
+ '| SDK | Install |',
+ '|---|---|',
+ ...QUICKSTARTS.map((q) => `| [${q.pkg}](quickstarts/${q.slug}) | \`npm install ${q.pkg}@^${PKG_VERSION[q.pkg]}\` |`),
+ '',
+ '## Agents',
+ '',
+ '| Example | What it shows | Run |',
+ '|---|---|---|',
+ ...AGENTS.map((a) => row(a.title, `agents/${a.dir}`, a.shows, a.run)),
+ '',
+ '## Embeds',
+ '',
+ '| Pattern | What it shows |',
+ '|---|---|',
+ ...EMBEDS.map((e) => `| [${e.file}](embeds/${e.file}) | ${e.shows} |`),
+ '',
+ '## Tutorials',
+ '',
+ '| Walkthrough | What it shows | Run |',
+ '|---|---|---|',
+ ...TUTORIALS.map((t) => row(t.title, `tutorials/${t.dir}`, t.shows, t.run)),
+ '',
+ '## Skills',
+ '',
+ 'Reusable skill definitions (manifest + tools + handlers) under [`skills/`](skills):',
+ 'drop-in capabilities for pump.fun trading, strategy, and Solana wallet flows.',
+ '',
+ '---',
+ '',
+ `Docs: ${HOST}/docs · Changelog: ${HOST}/changelog · Live platform: ${HOST}`,
+ '',
+].join('\n'));
+
+// skills/
+copyDir('examples/skills', 'skills');
+
+// ---------------------------------------------------------------------------
+// Optional smoke test: real npm install + example check. Off by default: it
+// needs network access to the npm registry and is meant to run right before the
+// owner publishes. It never mocks; it shells out to real npm.
+// ---------------------------------------------------------------------------
+if (SMOKE) {
+ console.log('\nSmoke-testing exported examples (npm install + check)…');
+ const targets = [
+ ...TUTORIALS.map((t) => join(OUT, 'tutorials', t.dir)),
+ ].filter((d) => existsSync(join(d, 'package.json')));
+ for (const dir of targets) {
+ console.log(` → ${relative(OUT, dir)}: npm install`);
+ execFileSync('npm', ['install', '--no-audit', '--no-fund'], { cwd: dir, stdio: 'inherit' });
+ }
+ console.log('Smoke test complete.');
+}
+
+// ---------------------------------------------------------------------------
+// Report the produced tree + counts.
+// ---------------------------------------------------------------------------
+let fileCount = 0;
+let dirCount = 0;
+function tree(dir, prefix, depth) {
+ const entries = readdirSync(dir).sort();
+ entries.forEach((name, i) => {
+ const full = join(dir, name);
+ const isDir = statSync(full).isDirectory();
+ const last = i === entries.length - 1;
+ if (isDir) dirCount++; else fileCount++;
+ if (depth <= 2) {
+ console.log(`${prefix}${last ? '└── ' : '├── '}${name}${isDir ? '/' : ''}`);
+ }
+ if (isDir) tree(full, prefix + (last ? ' ' : '│ '), depth + 1);
+ });
+}
+console.log('\nProduced tree (depth ≤ 2):');
+console.log(`${relative(process.cwd(), OUT) || OUT}/`);
+tree(OUT, '', 0);
+console.log(`\n${fileCount} files, ${dirCount} directories.`);
+console.log('This is a build artifact under a gitignored dir; it is never committed.');
+console.log(`Publish steps (owner-run, not automated): docs/ops/examples-repo-export.md`);
diff --git a/src/clip-director-page.js b/src/clip-director-page.js
new file mode 100644
index 000000000..68a1b28f8
--- /dev/null
+++ b/src/clip-director-page.js
@@ -0,0 +1,156 @@
+// Clip Director page, turn a real closed trade into shareable cards per surface.
+// Populates a trader picker from the live mirror leaderboard, then fetches
+// /api/clip-director for the selected agent's most notable close and renders one
+// card per surface (X / Telegram / Feed) with a copyable payload. Every state is
+// designed: loading, empty (no closed trades), error, populated.
+
+const agentSel = document.getElementById('cdAgent');
+const tradeEl = document.getElementById('cdTrade');
+const resultEl = document.getElementById('cdResult');
+
+let reqSeq = 0;
+
+const SURFACES = [
+ { key: 'x', label: 'X / Twitter' },
+ { key: 'telegram', label: 'Telegram' },
+ { key: 'feed', label: 'In-app Feed' },
+];
+const GESTURE_EMOJI = { celebrate: '🎉', point: '👉', wave: '👋', shrug: '🤷', sweat: '😰' };
+const CTA_LABEL = { 'fork-this-trade': 'Fork this trade', 'copy-the-agent': 'Copy the agent', 'view-track-record': 'View track record' };
+
+function esc(s) {
+ return String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+}
+
+async function loadLeaders() {
+ try {
+ const res = await fetch('/api/mirror/leaderboard?sort=score&limit=40', { headers: { accept: 'application/json' } });
+ if (!res.ok) throw new Error(String(res.status));
+ const data = await res.json();
+ const leaders = (data?.data?.leaders || []).filter((l) => l.settled > 0);
+ if (!leaders.length) {
+ agentSel.innerHTML = '<option value="">No agents with closed trades yet</option>';
+ renderEmpty('No agent has a closed on-chain trade yet. Clips are minted from real closed round-trips, so the board fills as agents trade.');
+ return;
+ }
+ agentSel.innerHTML = leaders.map((l) =>
+ `<option value="${esc(l.agent_id)}">${esc(l.name || 'Unnamed')}: ${l.settled} trade${l.settled === 1 ? '' : 's'}${l.win_rate != null ? `, ${l.win_rate}% win` : ''}</option>`).join('');
+ // Deep-link support: ?agent_id=<uuid> preselects.
+ const wanted = new URLSearchParams(location.search).get('agent_id');
+ if (wanted && leaders.some((l) => l.agent_id === wanted)) agentSel.value = wanted;
+ loadClips(agentSel.value);
+ } catch {
+ agentSel.innerHTML = '<option value="">Could not load leaders</option>';
+ renderError('The trader leaderboard is unreachable right now.');
+ }
+}
+
+function skeleton() {
+ tradeEl.innerHTML = '';
+ resultEl.innerHTML = `<div class="cd-skel" aria-hidden="true">${'<div class="cd-skel-card"></div>'.repeat(3)}</div><span class="sr-only">Directing clips…</span>`;
+}
+
+function renderEmpty(msg) {
+ tradeEl.innerHTML = '';
+ resultEl.innerHTML = `
+ <div class="cd-empty">
+ <h3>No closed trade to feature</h3>
+ <p>${esc(msg || 'This agent has no closed trades yet. Clips are minted from real closed round-trips.')}</p>
+ <a href="/leaderboard">See who is trading</a>
+ </div>`;
+}
+
+function renderError(msg) {
+ tradeEl.innerHTML = '';
+ resultEl.innerHTML = `
+ <div class="cd-error">
+ <h3>Could not direct a clip</h3>
+ <p>${esc(msg || 'The clip service is unreachable right now.')}</p>
+ <button type="button" id="cdRetry">Try again</button>
+ </div>`;
+ document.getElementById('cdRetry')?.addEventListener('click', () => loadClips(agentSel.value));
+}
+
+function renderTrade(agent, trade, proof) {
+ const win = trade.is_win !== false;
+ const cls = win ? 'win' : 'loss';
+ const headline = trade.multiple != null ? `${trade.multiple}x`
+ : trade.realized_pnl_sol != null ? `${trade.realized_pnl_sol > 0 ? '+' : ''}${trade.realized_pnl_sol} SOL`
+ : trade.pnl_pct != null ? `${trade.pnl_pct}%` : 'closed';
+ const sym = trade.symbol || trade.name || (trade.mint ? trade.mint.slice(0, 6) : 'coin');
+ tradeEl.innerHTML = `
+ <div class="cd-trade">
+ <span class="sym">${esc(sym.startsWith('$') ? sym : `$${sym}`)}</span>
+ <span class="stat">Result <b class="${cls}">${esc(headline)}</b></span>
+ ${trade.hold_min != null ? `<span class="stat">Held <b>${trade.hold_min < 60 ? `${trade.hold_min}m` : `${Math.round(trade.hold_min / 60)}h`}</b></span>` : ''}
+ ${trade.exit_reason ? `<span class="stat">Exit <b>${esc(trade.exit_reason.replace(/_/g, ' '))}</b></span>` : ''}
+ ${proof ? `<a class="proof" href="${esc(proof)}" target="_blank" rel="noopener noreferrer">On-chain proof ↗</a>` : ''}
+ </div>`;
+}
+
+function clipCard(surface, label, clip) {
+ const gesture = GESTURE_EMOJI[clip.avatar_gesture] || '🎯';
+ const copyPayload = `${clip.hook}\n\n${clip.body}\n\n(${CTA_LABEL[clip.cta] || clip.cta} · verifiable on-chain · three.ws)`;
+ return `
+ <article class="cd-card ${surface}">
+ <div class="cd-card-head"><span class="dot"></span>${esc(label)}</div>
+ <div class="cd-card-body">
+ <div class="cd-hook">${esc(clip.hook)}</div>
+ <div class="cd-featstat"><span class="gesture" title="${esc(clip.avatar_gesture)} reaction" aria-hidden="true">${gesture}</span><span class="num">${esc(clip.feature_stat)}</span></div>
+ <div class="cd-text">${esc(clip.body)}</div>
+ <div class="cd-cta">${esc(CTA_LABEL[clip.cta] || clip.cta)}</div>
+ <div class="cd-alt"><b>Alt text.</b> ${esc(clip.alt_text)}</div>
+ <button type="button" class="cd-copy" data-payload="${esc(copyPayload)}">Copy ${esc(label.split(' ')[0])} text</button>
+ </div>
+ </article>`;
+}
+
+function renderClips(agent, data) {
+ renderTrade(agent, data.trade, data.proof);
+ const cards = SURFACES.map(({ key, label }) => {
+ const clip = data.clips.find((c) => c.surface === key);
+ return clip ? clipCard(key, label, clip) : '';
+ }).join('');
+ resultEl.innerHTML = `
+ <div class="cd-grid">${cards}</div>
+ <div class="cd-note"><b>Honest by design.</b> Wins and losses both get a card, always with a verifiable on-chain angle. The number you see is a real closed round-trip, never a screenshot.</div>`;
+
+ for (const btn of resultEl.querySelectorAll('.cd-copy')) {
+ btn.addEventListener('click', async () => {
+ try {
+ await navigator.clipboard.writeText(btn.dataset.payload);
+ const original = btn.textContent;
+ btn.textContent = 'Copied ✓';
+ btn.classList.add('done');
+ setTimeout(() => { btn.textContent = original; btn.classList.remove('done'); }, 1600);
+ } catch {
+ btn.textContent = 'Press Ctrl+C';
+ }
+ });
+ }
+}
+
+async function loadClips(agentId) {
+ if (!agentId) return;
+ const seq = ++reqSeq;
+ skeleton();
+ try {
+ const res = await fetch(`/api/clip-director?agent_id=${encodeURIComponent(agentId)}&surface=all`, { headers: { accept: 'application/json' } });
+ if (seq !== reqSeq) return;
+ if (!res.ok) {
+ let msg = `Service returned ${res.status}.`;
+ try { const j = await res.json(); if (j?.error_description) msg = j.error_description; } catch { /* keep default */ }
+ return renderError(msg);
+ }
+ const data = await res.json();
+ if (seq !== reqSeq) return;
+ if (!data.clips || data.clips.length === 0) return renderEmpty(data.empty);
+ renderClips(data.agent, data);
+ } catch {
+ if (seq !== reqSeq) return;
+ renderError('Network error reaching the Clip Director. Check your connection and try again.');
+ }
+}
+
+agentSel.addEventListener('change', () => loadClips(agentSel.value));
+loadLeaders();
diff --git a/src/create-agent.js b/src/create-agent.js
index a41365305..1436c0386 100644
--- a/src/create-agent.js
+++ b/src/create-agent.js
@@ -1301,6 +1301,16 @@ function succeed(agent) {
const fund = $('success-fund');
if (fund) fund.href = `/agent/${agent.id}/wallet#deposit`;
+ // Pipeline handoffs: the agent is the hub, deployment is the next stage.
+ // Each link opens the next-stage surface; the embed link pre-loads this
+ // agent's 3D body into Widget Studio when the model is publicly readable.
+ const embed = $('success-embed');
+ if (embed) {
+ embed.href = agent.avatar_model_url
+ ? `/studio?model=${encodeURIComponent(agent.avatar_model_url)}`
+ : '/studio';
+ }
+
// Show the 3D body if it's publicly readable.
const modelUrl = agent.avatar_model_url;
if (modelUrl) {
diff --git a/src/meta-allocator.js b/src/meta-allocator.js
new file mode 100644
index 000000000..f56083bcf
--- /dev/null
+++ b/src/meta-allocator.js
@@ -0,0 +1,159 @@
+// Meta-Allocator page, the "ETF of degens" allocation planner UI.
+// Fetches /api/meta-allocator (real verified leaders + a diversified plan) and
+// renders the basket with every state designed: loading, empty, error, populated.
+// Non-custodial: it shows a plan and deep-links each leader to the existing
+// copy-subscribe flow. Nothing here signs or moves funds.
+
+const resultEl = document.getElementById('maResult');
+const budgetEl = document.getElementById('maBudget');
+const segEl = document.getElementById('maSeg');
+
+let risk = 'balanced';
+let budget = 5;
+let reqSeq = 0;
+
+const GROUP_LABEL = {
+ high_winrate: 'high win-rate',
+ moonshot: 'moonshot',
+ high_roi: 'high ROI',
+ steady: 'steady',
+ volatile: 'volatile',
+};
+// The copy-trade / back-an-agent surface is /vaults (segregated custody, spend
+// caps, drawdown breaker). The leader's own track record lives at /trader/<id>.
+const CTA_HREF = () => `/vaults`;
+
+function esc(s) {
+ return String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+}
+function initials(name) {
+ return String(name || '?').trim().split(/\s+/).slice(0, 2).map((w) => w[0]).join('').toUpperCase() || '?';
+}
+function pct(n) { return n == null ? '-' : `${n}%`; }
+function groupColor(g) {
+ return { high_winrate: '#34d399', moonshot: '#fb7185', high_roi: '#22d3ee', steady: '#7c5cff', volatile: '#fbbf24' }[g] || '#a1a1aa';
+}
+
+function skeleton() {
+ resultEl.innerHTML = `<div class="ma-skel" aria-hidden="true">${'<div class="ma-skel-card"></div>'.repeat(4)}</div><span class="sr-only">Building your allocation…</span>`;
+}
+
+function renderEmpty(plan) {
+ resultEl.innerHTML = `
+ <div class="ma-empty">
+ <h3>No verified leaders qualify yet</h3>
+ <p>${esc(plan?.caution || 'The allocator only picks agents with a real, closed on-chain track record. None meet this risk profile right now.')} Try a looser risk profile, or explore the leaderboard while more records settle.</p>
+ <a href="/leaderboard">Browse the trader leaderboard</a>
+ </div>`;
+}
+
+function renderError(msg) {
+ resultEl.innerHTML = `
+ <div class="ma-error">
+ <h3>Could not build an allocation</h3>
+ <p>${esc(msg || 'The allocation service is unreachable right now.')}</p>
+ <button type="button" id="maRetry">Try again</button>
+ </div>`;
+ document.getElementById('maRetry')?.addEventListener('click', load);
+}
+
+function renderPlan(plan) {
+ if (!plan || !Array.isArray(plan.allocations) || plan.allocations.length === 0) {
+ return renderEmpty(plan);
+ }
+ const barSegments = plan.allocations
+ .map((a) => `<i style="width:${a.weight_pct}%;background:${groupColor(a.correlation_group)}" title="${esc(a.name)} ${a.weight_pct}%"></i>`)
+ .join('');
+
+ const cards = plan.allocations.map((a) => {
+ const avatar = a.avatar
+ ? `<img class="ma-ava" src="${esc(a.avatar)}" alt="" loading="lazy" />`
+ : `<span class="ma-ava" aria-hidden="true">${esc(initials(a.name))}</span>`;
+ const roiCls = a.roi_pct == null ? '' : a.roi_pct >= 0 ? 'pos' : 'neg';
+ const warn = a.over_capacity
+ ? `<div class="ma-warn">⚠ Suggested size is above this leader's typical fill and may move their price. Consider trimming.</div>`
+ : '';
+ return `
+ <article class="ma-card">
+ <div class="ma-card-top">
+ ${avatar}
+ <div>
+ <p class="ma-name">${esc(a.name)}</p>
+ <div class="ma-chips"><span class="ma-chip grp" style="color:${groupColor(a.correlation_group)}">${esc(GROUP_LABEL[a.correlation_group] || a.correlation_group)}</span><span class="ma-chip">${a.settled} trades</span></div>
+ </div>
+ <div class="ma-weight"><b>${a.weight_pct}%</b><small>${a.size_quote == null ? '' : `${a.size_quote} SOL`}</small></div>
+ </div>
+ <div class="ma-stats">
+ <span>Win <b>${pct(a.win_rate_pct)}</b></span>
+ <span>ROI <b class="${roiCls}">${pct(a.roi_pct)}</b></span>
+ <span>Max DD <b>${pct(a.max_drawdown_pct)}</b></span>
+ <span>Followers <b>${a.followers}</b></span>
+ </div>
+ <div class="ma-why">${esc(a.why)}</div>
+ ${warn}
+ <div class="ma-links">
+ <a href="/trader/${encodeURIComponent(a.agent_id)}">Track record</a>
+ <a class="primary" href="${CTA_HREF()}">Copy this leader</a>
+ </div>
+ </article>`;
+ }).join('');
+
+ const excluded = Array.isArray(plan.excluded) && plan.excluded.length
+ ? `<details class="ma-excluded"><summary>Considered but excluded (${plan.excluded.length})</summary><ul>${plan.excluded.map((e) => `<li><b>${esc(e.name)}</b>: ${esc(e.reason)}</li>`).join('')}</ul></details>`
+ : '';
+
+ const groups = plan.diversification || {};
+ const groupCount = Object.keys(groups).length;
+
+ resultEl.innerHTML = `
+ <div class="ma-summary">
+ <span>Basket of <b>${plan.allocations.length}</b> verified leaders</span>
+ <span>across <b>${groupCount}</b> style${groupCount === 1 ? '' : 's'}</span>
+ <span>from <b>${plan.leaders_considered}</b> considered</span>
+ ${plan.source === 'llm' ? '<span>plan by <b>three.ws LLM</b></span>' : '<span>plan by <b>risk-adjusted ranking</b></span>'}
+ </div>
+ <div class="ma-bar" aria-hidden="true">${barSegments}</div>
+ <div class="ma-grid">${cards}</div>
+ <div class="ma-note"><b>Rebalance rule.</b> ${esc(plan.rebalance_rule)}</div>
+ <div class="ma-note"><b>Risk.</b> ${esc(plan.caution)}</div>
+ ${excluded}
+ <div class="ma-note">This is a non-custodial <b>plan</b>. three.ws never holds your funds. Copying a leader opens a segregated, spend-capped subscription you control and can stop at any time.</div>`;
+}
+
+async function load() {
+ const seq = ++reqSeq;
+ skeleton();
+ try {
+ const url = `/api/meta-allocator?risk=${encodeURIComponent(risk)}&budget=${encodeURIComponent(budget)}`;
+ const res = await fetch(url, { headers: { accept: 'application/json' } });
+ if (seq !== reqSeq) return; // a newer request superseded this one
+ if (!res.ok) {
+ let msg = `Service returned ${res.status}.`;
+ try { const j = await res.json(); if (j?.error_description) msg = j.error_description; } catch { /* keep default */ }
+ return renderError(msg);
+ }
+ const data = await res.json();
+ if (seq !== reqSeq) return;
+ renderPlan(data.plan);
+ } catch (err) {
+ if (seq !== reqSeq) return;
+ renderError('Network error reaching the allocator. Check your connection and try again.');
+ }
+}
+
+let budgetTimer = null;
+budgetEl.addEventListener('input', () => {
+ const v = parseFloat(budgetEl.value);
+ budget = Number.isFinite(v) && v > 0 ? v : 5;
+ clearTimeout(budgetTimer);
+ budgetTimer = setTimeout(load, 350);
+});
+segEl.addEventListener('click', (e) => {
+ const btn = e.target.closest('button[data-risk]');
+ if (!btn) return;
+ risk = btn.dataset.risk;
+ for (const b of segEl.querySelectorAll('button')) b.setAttribute('aria-pressed', String(b === btn));
+ load();
+});
+
+load();
diff --git a/vercel.json b/vercel.json
index a24b516b3..5b4266751 100644
--- a/vercel.json
+++ b/vercel.json
@@ -914,6 +914,14 @@
"src": "/claim-wallet/?",
"dest": "/claim-wallet.html"
},
+ {
+ "src": "/meta-allocator/?",
+ "dest": "/meta-allocator.html"
+ },
+ {
+ "src": "/clip-director/?",
+ "dest": "/clip-director.html"
+ },
{
"src": "/oracle/coin/([1-9A-HJ-NP-Za-km-z]{32,44})/?",
"dest": "/api/oracle-share?mint=$1"
diff --git a/vite.config.js b/vite.config.js
index 6fb2f8067..edb11d10c 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -436,6 +436,8 @@ const appConfig = {
'signal-detail': resolve(__dirname, 'pages/signal-detail.html'),
trades: resolve(__dirname, 'pages/trades.html'),
'claim-wallet': resolve(__dirname, 'pages/claim-wallet.html'),
+ 'meta-allocator': resolve(__dirname, 'pages/meta-allocator.html'),
+ 'clip-director': resolve(__dirname, 'pages/clip-director.html'),
'avatar-embed': resolve(__dirname, 'pages/avatar-embed.html'),
'avatar-wallet-chat': resolve(__dirname, 'pages/avatar-wallet-chat.html'),
'agent-exchange': resolve(__dirname, 'pages/agent-exchange.html'),