Architecture

Murmuration: self-organizing infrastructure for EU data intelligence. Zone-based security, automated task discovery, and multi-reviewer quality gates. PQ Ready EU Only

Overview

Pauhu® infrastructure follows a murmuration pattern — inspired by the self-organizing flight patterns of starlings. Each terminal (processing unit) operates independently within its security zone, communicates via structured messages, and adapts to changing workload through automated task discovery and health monitoring.

Key principles:

Zone model (IEC 62443-3-3)

Pauhu implements IEC 62443-3-3 zone-based security with four distinct zones and conduit-controlled data flow between them.

  +-----------+    +------------+    +----------+
  | Protected | -> | Controlled | -> | External |
  |  Zone     |    |   Zone     |    |   Zone   |
  |  SL-4     |    |  SL-2/3    |    |   SL-1   |
  +-----------+    +------------+    +----------+
                         |
                   ==============
                   ||  Conduit  ||
                   ==============
                         |
  +-----------+    +----------+
  | Business  | <- |  Audit   |
  |  Zone     |    |   Zone   |
  |  SL-0     |    |   FR6    |
  +-----------+    +----------+
Security LevelTarget
SL-4Protection against state-sponsored attack
SL-3Protection against sophisticated attack
SL-2Protection against intentional attack
SL-1Protection against casual violation
SL-0No specific requirements

Gate orchestration

A central orchestrator routes each request through zone-specific security gates. Gates pass before any ML model runs (Model Last principle).

                 +-- Protected ------+-- Architecture
                 |   (Constraints)    +-- ML Pipeline
                 |                    +-- Data Engineering
                 |                    +-- Security Audit
                 |                    +-- Legal Review
                 |                    +-- Red Team
                 |
Orchestrator ----+-- Controlled -----+-- Development
                 |   (Conduit)       +-- Operations
                 |                    +-- Infrastructure
                 |                    +-- Product
                 |
                 +-- External -------+-- Frontend
                      (Actions)      +-- Documentation
                                     +-- Internationalization

  Model Last: All security gates pass FIRST → then AI inference

Gate classification

Each gate enforces one of four deontic modalities (from modal logic), determining how strictly it controls data flow:

ModalityBehaviourExample
ProhibitionBlock if violated (MUST NOT)Reject requests containing PII in search queries
ObligationRequire completion (MUST)Enforce data license terms before export
PermissionApprove if proposed (MAY)Allow optional semantic ranking add-on
ExemptionNo action needed (EXEMPT)Pass-through for static documentation

Document extraction on Hetzner

Document extraction is a headless Chrome bridge running on a dedicated server in Helsinki (EU jurisdiction). It provides server-side document extraction, PDF rendering, and accessibility tree snapshotting.

  +-----------------------+        +----------------------+
  | Edge Workers          |        | Helsinki Server      |
  | (EU edge)             |        | (EU datacenter)      |
  |                       |        |                      |
  |  API Router           |        |  Document extraction Bridge     |
  |    |                  |        |    |                  |
  |    +-- /extract ------+------->|    +-- Chrome CDP     |
  |    +-- /pdf-render ---+------->|    +-- Tab lifecycle  |
  |    |                  |        |    +-- Text extract   |
  |  Vision Service       |        |    +-- PDF render     |
  |    +-- annotate ------+--+     |                      |
  |    +-- terminology ---+--+     +----------------------+
  |    |                  |  |
  |  Annotation Service   |  |     +-----------------------+
  |    +-- STAM sidecar --+--+---->| Object Storage (EU)   |
  |                       |        | pinchtab/{product}/   |
  |  Index Service        |        |   {hash}.stam.json    |
  |    +-- DB + Vectorize |        +-----------------------+
  +-----------------------+

Data flow

  1. Client sends URL to /extract or /pdf-render via the API router
  2. The vision service opens a Chrome tab on Document extraction (Helsinki) via authenticated bridge token
  3. Chrome navigates to the URL, extracts text (or renders PDF)
  4. Tab is closed in background — stateless, no data retained
  5. If annotate: true, text is sent to the annotation service for topic and deontic classification
  6. If terminology: true, IATE terms are extracted via the terminology service
  7. For /extract-and-index, STAM sidecar JSON is written to object storage for indexing

Security

Automated task discovery

The murmuration health loop automatically discovers work from four signal sources and creates tasks in the registry. Each task is routed to the appropriate terminal based on its zone and type.

SourceSignalRouting
Error collector>10 same error in 24hBy phase: model→ML team, auth→security, ui→frontend, api→development
Git logFIXME / TODO / HACK in recent commitsDevelopment team
CI failuresSame workflow fails 3+ times in 7dOperations team
Stale PRsOpen >7 days, no updatesOriginal author

Failed tasks are automatically retried up to 3 times. After 3 failures, the task is marked as blocked and requires human intervention.

Multi-reviewer quality

Every pull request is reviewed by three independent reviewers:

A consensus job runs after all three reviewers complete. If 2 out of 3 flag critical issues, the PR is blocked until the issues are resolved.

Health loop

A 10-minute cron job runs the murmuration health check across the entire infrastructure:

Results are written to a JSON report and committed back to the repository by the murmuration-bot.

Data pipeline

Every EU document flows through a 6-stage pipeline from source to searchable index. This is the same pipeline for all 20 data sources — only the seed script and product code differ.

  Seed Script         Object Storage       Queue              Annotation Service
  (per source)        (per product)        (per product)      (topic + deontic)
       |                   |                    |                    |
  Fetch from EU    Upload with         Storage event         Classify:
  institution      metadata            notification          - language detection
  (SPARQL, REST,   (celex_id,          triggers              - topic domain (1-21)
   SDMX, OAI-PMH)  product, lang)      consumer              - deontic modality
       |                   |                    |               - word/char count
       v                   v                    v                    |
                                                                     v
  STAM Sidecar       Index Service        Database            Vectorize Index
  (.stam.json)       (hybrid search)      (per product)       (BGE-M3, 1024d)
       |                   |                    |                    |
  Annotation         Index into           Structured           Semantic search
  stored next to     DB + Vectorize       metadata for         across 20 indexes
  source doc         (70% semantic,       SQL queries          via Laine Algorithm
  in storage         30% BM25)                                                

Stage 1: Seed

Source-specific seed scripts fetch documents from EU institutions via their official APIs (SPARQL for EUR-Lex/CELLAR, REST for TED/ECHA/EMA, SDMX for ECB/Eurostat, OAI-PMH for CORDIS). Each document is uploaded to its product-specific R2 bucket with customMetadata containing the CELEX ID, product code, language, and source URL.

Stage 2: Queue

Storage event notifications trigger a queue message for each new or updated document. The 20 products are split across two queue consumers for load balancing (products A–E and products E–W).

Stage 3: Annotate

The annotation worker classifies each document:

Stage 4: STAM sidecar

Annotations are stored as .stam.json sidecar files next to the source document in R2. The STAM (Stand-off Text Annotation Model) format keeps annotations separate from source text, enabling non-destructive updates and full provenance tracking.

Stage 5: Index

The indexing service reads annotated documents and indexes them into:

Stage 6: Search

The Laine Algorithm fans out queries across all 20 Vectorize indexes simultaneously, combining 70% semantic similarity with 30% BM25 keyword matching. Results include DSA Article 27 ranking transparency metadata.

Dead letter queue

Documents that fail annotation after 3 retries are routed to a dead letter queue for manual inspection. The /backfill admin endpoint can re-index documents after the issue is resolved.

DSPy modules

Pauhu uses Stanford DSPy for all prompt optimization and ML orchestration. The codebase contains 486 DSPy signatures, 401 modules, and 34 orchestrators.

DSPy modules replace traditional prompt engineering with programmatic, optimizable pipelines. Each module defines typed signatures (input/output contracts) and can be composed into larger orchestration flows.

ComponentCountPurpose
Signatures486Typed input/output contracts
Modules401Composable processing units
Orchestrators34Multi-module coordination flows

The MetaPromptEngine handles prompt optimization across all services, ensuring consistent quality and EU AI Act transparency compliance.