updated 2026-11-26·3 min read
Parallel AST Analyzers Reference
Five-worker parallel analyzer layout, analyzer_progress_event.json wire schema, and domain-isolated analysis pipeline.
A single generalist linter chokes on mixed SQL, Python, Rust, and Protobuf files. Stokes gives each language toolchain its own isolated worker and fans their findings into an asyncio.Queue event bus with a 16.6 ms (60 FPS) render coalescer.

Five-Worker Analyzer Layout
Each worker scans only its own file types and emits typed findings upward to the coordinator (BobMultiplexer):
| Worker | Runtime Scope | Domain Focus | Typical Drift Finding |
|---|---|---|---|
stokes-sql | ClickHouse / SQL | Schema queries & catalog reflection | events_r0 / r1 matched (280 cols) |
stokes-python | Python ETL | Dynamic dict unpacking & slice bounds | priority = 0 shadow admission without cap |
stokes-rust | Rust Proxy | Fixed buffer capacity & .try_into().unwrap() | TryFromSliceError risk (Risk = 1.40) |
stokes-proto | Protobuf v2/v3 | repeated field bounds & tags | Missing stokes.max_items option |
stokes-verify | Sandbox Harness | Criterion JSON & IEEE-754 float fuzzing | Validates 10,000 float cases and seals lockfile |
Four-Step Analysis Pipeline
- Domain-Isolated Parsing
Each worker inspects only its target language (SQL, Python, Rust, Protobuf) to prevent mixed-grammar parse errors.
- In-Memory Event Queue & Wire Framing
Workers push typed diagnostics into asyncio.Queue with cooperative backpressure and 16.6 ms coalescing; external integrations use 4-byte big-endian uint32 framing.
- Automated Patch Generation
On drift detection, Stokes emits parameterized unified diffs (database qualification in SQL, in-place quickselect in Rust) with 0 B heap allocation.
- Clean Verification Gate
Requires all active language workers and property tests to pass before sealing stokes.lock and CONFORMANCE.md.
Typed Event Schema (analyzer_progress_event.json)
Length-Prefixed Analyzer Progress Event Payload
{
"event_id": "c7a8e291-f0b4-4e2a-92b1-8d2e82110c4a",
"timestamp_ns": 1727282400012000000,
"analyzer_id": "stokes-rust",
"phase": "invariant_evaluation",
"target_file": "crates/cloudflame-proxy/src/engine/feature_ingest.rs",
"line_offset": 98,
"ast_node_type": "call_expression",
"ast_symbol_name": "try_into().unwrap()",
"status_message": "fatal tryfromsliceerror: 280 elements exceed [feature; 200]",
"severity": "contract_violation",
"remediation_patch": {
"action": "dual_zone_quickselect",
"heap_allocation_limit_bytes": 0,
"core_reserved_slots": 128,
"adaptive_slots": 72,
"algorithm": "select_nth_unstable_by"
}
}Analyzer Architecture FAQ
- Why run separate language workers instead of one generalist linter? Polyglot stacks have conflicting syntax rules; keeping each language in its own worker avoids parse collisions while still letting Stokes cross-reference SQL projections, Python loops, and Rust stack arrays.
- How do workers communicate inside the CLI? Events stream into an
asyncio.Queuethrottled to a 16.6 ms render tick (60 FPS); external IPC uses 4-byte big-endian length-prefixed frames. - What happens when a worker flags drift? It emits file path, line offset, and node metadata, then triggers patch generation and
stokes-verifychecks. - How do AI agents consume worker findings? Via
stokes mcpover stdio orstokes remediate --agent claude|bob|aider.
See Parallel Language Workers & Event Bus for IPC internals and Multi-Language AST & Regex Analysis Engine for .scm queries.