Deterministic event orchestration for AI systems.
No duplication. No hidden state. No ambiguity.

Bifrost uses event-driven sequential pipelines.
Each service consumes and emits typed events.
No direct service-to-service calls.
No shared mutable state.
All state changes occur through events.
No service can mutate global state. All state changes occur through events only.
Every event in Bifrost must conform to this exact schema. No exceptions.
{
"id": "evt_7f3a9c2b",
"type": "invoice.created",
"timestamp": "2026-04-29T14:23:01.000Z",
"source": "crm/opportunities",
"payload": {
"client": "Nova Corp",
"amount": 12500,
"currency": "USD"
},
"metadata": {
"trace_id": "sk-7f3a9c2b-x9k2",
"version": "v1",
"schema_version": "1.0.0",
"idempotency_key": "inv_novacorp_20260429"
}
}Rule: "New versions never break old contracts. Old events are always processable."
If you run the same event twice — the system produces the same result.
Bifrost enforces idempotency via event IDs. Duplicate events are detected via idempotency_key and ignored or reconciled.
Every event ID is unique. Every outcome is traceable. Same input always produces same audit trail.
// Duplicate detection
const existing = await prisma.bifrostEvent.findFirst({
where: {
payload: { path: ['metadata', 'idempotency_key'],
equals: event.metadata.idempotency_key }
}
})
if (existing) return {
status: 'duplicate_ignored',
original: existing.id
}No god objects. No hidden complexity.
Responsibility: "Receives raw events and persists them before any processing begins."
type Input = RawBifrostEvent type Output = PersistedEvent
export async function ingest(e) {
return prisma.bifrostEvent.create({ ... })
}"On failure → returns INTAKE_FAILED error. Event is never lost — retry queue activated. Pipeline halts. No partial processing."
Responsibility: "Validates every event against the TypeScript contract. Rejects non-compliant events."
type Input = PersistedEvent type Output = ValidatedEvent | Error
export function validate(e) {
const res = validateSchema(e)
return res.valid ? e : res.err
}"On failure → emits EVENT_VALIDATION_FAILED. Pipeline halts immediately. Error logged to observability layer. Caller receives violation list."
Responsibility: "Calculates risk score 0-100 using rules engine and ML fallback."
type Input = ValidatedEvent type Output = ScoredEvent
export async function score(e) {
const ml = await scoreWithML(e)
return { ...e, score: ml ?? rules(e) }
}"ML service failure → automatic fallback to TypeScript rules engine. Score is never null. Pipeline never halts due to scoring failure."
Responsibility: "Determines the correct destination and action for each event."
type Input = ScoredEvent type Output = RoutedEvent
export function route(e) {
const res = routingRules.eval(e)
return { ...e, destination: res }
}"On failure → routes to DEFAULT_REVIEW queue. No event is dropped. Human review triggered automatically."
Responsibility: "Creates an immutable, append-only audit record for every event."
type Input = ProcessedEvent type Output = AuditRecord
export async function audit(e) {
return prisma.auditLog.create({ ... })
}"Audit is the LAST stage. It never blocks. If audit write fails → emergency log to separate append-only store. Audit failure is a P0 alert. No audit = system violation."
Not philosophy. Engineering requirements.
Watch the Bifrost pipeline execute in real-time. Select an event type and see deterministic processing.
No duplication. No hidden state. No ambiguity.