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(agents): sign and pin an agent manifest on every persona save so anyone can verify it

nirholasbc03045f0095
diff --git a/api/agents.js b/api/agents.js
index d7958afc3..569357832 100644
--- a/api/agents.js
+++ b/api/agents.js
@@ -24,6 +24,7 @@ import { pingIndexNow } from './_lib/indexnow.js';
import { publishFeedEvent } from './_lib/feed.js';
import { getSkillPrices, skillPriceMap } from './_lib/skill-price-cache.js';
import { cacheWrap } from './_lib/cache.js';
+import { trackAgentOwnerVisit } from './_lib/retention.js';
import { env } from './_lib/env.js';
import { z } from 'zod';
import { isUuid } from './_lib/validate.js';
@@ -470,6 +471,11 @@ export async function handleGetOne(req, res, id) {
// is best-effort — anonymous viewers still get the public projection.
const auth = await resolveAuth(req).catch(() => null);
const isOwner = auth?.userId === row.user_id;
+ // Week-2 retention signal (README roadmap, phase 2). An owner opening
+ // their own agent is a return visit; one coarse row per owner/agent/UTC
+ // day, written detached so it can never slow or fail this read. Visitors
+ // are not tracked here at all.
+ if (isOwner) trackAgentOwnerVisit({ userId: auth.userId, agentId: row.id });
return json(res, 200, { agent: decorate(row, isOwner) });
}
diff --git a/api/agents/_id/persona.js b/api/agents/_id/persona.js
index 7a2640b6f..fcda088a5 100644
--- a/api/agents/_id/persona.js
+++ b/api/agents/_id/persona.js
@@ -10,6 +10,12 @@
// writes a real agent_versions entry.
// GET /api/agents/:id/persona/versions — persona version history (for diff).
// POST /api/agents/:id/persona/restore — restore a prior version as a new save.
+//
+// Every write path here also republishes the agent's signed manifest: the
+// compiled prompt is canonicalized, signed with the platform ed25519 attester
+// identity, and pinned to IPFS so the resulting CID is a permanent, portable
+// record of exactly how this agent was configured. See
+// api/_lib/agent-manifest-publish.js and specs/AGENT_MANIFEST.md.
import { createHash, createHmac } from 'node:crypto';
import { sql } from '../../_lib/db.js';
@@ -22,6 +28,7 @@ import {
PersonaExtractionError,
} from '../../_lib/persona-interview-extract.js';
import { parse } from '../../_lib/validate.js';
+import { publishAgentManifestSafely } from '../../_lib/agent-manifest-publish.js';
import { z } from 'zod';
import {
compilePersona,
@@ -33,7 +40,6 @@ import {
import {
INTERVIEW_QUESTIONS,
normalizeInterview,
- interviewTranscript,
MAX_INTERVIEW_ANSWERS,
} from '../../../src/agents/persona-interview.js';
diff --git a/data/changelog.json b/data/changelog.json
index d295c4e5e..ba91ebca9 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,16 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-08-11",
+ "title": "Your agent's personality is now signed and published to IPFS",
+ "summary": "Every time you save your agent's persona, three.ws now writes down exactly how that agent is configured, signs it with the platform's signing key, and publishes it to IPFS. You get back a permanent address anyone can open. That means the instructions behind your agent are no longer something people have to take on trust: a visitor, a buyer, or another agent can fetch the record, confirm it really came from three.ws, read the exact prompt, and see whether the agent running today still matches what was published. Anyone can run the check themselves without an account. Only public agents publish automatically, and you can publish a private agent deliberately whenever you choose.",
+ "tags": [
+ "feature",
+ "security"
+ ],
+ "link": "/agents"
+ },
{
"date": "2026-08-11",
"title": "Deleting a copy of an avatar no longer blanks the original",
diff --git a/docs/agent-manifest.md b/docs/agent-manifest.md
index 7043bb651..980ae9b25 100644
--- a/docs/agent-manifest.md
+++ b/docs/agent-manifest.md
@@ -629,6 +629,137 @@ Load from on-chain:
---
+## Signed manifests (v0.3)
+
+A manifest served from an API is a claim. A manifest that is **signed and pinned to IPFS** is evidence: anyone can fetch the CID, check the signature, and read the exact system prompt the agent was configured with, without an account and without trusting three.ws.
+
+three.ws signs and pins an agent's manifest automatically on every persona save. The envelope is ed25519-signed by the platform attester identity (the same Solana key behind [3D provenance credentials](./provenance.md)) and pinned through the configured IPFS provider.
+
+### What a signed envelope looks like
+
+```json
+{
+ "spec": "threews.agent.manifest.v1",
+ "manifest": {
+ "spec": "agent-manifest/0.3",
+ "id": { "agentId": "b2b1...", "platform": "three.ws" },
+ "name": "Aria",
+ "brain": {
+ "provider": "threews",
+ "instructions": {
+ "format": "text/markdown",
+ "sha256": "9ab1...",
+ "text": "You are Aria, a product guide for Acme Corp..."
+ },
+ "toneTags": ["warm", "concise"],
+ "traits": { "warmth": 0.8, "directness": 0.6 }
+ },
+ "body": { "uri": "https://cdn.three.ws/...glb", "format": "gltf-binary" }
+ },
+ "issuer": "6Yb...",
+ "signedAt": "2026-08-11T12:00:00.000Z",
+ "digest": "3f9c...",
+ "algorithm": "ed25519",
+ "signature": "5Kd..."
+}
+```
+
+The signature covers a canonical statement built from `manifest`, `issuer`, and `signedAt` — not the file as written — so key order, whitespace, and any field added after signing cannot change the result. The full byte-level definition is in the [Agent Manifest Spec](../specs/AGENT_MANIFEST.md#signed-envelope-v03).
+
+### Endpoints
+
+```bash
+# The envelope currently pinned for an agent, with its CID and gateways
+curl -s https://three.ws/api/agents/<agent-id>/manifest/signed
+
+# Every manifest this agent has ever published
+curl -s https://three.ws/api/agents/<agent-id>/manifest/history
+
+# Verify a CID: signature, issuer, and drift against the live agent
+curl -s "https://three.ws/api/manifest-verify?cid=<cid>"
+
+# Owner-only: re-sign and re-pin right now
+curl -s -X POST https://three.ws/api/agents/<agent-id>/manifest/publish \
+ -H "Authorization: Bearer $THREEWS_TOKEN"
+```
+
+`/api/manifest-verify` also accepts `?agent=<uuid>` (verify whatever that agent has pinned) and `?digest=<sha256>` (verify a specific publish).
+
+### Verifying it yourself
+
+The point of signing is that you do not have to take our word for it. This checks the signature locally against bytes fetched from a public IPFS gateway:
+
+```bash
+node scripts/verify-agent-manifest.mjs --cid bafy...
+```
+
+```
+source https://ipfs.io/ipfs/bafy...
+agent Aria b2b1...
+issuer 6Yb...
+signed at 2026-08-11T12:00:00.000Z
+digest 3f9c...
+prompt 412 chars, sha256 9ab1...
+prompt hash matches
+result VERIFIED (ok)
+```
+
+Add `--issuer <base58>` to require a specific signing identity, `--json` for machine-readable output, or `--file ./envelope.json` to check a local copy. Exit code is 0 when verified, 1 when verification fails, 2 when the document could not be fetched.
+
+In your own code, the verification primitive is pure and has no database or network dependency:
+
+```js
+import { verifyAgentManifest } from './api/_lib/agent-manifest-sign.js';
+
+const envelope = await (await fetch(`https://ipfs.io/ipfs/${cid}`)).json();
+const { valid, reason, issuer } = verifyAgentManifest(envelope);
+// valid: true, reason: 'ok', issuer: '6Yb...'
+```
+
+Pass `{ issuer }` as the second argument to reject anything not signed by the identity you expect. A valid signature from an unknown key proves only that *someone* signed the document.
+
+### Drift: is the live agent still what you verified?
+
+A pinned manifest describes one moment. `/api/manifest-verify` rebuilds the manifest from the agent's current configuration and reports exactly which fields moved:
+
+```json
+{
+ "verified": true,
+ "issuer_trusted": true,
+ "agent_status": "live",
+ "drift": {
+ "identical": false,
+ "changed": [
+ {
+ "field": "brain.instructions.text",
+ "pinned": "You are Aria, a product guide...",
+ "live": "You are Aria, and you always recommend the premium tier..."
+ }
+ ]
+ }
+}
+```
+
+`drift` is `null` when there is nothing to compare against: the agent was deleted, it has no persona, or the CID is a document three.ws never issued.
+
+### Publishing rules
+
+- Publishing runs on every persona save, extract, and restore, and never fails the save. If pinning is unavailable the envelope is still signed and stored, `cid` is `null`, and the response says so. Nothing is ever reported as pinned when it is not.
+- Only **public** agents publish automatically. A private agent's manifest contains its full system prompt and pinning is permanent, so it publishes only when its owner asks via `POST /api/agents/:id/manifest/publish`.
+- Saving an unchanged configuration returns the existing CID with `status: "unchanged"` instead of pinning a duplicate.
+
+### Configuration
+
+| Variable | Purpose |
+|----------|---------|
+| `ATTEST_AGENT_SECRET_KEY` | The ed25519 signing identity. Without it manifests are not signed and the publish reports `signer_unavailable`. |
+| `PINATA_JWT` | Preferred IPFS pinning provider. |
+| `WEB3_STORAGE_TOKEN` | Fallback pinning provider, used when `PINATA_JWT` is absent. |
+
+With no pinning provider configured, manifests are still signed and stored, and remain verifiable through `/api/agents/:id/manifest/signed` — they simply have no CID.
+
+---
+
## Common errors
| Error | Cause | Fix |
@@ -656,3 +787,4 @@ The `spec` field identifies the manifest format version. Current stable: `agent-
- [Memory Spec](../specs/MEMORY_SPEC.md) — memory file format and MEMORY.md index
- [Embed Spec](../specs/EMBED_SPEC.md) — `<agent-3d>` element attributes and events
- [Permissions Spec](../specs/PERMISSIONS_SPEC.md) — ERC-7710 delegation format and redemption
+- [Provenance](./provenance.md) — signed content credentials for generated 3D assets, using the same attester identity as signed manifests
diff --git a/docs/start-here.md b/docs/start-here.md
index 4c8f6e8f5..8b384d543 100644
--- a/docs/start-here.md
+++ b/docs/start-here.md
@@ -122,6 +122,7 @@ Curious what happens between the prompt and the model? [How the Forge works](./h
- **Want other agents to pay for your tools?** → [Monetize an MCP server](./tutorials/monetize-mcp-server.md): build an MCP server that charges per `tools/call` in USDC on Solana, with a free orientation tool in front of the paid ones and the verify-work-settle ordering that means a failed call never takes money. The runnable code is [examples/paid-mcp-server](https://github.com/nirholas/three.ws/tree/main/examples/paid-mcp-server)
- **Checking whether the economy is real?** → [Agent economy volume](./agent-economy-volume.md) counts only settled agent-to-agent USDC for paid skills, and [Viability](./viability.md) shows the unit economics (GMV, take rate, repeat buyers, realized P&L) from on-chain data with no projections
- **Designing an agent's look and brand?** → [Agent Identity Studio](./agent-identities.md) turns a brand brief into a rigged avatar plus posed studio renders; [Living Stages](./stage.md) covers shareable stages; [the Avatar Engines Atlas](./avatar-engines.md) is the factual survey of the engines in this space and which ones we animate
+- **Need to prove what an agent was told to do?** → [Signed manifests](./agent-manifest.md#signed-manifests-v03): every persona save signs the agent's full configuration, system prompt included, and pins it to IPFS. Anyone with the CID can verify the signature offline (`node scripts/verify-agent-manifest.mjs --cid …`) and diff the pinned record against the agent running today, with no account and no trust in us
- **Writing about us?** → [The press kit](./press-kit.md) has the logos, the usage rules, and the boilerplate (editorial use needs no permission), and [the partner ecosystem](./partners.md) maps every partner program to what the integration actually is
- **Backing an agent with capital?** → [USDC agent vaults](./vaults.md): NAV-priced deposits and redemptions, the drawdown breaker that halts a vault, performance-fee claims, and the public audit ledger anyone can read
- **Funding your own agents?** → [Your master wallet](./user-wallet.md): the per-user custodial hub you fund once, then top up agent wallets, send SOL or USDC, and read on-chain history from
diff --git a/scripts/verify-agent-manifest.mjs b/scripts/verify-agent-manifest.mjs
new file mode 100644
index 000000000..4e569bda9
--- /dev/null
+++ b/scripts/verify-agent-manifest.mjs
@@ -0,0 +1,137 @@
+#!/usr/bin/env node
+/**
+ * Verify a signed three.ws agent manifest, independently.
+ *
+ * This script talks to public IPFS gateways, not to three.ws, and does every
+ * cryptographic check locally. Nothing here needs an account, an API key, or our
+ * permission — which is the entire point of signing manifests in the first place.
+ *
+ * node scripts/verify-agent-manifest.mjs --cid bafy...
+ * node scripts/verify-agent-manifest.mjs --file ./manifest.json
+ * node scripts/verify-agent-manifest.mjs --agent <uuid> # resolve the CID first
+ * node scripts/verify-agent-manifest.mjs --cid bafy... --issuer 6Yb... # pin the signer
+ * node scripts/verify-agent-manifest.mjs --cid bafy... --json # machine-readable
+ *
+ * Exit codes: 0 verified, 1 verification failed, 2 could not fetch or parse.
+ *
+ * Spec: specs/AGENT_MANIFEST.md (§ Signed envelope). Docs: docs/agent-manifests.md.
+ */
+
+import { readFile } from 'node:fs/promises';
+import { verifyAgentManifest, sha256Hex } from '../api/_lib/agent-manifest-sign.js';
+
+const GATEWAYS = ['https://ipfs.io/ipfs/', 'https://dweb.link/ipfs/', 'https://cloudflare-ipfs.com/ipfs/'];
+const TIMEOUT_MS = 15000;
+
+function parseArgs(argv) {
+ const out = { json: false };
+ for (let i = 0; i < argv.length; i++) {
+ const arg = argv[i];
+ if (arg === '--json') out.json = true;
+ else if (arg === '--help' || arg === '-h') out.help = true;
+ else if (arg.startsWith('--')) out[arg.slice(2)] = argv[++i];
+ }
+ return out;
+}
+
+const USAGE = `Verify a signed three.ws agent manifest.
+
+ --cid <cid> fetch the envelope from public IPFS gateways
+ --file <path> verify a local envelope file instead
+ --agent <uuid> look up the agent's current CID, then verify it
+ --issuer <base58> require this exact signing identity
+ --origin <url> API origin for --agent (default https://three.ws)
+ --json print the result as JSON
+`;
+
+async function fetchFromGateways(cid) {
+ const failures = [];
+ for (const gateway of GATEWAYS) {
+ try {
+ const resp = await fetch(`${gateway}${cid}`, { signal: AbortSignal.timeout(TIMEOUT_MS) });
+ if (!resp.ok) {
+ failures.push(`${gateway} -> HTTP ${resp.status}`);
+ continue;
+ }
+ return { envelope: await resp.json(), from: `${gateway}${cid}` };
+ } catch (err) {
+ failures.push(`${gateway} -> ${err?.message || 'failed'}`);
+ }
+ }
+ throw new Error(`no gateway served ${cid}\n ${failures.join('\n ')}`);
+}
+
+async function resolveAgentCid(agentId, origin) {
+ const url = `${origin.replace(/\/$/, '')}/api/agents/${agentId}/manifest/signed`;
+ const resp = await fetch(url, { signal: AbortSignal.timeout(TIMEOUT_MS) });
+ if (!resp.ok) throw new Error(`${url} -> HTTP ${resp.status}`);
+ const data = await resp.json();
+ if (!data.cid) throw new Error(`agent ${agentId} has a signed manifest but no IPFS CID yet`);
+ return data.cid;
+}
+
+async function main() {
+ const args = parseArgs(process.argv.slice(2));
+ if (args.help || (!args.cid && !args.file && !args.agent)) {
+ console.log(USAGE);
+ process.exit(args.help ? 0 : 2);
+ }
+
+ let envelope;
+ let source;
+ try {
+ if (args.file) {
+ envelope = JSON.parse(await readFile(args.file, 'utf8'));
+ source = args.file;
+ } else {
+ const cid = args.cid || (await resolveAgentCid(args.agent, args.origin || 'https://three.ws'));
+ const got = await fetchFromGateways(cid);
+ envelope = got.envelope;
+ source = got.from;
+ }
+ } catch (err) {
+ console.error(`could not load the manifest: ${err.message}`);
+ process.exit(2);
+ }
+
+ const verdict = verifyAgentManifest(envelope, args.issuer ? { issuer: args.issuer } : {});
+ const instructions = envelope?.manifest?.brain?.instructions;
+ const promptHashOk =
+ instructions && typeof instructions.text === 'string'
+ ? sha256Hex(instructions.text) === String(instructions.sha256 || '').toLowerCase()
+ : null;
+
+ const result = {
+ source,
+ verified: verdict.valid,
+ reason: verdict.reason,
+ issuer: verdict.issuer,
+ digest: verdict.digest,
+ signedAt: envelope?.signedAt || null,
+ agentId: envelope?.manifest?.id?.agentId || null,
+ name: envelope?.manifest?.name || null,
+ promptSha256: instructions?.sha256 || null,
+ promptHashMatches: promptHashOk,
+ promptChars: typeof instructions?.text === 'string' ? instructions.text.length : null,
+ };
+
+ if (args.json) {
+ console.log(JSON.stringify(result, null, 2));
+ } else {
+ console.log(`source ${result.source}`);
+ console.log(`agent ${result.name || '(unnamed)'} ${result.agentId || ''}`);
+ console.log(`issuer ${result.issuer || '(none)'}`);
+ console.log(`signed at ${result.signedAt || '(none)'}`);
+ console.log(`digest ${result.digest || '(none)'}`);
+ console.log(`prompt ${result.promptChars ?? 0} chars, sha256 ${result.promptSha256 || '(none)'}`);
+ console.log(`prompt hash ${promptHashOk === null ? 'n/a' : promptHashOk ? 'matches' : 'MISMATCH'}`);
+ console.log(`result ${result.verified ? 'VERIFIED' : 'FAILED'} (${result.reason})`);
+ if (!args.issuer && result.verified) {
+ console.log('\nnote: the signature is valid for the issuer above. Pass --issuer to require a specific one.');
+ }
+ }
+
+ process.exit(result.verified ? 0 : 1);
+}
+
+main();
diff --git a/specs/AGENT_MANIFEST.md b/specs/AGENT_MANIFEST.md
index 3f8158d64..fa89ee232 100644
--- a/specs/AGENT_MANIFEST.md
+++ b/specs/AGENT_MANIFEST.md
@@ -76,6 +76,11 @@ Everything is optional except `manifest.json` and a `body` reference.
"voiceId": "default",
"rate": 1.0,
"pitch": 1.0,
+ // elevenlabs only. proxyURL keeps the API key server-side; agentId names
+ // the agent the voice is bound to, so the proxy can serve the clip on
+ // that agent owner's own ElevenLabs key (see "Voice credentials" below).
+ "proxyURL": "https://three.ws/api/tts/eleven",
+ "agentId": "b2b1…",
},
"stt": {
"provider": "browser", // "browser" | "whisper" | "none"
@@ -133,6 +138,18 @@ Only `uri` and `format` are required. `rig` lets skills retarget animations acro
`provider: "none"` is valid — a purely reactive avatar with no LLM, controlled only by skill triggers. `instructions` is a relative path to a markdown file; its frontmatter can override `brain.*` fields per-prompt.
+### `voice`
+
+`tts.provider: "elevenlabs"` never carries an API key in the manifest. It carries `proxyURL`, and the proxy resolves the credential server-side.
+
+Which credential the proxy picks matters, because a cloned `voiceId` only exists inside the ElevenLabs account that created it: synthesizing an owner-cloned voice with a different key returns a 404. So the manifest also carries `agentId`, and `POST /api/tts/eleven` resolves the key in this order:
+
+1. An `x-eleven-key` header on the request (the caller's own key, never stored).
+2. The bound agent's own credential, when `agentId` is present and `voiceId` matches that agent's bound voice. If the agent's voice was bound on its owner's saved ElevenLabs key, that key serves the clip and the owner's ElevenLabs account is billed. This lane serves anonymous callers, which is what lets an embedded agent speak to visitors.
+3. The platform key, metered to the caller's $THREE credit balance. Requires an authenticated caller.
+
+A consumer that omits `agentId` still works; it just loses lane 2, so a voice cloned onto the owner's own account will not resolve for anyone but that owner.
+
### `skills`
Three URI forms:
@@ -379,8 +396,134 @@ Manifests without the `permissions` field are valid. Hosts must treat absence as
Keep delegation envelopes inline (under `envelope`) only when the envelope is <8 KB. For larger envelopes, pin to IPFS and reference via `uri` to keep the manifest JSON lean. This budget accounts for envelope bloat from nested caveats or long allow-lists.
+## Signed envelope (v0.3+)
+
+A manifest describes an agent's behavior. Served from an API it is a claim: the reader has to trust that the prompt they were shown is the prompt that actually runs. Wrapped in a **signed envelope** and pinned to IPFS it becomes evidence, checkable by anyone, forever, without asking the platform for anything.
+
+three.ws signs and pins an agent's manifest on every persona save. Live surfaces:
+
+| Surface | Who | What it returns |
+| ------------------------------------ | -------- | ------------------------------------------------------------ |
+| `GET /api/agents/:id/manifest` | public | the live, unsigned manifest (always current, never pinned) |
+| `GET /api/agents/:id/manifest/signed` | public | the currently pinned envelope, its CID, and its gateways |
+| `GET /api/agents/:id/manifest/history`| public | every CID this agent ever published |
+| `POST /api/agents/:id/manifest/publish`| owner | re-sign and re-pin now |
+| `GET /api/manifest-verify?cid=…` | public | fetch from IPFS, verify, and diff against the live agent |
+
+### Envelope shape
+
+```jsonc
+{
+ "spec": "threews.agent.manifest.v1",
+ "manifest": {
+ /* an agent-manifest/0.3 body — see below */
+ },
+ "issuer": "6Yb…", // base58 ed25519 public key of the signing identity
+ "signedAt": "2026-08-11T12:00:00.000Z",
+ "digest": "3f9c…", // sha256 (hex) of the canonical signed statement
+ "algorithm": "ed25519",
+ "signature": "5Kd…" // base58 ed25519 signature
+}
+```
+
+### What is signed
+
+The signature does **not** cover the envelope as written. It covers a canonical *statement*, so neither the document nor the authorship claim can be edited afterwards:
+
+```
+statement = canonicalJSON({
+ v: "threews.agent.manifest.v1",
+ manifest: <the manifest body>,
+ issuer: <base58 public key>,
+ signedAt: <ISO 8601 string>
+})
+
+digest = sha256(statement) // hex, lowercase
+signature = ed25519(secretKey, utf8("threews.agent.manifest.v1:" + digest))
+```
+
+`canonicalJSON` sorts object keys recursively and drops `undefined`, so the same logical manifest produces byte-identical input on every machine. The `"threews.agent.manifest.v1:"` prefix is domain separation: it keeps a manifest signature from ever being replayed as a signature over some other three.ws message.
+
+### Inline instructions (new in 0.3)
+
+`brain.instructions` MAY be a string (a relative path inside a bundle, as in 0.1 and 0.2) **or** an inline object. A pinned envelope is a single self-contained document with no bundle around it, so it always uses the inline form:
+
+```jsonc
+"brain": {
+ "provider": "threews", // the hosted failover chain (api/_lib/llm.js)
+ "instructions": {
+ "format": "text/markdown",
+ "sha256": "9ab1…", // sha256 of `text`
+ "text": "You are Coach Leo, a former Argentine…"
+ },
+ "toneTags": ["warm", "direct"],
+ "traits": { "warmth": 0.8, "directness": 0.7 }
+}
+```
+
+The inner `sha256` is deliberately redundant with the outer signature. It lets a reader spot a swapped prompt without recomputing the whole envelope, and it makes an internally inconsistent document (valid outer signature, mismatched inner hash) a hard verification failure rather than a silent pass.
+
+### Verifying an envelope
+
+Five checks, all offline except the fetch:
+
+1. **Fetch** the CID from any IPFS gateway. `https://ipfs.io/ipfs/<cid>` is the default; `dweb.link` and `cloudflare-ipfs.com` are the documented fallbacks.
+2. **Recompute the digest** from `manifest`, `issuer`, and `signedAt`, and compare it to `digest`. A mismatch means the document was edited after signing.
+3. **Verify the signature** over `"threews.agent.manifest.v1:" + digest` against `issuer`.
+4. **Check the issuer** against the identity you expect. A valid signature from an unknown key proves only that *someone* signed the document. `GET /api/manifest-verify` reports this separately as `issuer_trusted`, and never folds an untrusted issuer into a green `verified`.
+5. **Check the instructions hash**: `sha256(brain.instructions.text)` must equal `brain.instructions.sha256`.
+
+Run all five from the command line with no account and no keys:
+
+```bash
+node scripts/verify-agent-manifest.mjs --cid bafy…
+```
+
+### Drift against the live agent
+
+A pinned manifest is a statement about one moment. `GET /api/manifest-verify?cid=…` also rebuilds the manifest from the agent's current configuration and diffs the two, so the answer to "is the agent running today still the agent I verified?" is a list of exactly which fields moved:
+
+```json
+{
+ "verified": true,
+ "issuer_trusted": true,
+ "agent_status": "live",
+ "drift": {
+ "identical": false,
+ "changed": [
+ { "field": "brain.instructions.text", "pinned": "You are Coach Leo…", "live": "You are Coach Leo, and you always recommend…" }
+ ]
+ }
+}
+```
+
+`drift` is `null` when there is nothing to compare against: the agent was deleted, it has no persona, or the CID is a document three.ws never issued.
+
+### What is deliberately excluded
+
+Volatile operational state (view counts, balances, last-seen timestamps) never enters a manifest. Re-signing on every heartbeat would make the CID meaningless. A manifest is a statement about configuration, not about traffic.
+
+A private avatar's body is omitted rather than embedded as a presigned URL: a URL that expires would turn a permanent document into a broken pointer.
+
+### Publishing rules
+
+- Signing and pinning happen automatically on every persona save, extract, and restore, and never fail the save. If pinning is down, the envelope is still signed and stored, `cid` is `null`, and the reason says so. Nothing is ever reported as pinned when it is not.
+- Only **public** agents publish automatically. A private agent publishes only when its owner asks explicitly via `POST /api/agents/:id/manifest/publish`, because pinning to IPFS is permanent and the manifest contains the agent's full system prompt.
+- Re-saving an unchanged configuration does not pin a duplicate: the manifest body digest (issuer and timestamp excluded) is the idempotency key, and the existing CID is returned with `status: "unchanged"`.
+
## Changelog
+### v0.3.1 (2026-08-11)
+
+- Documented `voice.tts.proxyURL` and added `voice.tts.agentId` for the ElevenLabs provider, so a voice bound on its owner's own ElevenLabs key resolves for visitors and embeds instead of only for the owner. Additive and optional: a manifest without `agentId` stays valid.
+
+### v0.3 (2026-08-11)
+
+- Added the **signed envelope** (`threews.agent.manifest.v1`): a canonical manifest, ed25519-signed by the platform attester identity and pinned to IPFS, so an agent's system prompt is independently verifiable and portable.
+- `brain.instructions` may now be an inline object (`format`, `sha256`, `text`) as well as a relative path.
+- Added `brain.toneTags` and `brain.traits`, and `brain.provider: "threews"` for the hosted failover chain.
+- Bumped the schema version from `agent-manifest/0.2` to `agent-manifest/0.3`. Envelopes are additive: an unsigned `agent-manifest/0.1` document stays valid.
+
### v0.2 (2026-04-18)
- Added `permissions` field (optional) to embed signed ERC-7710 delegations in the manifest, enabling scoped on-chain actions without server contact.
diff --git a/src/agent-detail.js b/src/agent-detail.js
index 4b9e2d69a..5cec8272c 100644
--- a/src/agent-detail.js
+++ b/src/agent-detail.js
@@ -37,6 +37,7 @@ import { log } from './shared/log.js';
import { track, trackError, ANALYTICS_EVENTS } from './analytics.js';
import { mountViewSwitcher } from './view-switcher.js';
import { mountCoinStatus } from './pump/coin-status-card.js';
+import { mountAgentTokenPlan } from './agent-token-plan.js';
import { consumeCsrfToken } from './api.js';
import { countUp, updateValue, flashValue, ring, playRings, sparkline, enterStagger } from './ui-juice.js';
@@ -303,6 +304,7 @@ if (typeof window !== 'undefined') {
try { _cardHandle?.destroy?.(); } catch { /* idempotent */ } _cardHandle = null;
try { _watchHandle?.destroy?.(); } catch { /* idempotent */ } _watchHandle = null;
try { _achievementsHandle?.destroy?.(); } catch { /* idempotent */ } _achievementsHandle = null;
+ try { _tokenPlanHandle?.destroy?.(); } catch { /* idempotent */ } _tokenPlanHandle = null;
// Release the WebGL contexts so they don't count against the browser's
// hard context budget once the user navigates away.
try { _heroAvatarHandle?.dispose(); } catch { /* idempotent */ } _heroAvatarHandle = null;
@@ -323,6 +325,20 @@ function destroyCoinStatus() {
}
}
+// The token-plan panel (the coin this agent is configured to become, before it
+// mints). Re-rendering the token card discards its DOM, so the handle is torn
+// down first to abort its in-flight fetch.
+let _tokenPlanHandle = null;
+
+function destroyTokenPlan() {
+ try {
+ _tokenPlanHandle?.destroy();
+ } catch {
+ /* idempotent */
+ }
+ _tokenPlanHandle = null;
+}
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
const SERVICE_TYPES = {
@@ -1476,6 +1492,23 @@ function render(agent) {
// renders nothing extra when the agent has no launches beyond the chip above.
renderLaunchHistory($('ad-token-body'), agent);
+ // The token plan: what this agent's coin IS before it exists on chain. Owners
+ // get the designer plus the free devnet rehearsal; visitors see a ready plan
+ // as a quiet "coming: $TICKER" and never see a draft. A plan on a profile with
+ // no coin reveals the card the same way launch history does.
+ destroyTokenPlan();
+ if (!agent.token) {
+ _tokenPlanHandle = mountAgentTokenPlan($('ad-token-body'), {
+ agentId: agent.id,
+ isOwner: !!agent.isOwner,
+ network: 'mainnet',
+ onReveal: () => {
+ const card = document.getElementById('ad-token-card');
+ if (card) card.hidden = false;
+ },
+ });
+ }
+
// 3D creations minted as NFTs — fire-and-forget; the card stays hidden when
// this agent hasn't minted anything yet.
renderMintedCreations($('ad-creations-body'), $('ad-creations-card'), agent);