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 feeddetectSignals() 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.Detection engine
Detection engine
detectSignals(), individual detectors, buildBaselineStats(), DEFAULT_OPTIONSCalculations
Calculations
Pure math helpers:
usualDailyVolumeUSD, baselineDeviation, deriveConfidence, etc.Known labels
Known labels
CEX/bridge label patterns:
isCexLabel, isBridgeLabel, normaliseCexNameAPI
WalletSignal shape from the model layer.
Signal taxonomy
Default thresholds
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 oncounterpartyLabel, not address lookup. This keeps the engine decoupled from the API layer’s PROTOCOL_MAP and avoids hardcoding addresses that change after upgrades.
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 returnnulland are filtered out. Only label-based detectors (bridge, cex) can still fire, atconfidence: 'low'.- Partial baseline (
isPartial: true) — all emitted signals cap atconfidence: '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 === null—detectSignals()returns[].
Source provenance
Every signal includes:sources: SourceMetadata[]— the baseline source, each contributing event source, and anengineSourceentry (sourceType: 'computed').dataQuality.sources— same list, inside the DataQuality object.
engineSource entry has sourceId: 'signal-engine-v1' so consumers can filter engine-derived fields from raw data fields.
How the narrative engine uses signals
- Pass
signals[]as the primary context toNarrativeInput.signals— not the raw baseline or events. - Every narrative claim must trace to a signal’s
evidenceobject. If a number can’t be backed by evidence, it must not appear in the narrative. - Respect
signal.confidence. Narratives forconfidence: 'low'signals must use hedged language (“limited data suggests…”) and explicitly surface the relevant caveats. - Never override evidence fields. The AI may phrase and contextualise the evidence but must not change the numbers.
- Attach
signal.sourcesto theNarrativeCard.sourcesarray so the UI can show data-freshness badges for every claim.
Related: behavioral exposure signals
A separate behavioral-signals engine provides a set of behavioral exposure heuristics consumed by the Vault Readiness Card. These are not part of thedetectSignals() pipeline and are not WalletSignal objects. See Quantum Intelligence for the full specification.
Running tests
Related pages
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.
