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): carry the resolved market outcome on every feed card

nirholasd4a29d00f1ed
diff --git a/api/_lib/oracle/conviction.js b/api/_lib/oracle/conviction.js
index f8a11c0aa..2aba4992a 100644
--- a/api/_lib/oracle/conviction.js
+++ b/api/_lib/oracle/conviction.js
@@ -261,30 +261,39 @@ const FEATURE_TEXT = {
category: 'narrative category',
};
+const CREATOR_TEXT = {
+ has_wins: 'creator has shipped a graduated launch before',
+ serial_no_wins: 'creator has 5+ prior launches, none graduated',
+ repeat_no_wins: 'creator relaunches without a single graduation',
+ first_launch: 'first launch from this creator',
+ unknown: 'creator history unknown',
+};
+
+// Features whose reason reads as a fact about the launch rather than a
+// measurement of it, so the sentence says "such launches" instead of "similar".
+const SUCH = new Set(['creator_record', 'category', 'dev_sold']);
+
+/**
+ * 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
+ * room for the observation but not the sentence, and a card that re-derives it
+ * by splitting the sentence on a colon breaks the first time the wording moves.
+ */
+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';
+ return `${FEATURE_TEXT[feature.key] || feature.key} ${bucketLabel}`;
+}
+
function reasonText(feature, bucketLabel, stats) {
- const what = FEATURE_TEXT[feature.key] || feature.key;
const rate = Math.round((stats?.good_rate ?? 0) * 100);
const rel = MODEL.base_good_rate > 0 ? (stats?.good_rate ?? 0) / MODEL.base_good_rate : 0;
const vs = rel >= 1.15 ? `${rel.toFixed(1)}x base rate`
: rel <= 0.85 ? `${rel.toFixed(1)}x base rate`
: 'near base rate';
- if (feature.key === 'creator_record') {
- const CREATOR_TEXT = {
- has_wins: 'creator has shipped a graduated launch before',
- serial_no_wins: 'creator has 5+ prior launches, none graduated',
- repeat_no_wins: 'creator relaunches without a single graduation',
- first_launch: 'first launch from this creator',
- unknown: 'creator history unknown',
- };
- return `${CREATOR_TEXT[bucketLabel] || bucketLabel}: ${rate}% of such launches worked (${vs})`;
- }
- if (feature.key === 'category') {
- return `${bucketLabel} narrative: ${rate}% of such launches worked (${vs})`;
- }
- if (feature.key === 'dev_sold') {
- return `${bucketLabel === '>=0.5' ? 'dev sold inside the window' : 'dev held through the window'}: ${rate}% of such launches worked (${vs})`;
- }
- return `${what} ${bucketLabel}: ${rate}% of similar launches worked (${vs})`;
+ const kind = SUCH.has(feature.key) ? 'such' : 'similar';
+ return `${reasonSubject(feature, bucketLabel)}: ${rate}% of ${kind} launches worked (${vs})`;
}
// ── Smart-money overlay (expert priors, in log-odds) ─────────────────────────
@@ -428,10 +437,19 @@ export function convict(intel = {}) {
.filter((h) => h.stats && Math.abs(h.w) >= 0.08)
.sort((a, b) => Math.abs(b.w) - Math.abs(a.w))
.slice(0, 7)
- .map((h) => ({
- pillar: h.pillar,
- text: reasonText(MODEL.features.find((f) => f.key === h.key), h.bucket, h.stats),
- }));
+ .map((h) => {
+ const feature = MODEL.features.find((f) => f.key === h.key);
+ const rel = MODEL.base_good_rate > 0 ? h.stats.good_rate / MODEL.base_good_rate : null;
+ return {
+ pillar: h.pillar,
+ text: reasonText(feature, h.bucket, h.stats),
+ // Structured twin of `text` so a card can render the observation and
+ // its lift without re-parsing English.
+ subject: reasonSubject(feature, h.bucket),
+ rate: Math.round(h.stats.good_rate * 100),
+ lift: rel == null ? null : Number(rel.toFixed(1)),
+ };
+ });
const reasons = [
...overlay.reasons.map((t) => ({ pillar: 'pedigree', text: t })),
...modelReasons,
@@ -445,9 +463,13 @@ export function convict(intel = {}) {
if (evaled.hits.some((h) => h.pillar === 'structure' && h.w <= -0.5)) badges.push('structure-flag');
if (cap < 100) badges.push('pedigree-flag');
if (String(intel.narrative?.category || intel.category).toLowerCase() === 'news') badges.push('news');
- if (pillars.momentum >= 72) badges.push('momentum');
+ // Momentum earns a badge only when that pillar's evidence ALONE would carry
+ // the coin to prime. At the old 72 it fired on 93% of the live feed, which is
+ // a decoration, not a signal.
+ if (pillars.momentum >= 86) badges.push('momentum');
if (confidence < 45) badges.push('thin-data');
- if (score >= 86) badges.push('prime');
+ // No 'prime' badge: the card renders the tier next to the score already, so it
+ // only ever restated the pill beside it.
return {
score,
diff --git a/api/_lib/oracle/store.js b/api/_lib/oracle/store.js
index eb49a6097..8ea5ba030 100644
--- a/api/_lib/oracle/store.js
+++ b/api/_lib/oracle/store.js
@@ -192,6 +192,21 @@ export async function feedSince({ network = 'mainnet', sinceIso, limit = 40 } =
return rows.map(rowToFeedItem);
}
+/**
+ * The resolved market outcome on a feed row, or null when the join was not part
+ * of the query (feedSince) or the market has not resolved the coin yet.
+ * @param {object} r
+ */
+function outcomeFromRow(r) {
+ if (r.graduated == null && r.rugged == null && r.ath_multiple == null) return null;
+ const ath = r.ath_multiple != null ? Number(r.ath_multiple) : null;
+ return {
+ graduated: r.graduated === true,
+ rugged: r.rugged === true,
+ ath_multiple: Number.isFinite(ath) ? ath : null,
+ };
+}
+
function rowToFeedItem(r) {
// Compact conviction trajectory for the inline card sparkline: the recorded
// history points (24h, ≤16) with the live score guaranteed as the final point.
@@ -223,11 +238,18 @@ function rowToFeedItem(r) {
hit_rate: odds.rate,
hit_rate_lift: odds.lift,
hit_rate_n: odds.n,
+ hit_rate_band: odds.band,
+ base_rate: odds.baseRate,
category: r.category,
smart_wallet_count: r.smart_wallet_count,
scored_at: r.scored_at,
coin_first_seen_at: r.coin_first_seen_at,
spark: spark.length >= 2 ? spark : null,
+ // Ground truth, carried on the card itself. The feed ranks by score, so its
+ // top rows are the boldest calls, and a resolved one whose verdict is stated
+ // without its result is the whole reason the engine reads as broken. Absent
+ // (undefined) for callers that do not join outcomes, e.g. the SSE stream.
+ outcome: outcomeFromRow(r),
};
}
@@ -265,11 +287,10 @@ export async function readCoin(mint, network = 'mainnet') {
reasons: cached?.reasons || [],
components: cached?.components || null,
structure_cap: cached?.structure_cap ?? null,
- // What the score is worth in outcomes, and what event it was fitted to
- // predict. Served with every verdict so no surface has to guess: a bare
- // "100" invites the reader to hear "certain", and the honest answer (this
- // band of calls has won 26% of the time, 4.8x the market) is one field away.
- hit_rate: cached?.score != null ? hitRateFor(Number(cached.score)) : null,
+ // The event the score was fitted to predict, so no surface has to guess.
+ // A bare "100" invites the reader to hear "certain"; the verdict travels
+ // with what it claims (a 3x run or a graduation, not a safe hold) and, on
+ // the conviction object above, with what that band has actually returned.
predicts: PREDICTED_EVENT,
narrative: narr,
outcome,