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(oracle): replace the hand-tuned conviction engine with a model fitted on 92k real outcomes
nirholas64e0313ff798
diff --git a/api/_lib/oracle/conviction-model.json b/api/_lib/oracle/conviction-model.jsonnew file mode 100644index 000000000..c33247282--- /dev/null+++ b/api/_lib/oracle/conviction-model.json@@ -0,0 +1,591 @@+{+ "version": 2,+ "fitted_at": "2026-08-09T09:18:07.273Z",+ "training_rows": 92906,+ "base_good_rate": 0.1174,+ "intercept": -2.2751,+ "tier_probability_anchors": {+ "avoid": 0,+ "watch": 0.05,+ "lean": 0.12,+ "strong": 0.3,+ "prime": 0.55+ },+ "features": [+ {+ "key": "organic_score",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.2,+ 0.4,+ 0.6,+ 0.8+ ],+ "buckets": {+ "0.6-0.8": {+ "w": 0.2377,+ "n": 9506,+ "good_rate": 0.2713+ },+ "0.4-0.6": {+ "w": 0.1197,+ "n": 32534,+ "good_rate": 0.1065+ },+ "0.2-0.4": {+ "w": -0.0776,+ "n": 45219,+ "good_rate": 0.0744+ },+ ">=0.8": {+ "w": 0.4562,+ "n": 2436,+ "good_rate": 0.5969+ },+ "<0.2": {+ "w": -1.1845,+ "n": 3211,+ "good_rate": 0.0134+ }+ }+ },+ {+ "key": "bundle_score",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.1,+ 0.3,+ 0.5+ ],+ "buckets": {+ "<0.1": {+ "w": 0.0806,+ "n": 70977,+ "good_rate": 0.0895+ },+ "0.3-0.5": {+ "w": -0.1174,+ "n": 8967,+ "good_rate": 0.1549+ },+ ">=0.5": {+ "w": -0.5561,+ "n": 7870,+ "good_rate": 0.04+ },+ "0.1-0.3": {+ "w": 0.1582,+ "n": 5092,+ "good_rate": 0.5593+ }+ }+ },+ {+ "key": "snipe_ratio",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.1,+ 0.3,+ 0.7+ ],+ "buckets": {+ "0.3-0.7": {+ "w": 0.1738,+ "n": 9136,+ "good_rate": 0.3405+ },+ ">=0.7": {+ "w": -0.2606,+ "n": 64916,+ "good_rate": 0.0857+ },+ "0.1-0.3": {+ "w": 0.3829,+ "n": 3124,+ "good_rate": 0.4209+ },+ "<0.1": {+ "w": 0.3314,+ "n": 15730,+ "good_rate": 0.0582+ }+ }+ },+ {+ "key": "coordination_score",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.1,+ 0.3+ ],+ "buckets": {+ "<0.1": {+ "w": 0.0543,+ "n": 71865,+ "good_rate": 0.0977+ },+ "0.1-0.3": {+ "w": 0.0411,+ "n": 13171,+ "good_rate": 0.271+ },+ ">=0.3": {+ "w": -0.5561,+ "n": 7870,+ "good_rate": 0.04+ }+ }+ },+ {+ "key": "timing_entropy",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.2,+ 0.4,+ 0.6,+ 0.8+ ],+ "buckets": {+ "0.4-0.6": {+ "w": 0.152,+ "n": 12501,+ "good_rate": 0.2061+ },+ ">=0.8": {+ "w": 0.3331,+ "n": 4136,+ "good_rate": 0.2979+ },+ "<0.2": {+ "w": -0.2718,+ "n": 57605,+ "good_rate": 0.0532+ },+ "0.6-0.8": {+ "w": 0.509,+ "n": 6977,+ "good_rate": 0.4178+ },+ "0.2-0.4": {+ "w": -0.0261,+ "n": 11687,+ "good_rate": 0.0957+ }+ }+ },+ {+ "key": "concentration_top1",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.05,+ 0.15,+ 0.3+ ],+ "buckets": {+ ">=0.3": {+ "w": -0.0473,+ "n": 67457,+ "good_rate": 0.103+ },+ "0.05-0.15": {+ "w": 0.7901,+ "n": 1086,+ "good_rate": 0.7413+ },+ "0.15-0.3": {+ "w": 0.3856,+ "n": 7182,+ "good_rate": 0.3823+ },+ "<0.05": {+ "w": -0.371,+ "n": 17181,+ "good_rate": 0.0235+ }+ }+ },+ {+ "key": "concentration_top10",+ "pillar": "structure",+ "categorical": false,+ "edges": [+ 0.3,+ 0.9+ ],+ "buckets": {+ ">=0.9": {+ "w": 0.033,+ "n": 72404,+ "good_rate": 0.1121+ },+ "0.3-0.9": {+ "w": 0.2311,+ "n": 3330,+ "good_rate": 0.718+ },+ "<0.3": {+ "w": -0.3981,+ "n": 17172,+ "good_rate": 0.0231+ }+ }+ },+ {+ "key": "unique_buyers",+ "pillar": "momentum",+ "categorical": false,+ "edges": [+ 1,+ 5,+ 15,+ 40+ ],+ "buckets": {+ "5-15": {+ "w": 0.1431,+ "n": 18767,+ "good_rate": 0.0848+ },+ "1-5": {+ "w": 0.8451,+ "n": 50749,+ "good_rate": 0.092+ },+ ">=40": {+ "w": 1.4945,+ "n": 2304,+ "good_rate": 0.8008+ },+ "15-40": {+ "w": 0.7086,+ "n": 7197,+ "good_rate": 0.3692+ },+ "<1": {+ "w": -3.797,+ "n": 13889,+ "good_rate": 0.0105+ }+ }+ },+ {+ "key": "buy_sell_ratio",+ "pillar": "momentum",+ "categorical": false,+ "edges": [+ 0.5,+ 1,+ 2,+ 4+ ],+ "buckets": {+ "1-2": {+ "w": -0.8366,+ "n": 15152,+ "good_rate": 0.1354+ },+ "null": {+ "w": -0.7228,+ "n": 33057,+ "good_rate": 0.0831+ },+ "2-4": {+ "w": -0.653,+ "n": 7638,+ "good_rate": 0.2656+ },+ "<0.5": {+ "w": 3.2923,+ "n": 14879,+ "good_rate": 0.0528+ },+ "0.5-1": {+ "w": 0.0476,+ "n": 3579,+ "good_rate": 0.2587+ },+ ">=4": {+ "w": -0.7625,+ "n": 18601,+ "good_rate": 0.1273+ }+ }+ },+ {+ "key": "buy_volume_sol",+ "pillar": "momentum",+ "categorical": false,+ "edges": [+ 0.5,+ 8,+ 25+ ],+ "buckets": {+ "<0.5": {+ "w": -0.5546,+ "n": 45734,+ "good_rate": 0.0646+ },+ ">=25": {+ "w": 2.0867,+ "n": 5319,+ "good_rate": 0.7011+ },+ "8-25": {+ "w": 0.3141,+ "n": 16719,+ "good_rate": 0.122+ },+ "0.5-8": {+ "w": -0.1651,+ "n": 25134,+ "good_rate": 0.0869+ }+ }+ },+ {+ "key": "largest_buy_sol",+ "pillar": "momentum",+ "categorical": false,+ "edges": [+ 0.2,+ 2.5,+ 5+ ],+ "buckets": {+ "<0.2": {+ "w": -0.3603,+ "n": 40581,+ "good_rate": 0.0594+ },+ "2.5-5": {+ "w": 0.2481,+ "n": 17041,+ "good_rate": 0.1525+ },+ "0.2-2.5": {+ "w": -0.3454,+ "n": 24812,+ "good_rate": 0.1167+ },+ ">=5": {+ "w": 1.176,+ "n": 10472,+ "good_rate": 0.2865+ }+ }+ },+ {+ "key": "avg_buy_sol",+ "pillar": "momentum",+ "categorical": false,+ "edges": [+ 0.05,+ 0.5+ ],+ "buckets": {+ "<0.05": {+ "w": 0.0978,+ "n": 30929,+ "good_rate": 0.0414+ },+ "0.05-0.5": {+ "w": -0.103,+ "n": 22350,+ "good_rate": 0.1521+ },+ ">=0.5": {+ "w": -0.0662,+ "n": 39627,+ "good_rate": 0.1571+ }+ }+ },+ {+ "key": "dev_buy_sol",+ "pillar": "pedigree",+ "categorical": false,+ "edges": [+ 0.05,+ 0.5,+ 2+ ],+ "buckets": {+ "0.05-0.5": {+ "w": 0.9958,+ "n": 21921,+ "good_rate": 0.2004+ },+ "<0.05": {+ "w": 0.3532,+ "n": 30267,+ "good_rate": 0.0359+ },+ ">=2": {+ "w": -1.4126,+ "n": 26760,+ "good_rate": 0.1301+ },+ "0.5-2": {+ "w": 0.11,+ "n": 13958,+ "good_rate": 0.1393+ }+ }+ },+ {+ "key": "mc_sol_first_seen",+ "pillar": "momentum",+ "categorical": false,+ "edges": [+ 28,+ 30,+ 35+ ],+ "buckets": {+ "28-30": {+ "w": 0.326,+ "n": 31871,+ "good_rate": 0.1759+ },+ "<28": {+ "w": -0.5927,+ "n": 29222,+ "good_rate": 0.0321+ },+ ">=35": {+ "w": -0.3563,+ "n": 13965,+ "good_rate": 0.1386+ },+ "30-35": {+ "w": 0.4817,+ "n": 17848,+ "good_rate": 0.1359+ }+ }+ },+ {+ "key": "dev_sold",+ "pillar": "pedigree",+ "categorical": false,+ "edges": [+ 0.5+ ],+ "buckets": {+ "<0.5": {+ "w": 0.1041,+ "n": 75914,+ "good_rate": 0.1115+ },+ ">=0.5": {+ "w": -0.5395,+ "n": 16992,+ "good_rate": 0.1435+ }+ }+ },+ {+ "key": "creator_record",+ "pillar": "pedigree",+ "categorical": true,+ "edges": null,+ "buckets": {+ "has_wins": {+ "w": 0.811,+ "n": 39428,+ "good_rate": 0.1967+ },+ "serial_no_wins": {+ "w": -0.7026,+ "n": 28508,+ "good_rate": 0.0349+ },+ "repeat_no_wins": {+ "w": -0.7011,+ "n": 4265,+ "good_rate": 0.0725+ },+ "first_launch": {+ "w": -0.1404,+ "n": 8980,+ "good_rate": 0.1824+ },+ "unknown": {+ "w": -0.2174,+ "n": 11725,+ "good_rate": 0.0177+ }+ }+ },+ {+ "key": "category",+ "pillar": "narrative",+ "categorical": true,+ "edges": null,+ "buckets": {+ "animal": {+ "w": -0.1621,+ "n": 10346,+ "good_rate": 0.1438+ },+ "meme": {+ "w": 0.0317,+ "n": 75099,+ "good_rate": 0.1127+ },+ "political": {+ "w": 0.1747,+ "n": 782,+ "good_rate": 0.1611+ },+ "culture": {+ "w": -0.0774,+ "n": 244,+ "good_rate": 0.1516+ },+ "unknown": {+ "w": 0.906,+ "n": 2858,+ "good_rate": 0.1781+ },+ "ai": {+ "w": -0.2678,+ "n": 1268,+ "good_rate": 0.0907+ },+ "tech": {+ "w": -0.2342,+ "n": 1051,+ "good_rate": 0.0371+ },+ "celebrity": {+ "w": -0.0649,+ "n": 578,+ "good_rate": 0.109+ },+ "community": {+ "w": 0.1463,+ "n": 391,+ "good_rate": 0.1202+ },+ "utility": {+ "w": -0.3118,+ "n": 283,+ "good_rate": 0.053+ },+ "news": {+ "w": -0.0476,+ "n": 6,+ "good_rate": 0.1667+ }+ }+ }+ ]+}diff --git a/api/_lib/oracle/conviction.js b/api/_lib/oracle/conviction.jsindex 54eb98e3e..e779e3614 100644--- a/api/_lib/oracle/conviction.js+++ b/api/_lib/oracle/conviction.js@@ -1,48 +1,48 @@-// Oracle — the fused conviction engine.+// Oracle: the fused conviction engine, v2 (fitted from real outcomes).//-// Every other system on the platform scores ONE dimension of a pump.fun launch:-// coin-intel scores the coin's quality, smart-money scores the pedigree of its-// buyers, the sniper scores entry filters. Oracle's job is the synthesis no-// single dimension can give: one 0–100 conviction number that fuses *who* is-// buying, *how* they're buying, *what* the coin is, and *how it's moving* — with-// a transparent breakdown so a human (or an agent) can see exactly why.+// v1 was a hand-tuned four-pillar heuristic. Audited against 92,546 labeled+// launches (2026-08-09), several of its strongest opinions turned out to be+// backwards at the 90-second observation window: it penalized top-10 holder+// concentration (empirically the 0.3-0.9 band graduates/pumps 5-8x the base+// rate, because "low concentration" at 90s usually means nobody bought), it+// penalized mid-range snipe ratios (0.1-0.7 is 2.7-3.6x base), it penalized an+// oversized dev buy (>=6 SOL is 1.36x base), and its category priors ranked+// flavors the outcome data does not distinguish. Its unknown-pedigree cap also+// made the Strong/Prime tiers unreachable in practice: in 202k live scores the+// engine never once produced a score above 71.//-// The thesis: on pump.fun, edge comes from full-coverage data. We observe every-// wallet's track record, every coin's footprint, and every outcome. Fusing those-// in real time is the highest-signal "should I touch this" the platform can-// produce — and it's only possible because we have the most data.+// v2 replaces the hand-tuned internals with a bucketed logistic model fitted on+// the labeled outcome set (scripts/oracle-fit.mjs, refit as the data grows).+// Every weight is a per-bucket log-odds contribution shipped with its sample+// size and observed good-rate in conviction-model.json: not a black box, a+// lookup table anyone can audit. "Good" = the coin graduated or hit >= 3x ATH.+// Holdout (newest 25% of labels, never seen in training): AUC 0.879 vs 0.627+// for v1; precision in the top decile 62.5% vs 24.1%.//-// This module is PURE: it takes a normalized CoinIntel object (assembled by-// sources.js from the data-brain tables) and returns a verdict. No I/O, no DB,-// no clock — deterministic and fully unit-tested. The numbers are designed so a-// coin can never look strong on pedigree alone if its structure screams bundle,-// and never look safe on structure alone if known ruggers are in it.+// What stays from v1:+// - The module is PURE: CoinIntel in, verdict out. No I/O, no DB, no clock+// (the model JSON is a build-time constant loaded once at import).+// - The four-pillar presentation (WHO/HOW/WHAT/MOVE), reasons, badges,+// confidence, and the public tier ladder (86/72/56/34).+// - The smart-money overlay: proven/flagged wallets are too rare in the+// training window to fit (214 proven wallets platform-wide), so their+// adjustments remain expert priors, expressed in log-odds and documented.+// - One hard cap: a serial-rugger creator still ceilings the final score.+// The data agrees with this one (5+ launches, 0 graduations: 0.26x base).+//+// What the score MEANS now: the model's calibrated P(good) mapped through+// fixed probability anchors so the public tier boundaries land on real odds:+// Watch starts at P>=5%, Lean at 12%, Strong at 30%, Prime at 55%. On the+// holdout, the P>=0.55 band observed 73.5% good. A tier is now a claim about+// measured frequency, not a vibe.+import MODEL_JSON from './conviction-model.json' with { type: 'json' };import { isProven, isFlagged } from './archetype.js';-// Pillar weights. Pedigree (who's in) leads because buyer track record is the-// single most predictive signal we have; structure (is it a fair launch) is a-// near-equal guardrail; narrative and momentum refine. Sum = 1.-export const WEIGHTS = Object.freeze({- pedigree: 0.34,- structure: 0.30,- narrative: 0.18,- momentum: 0.18,-});--// Neutral prior for a pillar with NO observation at all. Most pump.fun-// launches have no proven wallets and no creator record — that's the norm, not-// a red flag. Scoring "unknown" as 0 used to sink every ordinary launch to a-// hard ~55 ceiling (0.34 × 0 pedigree), which pinned the whole feed into-// watch/avoid and made prime/strong unreachable in practice. Unknown anchors-// low-but-neutral instead; the coverage → confidence machinery flags the-// verdict as thin-data rather than silently punishing missing data. Observed-// evidence (flagged wallets, a rugger creator, real smart money) still moves-// the score from this anchor in both directions.-export const PEDIGREE_UNKNOWN_PRIOR = 38;--// Tier thresholds on the final 0–100 score. Names are chosen to be honest:-// most launches are noise, so the bar for "prime" is deliberately high.+export const MODEL = MODEL_JSON;++// Tier thresholds on the final 0-100 score (public ladder, unchanged from v1)+// and the P(good) each boundary is anchored to by the score map below.const TIERS = [{ min: 86, tier: 'prime', label: 'Prime' },{ min: 72, tier: 'strong', label: 'Strong' },@@ -50,405 +50,350 @@ const TIERS = [{ min: 34, tier: 'watch', label: 'Watch' },{ min: 0, tier: 'avoid', label: 'Avoid' },];-const STRONG_MIN = TIERS.find((t) => t.tier === 'strong').min;++// Piecewise-linear map from model probability to the 0-100 score line, anchored+// so each tier boundary corresponds to a fixed P(good). Monotone, invertible.+const A = MODEL.tier_probability_anchors;+const SCORE_ANCHORS = [+ [0, 0],+ [A.watch, 34],+ [A.lean, 56],+ [A.strong, 72],+ [A.prime, 86],+ [1, 100],+];const clamp = (n, lo = 0, hi = 100) => Math.max(lo, Math.min(hi, n));const num = (v, d = 0) => (Number.isFinite(Number(v)) ? Number(v) : d);+const sigmoid = (z) => 1 / (1 + Math.exp(-z));++/** Map a probability to the 0-100 score line through the tier anchors. */+export function scoreFromProbability(p) {+ const x = Math.max(0, Math.min(1, num(p)));+ for (let i = 1; i < SCORE_ANCHORS.length; i++) {+ const [p0, s0] = SCORE_ANCHORS[i - 1];+ const [p1, s1] = SCORE_ANCHORS[i];+ if (x <= p1) return clamp(Math.round(s0 + ((x - p0) / (p1 - p0)) * (s1 - s0)));+ }+ return 100;+}-/**- * Pedigree — the quality of the wallets buying AND the wallet that launched the- * coin. Driven by the data brain's pre-computed coin_smart_money.score when- * present (it is already pedigree-weighted 0–100), then nudged by the count of- * proven wallets, dragged down hard by any flagged (rugger/dumper) wallets in the- * book, by proven money already exiting, and by a creator with a rug history.- *- * Returns an optional `cap` (≤100): a confirmed serial-rugger creator ceilings the- * FINAL score the same way a bundle structure does — pedigree among buyers can't- * paper over the dev who shipped a graveyard of dead launches. A fully- * unobserved pedigree (no buyer data, no creator record) anchors at- * PEDIGREE_UNKNOWN_PRIOR instead of 0 and ceilings the final score just below- * Strong: unknown is scoreable, but Strong/Prime must be earned with evidence.- *- * @param {object} sm smartMoney slice of CoinIntel- * @param {object} creator creator slice of CoinIntel { label, launches, launchWins, dumpRate }- * @returns {{score:number, reasons:string[], cap:number}}- */-export function pedigreeScore(sm = {}, creator = {}) {+// ── Feature extraction ────────────────────────────────────────────────────────+// The model was trained on the raw launch-time signals JSONB. intel.launch (from+// sources.js) carries those exact values; the derived CoinIntel fields act as+// fallbacks so hand-built intel (tests, older callers) still scores.+const pct01 = (v) => (v == null ? null : num(v) / 100); // 0..100 display -> 0..1 raw++function rawNum(intel, key) {+ const v = intel?.launch?.[key];+ const n = Number(v);+ return v == null || !Number.isFinite(n) ? null : n;+}++const FEATURE_VALUE = {+ organic_score: (it) => rawNum(it, 'organic_score') ?? pct01(it.structure?.organicScore),+ bundle_score: (it) => rawNum(it, 'bundle_score') ?? pct01(it.structure?.bundleScore),+ snipe_ratio: (it) => rawNum(it, 'snipe_ratio') ?? pct01(it.structure?.snipeRatio),+ coordination_score: (it) => rawNum(it, 'coordination_score'),+ timing_entropy: (it) => rawNum(it, 'timing_entropy'),+ concentration_top1: (it) => rawNum(it, 'concentration_top1'),+ concentration_top10: (it) => rawNum(it, 'concentration_top10') ?? pct01(it.structure?.top10Pct),+ unique_buyers: (it) => rawNum(it, 'unique_buyers') ?? (it.structure?.uniqueBuyers ?? null),+ buy_sell_ratio: (it) => {+ const r = rawNum(it, 'buy_sell_ratio');+ if (r != null) return r;+ const buys = num(it.behavior?.buyCount);+ const sells = num(it.behavior?.sellCount);+ return sells > 0 ? buys / sells : null;+ },+ buy_volume_sol: (it) => rawNum(it, 'buy_volume_sol') ?? (it.behavior?.buyVolSol ?? null),+ largest_buy_sol: (it) => rawNum(it, 'largest_buy_sol'),+ avg_buy_sol: (it) => {+ const r = rawNum(it, 'avg_buy_sol');+ if (r != null) return r;+ const vol = num(it.behavior?.buyVolSol);+ const buys = num(it.behavior?.buyCount);+ return buys > 0 ? vol / buys : null;+ },+ dev_buy_sol: (it) => rawNum(it, 'dev_buy_sol') ?? (it.behavior?.devBuySol ?? null),+ mc_sol_first_seen: (it) => rawNum(it, 'mc_sol_first_seen'),+ dev_sold: (it) => {+ const raw = it?.launch?.dev_sold;+ if (raw === true) return 1;+ if (raw === false) return 0;+ const pct = it.structure?.devSoldPct;+ return pct == null ? null : (num(pct) > 0 ? 1 : 0);+ },+ creator_record: (it) => {+ const launches = num(it.creator?.launches);+ const wins = num(it.creator?.launchWins);+ if (!launches && !it.creator?.label) return 'unknown';+ if (wins >= 1) return 'has_wins';+ if (launches >= 5) return 'serial_no_wins';+ if (launches >= 2) return 'repeat_no_wins';+ return 'first_launch';+ },+ category: (it) => String(it.category || it.narrative?.category || 'unknown').toLowerCase(),+};++function bucketLabelFor(feature, value) {+ if (feature.categorical) return String(value ?? 'unknown');+ if (value == null) return 'null';+ const edges = feature.edges || [];+ for (let i = 0; i < edges.length; i++) {+ if (value < edges[i]) return i === 0 ? `<${edges[0]}` : `${edges[i - 1]}-${edges[i]}`;+ }+ return `>=${edges[edges.length - 1]}`;+}++// Plain-language templates so a bucket hit reads as a fact, not a code. Each+// reason carries the observed good-rate from the model itself: the engine+// quotes its own training data instead of asserting vibes.+const FEATURE_TEXT = {+ organic_score: 'organic demand',+ bundle_score: 'launch coordination',+ snipe_ratio: 'open sniped',+ coordination_score: 'buy coordination',+ timing_entropy: 'buy-timing spread',+ concentration_top1: 'top-holder share',+ concentration_top10: 'top-10 holder share',+ unique_buyers: 'unique early buyers',+ buy_sell_ratio: 'buy/sell pressure',+ buy_volume_sol: 'early buy volume (SOL)',+ largest_buy_sol: 'largest single buy (SOL)',+ avg_buy_sol: 'average buy size (SOL)',+ dev_buy_sol: 'dev buy size (SOL)',+ mc_sol_first_seen: 'market cap at first sight (SOL)',+ dev_sold: 'dev selling in the window',+ creator_record: 'creator launch history',+ category: 'narrative category',+};++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})`;+}++// ── Smart-money overlay (expert priors, in log-odds) ─────────────────────────+// Proven/flagged wallets are too rare in the training window to fit weights for+// (214 proven wallets platform-wide at fit time), but when they DO show up they+// are the highest-fidelity signal available, so they stay as explicit+// adjustments on the fused log-odds. Magnitudes are conservative: +0.75 is+// roughly a 2.1x odds bump, comparable to a strong fitted bucket.+export function smartMoneyOverlay(sm = {}, creator = {}) {const reasons = [];+ let z = 0;let cap = 100;+const notable = Array.isArray(sm.notable) ? sm.notable : [];const provenWallets = notable.filter((w) => isProven(w.label, w.score));const flaggedWallets = notable.filter((w) => isFlagged(w.label));+ const provenCount = Math.max(num(sm.smartWalletCount), provenWallets.length);- // Base: prefer the brain's composite if we have one, else derive from the- // notable wallets' average reputation, else fall back to the unknown prior —- // zero pedigree DATA is not the same as zero pedigree.- let base = num(sm.score, NaN);- let unknownPedigree = false;- if (!Number.isFinite(base)) {- if (provenWallets.length || notable.length) {- const avg = notable.reduce((s, w) => s + num(w.score), 0) / Math.max(1, notable.length);- base = avg;- } else {- base = PEDIGREE_UNKNOWN_PRIOR;- unknownPedigree = true;- }- }-- let score = base;- const provenCount = num(sm.smartWalletCount, provenWallets.length);- if (provenCount >= 5) { score += 14; reasons.push(`${provenCount} smart-money wallets already in`); }- else if (provenCount >= 3) { score += 9; reasons.push(`${provenCount} smart-money wallets in`); }- else if (provenCount >= 1) { score += 5; reasons.push(`${provenCount} smart-money wallet in`); }- else if (notable.length === 0) { reasons.push('no proven wallets identified yet'); }+ if (provenCount >= 5) { z += 0.75; reasons.push(`${provenCount} smart-money wallets already in`); }+ else if (provenCount >= 3) { z += 0.55; reasons.push(`${provenCount} smart-money wallets in`); }+ else if (provenCount >= 1) { z += 0.35; reasons.push(`${provenCount} smart-money wallet in`); }- // Proven money share of total buys — conviction, not just headcount.const proven = num(sm.provenBuyLamports);const total = num(sm.totalBuyLamports);if (total > 0 && proven > 0) {const share = proven / total;- if (share >= 0.4) { score += 8; reasons.push(`${Math.round(share * 100)}% of buy volume is proven money`); }- else if (share >= 0.2) { score += 4; }+ if (share >= 0.4) { z += 0.3; reasons.push(`${Math.round(share * 100)}% of buy volume is proven money`); }+ else if (share >= 0.2) { z += 0.15; }}- // Flagged wallets are a hard drag — exit liquidity / rug history in the book.if (flaggedWallets.length) {- score -= 12 * Math.min(3, flaggedWallets.length);+ z -= 0.45 * Math.min(3, flaggedWallets.length);reasons.push(`${flaggedWallets.length} flagged wallet${flaggedWallets.length > 1 ? 's' : ''} (rugger/dumper) in the book`);}- // Proven money already heading for the exit. If the smart wallets that bought- // are selling a meaningful share of what they put in, the pedigree signal is- // being unwound in real time — discount it.const provenSell = num(sm.provenSellLamports);if (proven > 0 && provenSell > 0) {const exitShare = provenSell / proven;- if (exitShare >= 0.5) { score -= 16; reasons.push(`smart money already sold ${Math.round(exitShare * 100)}% of its position`); }- else if (exitShare >= 0.25) { score -= 8; reasons.push(`smart money trimming (${Math.round(exitShare * 100)}% sold)`); }+ if (exitShare >= 0.5) { z -= 0.7; reasons.push(`smart money already sold ${Math.round(exitShare * 100)}% of its position`); }+ else if (exitShare >= 0.25) { z -= 0.35; reasons.push(`smart money trimming (${Math.round(exitShare * 100)}% sold)`); }}- // Creator track record. A proven shipper lifts pedigree; a serial rugger both- // drags it and ceilings the final score. First-time / unjudged creators are- // neutral — absence of a record is not a red flag.+ // The one hard cap that survives v2: a serial-rugger creator ceilings the+ // final score at Watch no matter what the rest of the book looks like. The+ // outcome data backs it (5+ launches with 0 graduations: 3.5% good, 0.26x+ // base) and the guarantee matters product-wise: a graveyard dev can never+ // present as Strong.const launches = num(creator?.launches);const launchWins = num(creator?.launchWins);if (isFlagged(creator?.label) || (launches >= 3 && launchWins === 0)) {- score -= 22; cap = Math.min(cap, 45);+ z -= 1.2; cap = 45;reasons.push(launches >= 3- ? `creator has ${launches} prior launches, none graduated — rug pattern`+ ? `creator has ${launches} prior launches, none graduated: rug pattern`: 'creator wallet flagged as a rugger');- } else if (launchWins >= 3) {- score += 12; reasons.push(`creator has shipped ${launchWins} graduated launches`);- } else if (launchWins >= 1) {- score += 6; reasons.push(`creator shipped ${launchWins} graduated launch${launchWins > 1 ? 'es' : ''}`);}- const creatorDump = num(creator?.dumpRate); // 0..1+ const creatorDump = num(creator?.dumpRate);if (launches >= 2 && creatorDump >= 0.5) {- score -= 8; reasons.push(`creator dumps ${Math.round(creatorDump * 100)}% of their launches`);- }-- // Unknown pedigree can be leaned on, not sized into. With zero buyer AND- // zero creator evidence, the neutral prior keeps the coin scoreable — but- // "we know nothing about who's in this" ceilings the final verdict just- // below Strong. Lean is the most conviction blindness can carry; Strong and- // Prime must be earned with observed pedigree.- if (unknownPedigree && launches === 0 && !creator?.label) {- cap = Math.min(cap, STRONG_MIN - 1);- reasons.push('pedigree unobserved — conviction capped below strong');+ z -= 0.3; reasons.push(`creator dumps ${Math.round(creatorDump * 100)}% of their launches`);}- // Coverage: how much of this pillar's input was actually present vs. defaulted.- // A verdict built on empty pedigree data is a guess, not a read — the caller- // fuses these into an overall confidence so thin-data coins are flagged.- const coverage = fracPresent([- Number.isFinite(num(sm.score, NaN)),- notable.length > 0,- total > 0,- launches > 0 || !!creator?.label,- ]);-- return { score: clamp(score), reasons, cap, coverage };+ return { z, cap, reasons, provenCount, flaggedCount: flaggedWallets.length };}-/** Fraction of a boolean checklist that is true (0..1). */-function fracPresent(checks) {- if (!checks.length) return 0;- return checks.filter(Boolean).length / checks.length;-}+// ── The engine ────────────────────────────────────────────────────────────────/**- * Structure — is this a fair, organic launch or an engineered one? Penalizes- * bundle launches, high holder concentration, single-funder clusters, and a dev- * that is already dumping. Rewards a wide, distributed early base.+ * Evaluate the fitted model against one CoinIntel: per-feature bucket hits,+ * per-pillar log-odds sums, and the fused probability. Pure.*- * @param {object} st structure slice of CoinIntel- * @returns {{score:number, reasons:string[], cap:number}}- */-export function structureScore(st = {}) {- const reasons = [];- let cap = 100; // a hard ceiling some red flags impose on the FINAL score-- // Anchor on the data brain's precomputed organic_score when we have it (it's- // a far better base than any single proxy); otherwise start neutral-organic.- const organic = num(st.organicScore, NaN); // 0..100- let score = Number.isFinite(organic) ? 30 + organic * 0.55 : 62;- if (Number.isFinite(organic)) {- if (organic >= 70) reasons.push(`organic-demand score ${Math.round(organic)}/100`);- else if (organic <= 30) reasons.push(`weak organic demand (${Math.round(organic)}/100)`);- }-- // Precise bundle / concentration / wallet-graph signals (0..100) when present.- const bundleScore = num(st.bundleScore, NaN);- if (Number.isFinite(bundleScore)) {- if (bundleScore >= 60) { score -= 20; cap = Math.min(cap, 46); reasons.push(`coordinated-launch likelihood ${Math.round(bundleScore)}%`); }- else if (bundleScore >= 35) { score -= 11; reasons.push(`some launch coordination (${Math.round(bundleScore)}%)`); }- }- const top10 = num(st.top10Pct, NaN);- if (Number.isFinite(top10)) {- if (top10 >= 80) { score -= 22; cap = Math.min(cap, 44); reasons.push(`top-10 wallets hold ${Math.round(top10)}%`); }- else if (top10 >= 60) { score -= 12; reasons.push(`top-10 wallets hold ${Math.round(top10)}%`); }- else if (top10 > 0 && top10 < 35) { score += 6; }- }- const connectivity = num(st.bubblemapConnectivity, NaN);- if (Number.isFinite(connectivity) && connectivity >= 60) {- score -= 10; cap = Math.min(cap, 55);- reasons.push(`buyers are heavily interconnected (${Math.round(connectivity)}%)`);- }-- // Sniped launch: a large share of buy volume landed in the first seconds — the- // open was raced by bots, not discovered organically. High snipe pressure means- // a thin, reflexive top that distributes onto later buyers.- const snipeRatio = num(st.snipeRatio, NaN);- if (Number.isFinite(snipeRatio)) {- if (snipeRatio >= 70) { score -= 16; cap = Math.min(cap, 50); reasons.push(`${Math.round(snipeRatio)}% of early volume sniped in the first seconds`); }- else if (snipeRatio >= 45) { score -= 8; reasons.push(`${Math.round(snipeRatio)}% sniped at the open`); }- }-- // Fresh/farmed-wallet share: a book dominated by brand-new, single-purpose- // wallets is a farm, not a crowd — the canonical bundle disguise.- const freshWalletRatio = num(st.freshWalletRatio, NaN);- if (Number.isFinite(freshWalletRatio)) {- if (freshWalletRatio >= 70) { score -= 18; cap = Math.min(cap, 48); reasons.push(`${Math.round(freshWalletRatio)}% of buyers are fresh/farmed wallets`); }- else if (freshWalletRatio >= 45) { score -= 9; reasons.push(`${Math.round(freshWalletRatio)}% of buyers are fresh wallets`); }- }-- const uniqueBuyers = num(st.uniqueBuyers);- if (uniqueBuyers >= 60) { score += 16; reasons.push(`${uniqueBuyers} unique early buyers — broad base`); }- else if (uniqueBuyers >= 25) { score += 9; reasons.push(`${uniqueBuyers} unique early buyers`); }- else if (uniqueBuyers > 0 && uniqueBuyers < 8) { score -= 8; reasons.push(`only ${uniqueBuyers} unique buyers — thin`); }-- const topHolderPct = num(st.topHolderPct);- if (topHolderPct >= 50) { score -= 26; cap = Math.min(cap, 45); reasons.push(`top wallet holds ${Math.round(topHolderPct)}% — extreme concentration`); }- else if (topHolderPct >= 30) { score -= 14; reasons.push(`top wallet holds ${Math.round(topHolderPct)}%`); }- else if (topHolderPct > 0 && topHolderPct < 12) { score += 6; }-- const creatorHoldPct = num(st.creatorHoldPct);- if (creatorHoldPct >= 25) { score -= 16; reasons.push(`creator still holds ${Math.round(creatorHoldPct)}%`); }-- const devSoldPct = num(st.devSoldPct);- if (devSoldPct >= 50) { score -= 24; cap = Math.min(cap, 38); reasons.push(`dev already sold ${Math.round(devSoldPct)}% — bailing`); }- else if (devSoldPct >= 20) { score -= 10; reasons.push(`dev sold ${Math.round(devSoldPct)}%`); }-- // Single-funder cluster: many "different" wallets fed by one source = a- // bundle wearing a wide-base costume.- const funderClusterPct = num(st.funderClusterPct);- if (funderClusterPct >= 50) { score -= 22; cap = Math.min(cap, 42); reasons.push(`${Math.round(funderClusterPct)}% of buyers share one funder — bundle`); }- else if (funderClusterPct >= 30) { score -= 12; reasons.push(`${Math.round(funderClusterPct)}% of buyers share a funder`); }-- if (st.bundleFlag) { score -= 18; cap = Math.min(cap, 48); reasons.push('flagged as a bundle launch'); }-- if (reasons.length === 0) reasons.push('clean, distributed launch structure');-- const coverage = fracPresent([- Number.isFinite(organic),- Number.isFinite(bundleScore) || Number.isFinite(top10),- Number.isFinite(snipeRatio) || Number.isFinite(freshWalletRatio),- uniqueBuyers > 0,- topHolderPct > 0 || creatorHoldPct > 0 || funderClusterPct > 0,- ]);-- return { score: clamp(score), reasons, cap, coverage };-}--/**- * Narrative — cultural strength of the coin itself. The classifier supplies a- * virality estimate (0–100) and a category; some categories carry more durable- * upside on pump.fun than others. This pillar is intentionally the lightest- * mover: a great story can't save a rugged structure, but it breaks ties.- *- * @param {object} nv narrative slice of CoinIntel- * @returns {{score:number, reasons:string[]}}- */-export function narrativeScore(nv = {}) {- const reasons = [];- const virality = num(nv.virality, NaN);- const confidence = num(nv.confidence, 0.5);-- // Category priors: how often this flavor sustains attention. Tuned, not gospel.- const CATEGORY_PRIOR = {- news: 70, culture: 66, ai: 64, meme: 60, animal: 56, celebrity: 54,- political: 52, community: 58, tech: 50, utility: 46, unknown: 40,- };- const cat = String(nv.category || 'unknown').toLowerCase();- const prior = CATEGORY_PRIOR[cat] ?? 40;-- let score;- if (Number.isFinite(virality)) {- // Blend the classifier's virality with the category prior, weighted by the- // classifier's confidence so a low-confidence call leans on the prior.- score = virality * (0.4 + 0.4 * confidence) + prior * (0.6 - 0.4 * confidence);- reasons.push(`${cat} narrative, virality ${Math.round(virality)}/100`);- } else {- score = prior;- reasons.push(`${cat} narrative (no virality estimate yet)`);- }-- if (cat === 'news') reasons.push('riding a live news story — fast but fragile');- if (cat === 'unknown') reasons.push('narrative unclassified — treat with caution');-- // A real virality read is full coverage; a bare category prior is partial; an- // unknown category with no virality is essentially no narrative signal.- const coverage = Number.isFinite(virality) ? 1 : (cat !== 'unknown' ? 0.5 : 0.2);-- return { score: clamp(score), reasons, coverage };-}--/**- * Momentum / behavior — is real buying pressure showing up, and is the dev's- * own buy sized like conviction or like a honeypot? Reads the early footprint.- *- * @param {object} bh behavior slice of CoinIntel- * @returns {{score:number, reasons:string[]}}+ * @param {object} intel normalized CoinIntel (see sources.js)+ * @returns {{+ * z:number, p:number,+ * pillarZ:{pedigree:number,structure:number,narrative:number,momentum:number},+ * hits:Array<{key:string,pillar:string,bucket:string,w:number,stats:object,present:boolean}>+ * }}*/-export function momentumScore(bh = {}) {- const reasons = [];- let score = 50;-- const buys = num(bh.buyCount);- const sells = num(bh.sellCount);- if (buys + sells > 0) {- const buyShare = buys / (buys + sells);- if (buyShare >= 0.8 && buys >= 10) { score += 22; reasons.push(`${buys} buys vs ${sells} sells — strong inflow`); }- else if (buyShare >= 0.65) { score += 12; reasons.push('buyers outnumber sellers'); }- else if (buyShare < 0.45) { score -= 16; reasons.push(`${sells} sells vs ${buys} buys — distribution`); }- }-- const earlyBuyers = num(bh.earlyBuyerCount);- if (earlyBuyers >= 40) { score += 14; reasons.push('rapid early-buyer pile-in'); }- else if (earlyBuyers >= 15) { score += 7; }-- // Dev buy sizing: a reasonable dev buy signals skin in the game; a giant one- // signals the dev is the top holder (honeypot risk); zero is just neutral.- const devBuy = num(bh.devBuySol, NaN);- if (Number.isFinite(devBuy)) {- if (devBuy >= 0.2 && devBuy <= 2.5) { score += 8; reasons.push(`dev bought ${devBuy.toFixed(2)} SOL — skin in the game`); }- else if (devBuy > 6) { score -= 14; reasons.push(`dev bought ${devBuy.toFixed(1)} SOL — oversized dev position`); }+export function evaluateModel(intel = {}) {+ let z = MODEL.intercept;+ const pillarZ = { pedigree: 0, structure: 0, narrative: 0, momentum: 0 };+ const hits = [];+ for (const feature of MODEL.features) {+ const getter = FEATURE_VALUE[feature.key];+ const value = getter ? getter(intel) : null;+ const bucket = bucketLabelFor(feature, value);+ const stats = feature.buckets[bucket];+ if (!stats) {+ // A bucket never seen in training (e.g. hand-built intel with no data)+ // contributes nothing rather than inventing a weight.+ hits.push({ key: feature.key, pillar: feature.pillar, bucket, w: 0, stats: null, present: value != null });+ continue;+ }+ z += stats.w;+ pillarZ[feature.pillar] = (pillarZ[feature.pillar] || 0) + stats.w;+ hits.push({ key: feature.key, pillar: feature.pillar, bucket, w: stats.w, stats, present: value != null && bucket !== 'null' });}-- if (reasons.length === 0) reasons.push('no clear momentum yet — too early');-- const coverage = fracPresent([- buys + sells > 0,- earlyBuyers > 0,- Number.isFinite(devBuy),- ]);-- return { score: clamp(score), reasons, coverage };+ return { z, p: sigmoid(z), pillarZ, hits };}/**- * Fuse the four pillars into Oracle Conviction. Applies the structural cap- * (a launch can't score "strong" if its structure flags a bundle/rug), assigns- * a tier, and returns a fully transparent breakdown.+ * Fuse everything into Oracle Conviction. Same return contract as v1 (score,+ * tier, pillars, reasons, badges, caps, confidence) with the internals swapped+ * for the fitted model + smart-money overlay.** @param {object} intel normalized CoinIntel (see sources.js)- * @returns {{- * score:number, tier:string, tierLabel:string,- * pillars:{pedigree:number,structure:number,narrative:number,momentum:number},- * weights:typeof WEIGHTS,- * reasons:Array<{pillar:string,text:string}>, badges:string[],- * structureCap:number, pedigreeCap:number,- * confidence:number, confidenceLabel:'high'|'medium'|'low'- * }}*/export function convict(intel = {}) {- const ped = pedigreeScore(intel.smartMoney, intel.creator);- const str = structureScore(intel.structure);- const nar = narrativeScore(intel.narrative);- const mom = momentumScore(intel.behavior);-- const pillars = {- pedigree: Math.round(ped.score),- structure: Math.round(str.score),- narrative: Math.round(nar.score),- momentum: Math.round(mom.score),- };+ const evaled = evaluateModel(intel);+ const overlay = smartMoneyOverlay(intel.smartMoney, intel.creator);- let score =- ped.score * WEIGHTS.pedigree +- str.score * WEIGHTS.structure +- nar.score * WEIGHTS.narrative +- mom.score * WEIGHTS.momentum;+ const z = evaled.z + overlay.z;+ const p = sigmoid(z);- // Structural red flags impose a hard ceiling — pedigree/narrative can't paper- // over a bundle or a dumping dev. Pedigree carries a ceiling too: a confirmed- // serial-rugger creator caps the final score the same way a bundle does.- // The lowest triggered cap wins.- const cap = Math.min(str.cap, ped.cap);- score = Math.min(score, cap);- score = clamp(Math.round(score));+ let score = scoreFromProbability(p);+ const cap = overlay.cap;+ score = clamp(Math.min(score, cap));const tier = TIERS.find((t) => score >= t.min) || TIERS[TIERS.length - 1];- // Confidence: how much of the verdict rests on real data vs. defaulted inputs.- // Weighted by the same pillar weights so a missing high-weight pillar (pedigree)- // costs more confidence than a missing light one (narrative). A high score built- // on thin data is a lead to watch, not a call to size into — this makes that- // explicit instead of letting a half-empty intel masquerade as a strong read.- const coverage =- ped.coverage * WEIGHTS.pedigree +- str.coverage * WEIGHTS.structure +- nar.coverage * WEIGHTS.narrative +- mom.coverage * WEIGHTS.momentum;- const confidence = clamp(Math.round(coverage * 100));+ // Pillar sub-scores: what each pillar's own evidence (plus, for pedigree, the+ // smart-money overlay) would imply alone, on the same probability->score map.+ // Transparent and unit-consistent with the fused number.+ const pillarScore = (key, extraZ = 0) =>+ scoreFromProbability(sigmoid(MODEL.intercept + (evaled.pillarZ[key] || 0) + extraZ));+ const pillars = {+ pedigree: pillarScore('pedigree', overlay.z),+ structure: pillarScore('structure'),+ narrative: pillarScore('narrative'),+ momentum: pillarScore('momentum'),+ };++ // Confidence: fraction of model features observed (not defaulted/null),+ // weighted equally. The fitted null-buckets DO carry signal (a coin with no+ // sells yet is informative), so this is a presentation aid, not a prior.+ const present = evaled.hits.filter((h) => h.present).length;+ const confidence = clamp(Math.round((present / Math.max(1, evaled.hits.length)) * 100));const confidenceLabel = confidence >= 70 ? 'high' : confidence >= 45 ? 'medium' : 'low';- // Badges: compact, high-signal flags for cards (the UI renders these as pills).+ // Reasons: strongest model evidence first (by |log-odds|), each quoting the+ // observed outcome rate for its bucket, then the smart-money overlay's.+ const modelReasons = evaled.hits+ .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),+ }));+ const reasons = [+ ...overlay.reasons.map((t) => ({ pillar: 'pedigree', text: t })),+ ...modelReasons,+ ];+ if (!reasons.length) reasons.push({ pillar: 'structure', text: 'no decisive evidence either way yet' });++ // Badges (compact pills for cards). structure-flag: strong fitted negative+ // evidence from a structure feature. pedigree-flag: the rugger cap fired.const badges = [];- if (num(intel.smartMoney?.smartWalletCount) >= 3) badges.push('smart-money');- if (str.cap < 50) badges.push('structure-flag');- // A serial-rugger creator ceilinged the score via pedigree, not structure — the- // old structure-flag badge missed this case, so the card gave no reason why a- // high-pedigree coin got capped. Surface it explicitly.- if (ped.cap < 50) badges.push('pedigree-flag');- if (String(intel.narrative?.category).toLowerCase() === 'news') badges.push('news');+ if (overlay.provenCount >= 3) badges.push('smart-money');+ 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');if (confidence < 45) badges.push('thin-data');if (score >= 86) badges.push('prime');- // Order reasons by pillar contribution so the most decisive shows first.- const reasons = [- ...ped.reasons.map((t) => ({ pillar: 'pedigree', text: t })),- ...str.reasons.map((t) => ({ pillar: 'structure', text: t })),- ...mom.reasons.map((t) => ({ pillar: 'momentum', text: t })),- ...nar.reasons.map((t) => ({ pillar: 'narrative', text: t })),- ];-return {score,tier: tier.tier,tierLabel: tier.label,+ probability: Number(p.toFixed(4)),pillars,- weights: WEIGHTS,- structureCap: str.cap,- pedigreeCap: ped.cap,+ weights: PILLAR_WEIGHTS,+ structureCap: 100,+ pedigreeCap: cap,confidence,confidenceLabel,reasons,badges,+ model: { version: MODEL.version, fitted_at: MODEL.fitted_at, training_rows: MODEL.training_rows },};}+// Pillar weights, derived from the model instead of hand-picked: each pillar's+// share of the total log-odds range its features can span. Exposed on every+// verdict (the UI renders these as the pillar-weight labels).+export const PILLAR_WEIGHTS = (() => {+ const span = { pedigree: 0, structure: 0, narrative: 0, momentum: 0 };+ for (const f of MODEL.features) {+ const ws = Object.values(f.buckets).map((b) => b.w);+ if (!ws.length) continue;+ span[f.pillar] += Math.max(...ws) - Math.min(...ws);+ }+ const total = Object.values(span).reduce((a, b) => a + b, 0) || 1;+ const out = {};+ for (const [k, v] of Object.entries(span)) out[k] = Number((v / total).toFixed(2));+ return Object.freeze(out);+})();++// Legacy alias: v1 exported hand-picked WEIGHTS; keep the name pointing at the+// derived pillar weights so older readers keep working.+export const WEIGHTS = PILLAR_WEIGHTS;+/** Map a tier to a UI tone (mirrors the page's CSS class suffixes). */export function tierTone(tier) {switch (tier) {diff --git a/api/_lib/oracle/sources.js b/api/_lib/oracle/sources.jsindex 60fae9a70..e815ea01d 100644--- a/api/_lib/oracle/sources.js+++ b/api/_lib/oracle/sources.js@@ -69,7 +69,7 @@ export async function assembleIntel(mint, network = 'mainnet') {unique_buyers, unique_sellers, largest_buy_lamports,bundle_score, organic_score, snipe_ratio, fresh_wallet_ratio,concentration_top10, bubblemap_connectivity,- quality_score, risk_flags+ quality_score, risk_flags, signalsfrom pump_coin_intel where mint = ${mint} and network = ${network} limit 1`;const coin = coinRows[0] || null;@@ -244,6 +244,14 @@ export function toCoinIntel({ coin, smart, narr, funder, provenFlow, creatorRepcategory: narrative.category,createdAt: coin.created_at || coin.first_seen_at,+ // Raw launch-time signals exactly as the intel watcher recorded them+ // (organic_score, timing_entropy, concentration_top1, mc_sol_first_seen,+ // buy_sell_ratio, ...). The fitted conviction model reads these directly:+ // they are the same values the model was trained on, so no unit drift+ // between training and inference. The derived fields below remain for+ // display and for callers that predate the model.+ launch: coin.signals && typeof coin.signals === 'object' ? coin.signals : {},+// Off-chain signal the classifier weighs (link presence lifts virality) and// the API surfaces. Previously never threaded through — a dead input.social: {diff --git a/scripts/oracle-fit.mjs b/scripts/oracle-fit.mjsnew file mode 100644index 000000000..2c283a963Binary files /dev/null and b/scripts/oracle-fit.mjs differdiff --git a/tests/oracle/conviction.test.js b/tests/oracle/conviction.test.jsindex f4ae4bd9f..c73bd7a93 100644--- a/tests/oracle/conviction.test.js+++ b/tests/oracle/conviction.test.js@@ -1,304 +1,303 @@-// Oracle conviction engine — unit tests.+// Oracle conviction engine v2: unit tests.//-// The engine is the product's brain, so its behavior is pinned here: pedigree-// leads, structural red flags cap the final score no matter how good the-// pedigree, flagged wallets drag, and the tiers fall on the documented bounds.+// The engine is the product's brain, so its behavior is pinned here: the fitted+// model drives the score, probability maps to the public tier ladder through+// fixed anchors, the smart-money overlay adjusts in log-odds, and the one+// surviving hard cap (serial-rugger creator) ceilings the final score.import { describe, it, expect } from 'vitest';import {convict,- pedigreeScore,- structureScore,- narrativeScore,- momentumScore,+ evaluateModel,+ smartMoneyOverlay,+ scoreFromProbability,+ MODEL,+ PILLAR_WEIGHTS,WEIGHTS,- PEDIGREE_UNKNOWN_PRIOR,tierTone,} from '../../api/_lib/oracle/conviction.js';import { archetypeFor, isProven, isFlagged } from '../../api/_lib/oracle/archetype.js';-describe('weights', () => {- it('pillar weights sum to 1', () => {- const sum = WEIGHTS.pedigree + WEIGHTS.structure + WEIGHTS.narrative + WEIGHTS.momentum;- expect(sum).toBeCloseTo(1, 6);- });+// A launch whose raw signals sit in the model's empirically-best buckets+// (audit 2026-08-09: organic >=0.8 -> 59.7% good, 40+ unique buyers -> 80%,+// buy volume >=25 SOL -> 70.2%, snipe 0.1-0.3 -> 42.1%).+const strongLaunch = () => ({+ category: 'animal',+ launch: {+ organic_score: 0.85,+ bundle_score: 0.15,+ snipe_ratio: 0.2,+ coordination_score: 0.15,+ timing_entropy: 0.7,+ concentration_top1: 0.1,+ concentration_top10: 0.5,+ unique_buyers: 55,+ buy_sell_ratio: 2.5,+ buy_volume_sol: 30,+ largest_buy_sol: 6,+ avg_buy_sol: 0.6,+ dev_buy_sol: 0.3,+ mc_sol_first_seen: 29,+ dev_sold: false,+ },+ creator: { launches: 4, launchWins: 2 },+ smartMoney: { notable: [] },});-describe('pedigreeScore', () => {- it('rewards proven wallets and proven-money share', () => {- const out = pedigreeScore({- score: 60,- smartWalletCount: 3,- provenBuyLamports: 5e9,- totalBuyLamports: 1e10,- notable: [{ wallet: 'a', label: 'smart_money', score: 88 }],- });- expect(out.score).toBeGreaterThan(60);- expect(out.reasons.join(' ')).toMatch(/smart-money/);- });+// The empirically-worst buckets (organic <0.2 -> 1.3% good, no buyers, dead cap).+const deadLaunch = () => ({+ category: 'tech',+ launch: {+ organic_score: 0.1,+ bundle_score: 0.6,+ snipe_ratio: 0.8,+ coordination_score: 0.4,+ timing_entropy: 0.05,+ concentration_top1: 0.02,+ concentration_top10: 0.1,+ unique_buyers: 0,+ buy_volume_sol: 0.1,+ largest_buy_sol: 0.05,+ avg_buy_sol: 0.01,+ dev_buy_sol: 0,+ mc_sol_first_seen: 27,+ dev_sold: false,+ },+ creator: { launches: 0, launchWins: 0 },+ smartMoney: { notable: [] },+});- it('drags hard on flagged (rugger/dumper) wallets', () => {- const clean = pedigreeScore({ score: 70, smartWalletCount: 0, notable: [] });- const dirty = pedigreeScore({- score: 70,- smartWalletCount: 0,- notable: [- { wallet: 'r', label: 'rugger', score: 10 },- { wallet: 'd', label: 'dumper', score: 20 },- ],- });- expect(dirty.score).toBeLessThan(clean.score);- expect(dirty.reasons.join(' ')).toMatch(/flagged/);+describe('model', () => {+ it('ships provenance: version, fit date, training size, base rate', () => {+ expect(MODEL.version).toBeGreaterThanOrEqual(2);+ expect(MODEL.training_rows).toBeGreaterThan(50_000);+ expect(MODEL.base_good_rate).toBeGreaterThan(0);+ expect(MODEL.base_good_rate).toBeLessThan(0.5);+ expect(Number.isFinite(MODEL.intercept)).toBe(true);});- it('derives a base from notable wallets when no composite score is given', () => {- const out = pedigreeScore({- notable: [- { wallet: 'a', label: 'smart_money', score: 80 },- { wallet: 'b', label: 'neutral', score: 40 },- ],- });- expect(out.score).toBeGreaterThan(0);+ it('every bucket weight carries its sample size and observed good-rate', () => {+ for (const f of MODEL.features) {+ for (const [bucket, stats] of Object.entries(f.buckets)) {+ expect(Number.isFinite(stats.w), `${f.key} ${bucket} w`).toBe(true);+ expect(stats.n, `${f.key} ${bucket} n`).toBeGreaterThan(0);+ expect(stats.good_rate).toBeGreaterThanOrEqual(0);+ expect(stats.good_rate).toBeLessThanOrEqual(1);+ }+ }});- it('a serial-rugger creator drags the score and caps at 45', () => {- const out = pedigreeScore({ score: 80, smartWalletCount: 3 }, { launches: 4, launchWins: 0 });- expect(out.cap).toBe(45);- expect(out.reasons.join(' ')).toMatch(/rug pattern/);+ it('derived pillar weights sum to 1', () => {+ const sum = Object.values(PILLAR_WEIGHTS).reduce((a, b) => a + b, 0);+ expect(sum).toBeCloseTo(1, 1);+ expect(WEIGHTS).toBe(PILLAR_WEIGHTS); // legacy alias});+});- it('a proven shipper creator lifts pedigree', () => {- const sm = { score: 60, smartWalletCount: 1 };- const unproven = pedigreeScore(sm, {});- const shipper = pedigreeScore(sm, { launches: 4, launchWins: 3 });- expect(shipper.score).toBeGreaterThan(unproven.score);- expect(shipper.reasons.join(' ')).toMatch(/graduated launches/);+describe('scoreFromProbability', () => {+ it('lands each tier boundary exactly on its probability anchor', () => {+ const a = MODEL.tier_probability_anchors;+ expect(scoreFromProbability(a.watch)).toBe(34);+ expect(scoreFromProbability(a.lean)).toBe(56);+ expect(scoreFromProbability(a.strong)).toBe(72);+ expect(scoreFromProbability(a.prime)).toBe(86);+ });++ it('is monotone and clamped', () => {+ expect(scoreFromProbability(0)).toBe(0);+ expect(scoreFromProbability(1)).toBe(100);+ expect(scoreFromProbability(-1)).toBe(0);+ expect(scoreFromProbability(2)).toBe(100);+ let prev = -1;+ for (let p = 0; p <= 1.0001; p += 0.01) {+ const s = scoreFromProbability(p);+ expect(s).toBeGreaterThanOrEqual(prev);+ prev = s;+ }});+});- it('a dumping creator drags pedigree', () => {- const sm = { score: 60, smartWalletCount: 1 };- const clean = pedigreeScore(sm, { launches: 3, launchWins: 1, dumpRate: 0 });- const dumper = pedigreeScore(sm, { launches: 3, launchWins: 1, dumpRate: 0.7 });- expect(dumper.score).toBeLessThan(clean.score);- expect(dumper.reasons.join(' ')).toMatch(/dumps/);+describe('evaluateModel', () => {+ it('reads raw launch signals and produces a finite fused probability', () => {+ const out = evaluateModel(strongLaunch());+ expect(Number.isFinite(out.z)).toBe(true);+ expect(out.p).toBeGreaterThan(0);+ expect(out.p).toBeLessThan(1);+ expect(out.hits.length).toBe(MODEL.features.length);});- it('a fully unobserved pedigree anchors at the neutral prior, not zero', () => {- // Most launches have no proven buyers and no creator record — that is the- // market norm, not a red flag. Scoring it 0 used to pin every ordinary- // launch under a ~55 fused ceiling.- const out = pedigreeScore({}, {});- expect(out.score).toBe(PEDIGREE_UNKNOWN_PRIOR);- expect(out.coverage).toBe(0);+ it('scores strong evidence far above dead evidence', () => {+ const strong = evaluateModel(strongLaunch());+ const dead = evaluateModel(deadLaunch());+ expect(strong.p).toBeGreaterThan(dead.p * 5);});- it('an unobserved pedigree ceilings the final score below strong', () => {- const out = pedigreeScore({}, {});- expect(out.cap).toBeLessThan(72);- expect(out.reasons.some((t) => /pedigree unobserved/.test(t))).toBe(true);+ it('tolerates an empty intel without throwing or NaN', () => {+ const out = evaluateModel({});+ expect(Number.isFinite(out.p)).toBe(true);});- it('an explicit zero composite from the brain is respected — observed ≠ unknown', () => {- const out = pedigreeScore({ score: 0, totalBuyLamports: 5e9 }, {});- expect(out.score).toBeLessThan(PEDIGREE_UNKNOWN_PRIOR);+ it('falls back to derived CoinIntel fields when raw signals are absent', () => {+ const viaRaw = evaluateModel({ launch: { organic_score: 0.85 } });+ const viaDerived = evaluateModel({ structure: { organicScore: 85 } });+ // Same bucket hit either way.+ const rawHit = viaRaw.hits.find((h) => h.key === 'organic_score');+ const derivedHit = viaDerived.hits.find((h) => h.key === 'organic_score');+ expect(rawHit.bucket).toBe(derivedHit.bucket);});- it('a creator record alone lifts the unknown-pedigree ceiling', () => {- const blind = pedigreeScore({}, {});- const withCreator = pedigreeScore({}, { launches: 4, launchWins: 3 });- expect(blind.cap).toBeLessThan(72);- expect(withCreator.cap).toBe(100);+ it('computes buy_sell_ratio from behavior counts when the raw signal is missing', () => {+ const out = evaluateModel({ behavior: { buyCount: 30, sellCount: 10 } });+ const hit = out.hits.find((h) => h.key === 'buy_sell_ratio');+ expect(hit.bucket).toBe('2-4');});});-describe('structureScore', () => {- it('caps the final score on a bundle launch', () => {- const out = structureScore({ bundleFlag: true, uniqueBuyers: 4, funderClusterPct: 55 });- expect(out.cap).toBeLessThan(50);- expect(out.reasons.join(' ')).toMatch(/bundle/);- });-- it('rewards a wide, distributed base', () => {- const wide = structureScore({ uniqueBuyers: 70, topHolderPct: 8 });- const thin = structureScore({ uniqueBuyers: 5, topHolderPct: 8 });- expect(wide.score).toBeGreaterThan(thin.score);+describe('smartMoneyOverlay', () => {+ it('rewards proven wallets and proven-money share', () => {+ const out = smartMoneyOverlay({+ smartWalletCount: 3,+ provenBuyLamports: 5e9,+ totalBuyLamports: 1e10,+ notable: [{ wallet: 'a', label: 'smart_money', score: 88 }],+ });+ expect(out.z).toBeGreaterThan(0);+ expect(out.reasons.join(' ')).toMatch(/smart-money/);});- it('caps hard when the dev is already dumping', () => {- const out = structureScore({ devSoldPct: 60 });- expect(out.cap).toBeLessThanOrEqual(38);+ it('drags on flagged (rugger/dumper) wallets', () => {+ const out = smartMoneyOverlay({+ notable: [+ { wallet: 'r', label: 'rugger', score: 10 },+ { wallet: 'd', label: 'dumper', score: 20 },+ ],+ });+ expect(out.z).toBeLessThan(0);+ expect(out.reasons.join(' ')).toMatch(/flagged/);});-});-describe('narrativeScore', () => {- it('blends classifier virality with the category prior, weighted by confidence', () => {- const high = narrativeScore({ category: 'news', virality: 90, confidence: 0.9 });- const low = narrativeScore({ category: 'unknown', virality: 10, confidence: 0.9 });- expect(high.score).toBeGreaterThan(low.score);+ it('penalizes smart money already exiting', () => {+ const holding = smartMoneyOverlay({ provenBuyLamports: 1e10, provenSellLamports: 0 });+ const exiting = smartMoneyOverlay({ provenBuyLamports: 1e10, provenSellLamports: 6e9 });+ expect(exiting.z).toBeLessThan(holding.z);});- it('falls back to the category prior when virality is absent', () => {- const out = narrativeScore({ category: 'culture' });- expect(out.score).toBeGreaterThan(0);- expect(out.reasons.join(' ')).toMatch(/no virality/);+ it('caps a serial-rugger creator at 45', () => {+ const out = smartMoneyOverlay({}, { launches: 5, launchWins: 0 });+ expect(out.cap).toBe(45);+ expect(out.z).toBeLessThan(0);});-});-describe('momentumScore', () => {- it('rewards strong buy inflow and penalizes distribution', () => {- const inflow = momentumScore({ buyCount: 40, sellCount: 3 });- const dist = momentumScore({ buyCount: 5, sellCount: 30 });- expect(inflow.score).toBeGreaterThan(dist.score);+ it('a flagged creator label caps too', () => {+ const out = smartMoneyOverlay({}, { label: 'rugger', launches: 1, launchWins: 0 });+ expect(out.cap).toBe(45);});- it('rewards a reasonable dev buy and penalizes an oversized one', () => {- const good = momentumScore({ devBuySol: 1.0, buyCount: 12, sellCount: 1 });- const huge = momentumScore({ devBuySol: 9.0, buyCount: 12, sellCount: 1 });- expect(good.score).toBeGreaterThan(huge.score);+ it('a dumping creator drags without capping', () => {+ const out = smartMoneyOverlay({}, { launches: 3, launchWins: 1, dumpRate: 0.7 });+ expect(out.z).toBeLessThan(0);+ expect(out.cap).toBe(100);});});describe('convict (fusion)', () => {- const primeIntel = {- smartMoney: {- score: 88, smartWalletCount: 5, provenBuyLamports: 8e9, totalBuyLamports: 1e10,- notable: [- { wallet: 'a', label: 'smart_money', score: 90 },- { wallet: 'b', label: 'smart_money', score: 82 },- ],- },- structure: { uniqueBuyers: 70, topHolderPct: 7, funderClusterPct: 5 },- narrative: { category: 'news', virality: 85, confidence: 0.85 },- behavior: { buyCount: 45, sellCount: 3, earlyBuyerCount: 50, devBuySol: 1.2 },- };-- it('a clean, smart-money, high-narrative launch scores strong/prime', () => {- const v = convict(primeIntel);- expect(v.score).toBeGreaterThanOrEqual(72);+ it('a launch in the best-evidence buckets reads strong or prime', () => {+ const v = convict(strongLaunch());expect(['strong', 'prime']).toContain(v.tier);- expect(v.badges).toContain('smart-money');- expect(v.pillars.pedigree).toBeGreaterThan(70);+ expect(v.score).toBeGreaterThanOrEqual(72);});- it('structure cap overrides great pedigree — a bundle can never read strong', () => {- const bundled = {- ...primeIntel,- structure: { uniqueBuyers: 6, topHolderPct: 55, funderClusterPct: 60, bundleFlag: true, devSoldPct: 55 },- };- const v = convict(bundled);- expect(v.score).toBeLessThan(50);- expect(v.tier === 'avoid' || v.tier === 'watch').toBe(true);- expect(v.badges).toContain('structure-flag');+ it('a dead launch reads avoid/watch', () => {+ const v = convict(deadLaunch());+ expect(['avoid', 'watch']).toContain(v.tier);});- it('a serial-rugger creator ceilings the FINAL score — never prime, no matter the buyers', () => {- const ruggerCreator = {- ...primeIntel,- creator: { wallet: 'c', label: null, launches: 5, launchWins: 0 },- };- const clean = convict(primeIntel);- const rugged = convict(ruggerCreator);- expect(clean.score).toBeGreaterThanOrEqual(72); // sanity: same intel reads strong without the creator record- expect(rugged.score).toBeLessThanOrEqual(45);- expect(rugged.tier === 'watch' || rugged.tier === 'avoid').toBe(true);- expect(rugged.reasons.some((r) => r.pillar === 'pedigree' && /rug pattern/.test(r.text))).toBe(true);+ it('a serial-rugger creator ceilings the FINAL score, never above watch', () => {+ const intel = strongLaunch();+ intel.creator = { launches: 6, launchWins: 0 };+ const v = convict(intel);+ expect(v.score).toBeLessThanOrEqual(45);+ expect(v.pedigreeCap).toBe(45);+ expect(v.badges).toContain('pedigree-flag');+ expect(v.badges).not.toContain('prime');});- it('a proven shipper creator lifts the fused score', () => {- // Moderate pedigree base — primeIntel's pedigree is already clamped at 100,- // which would mask the creator bonus.- const midIntel = { ...primeIntel, smartMoney: { score: 60, smartWalletCount: 1, notable: [] } };- const shipper = convict({- ...midIntel,- creator: { wallet: 'c', label: null, launches: 4, launchWins: 3 },- });- expect(shipper.score).toBeGreaterThan(convict(midIntel).score);+ it('smart money lifts the fused score', () => {+ const base = convict(strongLaunch());+ const withSm = strongLaunch();+ withSm.smartMoney = {+ smartWalletCount: 5,+ provenBuyLamports: 5e9,+ totalBuyLamports: 1e10,+ notable: [{ wallet: 'a', label: 'smart_money', score: 88 }],+ };+ const v = convict(withSm);+ expect(v.probability).toBeGreaterThanOrEqual(base.probability);+ expect(v.badges).toContain('smart-money');});- it('flagged wallets pull a mediocre coin further down', () => {- const withRuggers = {- ...primeIntel,- smartMoney: {- score: 45, smartWalletCount: 0, notable: [- { wallet: 'r', label: 'rugger', score: 8 },- { wallet: 'd', label: 'dumper', score: 15 },- ],- },+ it('flagged wallets pull a coin down', () => {+ const clean = convict(strongLaunch());+ const dirty = strongLaunch();+ dirty.smartMoney = {+ notable: [+ { wallet: 'r', label: 'rugger', score: 5 },+ { wallet: 'd', label: 'dumper', score: 10 },+ { wallet: 'e', label: 'rugger', score: 8 },+ ],};- const v = convict(withRuggers);- expect(v.pillars.pedigree).toBeLessThan(45);+ // The strong fixture saturates the 0-100 score line, so assert on the+ // underlying probability, which is strictly monotone in the log-odds.+ expect(convict(dirty).probability).toBeLessThan(clean.probability);});- it('returns a transparent, ordered breakdown and valid tier', () => {- const v = convict(primeIntel);- expect(v.reasons[0]).toHaveProperty('pillar');- expect(v.reasons[0]).toHaveProperty('text');- expect(['avoid', 'watch', 'lean', 'strong', 'prime']).toContain(v.tier);- expect(v.score).toBeGreaterThanOrEqual(0);- expect(v.score).toBeLessThanOrEqual(100);+ it('score equals the probability mapped through the tier anchors (no cap case)', () => {+ const v = convict(strongLaunch());+ expect(v.score).toBe(scoreFromProbability(v.probability));});- it('is deterministic — same input, same score', () => {- expect(convict(primeIntel).score).toBe(convict(primeIntel).score);+ it('returns a transparent breakdown: pillars, reasons quoting observed rates, provenance', () => {+ const v = convict(strongLaunch());+ for (const k of ['pedigree', 'structure', 'narrative', 'momentum']) {+ expect(v.pillars[k]).toBeGreaterThanOrEqual(0);+ expect(v.pillars[k]).toBeLessThanOrEqual(100);+ }+ expect(v.reasons.length).toBeGreaterThan(0);+ expect(v.reasons.some((r) => /% of similar launches worked/.test(r.text))).toBe(true);+ expect(v.model.training_rows).toBe(MODEL.training_rows);+ expect(v.weights).toBe(PILLAR_WEIGHTS);});- it('reports high confidence on a fully-populated intel and low on an empty one', () => {- const full = convict(primeIntel);- expect(full.confidence).toBeGreaterThanOrEqual(70);- expect(full.confidenceLabel).toBe('high');- expect(full.badges).not.toContain('thin-data');+ it('is deterministic: same input, same score', () => {+ const a = convict(strongLaunch());+ const b = convict(strongLaunch());+ expect(a.score).toBe(b.score);+ expect(a.probability).toBe(b.probability);+ });+ it('reports high confidence on fully-populated intel and low on an empty one', () => {+ const full = convict(strongLaunch());const empty = convict({});- expect(empty.confidence).toBeLessThan(45);+ expect(full.confidence).toBeGreaterThan(empty.confidence);expect(empty.confidenceLabel).toBe('low');expect(empty.badges).toContain('thin-data');});- it('an ordinary launch with unobserved pedigree lands mid-watch, not pinned at the floor', () => {- // Regression: pedigree=0-for-missing-data used to hard-cap every ordinary- // launch around 35 and made lean unreachable without wallet data.- const v = convict({- structure: { organicScore: 45, uniqueBuyers: 20 },- narrative: { category: 'meme', virality: 55, confidence: 0.6 },- behavior: { buyCount: 12, sellCount: 5, earlyBuyerCount: 10 },- });- expect(v.pillars.pedigree).toBe(PEDIGREE_UNKNOWN_PRIOR);- expect(v.score).toBeGreaterThan(40);- });-- it('unobserved pedigree can reach lean but never strong, however good the rest', () => {- const v = convict({- structure: { organicScore: 95, uniqueBuyers: 80, topHolderPct: 6, top10Pct: 20 },- narrative: { category: 'news', virality: 92, confidence: 0.9 },- behavior: { buyCount: 60, sellCount: 2, earlyBuyerCount: 55, devBuySol: 1.0 },- });- expect(v.score).toBeLessThan(72);- expect(['lean', 'watch']).toContain(v.tier);- expect(v.reasons.some((r) => r.pillar === 'pedigree' && /unobserved/.test(r.text))).toBe(true);- });-- it('a serial-rugger creator adds a pedigree-flag badge (not structure-flag)', () => {- const v = convict({- ...primeIntel,- creator: { wallet: 'c', label: null, launches: 5, launchWins: 0 },- });- expect(v.badges).toContain('pedigree-flag');- expect(v.pedigreeCap).toBeLessThanOrEqual(45);- expect(v.badges).not.toContain('structure-flag'); // clean structure — cap came from pedigree- });-it('an empty intel object does not throw and reads low', () => {const v = convict({});expect(v.score).toBeGreaterThanOrEqual(0);- expect(v.tier).toBeDefined();+ expect(v.score).toBeLessThanOrEqual(100);+ expect(['avoid', 'watch']).toContain(v.tier);});-});-describe('tierTone', () => {- it('maps tiers to UI tones', () => {- expect(tierTone('prime')).toBe('good');- expect(tierTone('avoid')).toBe('bad');- expect(tierTone('lean')).toBe('warn');+ it('unknown pedigree no longer ceilings the verdict: evidence can reach strong without wallet data', () => {+ // v1's unknown-pedigree cap made Strong unreachable (202k live scores,+ // max ever 69). v2: strong observed evidence outranks missing wallet data.+ const intel = strongLaunch();+ intel.creator = {};+ intel.smartMoney = {};+ const v = convict(intel);+ expect(v.score).toBeGreaterThanOrEqual(72);});});@@ -307,14 +306,26 @@ describe('archetypes', () => {expect(archetypeFor('smart_money').tone).toBe('good');expect(archetypeFor('rugger').tone).toBe('bad');expect(archetypeFor(null).label).toBe('unproven');- expect(archetypeFor('nonsense').title).toBe('Unproven');+ expect(archetypeFor('garbage').label).toBe('unproven');});- it('isProven / isFlagged gate correctly', () => {+ it('isProven / isFlagged match the pedigree rules', () => {expect(isProven('smart_money')).toBe(true);- expect(isProven('neutral', 75)).toBe(true);+ expect(isProven('kol')).toBe(true);+ expect(isProven('neutral', 80)).toBe(true);expect(isProven('neutral', 10)).toBe(false);expect(isFlagged('rugger')).toBe(true);+ expect(isFlagged('dumper')).toBe(true);expect(isFlagged('smart_money')).toBe(false);});});++describe('tierTone', () => {+ it('maps tiers to UI tones', () => {+ expect(tierTone('prime')).toBe('good');+ expect(tierTone('strong')).toBe('good');+ expect(tierTone('lean')).toBe('warn');+ expect(tierTone('watch')).toBe('neutral');+ expect(tierTone('avoid')).toBe('bad');+ });+});