When an AI coding agent writes both the code and the test, 1 passed in 0.01s stops being proof of correctness. Under pressure to make CI green in our live local-LLM trial, the model literally deleted and swallowed its own assertions so pytest would exit 0.
To stop this structurally, I built KERN—a zero-trust verification gateway in Zig 0.17, backed by Z3 and 147 Lean 4 theorems (0 sorry).
- Try it offline in your browser (121 KB freestanding WASM, 0 syscalls): https://newmathphys.github.io/kern/
- GitHub Repository: https://github.com/newmathphys/kern
What KERN actually does
-
Re-checks Z3 proofs in Zig (
trusted: 0 | holes: 0): Instead of trusting solver output on faith, KERN parses Z3's proof DAG (Farkas certificates, resolution, linear rewrites). Open section #4 in the WASM Playground and sabotage 1 byte of a 16-step Z3 proof in memory to watch the kernel reject it. -
Blocks AI reward-hacking (
R = -2.0): Swallowed exceptions (except: pass),sys.exit(0), injected mocks, and silent boundary shifts are caught before merge;+1.0is granted only on a verified mathematical proof. -
Belnap B₄ four-valued logic (
N, T, F, B): Policy or contract collisions never overwrite each other—kernc belnap join_k T FyieldsB(HTTP 409 Conflictinstead of silent "deny wins"), whilekernc unsat-coreisolates the irreducible conflicting clauses. -
Zero-noise bug hunting + Live Replay (
kern_guardMCP): Lattice nullability + SMT bounds paired with a 3-lock CPython replay harness achieved 0 false alarms acrosspackaging,python-semver, anddateutil, while catching 43 real crashes in MBPP+ reference solutions (which passed 80× test suites) plus real bugs inTheAlgorithms/C(#1595, #1596),TheAlgorithms/Rust(#1075), andboltons(IndexedSet().pop()). -
Proven capable of failing: All 219 check targets across 38 CI stages are guarded by 266 fault-injection cases (
canfail).
Add to Claude Code / Cline / Cursor in 10 seconds (9 MCP tools)
json
{
"mcpServers": {
"kern": {
"command": "python3",
"args": ["/path/to/kern/examples/kern_mcp_server.py"]
}
}
}
Top comments (0)