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.

Sniper honeypot detector: recalibrate to labeled outcomes, not intuition

nirholas13631cd2a13f
diff --git a/api/_lib/market-realness.js b/api/_lib/market-realness.js
index bb6eda4ba..c1261f541 100644
--- a/api/_lib/market-realness.js
+++ b/api/_lib/market-realness.js
@@ -1,22 +1,29 @@
-// market-realness.js — tell a real market from a painted one.
+// market-realness.js — tell a real market from a painted one, calibrated to the
+// platform's OWN labeled outcomes, not to intuition.
//
// The problem an operator sees instantly but a naive bot misses: a coin with a
// big opening candle that then "stairsteps" up looks like momentum, but is often
-// a chart PAINTED by a handful of wallets with no real two-sided market beneath
-// it. The bot buys the green; the launcher dumps the thin float on it.
+// a chart PAINTED by a handful of wallets. The bot buys the green; the launcher
+// dumps the thin float on it.
//
-// Grounded in the platform's own labeled outcomes (pump_coin_outcomes joined to
-// the intel observation window, ~62k coins, base win rate ~12.4% where "win" =
-// pumped 3x or graduated):
+// We derived the actual tell from pump_coin_intel joined to pump_coin_outcomes
+// over the ACTIVE cohort (coins with a real formed market at entry,
+// unique_buyers >= 10 — the only coins a momentum bot would ever consider).
+// scripts/rug-signature.mjs reproduces this. Buying blind in that cohort wins
+// 31%. The features that actually separate a winner from a rug, with their
+// measured single-gate lift:
//
-// ≥20 unique buyers AND ≥5 unique sellers → 52% win (a real two-sided market)
-// ≥3 unique sellers → 24% win
-// no sellers at all (us=0) → 15% win
-// mechanically-timed trades (entropy<0.5) → 11% win (a metronome, not a crowd)
+// concentration_top10 < 0.90 -> 72% win (2.30x) whale-held float is the strongest tell
+// unique_buyers >= 30 -> 68% win (2.16x) a real crowd, not a few wallets
+// snipe_ratio < 0.50 -> 45% win (1.44x) NOT front-loaded into the opening candle
+// bundle_score < 0.25 -> 43% win (1.38x) not a coordinated launch
+// unique_sellers >= 5 -> 32% win (1.03x) near-useless: a two-sided market barely helps
//
-// The single strongest, simplest tell is a genuine two-sided market: many buyers
-// AND real sellers. A rising price with almost no unique buyers and no sellers is
-// the painted-stairstep signature, and it barely beats a coin flip.
+// Combined (buyers>=30 AND snipe<0.5 AND conc<0.9) -> 75% win, 2.4x lift, still
+// keeps 13% of the active flow. So the honeypot signature the owner described is,
+// precisely: a FRONT-LOADED opening candle (high snipe_ratio) on a WHALE-HELD
+// float (high concentration) with a THIN real crowd (few unique buyers). Seller
+// presence, which earlier hand-tuned versions leaned on, is not the tell.
//
// Pure function over the intel `signals` object; no I/O. Shared by the sniper's
// scoreIntel gate and the LLM judge prompt so both "see" the same market shape.
@@ -26,13 +33,24 @@ function n(v) {
return Number.isFinite(x) ? x : null;
}
+// Thresholds are the winner/rug medians from the active-cohort analysis, chosen
+// where the two distributions cross. Tightening these trades coverage for win
+// rate; they are the measured crossover, not round numbers.
+const T = {
+ crowdReal: 30, // unique_buyers at/above this looks like a real crowd (winner median 34)
+ crowdThin: 20, // below this the "crowd" is suspiciously small (rug median 15)
+ snipeHot: 0.6, // snipe_ratio at/above this is a front-loaded opening candle (rug median 0.74)
+ concWhale: 0.95, // top-10 hold at/above this is a whale-held float (rug median 1.00)
+ bundleHot: 0.3, // bundle_score at/above this is a coordinated launch (rug median 0.31)
+};
+
/**
* Assess how real the market under a coin is from its observation-window signals.
- * @param {object} signals pump_coin_intel signals (buy/sell counts, unique buyers/sellers, concentration, timing)
+ * @param {object} signals pump_coin_intel signals (buyers, snipe_ratio, concentration_top10, bundle_score, ...)
* @returns {{
- * realness: number, // 0..1, higher = more like a genuine two-sided market
- * twoSided: boolean, // meets the data's 52%-win two-sided bar
- * painted: boolean, // matches the painted-stairstep signature
+ * realness: number, // 0..1, higher = more like a genuine coin, lower = more like a painted rug
+ * twoSided: boolean, // has a real two-sided market (kept for the require_two_sided_market gate)
+ * painted: boolean, // matches the data-derived honeypot signature
* buyers: number|null, sellers: number|null,
* flags: string[], // machine reasons
* read: string, // one-line human read for a prompt / log
@@ -44,8 +62,10 @@ export function assessMarketRealness(signals) {
const sellers = n(s.unique_sellers);
const buyCount = n(s.buy_count) ?? 0;
const sellCount = n(s.sell_count) ?? 0;
- const conc5 = n(s.concentration_top5);
- const entropy = n(s.timing_entropy);
+ // concentration_top10 is the proven column; fall back to top5 if only that is present.
+ const conc = n(s.concentration_top10) ?? n(s.concentration_top5);
+ const snipe = n(s.snipe_ratio);
+ const bundle = n(s.bundle_score);
const flags = [];
// Not enough trading to judge yet — neutral, never a false "painted" verdict on
@@ -54,45 +74,51 @@ export function assessMarketRealness(signals) {
return { realness: 0.5, twoSided: false, painted: false, buyers, sellers, flags: ['insufficient_trades'], read: 'too new to read a market yet' };
}
- // The proven bars.
- const hasRealSellers = sellers != null && sellers >= 3;
+ // The proven structural tells of a painted honeypot.
+ const frontLoaded = snipe != null && snipe >= T.snipeHot; // opening-candle spike, then nothing
+ const whaleHeld = conc != null && conc >= T.concWhale; // ~all of the float in ~10 wallets
+ const thinCrowd = buyers < T.crowdThin; // no real buyer base under the rise
+ const bundled = bundle != null && bundle >= T.bundleHot; // coordinated launch wallets
+ const realCrowd = buyers >= T.crowdReal;
+ // two-sided is a weak signal (1.03x) — kept only for the explicit strategy gate.
const twoSided = buyers >= 20 && sellers != null && sellers >= 5;
- const oneSided = sellers != null && sellers <= 1; // rising with nobody selling
- const thinCrowd = buyers < 10;
- const concentrated = conc5 != null && conc5 > 0.8;
- const mechanical = entropy != null && entropy < 0.5;
- // Painted-stairstep: a one-sided, concentrated, thin-crowd rise. Any two of the
- // three structural tells (no sellers, thin crowd, whale-held) marks it painted;
- // mechanical timing reinforces but never alone convicts.
- const structural = [oneSided, thinCrowd, concentrated].filter(Boolean).length;
+ // Painted-stairstep: any two of the three PROVEN structural tells. Bundling
+ // reinforces but, like the old mechanical-timing tell, never convicts alone.
+ const structural = [frontLoaded, whaleHeld, thinCrowd].filter(Boolean).length;
const painted = structural >= 2;
- if (twoSided) flags.push('two_sided_market');
- if (hasRealSellers && !twoSided) flags.push('has_sellers');
- if (oneSided) flags.push('one_sided_no_sellers');
+ if (frontLoaded) flags.push('front_loaded_candle');
+ if (whaleHeld) flags.push('whale_held_float');
if (thinCrowd) flags.push('thin_crowd');
- if (concentrated) flags.push('whale_concentrated');
- if (mechanical) flags.push('mechanical_timing');
+ if (bundled) flags.push('coordinated_launch');
+ if (realCrowd) flags.push('real_crowd');
+ if (twoSided) flags.push('two_sided_market');
- // Realness score: start from the crowd size, credit real sellers, debit the
- // painted tells. Calibrated so twoSided lands high (~0.8+) and a painted
- // stairstep lands low (~0.2), matching the 52% vs ~12% win split.
+ // Realness score: center at 0.5, move by the PROVEN features weighted by their
+ // measured lift. Calibrated so a winner-median coin (buyers 34, snipe 0.47,
+ // conc 0.90, bundle 0.19) lands ~0.56 (above center, "real market") and a
+ // rug-median coin (buyers 15, snipe 0.74, conc 1.00, bundle 0.31) floors at
+ // 0.0 ("painted rise"), matching the 75% vs 31% active-cohort win split.
let r = 0.5;
- r += Math.min(0.25, (buyers / 40) * 0.25); // more buyers → more real
- if (hasRealSellers) r += 0.15;
- if (twoSided) r += 0.15;
- if (oneSided) r -= 0.2;
- if (thinCrowd) r -= 0.15;
- if (concentrated) r -= 0.15;
- if (mechanical) r -= 0.08;
+ // crowd size: strongest continuous signal, moved around the 30-buyer crossover.
+ if (buyers != null) r += Math.max(-0.22, Math.min(0.22, (buyers - T.crowdReal) / 60));
+ // front-loading: penalize an opening-candle-heavy tape above the 0.5 crossover.
+ if (snipe != null) r -= Math.max(0, Math.min(0.22, (snipe - 0.5) * 0.6));
+ // whale concentration: penalize a float held by a handful of wallets.
+ if (conc != null) r -= Math.max(0, Math.min(0.2, (conc - 0.85) * 1.2));
+ // coordinated launch: smaller debit.
+ if (bundle != null) r -= Math.max(0, Math.min(0.12, (bundle - 0.2) * 0.4));
+ // tiny credit for a genuine two-sided market (weak but real).
+ if (twoSided) r += 0.05;
const realness = Math.max(0, Math.min(1, r));
- const read = twoSided
- ? `real two-sided market: ${buyers} buyers, ${sellers} sellers`
- : painted
- ? `painted rise: ${buyers} buyers, ${sellers ?? 0} sellers, top5 hold ${conc5 != null ? Math.round(conc5 * 100) + '%' : '?'}${mechanical ? ', metronomic timing' : ''}`
- : `${buyers} buyers / ${sellers ?? 0} sellers, ${buyCount} buys / ${sellCount} sells`;
+ const pct = (x) => (x != null ? Math.round(x * 100) + '%' : '?');
+ const read = painted
+ ? `painted rise: ${buyers} buyers, snipe ${pct(snipe)}, top10 hold ${pct(conc)}${bundled ? ', bundled' : ''}`
+ : realCrowd && !frontLoaded && !whaleHeld
+ ? `real market: ${buyers} buyers, snipe ${pct(snipe)}, top10 hold ${pct(conc)}`
+ : `${buyers} buyers / ${sellers ?? 0} sellers, snipe ${pct(snipe)}, top10 ${pct(conc)}`;
return { realness: Number(realness.toFixed(3)), twoSided, painted, buyers, sellers, flags, read };
}
diff --git a/tests/market-realness.test.js b/tests/market-realness.test.js
index af304177b..6f4683240 100644
--- a/tests/market-realness.test.js
+++ b/tests/market-realness.test.js
@@ -1,24 +1,35 @@
// market-realness: the painted-stairstep detector, calibrated to the platform's
-// own labeled outcomes (two-sided markets win ~52% vs a ~12% base).
+// own labeled outcomes over the active cohort (scripts/rug-signature.mjs). The
+// proven tells are front-loading (snipe_ratio), whale concentration
+// (concentration_top10), and thin crowd (unique_buyers) — NOT seller presence.
import { describe, it, expect } from 'vitest';
import { assessMarketRealness } from '../api/_lib/market-realness.js';
describe('assessMarketRealness', () => {
- it('flags a painted one-sided rise (the honeypot stairstep)', () => {
- const m = assessMarketRealness({ unique_buyers: 4, unique_sellers: 0, buy_count: 11, sell_count: 0, concentration_top5: 0.94, timing_entropy: 0.3 });
+ it('flags a front-loaded, whale-held, thin-crowd rise (the honeypot signature)', () => {
+ // rug-median shape: few buyers, opening-candle-heavy, float held by ~10 wallets.
+ const m = assessMarketRealness({ unique_buyers: 15, unique_sellers: 10, buy_count: 16, sell_count: 11, snipe_ratio: 0.74, concentration_top10: 1.0, bundle_score: 0.31 });
expect(m.painted).toBe(true);
- expect(m.twoSided).toBe(false);
expect(m.realness).toBeLessThan(0.3);
- expect(m.flags).toContain('one_sided_no_sellers');
- expect(m.flags).toContain('whale_concentrated');
+ expect(m.flags).toContain('front_loaded_candle');
+ expect(m.flags).toContain('whale_held_float');
+ expect(m.flags).toContain('thin_crowd');
});
- it('rewards a genuine two-sided market', () => {
- const m = assessMarketRealness({ unique_buyers: 31, unique_sellers: 8, buy_count: 60, sell_count: 22, concentration_top5: 0.42, timing_entropy: 0.8 });
- expect(m.twoSided).toBe(true);
+ it('rewards a genuine coin: real crowd, not front-loaded, not whale-held', () => {
+ // winner-median shape.
+ const m = assessMarketRealness({ unique_buyers: 34, unique_sellers: 18, buy_count: 37, sell_count: 23, snipe_ratio: 0.47, concentration_top10: 0.9, bundle_score: 0.19 });
expect(m.painted).toBe(false);
- expect(m.realness).toBeGreaterThan(0.8);
+ expect(m.realness).toBeGreaterThan(0.55);
+ expect(m.flags).toContain('real_crowd');
+ });
+
+ it('does NOT reward seller presence alone (two-sided is a near-useless 1.03x tell)', () => {
+ // Plenty of sellers, but front-loaded on a whale-held thin float: still painted.
+ const m = assessMarketRealness({ unique_buyers: 12, unique_sellers: 8, buy_count: 14, sell_count: 9, snipe_ratio: 0.8, concentration_top10: 0.98, bundle_score: 0.1 });
+ expect(m.painted).toBe(true);
+ expect(m.realness).toBeLessThan(0.4);
});
it('stays neutral when there is not enough trading to read', () => {
@@ -29,9 +40,9 @@ describe('assessMarketRealness', () => {
expect(m.flags).toContain('insufficient_trades');
});
- it('does not convict on thin-crowd alone (needs two structural tells)', () => {
- // few buyers but real sellers and not whale-held → not painted
- const m = assessMarketRealness({ unique_buyers: 8, unique_sellers: 4, buy_count: 12, sell_count: 6, concentration_top5: 0.5, timing_entropy: 0.9 });
+ it('does not convict on a single structural tell (needs two of three proven tells)', () => {
+ // Whale-ish concentration but a real crowd and no front-loading: not painted.
+ const m = assessMarketRealness({ unique_buyers: 40, unique_sellers: 20, buy_count: 45, sell_count: 25, snipe_ratio: 0.3, concentration_top10: 0.96, bundle_score: 0.1 });
expect(m.painted).toBe(false);
});
});