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.

fix(oracle): say what a conviction score claims and what the coin did after the call

nirholas5a84debc7c75
diff --git a/api/_lib/oracle/conviction.js b/api/_lib/oracle/conviction.js
index 2aba4992a..da2898c57 100644
--- a/api/_lib/oracle/conviction.js
+++ b/api/_lib/oracle/conviction.js
@@ -273,6 +273,76 @@ const CREATOR_TEXT = {
// measurement of it, so the sentence says "such launches" instead of "similar".
const SUCH = new Set(['creator_record', 'category', 'dev_sold']);
+// One card-ready phrase per fitted bucket. The fallback below ("organic demand
+// 0.6-0.8") is readable to whoever fitted the model and to nobody else, and it
+// was fine while reasons only ever appeared in a diagnostic list. They are the
+// headline of every feed card now, so each bucket says what it means in the
+// units a trader already thinks in.
+const PHRASE = {
+ organic_score: {
+ '<0.2': 'almost no organic demand', '0.2-0.4': 'weak organic demand',
+ '0.4-0.6': 'middling organic demand', '0.6-0.8': 'solid organic demand',
+ '>=0.8': 'strong organic demand',
+ },
+ bundle_score: {
+ '<0.1': 'no sign of a bundled launch', '0.1-0.3': 'faint bundling',
+ '0.3-0.5': 'partly bundled', '>=0.5': 'heavily bundled',
+ },
+ snipe_ratio: {
+ '<0.1': 'barely sniped at open', '0.1-0.3': 'lightly sniped at open',
+ '0.3-0.7': 'heavily sniped at open', '>=0.7': 'almost entirely sniped at open',
+ },
+ coordination_score: {
+ '<0.1': 'buyers acting independently', '0.1-0.3': 'some coordinated buying',
+ '>=0.3': 'coordinated buying',
+ },
+ timing_entropy: {
+ '<0.2': 'buys landing in one burst', '0.2-0.4': 'buys clustered in time',
+ '0.4-0.6': 'buys moderately spread out', '0.6-0.8': 'buys well spread in time',
+ '>=0.8': 'buys evenly spread in time',
+ },
+ concentration_top1: {
+ '<0.05': 'no holder above 5%', '0.05-0.15': 'top holder at 5-15%',
+ '0.15-0.3': 'top holder at 15-30%', '>=0.3': 'top holder above 30%',
+ },
+ concentration_top10: {
+ '<0.3': 'top 10 under 30% of supply', '0.3-0.9': 'top 10 holding 30-90%',
+ '>=0.9': 'top 10 holding over 90%',
+ },
+ unique_buyers: {
+ '<1': 'no buyers yet', '1-5': 'under 5 early buyers', '5-15': '5-15 early buyers',
+ '15-40': '15-40 early buyers', '>=40': '40+ early buyers',
+ },
+ buy_sell_ratio: {
+ '<0.5': 'more sellers than buyers', '0.5-1': 'sells keeping pace with buys',
+ '1-2': 'buys leading sells', '2-4': 'buys 2-4x the sells', '>=4': 'buys 4x+ the sells',
+ null: 'nobody has sold yet',
+ },
+ buy_volume_sol: {
+ '<0.5': 'under 0.5 SOL bought', '0.5-8': '0.5-8 SOL bought early',
+ '8-25': '8-25 SOL bought early', '>=25': '25+ SOL bought early',
+ },
+ largest_buy_sol: {
+ '<0.2': 'no buy above 0.2 SOL', '0.2-2.5': 'biggest buy 0.2-2.5 SOL',
+ '2.5-5': 'biggest buy 2.5-5 SOL', '>=5': 'a 5+ SOL single buy',
+ },
+ avg_buy_sol: {
+ '<0.05': 'dust-sized average buy', '0.05-0.5': 'average buy 0.05-0.5 SOL',
+ '>=0.5': 'average buy above 0.5 SOL',
+ },
+ dev_buy_sol: {
+ '<0.05': 'dev barely bought their own launch', '0.05-0.5': 'dev bought 0.05-0.5 SOL',
+ '0.5-2': 'dev bought 0.5-2 SOL', '>=2': 'dev bought 2+ SOL of their own launch',
+ },
+ mc_sol_first_seen: {
+ '<28': 'spotted below a 28 SOL cap', '28-30': 'spotted at a 28-30 SOL cap',
+ '30-35': 'spotted at a 30-35 SOL cap', '>=35': 'already past a 35 SOL cap when spotted',
+ },
+ dev_sold: {
+ '<0.5': 'dev held through the window', '>=0.5': 'dev sold inside the window',
+ },
+};
+
/**
* The subject half of a reason: what the model actually saw, with no outcome
* statistics attached. Emitted alongside the full sentence because a card has
@@ -282,7 +352,8 @@ const SUCH = new Set(['creator_record', 'category', 'dev_sold']);
function reasonSubject(feature, bucketLabel) {
if (feature.key === 'creator_record') return CREATOR_TEXT[bucketLabel] || bucketLabel;
if (feature.key === 'category') return `${bucketLabel} narrative`;
- if (feature.key === 'dev_sold') return bucketLabel === '>=0.5' ? 'dev sold inside the window' : 'dev held through the window';
+ const phrased = PHRASE[feature.key]?.[bucketLabel];
+ if (phrased) return phrased;
return `${FEATURE_TEXT[feature.key] || feature.key} ${bucketLabel}`;
}
diff --git a/docs/oracle.md b/docs/oracle.md
index f43c1e976..cdbf2bc84 100644
--- a/docs/oracle.md
+++ b/docs/oracle.md
@@ -203,6 +203,8 @@ This is where the engine earns its keep. One score, many consumers.
**The coin pages.** Every Oracle coin page (`/oracle/coin/<mint>`) renders in the markets-hub design, the same editorial system as `/coin/bitcoin`: breadcrumbs, a coin header with the live price and 24h/7d change chips, a conviction card with the score dial and four pillar bars, and stacked full-width sections. It fuses conviction with a live market intel aggregator that fans out to six real sources in parallel: DexScreener, the pump.fun API, GeckoTerminal, GoPlus, Birdeye, and CoinGecko. Price, liquidity, FDV, bonding curve progress, holder count, top ten concentration, mint and freeze authority, all in one view, every number traced to a live upstream. Each source is isolated, so one being down degrades that slice to null instead of failing the page. A Launch Intelligence section brings the Coin Radar engine's first-90-seconds read onto the same page: quality score, organic versus bundle, risk flags, the full signal breakdown, smart-money buyers, and the top-trader ledger. It also shows the who-is-in breakdown: every early wallet labeled by archetype and track record. That trader-classification surface is what the product is built around. The price chart keeps the TradingView-grade DexScreener candles embed alongside a native line view and an agent-trades view that plots every three.ws agent buy and sell on the series.
+**What the verdict card says out loud.** A big dial reading 100 next to a chart that already collapsed is not a wrong score, it is an unlabelled one, so the conviction card carries two lines the dial cannot say by itself. Directly under the score, the odds line quotes the band's realized rug-aware rate instead of the score: "26% of calls in the 90-100 band have won (n=792), 4.8x the 5% a random launch wins", followed by when the call was made relative to the coin first surfacing ("Scored 54s after this coin surfaced") and the one sentence that resolves the whole confusion, that the score ranks the odds of a 3x run or graduation and not the odds of a safe hold. Below it, once the market has resolved the coin, a **Since the call** strip states the ground truth in the order a holder reads it: peak multiple, whether it graduated or rugged, and what it is worth now ("peak 6.7x · rugged · now $2.2K"). Both lines are rendered server-side in `api/oracle-share.js` and refilled by `public/oracle-coin.js`, so a link pasted into a chat shows them in the preview rather than a bare triumphant number; the share description carries the same clause ("since: ran 6.7x, then rugged"). The drawer's one-line take leads with the result for the same reason: "It ran to 6.7x and then rugged." before it repeats what Oracle called. On the feed at `/oracle`, each card carries the compact version of that strip as an outcome chip next to its odds chip, so a resolved coin never sits in the board looking like a live call.
+
## The x402 layer: intel with a price tag
Oracle's read API is free. The premium intel feeds are x402 paid endpoints, one cent USDC per call, settling on Solana or Base, and cataloged in the x402 bazaar so any paying agent on the open web can buy them:
diff --git a/tests/oracle/score-semantics.test.js b/tests/oracle/score-semantics.test.js
new file mode 100644
index 000000000..9c014a850
--- /dev/null
+++ b/tests/oracle/score-semantics.test.js
@@ -0,0 +1,167 @@
+// Pins what a conviction score MEANS, and pins the two ways every surface used
+// to get it wrong.
+//
+// 1. A score is a rank on a 0-100 line, not a percentage. 86 claims P=0.55.
+// Three surfaces (the backtest table, its Brier score, the calibration cron)
+// read score/100 as the prediction, which overstated the engine's own claim by
+// up to 4x and made a calibrated ranking look wildly overconfident.
+// 2. The engine is fitted to predict a 3x run or a graduation, judged whether or
+// not the coin later collapsed, while the platform's headline win rate
+// excludes anything that ever rugged. Grading the ranking on the stricter
+// definition without saying so is how a correct 100/prime call on a coin that
+// ran 6.7x and then died read as a broken engine.
+
+import { describe, it, expect } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+import {
+ PREDICTED_EVENT, SCORE_ANCHORS, MODEL,
+ probabilityFromScore, scoreFromProbability,
+} from '../../api/_lib/oracle/conviction.js';
+import { ladderCheck, assembleBands, brierScore } from '../../api/oracle/backtest.js';
+import { verdictOddsHtml, outcomeStripHtml } from '../../api/oracle-share.js';
+
+const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
+
+describe('score to probability', () => {
+ it('is the inverse of the probability to score map at every anchor', () => {
+ for (const [p, s] of SCORE_ANCHORS) {
+ expect(scoreFromProbability(p)).toBe(s);
+ expect(probabilityFromScore(s)).toBeCloseTo(p, 6);
+ }
+ });
+
+ it('does not read the score as a percentage', () => {
+ // The exact bug: a score of 86 claims 55%, and the old tables printed 86%.
+ expect(probabilityFromScore(86)).toBeCloseTo(MODEL.tier_probability_anchors.prime, 6);
+ expect(probabilityFromScore(86)).toBeLessThan(0.86);
+ expect(probabilityFromScore(34)).toBeCloseTo(MODEL.tier_probability_anchors.watch, 6);
+ });
+
+ it('is monotone and bounded across the whole line', () => {
+ let prev = -1;
+ for (let s = 0; s <= 100; s++) {
+ const p = probabilityFromScore(s);
+ expect(p).toBeGreaterThanOrEqual(0);
+ expect(p).toBeLessThanOrEqual(1);
+ expect(p).toBeGreaterThanOrEqual(prev);
+ prev = p;
+ }
+ });
+
+ it('clamps garbage instead of returning NaN', () => {
+ expect(probabilityFromScore(null)).toBe(0);
+ expect(probabilityFromScore('nope')).toBe(0);
+ expect(probabilityFromScore(1e9)).toBe(1);
+ expect(probabilityFromScore(-40)).toBe(0);
+ });
+
+ it('names the event it predicts, and that a later collapse does not undo a hit', () => {
+ expect(PREDICTED_EVENT.id).toBe('spike_or_graduate');
+ expect(PREDICTED_EVENT.label).toMatch(/3x/);
+ expect(PREDICTED_EVENT.caveat).toMatch(/not the odds of a safe hold/);
+ });
+});
+
+describe('ladder monotonicity', () => {
+ const band = (name, rate, lo, hi, n = 500) => ({ band: name, n, realized: rate, ci: { lo, hi } });
+
+ it('accepts a dip whose confidence intervals overlap', () => {
+ const out = ladderCheck([band('0-10', 5, 3, 7), band('10-20', 4, 2, 6), band('20-30', 9, 7, 11)], 'realized', 'ci');
+ expect(out.monotonic).toBe(true);
+ expect(out.inversions).toEqual([]);
+ });
+
+ it('flags a dip the intervals cannot explain, and names both bands', () => {
+ const out = ladderCheck([band('60-70', 16, 15, 18), band('70-80', 11, 9, 13)], 'realized', 'ci');
+ expect(out.monotonic).toBe(false);
+ expect(out.inversions[0]).toMatchObject({ band: '70-80', realized: 11, below_band: '60-70', below_realized: 16 });
+ });
+
+ it('never calls a real inversion monotonic just because it is small', () => {
+ // The retired check allowed any drop under 5 points, which is exactly the
+ // size of the drop production was shipping.
+ const out = ladderCheck([band('20-30', 6, 6, 7, 10724), band('30-40', 3, 3, 3, 8037)], 'realized', 'ci');
+ expect(out.monotonic).toBe(false);
+ });
+
+ it('ignores bands too thin to judge', () => {
+ const out = ladderCheck([band('80-90', 40, 30, 55, 20), band('90-100', 10, 8, 12, 800)], 'realized', 'ci');
+ expect(out.judged_bands).toBe(1);
+ expect(out.monotonic).toBe(true);
+ });
+});
+
+describe('calibration bands', () => {
+ // The real shape of the top band in production (n=792, 208 clean wins, 540 that
+ // ran 3x or graduated) split across two exact scores.
+ const rows = [
+ { score: 16, n: 24344, spikes: 3200, wins: 1184 },
+ { score: 95, n: 500, spikes: 340, wins: 130 },
+ { score: 100, n: 292, spikes: 200, wins: 78 },
+ ];
+
+ it('reports both realized rates against the claim the score actually makes', () => {
+ const [low, top] = assembleBands(rows);
+ expect(low.band).toBe('10-20');
+ expect(top.band).toBe('90-100');
+ expect(top.n).toBe(792);
+ expect(top.realized).toBe(26); // graduated or 2x without ever rugging
+ expect(top.realized_spike).toBe(68); // the trained event
+ // The retired code would have printed 95 here (the band midpoint).
+ expect(top.predicted).toBeLessThan(95);
+ expect(top.predicted).toBe(90);
+ });
+
+ it('drops empty bands instead of inventing zero rows', () => {
+ expect(assembleBands(rows).map((b) => b.band)).toEqual(['10-20', '90-100']);
+ expect(assembleBands([])).toEqual([]);
+ });
+
+ it('puts a perfect 100 in the top band rather than off the end', () => {
+ const bands = assembleBands([{ score: 100, n: 10, spikes: 5, wins: 3 }]);
+ expect(bands).toHaveLength(1);
+ expect(bands[0].band).toBe('90-100');
+ expect(bands[0].n).toBe(10);
+ });
+
+ it('scores Brier per exact score, not per band', () => {
+ expect(brierScore(rows)).toBeCloseTo(0.1303, 4);
+ expect(brierScore([])).toBeNull();
+ // A claim of 1.0 that never happens is the worst possible score.
+ expect(brierScore([{ score: 100, n: 1, spikes: 0 }])).toBe(1);
+ });
+});
+
+describe('the coin page states the odds and the outcome next to the score', () => {
+ it('quotes the band hit rate rather than implying the score is a probability', () => {
+ const html = verdictOddsHtml(100, '2026-08-14T03:02:07.434Z', '2026-08-14T03:01:13.000Z');
+ expect(html).toMatch(/band have won/);
+ expect(html).toMatch(/54s after this coin surfaced/);
+ expect(html).toMatch(/not the odds of a safe hold/);
+ expect(html).not.toMatch(/100% of calls/);
+ });
+
+ it('renders a rugged run as a run that rugged', () => {
+ const html = outcomeStripHtml({ graduated: false, rugged: true, ath_multiple: '6.675', last_market_cap_usd: '2204.27' });
+ expect(html).toMatch(/peak <b>6\.7x<\/b>/);
+ expect(html).toMatch(/rugged/);
+ expect(html).toMatch(/\$2\.2K/);
+ });
+
+ it('says nothing when the market has not resolved the coin', () => {
+ expect(outcomeStripHtml({ graduated: false, rugged: false, ath_multiple: null })).toBe('');
+ expect(outcomeStripHtml(null)).toBe('');
+ });
+
+ it('keeps the hero honesty lines server-rendered, so a share preview carries them too', () => {
+ const src = readFileSync(join(ROOT, 'api/oracle-share.js'), 'utf8');
+ expect(src).toMatch(/id="ocOdds"/);
+ expect(src).toMatch(/id="ocSince"/);
+ // The client mirrors both (buildless file, no imports) and must keep filling them.
+ const client = readFileSync(join(ROOT, 'public/oracle-coin.js'), 'utf8');
+ expect(client).toMatch(/#ocOdds/);
+ expect(client).toMatch(/#ocSince/);
+ });
+});