ES
AI & Agent-First EcosystemMCP · Graph · Sandbox

Effects, C99 Sandbox, Quotas & Trace Replay

Conservative MIR effect auditing (wysna explain), compiled C99 runtime capability guards (--sandbox), deterministic execution quotas (W4004), and offline effect trace replay.

Wysna ships explicit execution governance primitives so you can audit what a program touches, constrain its runtime capabilities and resource budgets, and reproduce I/O deterministically offline.


1. Static Transitive Effect Analysis (wysna explain)

Section titled “1. Static Transitive Effect Analysis (wysna explain)”

wysna explain lowers source through verified MIR (without running the program or loading external libraries) and computes a conservative fixed point of direct and transitive effects (wysna.effect-report/1, wysna.effects-model/1):

Terminal window
wysna explain src/main.wysna
wysna explain src/main.wysna --function sync_batch --output-format=json-v1
wysna explain src/main.wysna --manifest wysna.toml --frozen
Effects Capability Name
stdio.write stdio
arguments.read arguments
environment.read environment
clock.read clock
filesystem.read filesystem.read
filesystem.write filesystem.write
network.http network
process.spawn, process.wait processes
process.exit process-control
ffi.native native-ffi
Unresolved call / external FFI unknown (complete_within_model: false)

2. Safety Facts (wysna.safety-facts/1) & Capability Policy Gates ([W5006])

Section titled “2. Safety Facts (wysna.safety-facts/1) & Capability Policy Gates ([W5006])”
  • Machine-readable safety summary (wysna check):

    Terminal window
    wysna check --output-format=json-v1 src/main.wysna

    Returns a top-level safety_facts object (schema_version: "wysna.safety-facts/1") across Seed, Selfhost, Native SDK, and MCP wysna_check reporting memory_model ("arc+cow"), checked, capabilities, untrusted_externs, arc_cycles (W6002), contracts (verified requires/ensures), and optional policy verification status.

  • Explicit capability gates on check (Seed, Native SDK & MCP):

    Terminal window
    wysna check --deny=filesystem.read,network src/main.wysna --output-format=json-v1
    wysna check --allow=stdio,arguments src/main.wysna

    Or in MCP wysna_check, pass allow_capabilities / deny_capabilities. Violations fail closed with [W5006] and populate safety_facts.policy (passed: false, violations: [...]).

  • Interpreted pre-execution gate (Seed):

    Terminal window
    wysna run --deny=network,processes src/main.wysna
    wysna run --allow=stdio,filesystem.read src/main.wysna

    Conservatively refuses execution with [W5006] if the program violates the policy or if complete_within_model is false.

  • Compiled C99 runtime sandbox guards (Seed):

    Terminal window
    wysna build --sandbox --deny=network,processes src/main.wysna -o app
    wysna emit-c --sandbox --allow=stdio,filesystem.read src/main.wysna -o app.c

    Emits #define WYSNA_DENY_CAP_* guards into the compiled C99 runtime ABI so disallowed host operations trap immediately with [W5006].


3. Deterministic Execution Quotas ([W4004])

Section titled “3. Deterministic Execution Quotas ([W4004])”

Bound instruction steps and heap allocation budgets to prevent runaway loops or memory exhaustion in automated pipelines:

Terminal window
# Via CLI flags
wysna run --max-steps=1000000 --max-heap-mb=32 src/main.wysna
# In compiled native binaries via environment variables
WYSNA_MAX_STEPS=500000 WYSNA_MAX_HEAP_BYTES=16777216 ./app

Exceeding either budget terminates execution deterministically with [W4004].


4. Offline Effect Cassette Replay (wysna.effect.trace/1)

Section titled “4. Offline Effect Cassette Replay (wysna.effect.trace/1)”

Record external I/O (HTTP responses, wall clock, filesystem reads) during a live run and replay bit-identically offline in CI without network access:

Terminal window
# Record external effects
wysna run --record-trace=trace.json src/sync.wysna
# Replay bit-identically offline
wysna run --replay-trace=trace.json src/sync.wysna