Skip to main content

Signal Engine

The signal engine is the fact layer between raw on-chain data and AI narratives. It has zero external dependencies. The Dune baseline and live wallet events feed detectSignals() independently — either can be absent (see Missing-data behaviour) — and only its WalletSignal[] output, never the raw baseline or events, is passed on to the AI narrative layer. AI narratives must consume these deterministic signals — they must not invent facts. Every number, address, and time window in a narrative must trace back to a WalletSignal.evidence field and its sources provenance chain.

Modules

The signal engine is organised into three conceptual modules, all available from its public entry point. Each is documented in full further down this page.
detectSignals(), individual detectors, buildBaselineStats(), DEFAULT_OPTIONS
Pure math helpers: usualDailyVolumeUSD, baselineDeviation, deriveConfidence, etc.
CEX/bridge label patterns: isCexLabel, isBridgeLabel, normaliseCexName

API

All outputs conform to the WalletSignal shape from the model layer.

Signal taxonomy

Default thresholds

All thresholds can be overridden by passing a Partial<SignalEngineOptions> as the second argument to detectSignals().

Confidence rules

Confidence is derived from data completeness, not signal magnitude. A large move detected from a partial dataset is medium, not high. Rules are evaluated in order; the first match wins. Use deriveConfidence(baseline, events) directly when building custom detectors.

Deterministic calculations

All math lives in the signal engine’s calculation helpers:

CEX and bridge detection

CEX and bridge classification uses label matching on counterpartyLabel, not address lookup. This keeps the engine decoupled from the API layer’s PROTOCOL_MAP and avoids hardcoding addresses that change after upgrades.
Known patterns live in CEX_LABEL_PATTERNS and BRIDGE_LABEL_PATTERNS. Add new entries there when a new exchange or bridge needs to be covered — no engine logic changes required.

Missing-data behaviour

The engine never throws on missing or partial inputs. It degrades gracefully:
  • baseline === null — detectors that require baseline return null and are filtered out. Only label-based detectors (bridge, cex) can still fire, at confidence: 'low'.
  • Partial baseline (isPartial: true) — all emitted signals cap at confidence: 'medium' and carry a caveat noting the incomplete dataset.
  • event.valueUSD === null — the event is included in tx-count comparisons but excluded from volume sums. If this causes a relevant deviation, the signal is emitted at max 'medium' confidence.
  • Empty event array — only baseline-derived signals are considered.
  • Empty event array AND baseline === nulldetectSignals() returns [].

Source provenance

Every signal includes:
  • sources: SourceMetadata[] — the baseline source, each contributing event source, and an engineSource entry (sourceType: 'computed').
  • dataQuality.sources — same list, inside the DataQuality object.
The engineSource entry has sourceId: 'signal-engine-v1' so consumers can filter engine-derived fields from raw data fields.

How the narrative engine uses signals

  1. Pass signals[] as the primary context to NarrativeInput.signals — not the raw baseline or events.
  2. Every narrative claim must trace to a signal’s evidence object. If a number can’t be backed by evidence, it must not appear in the narrative.
  3. Respect signal.confidence. Narratives for confidence: 'low' signals must use hedged language (“limited data suggests…”) and explicitly surface the relevant caveats.
  4. Never override evidence fields. The AI may phrase and contextualise the evidence but must not change the numbers.
  5. Attach signal.sources to the NarrativeCard.sources array so the UI can show data-freshness badges for every claim.
A separate behavioral-signals engine provides a set of behavioral exposure heuristics consumed by the Vault Readiness Card. These are not part of the detectSignals() pipeline and are not WalletSignal objects. See Quantum Intelligence for the full specification.

Running tests

Model Layer

The WalletSignal shape and shared schema conventions the signal engine outputs conform to.

Quantum Intelligence

The separate behavioral-signals engine and Vault Readiness Card specification.

Whale Watcher

A consumer of WalletSignal[] alongside the signal engine and narrative layer.