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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(skills): generator + drift gate for the marketplace skill seed
nirholas12822b3a3bb7
diff --git a/package.json b/package.jsonindex 300aad11a..60a91b953 100644--- a/package.json+++ b/package.json@@ -282,6 +282,8 @@"pump:launch": "node scripts/pump-launch-repos.mjs","pump:launch:ui": "node scripts/pump-launch-server.mjs","seed:skills": "node scripts/seed-skills.js",+ "build:skills-seed": "node scripts/build-skills-seed.mjs",+ "check:skills-seed": "node scripts/build-skills-seed.mjs --check","install:sdk": "npm install --prefix agent-payments-sdk && npm run build --prefix agent-payments-sdk && npm install ./agent-payments-sdk","claude": "./scripts/claude.sh","typecheck": "tsc -p jsconfig.json",diff --git a/prompts/fable-audit/LEAN-deletions.md b/prompts/fable-audit/LEAN-deletions.mdindex dd9461473..b4e978ef3 100644--- a/prompts/fable-audit/LEAN-deletions.md+++ b/prompts/fable-audit/LEAN-deletions.md@@ -111,6 +111,24 @@ stays as-is: different runtime (browser), deliberate copy.files. **⚠ some skill bodies reference other coins → the regeneration diff may hit thecommit gate; check before staging.** Larger effort — treat as its own task.+**Tooling DONE (2026-07-31): `scripts/build-skills-seed.mjs`, `npm run+build:skills-seed` / `check:skills-seed`.** Corrections to the entry above,+verified against the tree: there are no `public/skills/`, `dist/`, or+`examples/skills/` copies of seed.json (those dirs hold unrelated example+packs), so the single `data/skills/seed.json` is the only generated artifact.+Builtin entries regenerate wholly from `data/skills/<category>/<id>/SKILL.md`+(content = body.trim(), manifest = frontmatter); the two vendored metamask+entries regenerate their content from the vendor body + the marketplace+trailer while carrying their hand-curated manifest/category over from the+existing entry. `--check` is the drift gate; the first run caught 5 real+drifts (a block-scalar description stored literally for one trading skill, a+deleted sentence still present in another's seed copy, an edited erc8004+description never mirrored) plus the stale `total: 113` (real count 115).+**The regeneration itself is NOT committed:** its 14-line diff touches+other-project skill content, so `node scripts/build-skills-seed.mjs` + commit+awaits owner approval per the commit gate. Verified idempotent: regenerate,+then `--check` passes and a second run writes nothing.+## 7. De-duplicate draco vendor libs: DONECorrection to the original finding: the files were **never committed**. Both treeswere gitignored and regenerated from `node_modules/three` bydiff --git a/scripts/build-skills-seed.mjs b/scripts/build-skills-seed.mjsnew file mode 100644index 000000000..3413eca97--- /dev/null+++ b/scripts/build-skills-seed.mjs@@ -0,0 +1,296 @@+#!/usr/bin/env node+// Regenerates data/skills/seed.json from the SKILL.md files themselves, so the+// marketplace seed can never drift from the on-disk skills (fable-audit LEAN+// item 6: every skill fix previously had to be made twice, once in SKILL.md+// and once in the 796KB seed mirror, and the mirrors drifted).+//+// Usage: node scripts/build-skills-seed.mjs [--check] [--list]+// --check exit 1 if the generated output differs from what is on disk+// (ignoring generatedAt); prints which skills drifted. Use in+// reviews the same way as scripts/build-skills-pack.mjs --check.+// --list print every skill (category/identifier/kind) and exit.+//+// Source layout under data/skills/:+// <category>/<identifier>/SKILL.md builtin skills: the seed entry is the+// frontmatter (manifest) + body (content),+// exactly: content = body.trim().+// <identifier>/SKILL.md vendored partner drops (metamask-*):+// content = vendor body + the marketplace+// pack trailer; manifest/category carry+// over from the existing seed entry+// (hand-curated, richer than the vendor+// frontmatter). Their entries omit the+// top-level name/source fields, as the+// seed always has.+//+// Determinism: existing seed order is preserved (new skills append, sorted),+// generatedAt only advances when something other than generatedAt changed, and+// entry keys are emitted alphabetically to match the historical file. A+// re-run over an unchanged tree writes nothing.+//+// Frontmatter is parsed with the same dependency-free reader approach as+// scripts/build-skills-pack.mjs, extended with flow lists ([a, b]) because the+// data/skills manifests carry tags that way.++import fs from 'node:fs';+import path from 'node:path';+import process from 'node:process';++const ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..');+const SKILLS_DIR = path.join(ROOT, 'data', 'skills');+const SEED_PATH = path.join(SKILLS_DIR, 'seed.json');++// Appended to every vendored (partner-drop) entry's content in the seed. The+// SKILL.md itself stays byte-identical to the vendor file; this marketplace+// trailer exists only in the seed copy (verified against the historical seed).+const VENDOR_TRAILER = `++## Get the full skill pack++This skill ships with per-command reference files and step-by-step workflow templates.+Install the complete pack into your own agent (Claude Code, Codex, Cursor, or similar):++\`\`\`+npm install -g @metamask/agentic-cli+npx skills add MetaMask/agent-skills+\`\`\`++Then run \`mm login\` and \`mm init\` to provision your own agent wallet. Each user+authenticates their own MetaMask Agent Wallet \u2014 keys are never shared or custodied+by three.ws.+`;++// ── Frontmatter reader ───────────────────────────────────────────────────────++function stripQuotes(v) {+ if (+ (v.startsWith('"') && v.endsWith('"') && v.length > 1) ||+ (v.startsWith("'") && v.endsWith("'") && v.length > 1)+ ) {+ return v.slice(1, -1).replace(/\\"/g, '"').replace(/''/g, "'");+ }+ return v;+}++function parseScalar(raw) {+ const v = raw.trim();+ if (/^\[.*\]$/.test(v)) {+ const inner = v.slice(1, -1).trim();+ if (!inner) return [];+ return inner.split(',').map((s) => stripQuotes(s.trim()));+ }+ return stripQuotes(v);+}++function readFrontmatter(text, file) {+ const m = text.match(/^---\r?\n([\s\S]*?)\r?\n---/);+ if (!m) throw new Error(`${file}: missing frontmatter`);+ const lines = m[1].split(/\r?\n/);+ const out = {};+ let i = 0;+ while (i < lines.length) {+ const key = lines[i].match(/^([A-Za-z0-9_-]+):(.*)$/);+ if (!key) {+ i += 1;+ continue;+ }+ const name = key[1];+ const value = key[2].trim();+ if (value === '|' || value === '>' || value === '|-' || value === '>-') {+ const block = [];+ i += 1;+ while (i < lines.length && (/^\s+\S/.test(lines[i]) || lines[i].trim() === '')) {+ block.push(lines[i].replace(/^\s+/, ''));+ i += 1;+ }+ out[name] = block.join(value.startsWith('|') ? '\n' : ' ').trim();+ continue;+ }+ if (value === '') {+ const child = {};+ i += 1;+ while (i < lines.length && /^\s+\S/.test(lines[i])) {+ const cm = lines[i].match(/^\s+([A-Za-z0-9_-]+):\s*(.*)$/);+ if (cm) child[cm[1]] = parseScalar(cm[2]);+ i += 1;+ }+ out[name] = child;+ continue;+ }+ out[name] = parseScalar(value);+ i += 1;+ }+ return { manifest: out, body: text.slice(m[0].length) };+}++// ── Collection ───────────────────────────────────────────────────────────────++function collectSkills() {+ const builtin = [];+ const vendored = [];+ for (const entry of fs.readdirSync(SKILLS_DIR, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {+ if (!entry.isDirectory()) continue;+ const dir = path.join(SKILLS_DIR, entry.name);+ const direct = path.join(dir, 'SKILL.md');+ if (fs.existsSync(direct)) {+ vendored.push({ identifier: entry.name, file: direct });+ continue;+ }+ for (const sub of fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {+ if (!sub.isDirectory()) continue;+ const file = path.join(dir, sub.name, 'SKILL.md');+ if (!fs.existsSync(file)) {+ throw new Error(`${path.relative(ROOT, path.join(dir, sub.name))}: missing SKILL.md`);+ }+ builtin.push({ category: entry.name, identifier: sub.name, file });+ }+ }+ return { builtin, vendored };+}++function buildEntries() {+ const { builtin, vendored } = collectSkills();+ const entries = [];+ for (const s of builtin) {+ const raw = fs.readFileSync(s.file, 'utf8');+ const { manifest, body } = readFrontmatter(raw, path.relative(ROOT, s.file));+ if (!manifest.name || !manifest.description) {+ throw new Error(`${path.relative(ROOT, s.file)}: frontmatter missing name/description`);+ }+ if (manifest.name !== s.identifier) {+ throw new Error(`${path.relative(ROOT, s.file)}: frontmatter name "${manifest.name}" != directory name`);+ }+ entries.push({+ category: s.category,+ content: body.trim(),+ description: manifest.description,+ identifier: s.identifier,+ manifest,+ name: s.identifier,+ source: 'builtin',+ });+ }+ return { entries, vendored };+}++// ── Assembly ─────────────────────────────────────────────────────────────────++function loadExisting() {+ try {+ return JSON.parse(fs.readFileSync(SEED_PATH, 'utf8'));+ } catch {+ return { generatedAt: null, skills: [], total: 0 };+ }+}++function assemble() {+ const existing = loadExisting();+ const existingOrder = new Map((existing.skills || []).map((s, i) => [s.identifier, i]));+ const byId = new Map((existing.skills || []).map((s) => [s.identifier, s]));+ const { entries, vendored } = buildEntries();++ // Vendored partner drops (SKILL.md directly under data/skills/<name>/):+ // their seed manifests are hand-curated for the marketplace (category,+ // difficulty, tags the vendor file does not carry), so the manifest and+ // category carry over from the existing seed entry while the CONTENT is+ // regenerated from the vendor body plus the standard pack trailer. That+ // keeps the body drift-proof without flattening the curation.+ for (const s of vendored) {+ const cur = byId.get(s.identifier);+ if (!cur) {+ throw new Error(+ `${path.relative(ROOT, s.file)}: vendored skill has no existing seed entry to carry curated metadata from; add one to data/skills/seed.json by hand first`,+ );+ }+ const raw = fs.readFileSync(s.file, 'utf8');+ const { body } = readFrontmatter(raw, path.relative(ROOT, s.file));+ entries.push({+ category: cur.category,+ content: body.trim() + VENDOR_TRAILER,+ description: cur.description,+ identifier: s.identifier,+ manifest: cur.manifest,+ });+ }+ // Preserve the historical seed order for known skills so a regeneration+ // diff shows real content changes, not a wholesale reorder; new skills+ // append in (category, identifier) order.+ entries.sort((a, b) => {+ const ia = existingOrder.has(a.identifier) ? existingOrder.get(a.identifier) : Infinity;+ const ib = existingOrder.has(b.identifier) ? existingOrder.get(b.identifier) : Infinity;+ if (ia !== ib) return ia - ib;+ return (a.category + '/' + a.identifier).localeCompare(b.category + '/' + b.identifier);+ });+ return { existing, entries };+}++function render(entries, generatedAt) {+ // Alphabetical entry keys (the historical file's convention); manifest+ // keys keep frontmatter order.+ const skills = entries.map((e) => {+ const out = {};+ for (const k of Object.keys(e).sort()) out[k] = e[k];+ return out;+ });+ return JSON.stringify({ generatedAt, skills, total: skills.length }, null, 2) + '\n';+}++// ── Main ─────────────────────────────────────────────────────────────────────++const flag = (name) => process.argv.includes(name);+const { existing, entries } = assemble();++if (flag('--list')) {+ for (const e of entries) {+ console.log(`${e.category}/${e.identifier}${e.source === 'builtin' ? '' : ' (vendored)'}`);+ }+ console.log(`${entries.length} skill(s)`);+ process.exit(0);+}++const keepStamp = existing.generatedAt || new Date().toISOString();+const unchanged = render(entries, keepStamp) === fs.readFileSync(SEED_PATH, 'utf8');++if (flag('--check')) {+ if (unchanged) {+ console.log(`OK: data/skills/seed.json matches its ${entries.length} SKILL.md sources.`);+ process.exit(0);+ }+ const byId = new Map((existing.skills || []).map((s) => [s.identifier, s]));+ const drifted = [];+ for (const e of entries) {+ const cur = byId.get(e.identifier);+ if (!cur) {+ drifted.push(`${e.identifier}: missing from seed.json`);+ continue;+ }+ for (const k of Object.keys(e)) {+ if (JSON.stringify(cur[k]) !== JSON.stringify(e[k])) {+ drifted.push(`${e.identifier}: ${k} drifted`);+ }+ }+ }+ for (const s of existing.skills || []) {+ if (!entries.some((e) => e.identifier === s.identifier)) {+ drifted.push(`${s.identifier}: in seed.json but has no SKILL.md`);+ }+ }+ if ((existing.total ?? null) !== entries.length) {+ drifted.push(`total: seed says ${existing.total}, sources say ${entries.length}`);+ }+ console.error(`DRIFT: data/skills/seed.json does not match its sources (${drifted.length} difference(s)):`);+ for (const d of drifted) console.error(` ${d}`);+ console.error('Regenerate with: node scripts/build-skills-seed.mjs');+ process.exit(1);+}++if (unchanged) {+ console.log(`data/skills/seed.json unchanged (${entries.length} skills).`);+ process.exit(0);+}+const out = render(entries, new Date().toISOString());+const tmp = SEED_PATH + '.tmp';+fs.writeFileSync(tmp, out);+fs.renameSync(tmp, SEED_PATH);+console.log(`Wrote data/skills/seed.json: ${entries.length} skills, ${(out.length / 1024).toFixed(0)}KB.`);+console.log('Reminder: skill bodies may reference non-$THREE projects; the CLAUDE.md commit gate applies to the regenerated diff.');