lietzsche;stokes

updated 2026-11-26·6 min read

Command Line Interface (CLI) Reference

Systems reference for the Stokes CLI: subcommands, flags, POSIX exit codes, CI environment variables, and ANSI terminal rendering.

stokes wraps contract checks, AST diffing, Dual-Zone buffer synthesis, and CI gating in one CLI (curl -fsSL https://trystokes.pages.dev/install.sh | sh). Its subcommands split into three groups: pipeline gates (verify, check, cert, scan, stage-check, bench), synthesis and topology tools (codegen, diff, graph, init), and agent bridges (mcp, audit, remediate).

Stokes CLI hero view and interactive stokes audit --diff terminal session
the stokes cli interface: interactive stokes audit --diff and deterministic ci gating.

Global Options & Environment Variables

OptionShorthandTypeDescription
--version-VFlagPrint Stokes engine version and target architecture.
--help-hFlagPrint context-sensitive subcommand help and flags.
export STOKES_STRICT=1                         # Exit 1 on any contract warning or drift
export STOKES_LOCKFILE_PATH=/etc/stokes/prod.lock
export STOKES_NO_COLOR=1                       # Disable VT-100 ANSI sequences
export CI=true                                 # Auto-disable interactive animations
export STOKES_AGENT=bob                        # Preferred remediation agent backend
export STOKES_WORKSPACE=/workspace             # Base root for poly-repo evaluation
export STOKES_LOG_LEVEL=info                   # trace | debug | info | warn | error

Terminal Rendering Engine & Exit Codes

Stokes renders straight to VT-100 escape sequences (\033[<N>A multi-line cursor overwrite, 16.6 ms 60 FPS bracketless loaders, Unicode tree connectors, and ANSI unified diffs). On Windows (win32), it turns on ENABLE_VIRTUAL_TERMINAL_PROCESSING and UTF-8 streams on startup.

Exit CodeClassificationSemanticsRecommended CI Action
0Success / CompliantEmitted columns fit downstream capacity and digests match stokes.lock.Allow PR merge.
1Contract Breach / DriftPeak Risk Ratio > 1.0, unhandled .unwrap(), or lockfile mismatch.Block PR merge and dispatch remediation.
2Configuration ErrorMissing stokes.toml, missing stokes.lock, or invalid arguments in --strict mode.Run stokes init or stokes scan.
3Internal ErrorSystem I/O error or unhandled parser fault.Inspect logs with STOKES_LOG_LEVEL=debug.
130InterruptedReceived SIGINT (Ctrl+C) or timed out.Abort pipeline step.

Subcommand Reference

stokes verify

Primary CI gate executing AST parsing, Cardinality Risk evaluation, 10,000-case IEEE-754 float fuzzing, and Criterion checks:

stokes verify [PATH] [OPTIONS]
OptionTypeDefaultDescription
PATHPositional.Target workspace path.
--strictBooleantrueExit 1 on any invariant breach, unwrap, or digest mismatch.
--consumer PATHStringNoneDownstream consumer repo path for poly-repo checks.
--producer PATHStringNoneUpstream producer repo path for poly-repo checks.
--lockfile PATHStringstokes.lockLockfile path for AST digest verification.
--format FORMATStringansiansi, json, or junit.
stokes verify --strict
stokes verify --consumer=../edge-proxy-service --producer=../analytics-pipeline --strict
stokes verify --format=json > verification-report.json

stokes codegen

Synthesizes Dual-Zone 128 + 72 stack partitioning (ingest_descriptors_dual_zone) into Rust or C++ consumer AST boundaries:

stokes codegen [PATH] [--consumer PATH] [--write] [--export-patch]
Synthesized Dual-Zone Partitioning Output (Rust)
pub const CORE_RESERVED_SLOTS: usize = 128;
pub const ADAPTIVE_SLOTS: usize = 72;
pub const MAX_ACTIVE_FEATURES: usize = CORE_RESERVED_SLOTS + ADAPTIVE_SLOTS;

#[repr(C, align(8))]
#[derive(Clone, Copy, Debug)]
pub struct FeatureDescriptor {
    pub id: u32,
    pub priority: u8,
    pub is_shadow: bool,
    pub _pad: [u8; 2],
}

#[inline(always)]
pub fn ingest_descriptors_dual_zone(
    source: &mut [FeatureDescriptor],
    out: &mut [FeatureDescriptor; MAX_ACTIVE_FEATURES],
) -> usize {
    let mut core_count = 0;
    for i in 0..source.len() {
        if source[i].priority >= 200 && core_count < CORE_RESERVED_SLOTS {
            source.swap(core_count, i);
            core_count += 1;
        }
    }

    let remaining = MAX_ACTIVE_FEATURES - core_count;
    let adaptive = &mut source[core_count..];
    if adaptive.len() > remaining {
        adaptive.select_nth_unstable_by(remaining, |a, b| b.priority.cmp(&a.priority));
    }

    let take = source.len().min(MAX_ACTIVE_FEATURES);
    out[..take].copy_from_slice(&source[..take]);
    take
}

stokes mcp

Launches the native JSON-RPC 2.0 MCP server (2024-11-05) over stdio for Cursor, Claude Code, Windsurf, and IBM Bob 2.0. See MCP Protocol Specification.

stokes diff

Computes normalized semantic AST contract diffs across git revisions, ignoring comments and formatting:

stokes diff [REVISION_A] [REVISION_B] [--path PATH] [--stat]
stokes diff origin/main HEAD
stokes diff v1.4.0 v1.5.0 --stat

stokes graph

Emits the directed reachability graph in dot, json, or svg format (--direction lr|td, --output FILE):

stokes graph --format=dot
stokes graph --format=svg --output=docs/boundary-graph.svg
stokes graph --format=json | jq '.edges[] | select(.risk_ratio > 1.0)'

stokes init & stokes scan

  • stokes init [PATH] [--force]: Scaffolds stokes.toml and an initial stokes.lock.
  • stokes scan [PATH] [--generate-contract]: Crawls workspace boundaries, updates stokes.toml, and optionally emits AGENTS.md.

stokes audit, stokes check, stokes remediate, stokes cert, stokes stage-check, stokes bench

CommandUsagePurpose
stokes auditstokes audit [PATH] [--diff] [--strict] [--agent ...] [--with-bob] [--export-patch]Dispatches parallel subagents (claude, bob, aider, goose, openhands, generic, patch) and proposes Dual-Zone diffs.
stokes checkstokes check [PATH] [--consumer PATH] [--producer PATH] [--strict]Enforces Consumer Expands First across poly-repo PRs in a single static pass.
stokes remediatestokes remediate [PATH] [--agent AGENT] [--with-bob] [--export-patch]Dispatches AST drift constraints and risk ratios to AI agents for repair.
stokes certstokes cert [--output FILE] [PATH]Computes normalized SHA-256 digests and writes stokes.lock and CONFORMANCE.md.
stokes stage-checkstokes stage-check [--hook] [--quiet]Scans git-staged boundary files locally as a pre-commit hook.
stokes benchstokes bench [--max-p99-ns=10.0] [--max-heap-bytes=0]Parses Criterion benchmarks and enforces the 10.0 ns / 0 B heap budget.
GitHub Actions Verification & Lockfile Integrity Workflow
name: Stokes Boundary Gate
on:
  pull_request:
    branches: [main, master]
  push:
    branches: [main, master]

jobs:
  verify-contracts:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - run: curl -fsSL https://trystokes.pages.dev/install.sh | sh
      - name: Run Deterministic Boundary Verification
        env:
          STOKES_STRICT: "1"
          CI: "true"
        run: stokes verify --strict --format=ansi
      - name: Verify Stokes Lockfile Integrity
        run: |
          stokes cert --output=stokes.lock.ci
          diff -u stokes.lock stokes.lock.ci

Continue to CLI Terminal Workflow & Gate Matrix for interactive stokes audit --diff sessions and pre-commit workflows, or Lockfile Specification for stokes.lock internals.

Search wiki and portfolio

type to search across all entries.