Technology · Discipline

Static analysis as tests

Static checks run as tests in my governance platform: a carve gate on imports, a check that no hook can surface a non-operation.

AgentOS and Agent SwarmRust test suites in CIRust and CUDA boundary
Every build passes five scans
source scancarve gatefixturesbudgetlayout
A build that breaks a rule
stops at the scan that catches it, every time
  • 41,990tokens of tool schemas replaced by one description
  • 44tools across three servers behind that description
  • 520characters, the cap a test holds the description to

A test that scans its own crate

AgentOS once had a test that built a real store and wrote synthetic rows into the real work graph. I had a test added to the hook crate that scans the crate's own source and fails the build if any test constructs a store outside the isolated path. Test isolation became a property of the build, enforced by a source scan that sees a structural rule no unit test can.

Every test in the hook crate, scanned by one more test
one test builds its store outside the isolated paththe build fails

When a rule breaks once, I add a test that fails the build for the whole class of mistake.

Boundaries and fixtures in Agent Swarm

Agent Swarm needed its runtime to stay separable from the estate it grew up in, so a carve gate in CI fails the build when a product crate imports platform-specific code. Its tool test runner fails the build for any declared tool without golden and attack fixtures, one-line tools included; a rule with no exceptions is simple enough to automate. See Tools are the platform.

The carve gate
product crates
platform-specific code
the lit crate imports across the wall: build fails
Every declared tool and its two fixtures
golden and attack fixtures under each tool; the lit one has none, so the build fails

A budget on one description

Capabilities model replaced the tool schemas of three servers with one tool description, and I wanted that description to stay small. A budget that protects a design goal is a test, so a test caps its length. See A hundred tokens instead of forty-two thousand.

Before · a schema per tool, three servers
After · one description
One tool description

Layouts checked across the CUDA boundary

Layout tests compare the Rust and C views of each shared struct and fail when they diverge, because a mismatch there corrupts data silently.

Rust view of the struct, byte by byte
field afield bfield cfield d
C view of the same struct
field afield bfield dfield c
the first two fields line upthe last two read each other's bytes

Checks the build runs every time matter most when AI agents write most of the code and do not remember the last incident.