Core Concepts
Signals
What signals are
Signals are detected patterns derived from loop events.
A SignalRule evaluates event streams and returns a detection result when matched.
SignalRule anatomy
1interface SignalRule {2 id: string3 name: string4 description: string5 targetLoopId?: LoopId6 evaluate: (events: LoopEvent[]) => SignalDetectionResult | null7}Built-in signal rules
threshold-breach
- Signal type:
THRESHOLD_BREACH - Detects numeric evidence crossing configured threshold
- Config:
field,operator,threshold
state-dwell
- Signal type:
STATE_DWELL_EXCEEDED - Detects prolonged dwell in a target state
- Config:
state,maxDwellMinutes
repeated-guard-failure
- Signal type:
GUARD_FAILURE_PATTERN - Detects repeated
loop.guard.failedevents for one guard ID - Config:
guardId,maxFailures
loop-not-started
- Signal type:
LOOP_TRIGGER_DELAYED - Detects when a signal is received but no loop started in time window
- Config:
maxDelayMinutes
Create a signal engine
1"cmt">// @no-typecheck2"cmt">// SR-024 will replace this block with the published `SignalRegistry` + event-bus flow. F-38 marker: legacy actor fields in related pages.3import { createSignalEngine } from '@loop-engine/sdk'4 5const signals = createSignalEngine()6signals.subscribe((signal) => {7 console.log(signal.type, signal.subject, signal.confidence)8})Connect signal detection to loop creation
1"cmt">// @no-typecheck2signals.subscribe(async (signal) => {3 if (signal.type !== 'THRESHOLD_BREACH') return4 await engine.start({5 loopId: 'scm.replenishment',6 aggregateId: aggregateId(`repl-${Date.now()}`),7 actor: { type: 'system', id: 'system:signal-router' },8 metadata: { triggeredBy: signal.id, source: 'signal-router' }9 })10})