updated 2026-11-26·4 min read
Quickstart & CLI Guide
Installation, project initialization, cryptographic contract locking, strict CI gating, and MCP server configuration with Stokes.
Stokes runs on Python 3.11+ with zero mandatory native build steps and installs straight into a polyglot repo in a couple of minutes.
1. Installation
Install via the hosted installer script (stokes ships on GitHub at github.com/yvliet/stokes):
curl -fsSL https://trystokes.pages.dev/install.sh | sh
Confirm the install with stokes --version (stokes v0.2.0).
2. Project Initialization
Run stokes init from the root of your monorepo or multi-tier workspace:
cd /workspace/cloudflame-platform
stokes init
The scanner walks the repo for SQL migration scripts (ClickHouse and PostgreSQL DDL), wire serialization endpoints (Python dictionary packing, JSON producers, Kafka topics), and downstream ingestion buffers (Rust [T; N] stack arrays, C++ structs), then writes stokes.toml and an initial stokes.lock:
Discovered boundaries:
[SQL DDL] migrations/001_bot_signals.sql
[Python] services/feature-pipeline/catalog_sync.py
[Rust Proxy] crates/cloudflame-proxy/src/engine/feature_ingest.rs
Generated stokes.toml with 1 bound channel.
3. Defining Cross-Boundary Contracts (stokes.toml)
stokes.toml binds upstream producers to downstream consumers without generating code or runtime wrappers (no stubs, no extra serialization layer in your compiled binaries):
Example stokes.toml Boundary Manifest
# stokes.toml: Declarative systems boundary specification
[workspace]
name = "cloudflame-l7-proxy"
version = "1.0.0"
strict = true
[[channels]]
id = "analytics_to_edge_l7"
wire_format = "json"
transport = "kv_store"
[channels.producer]
sql_schema = "migrations/001_bot_signals.sql"
python_source = "services/feature-pipeline/catalog_sync.py"
symbol = "extract_features"
cardinality_limit = 200
[channels.consumer]
rust_source = "crates/cloudflame-proxy/src/engine/feature_ingest.rs"
symbol = "[FeatureDescriptor; 200]"
capacity_limit = 200
core_reserved_slots = 128
adaptive_slots = 724. Cryptographic Boundary Locking (stokes.lock)
Run stokes cert to compile normalized semantic AST digests into stokes.lock and generate CONFORMANCE.md:
stokes cert
Sample Generated stokes.lock (JSON)
{
"$schema": "https://stokes.dev/schema/v1.json",
"version": "1.0.0",
"workspace": "cloudflame-l7-proxy",
"root_digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"invariants": {
"max_features": 200,
"max_heap_bytes": 0,
"max_p99_latency_ns": 10.0,
"core_reserved_slots": 128
},
"targets": [
{
"id": "clickhouse-schema",
"path": "migrations/001_bot_signals.sql",
"digest": "sha256:4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a"
},
{
"id": "rust-proxy-buffer",
"path": "crates/cloudflame-proxy/src/engine/feature_ingest.rs",
"digest": "sha256:ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d"
}
]
}Because Stokes hashes normalized syntax (stripping comments, whitespace, and private helper internals), running rustfmt, black, or sqlfluff won’t invalidate stokes.lock. See Lockfile Specification for the normalization rules.
5. Running Verification in CI (stokes verify --strict)
In CI/CD, stokes verify --lockfile=stokes.lock --strict parses boundary files, compares emitted column counts against downstream buffer capacities, and validates signatures against stokes.lock:
stokes verify --lockfile=stokes.lock --strict
Passing Gate (Exit Code 0)
[STOKES] Verifying cross-boundary contracts in workspace: cloudflame-l7-proxy
✔ SQL DDL: migrations/001_bot_signals.sql (200 canonical columns)
✔ Python ETL: services/feature-pipeline/catalog_sync.py (slice guard [:200] active)
✔ Rust Proxy: crates/cloudflame-proxy/src/engine/feature_ingest.rs (buffer: [FeatureDescriptor; 200])
✔ Cardinality Check: 200 upstream <= 200 downstream | Risk = 1.00
✔ Memory Layout: 1,600 bytes (4.8% of 32 KB L1D cache, 25 cache lines)
✔ Lockfile digest matched: stokes.lock verified
[PASS] 0 invariant violations detected across 3 language boundaries
Contract Drift Failure (Exit Code 1)
[STOKES] FATAL CONTRACT VIOLATION DETECTED
Rule: LINT-001 / LINT-004 (Fixed Stack Buffer Overflow Hazard)
Boundary Channel: analytics_to_edge_l7
Upstream Cardinality: 280 columns (migrations/002_shard_definitions.sql:14)
Downstream Capacity: 200 slots (crates/cloudflame-proxy/src/engine/feature_ingest.rs:42)
Cardinality Risk Ratio: 280 / 200 = 1.40 > 1.00 (FATAL TRYFROMSLICEERROR REACHABLE)
Root Cause:
system.columns reflection query in services/feature-pipeline/catalog_sync.py:127
omits 'database = currentDatabase()' filter, ingesting 80 shard columns from r0/r1.
Result: Pull request rejected. Merge blocked.
GitHub Actions Workflow (.github/workflows/stokes.yml)
name: Stokes Systems Boundary Gate
on:
pull_request:
branches: [main, production]
push:
branches: [main]
jobs:
verify-boundaries:
name: Verify Cross-Compiler Contracts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Stokes
run: curl -fsSL https://trystokes.pages.dev/install.sh | sh
- name: Run Stokes Strict Verification Gate
run: stokes verify --lockfile=stokes.lock --strict6. Local Model Context Protocol (MCP) Server
Stokes includes an MCP server over stdio so Cursor, Windsurf, Claude Code, and IBM Bob 2.0 can check boundary contracts and test patches before committing:
stokes mcp
Drop this block into .cursor/mcp.json or claude_desktop_config.json:
{
"mcpServers": {
"stokes": {
"command": "stokes",
"args": ["mcp"]
}
}
}
Exposed MCP Tools
stokes_audit: Evaluates SQL, Python, Protobuf, and Rust boundaries and returns Risk Ratios andLINT-*violations.stokes_boundary_graph: Extracts the sparse boundary compatibility graph nodes and edges.stokes_remediate: Generates AST patches (SQL catalog qualification + Dual-Zone128 + 72Rust partitioning).stokes_inspect_channel: Inspects a KV key, Kafka topic, or socket pattern for serialization guards.stokes_verify_patch: Simulates and checks a unified diff against Stokes contracts before disk write.
Sample JSON-RPC 2.0 stokes_audit Call
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "stokes_audit",
"arguments": { "workspace_path": ".", "strict": true }
}
}
// Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"passed": false,
"risk_ratio": 1.40,
"violations": [
{
"code": "LINT-001",
"message": "ClickHouse system.columns reflection missing currentDatabase() scope"
}
]
}
}For full command flags and protocol schemas, see CLI Reference and MCP Protocol Specification.