stokes

analyzers

parallel ast analyzers. cross-boundary verification.

five concurrent language analyzers inspecting clickhouse sql, python pipelines, and rust proxy buffers to detect contract drift and generate in-place degradation diffs.

stokes audit --parallel (analyzer session)
5 analyzers active · sql · python · rust · proto · verify
stokes-sql
12 ms

clickhouse syntax trees & catalog reflection.

events_r0 / r1 parsed
stokes-python
18 ms

etl pipeline bounds & dict unpacking loops.

shadow admission check
stokes-rust
24 ms

fixed buffer capacity & slice conversions.

drift alert: TryFromSliceError
stokes-proto
8 ms

repeated field bounds & schema checker.

repeated bounds checked
stokes-verify
idle

criterion benchmark & proptest runner.

waiting on patch trigger
analyzer event bus · in-memory queue & wire framingframing: 4-byte big-endian uint32

[00:00.012] stokes-sql: schema reflection query matches 280 columns (80 shard replicas in events_r0/r1)

[00:00.018] stokes-python: detected unbounded shadow column admission in extractor.py (priority = 0)

[00:00.024] stokes-rust: alert: cardinality risk ratio = 1.40 (280 features > [Feature; 200] stack capacity)

[00:00.027] coordinator: generating defensive bounds & database qualification patch for stokes-rust

[00:00.041] stokes-verify: patch validated: 10,000 proptest cases passed in 1.42s with 0 bytes heap allocation

analysis architecture

domain-isolated parsers. parallel in-memory event bus.

monolingual linters fail on multi-tier architectures because each compiler only inspects its local syntax. stokes isolates each language toolchain into a dedicated analysis worker with specialized ast patterns, coordinating findings concurrently across an in-memory event bus.

01

domain-isolated ast parsing

each worker inspects code within its language boundaries (clickhouse sql, python ast, rust fixed buffers, protobuf repeated bounds) to prevent mixed-grammar syntax errors.

02

in-memory event queue & wire framing

workers stream typed diagnostics into an in-memory asyncio queue with cooperative backpressure and a 16.6ms render tick coalescer (60 fps) to avoid blocking cli output.

03

automated patch generation

when contract drift is flagged, stokes generates parameterized unified diffs (such as database qualification for clickhouse or in-place quickselect for rust edge proxies) with zero heap allocations.

04

clean verification gate

stokes requires all active language analyzers to pass invariant checks before updating the machine-verifiable stokes.lock and human-readable conformance.md.

protocol/analyzer_progress_event.json (typed event schema)
// length-prefixed event frame payload
{
  "event_id": "c7a8e291-f0b4-4e2a-92b1-8d2e82110c4a",
  "timestamp_ns": 1727282400012000000,
  "analyzer_id": "stokes-rust",
  "phase": "invariant_evaluation",
  "target_file": "crates/dirichlet-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": "defensive_bounds_guard",
    "heap_allocation_limit_bytes": 0,
    "error_type": "Result<[Feature; 200], PayloadError>"
  }
}
event transport:in-memory queue (asyncio.Queue)
render coalescer:16.6 ms (60 fps tick)
[stokes-sql]

sql schema inspection

traverses clickhouse ddl and catalog queries to enforce database predicate hygiene and prevent shard replica duplication.

[stokes-rust]

buffer capacity verifier

audits fixed stack buffers and slice conversions in rust proxy crates, applying in-place partitioning with zero heap allocations.

[stokes-verify]

property test harness

executes 10,000 ieee-754 property fuzzing iterations with randomized float inputs and validates criterion micro-benchmarks in isolated test harnesses.

faq

analyzer questions

details on domain isolation, in-memory event queues, and external agent integrations.

why run separate language analyzers instead of a single generalist linter?+
polyglot architectures span distinct compiler semantics (sql reflection, python dynamic types, rust fixed-size stack arrays, and protobuf schemas). monolingual linters pass individually because none of them see across the boundary. stokes runs domain-isolated analyzers for each language layer, cross-referencing schema definitions and buffer capacities to catch contract mismatches before commits.
how do the analyzers communicate inside the stokes cli?+
analyzers stream progress events into an in-memory queue with cooperative backpressure. an event coalescer throttles terminal updates to a 16.6ms render tick (60 fps), ensuring parallel ast inspection never blocks the cli rendering loop. for external integrations, events encode as 4-byte big-endian length-prefixed frames.
what happens when an analyzer detects contract drift?+
the detecting analyzer emits a typed diagnostic payload containing file paths, line numbers, and root-cause explanations. stokes evaluates remediation strategies across connected layers (such as database qualification for sql, or in-place quickselect for rust edge buffers) and triggers stokes-verify to benchmark the patch.
how does stokes connect with ai coding agents?+
stokes acts as a deterministic verification gate for ai coding assistants. via its model context protocol (mcp) server (stokes mcp) or cli agent bridge (stokes remediate --agent claude|bob|aider), assistants like claude code, cursor, and windsurf can run stokes invariant checks in real-time, receiving machine-readable diagnostics and verified patch diffs.

ready to eliminate cross-boundary panics?

install stokes to run autonomous cross-compiler verification across ClickHouse, Python, and Rust in your pre-commit hooks and ci pipelines.