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(oracle): put the fitted reason and the realized odds next to every conviction score

nirholas9defae195dd6
diff --git a/api/_lib/oracle/store.js b/api/_lib/oracle/store.js
index 74f159d6e..eb49a6097 100644
--- a/api/_lib/oracle/store.js
+++ b/api/_lib/oracle/store.js
@@ -150,9 +150,11 @@ export async function readFeed({ network = 'mainnet', limit = 50, minScore = 0,
const rows = await sql`
select c.mint, c.symbol, c.name, c.image_uri, c.score, c.tier,
c.pedigree, c.structure, c.narrative, c.momentum,
- c.badges, c.category, c.smart_wallet_count, c.scored_at, c.coin_first_seen_at,
+ c.badges, c.reasons, c.category, c.smart_wallet_count, c.scored_at, c.coin_first_seen_at,
+ o.graduated, o.rugged, o.ath_multiple,
hist.spark
from oracle_conviction c
+ left join pump_coin_outcomes o on o.mint = c.mint
left join lateral (
select array_agg(h.score order by h.scored_at)::int[] as spark
from (
@@ -195,11 +197,32 @@ function rowToFeedItem(r) {
// history points (24h, ≤16) with the live score guaranteed as the final point.
let spark = Array.isArray(r.spark) ? r.spark.map(Number).filter(Number.isFinite) : [];
if (r.score != null && (spark.length === 0 || spark[spark.length - 1] !== r.score)) spark.push(r.score);
+
+ // The strongest fitted evidence behind this specific score. The feed used to
+ // ship the number alone, so every card had to fall back to a per-tier
+ // template and the whole page read as one sentence copy-pasted 200 times,
+ // even though the engine had already written a different, quantified reason
+ // for each coin. Three is what a card can show; the rest are on the coin page.
+ const reasons = Array.isArray(r.reasons)
+ ? r.reasons
+ .filter((x) => x && x.text)
+ .slice(0, 3)
+ .map((x) => ({ pillar: x.pillar || null, text: String(x.text) }))
+ : [];
+
+ // What the score has been worth in resolved outcomes, so no surface has to
+ // treat a 0-100 rank as if it were a percentage.
+ const odds = hitRateFor(r.score);
+
return {
mint: r.mint, symbol: r.symbol, name: r.name, image_uri: r.image_uri,
score: r.score, tier: r.tier,
pillars: { pedigree: r.pedigree, structure: r.structure, narrative: r.narrative, momentum: r.momentum },
badges: r.badges || [],
+ reasons,
+ hit_rate: odds.rate,
+ hit_rate_lift: odds.lift,
+ hit_rate_n: odds.n,
category: r.category,
smart_wallet_count: r.smart_wallet_count,
scored_at: r.scored_at,
diff --git a/api/oracle-share.js b/api/oracle-share.js
index 0b5017054..bce4533cf 100644
--- a/api/oracle-share.js
+++ b/api/oracle-share.js
@@ -302,12 +302,78 @@ function heroHtml({ mint, row, pump, origin }) {
</div>
<div class="oc-conv-card" aria-label="Oracle conviction">
${dial}
+ <div id="ocOdds">${oddsHtml}</div>
${pillars}
+ <div id="ocSince">${sinceHtml}</div>
</div>
</div>
</section>`;
}
+/**
+ * What the score is worth, under the score. Reads the production calibration
+ * (conviction-calibration.json: realized win rate per score band over every coin
+ * Oracle scored that the market has since resolved) so the claim next to the
+ * number is a measured frequency instead of an implied one.
+ *
+ * @param {number} score 0-100 conviction
+ * @param {string} scoredAt when the verdict was written
+ * @param {string} firstSeen when the coin first surfaced (the call's lead time)
+ */
+export function verdictOddsHtml(score, scoredAt, firstSeen) {
+ const hr = hitRateFor(Number(score));
+ if (!hr || hr.rate == null || !hr.n) return '';
+ const rate = Math.round(hr.rate * 100);
+ const base = Math.round((hr.baseRate || 0) * 100);
+ const lift = hr.lift != null ? Number(hr.lift).toFixed(1) : null;
+ const lead = leadSeconds(scoredAt, firstSeen);
+ return `<p class="oc-odds">
+ <b>${rate}%</b> of calls in the ${esc(hr.band || '')} band have won<span class="oc-odds-n"> (n=${hr.n.toLocaleString('en-US')})</span>${lift ? `, <b>${esc(lift)}x</b> the ${base}% a random launch wins` : ''}.
+ <span class="oc-odds-sub">Scored ${lead ? `${lead} after this coin surfaced` : 'at launch'}, from the first ~90s of trading. It ranks the odds of a 3x run or graduation, not the odds of a safe hold.</span>
+ </p>`;
+}
+
+/** Seconds/minutes between a launch first surfacing and Oracle scoring it. */
+function leadSeconds(scoredAt, firstSeen) {
+ if (!scoredAt || !firstSeen) return null;
+ const secs = Math.round((new Date(scoredAt).getTime() - new Date(firstSeen).getTime()) / 1000);
+ if (!Number.isFinite(secs) || secs < 0) return null;
+ return secs < 90 ? `${secs}s` : `${Math.round(secs / 60)}m`;
+}
+
+/**
+ * What the market did with this coin AFTER the call. A resolved outcome outranks
+ * the verdict on the page: the score is a prediction, this is the answer.
+ *
+ * @param {{graduated?:boolean, rugged?:boolean, ath_multiple?:number|string, last_market_cap_usd?:number|string}|null} row
+ */
+export function outcomeStripHtml(row) {
+ if (!row) return '';
+ const ath = row.ath_multiple != null ? Number(row.ath_multiple) : null;
+ const mc = row.last_market_cap_usd != null ? Number(row.last_market_cap_usd) : null;
+ const graduated = row.graduated === true;
+ const rugged = row.rugged === true;
+ if (!graduated && !rugged && !(ath > 0)) return '';
+ const verdict = graduated
+ ? '<span class="chip sm">graduated ✓</span>'
+ : rugged ? '<span class="chip flag">rugged ✕</span>' : '<span class="chip">still live</span>';
+ return `<div class="oc-since ${rugged && !graduated ? 'bad' : graduated ? 'good' : ''}">
+ <span class="oc-since-lbl">Since the call</span>
+ ${ath > 0 ? `<span class="chip" title="Peak market cap versus its market cap when Oracle scored it">peak <b>${ath.toFixed(1)}x</b></span>` : ''}
+ ${verdict}
+ ${mc != null ? `<span class="chip" title="Market cap now">now <b>${esc(fmtUsdShort(mc))}</b></span>` : ''}
+ </div>`;
+}
+
+function fmtUsdShort(n) {
+ const v = Number(n);
+ if (!Number.isFinite(v)) return '—';
+ if (v >= 1e9) return `$${(v / 1e9).toFixed(1)}B`;
+ if (v >= 1e6) return `$${(v / 1e6).toFixed(1)}M`;
+ if (v >= 1e3) return `$${(v / 1e3).toFixed(1)}K`;
+ return `$${v.toFixed(0)}`;
+}
+
function pumpUrl(mint) { return `https://pump.fun/coin/${mint}`; }
function shareTweet(mint, row, pump, origin) {