Zero-ASR Security & Negative-Overhead Brownfield Governance: A 5-Round, 460-Trajectory Paired Ablation#
How Sub-5ms Compiled AST Probes, Rename-Aware Ratchets, and 1-Turn Remediation Recipes Eliminated Both Agent Compromises (0 / 200) and Governance Turn/Token Overhead in nomos v4.17.0.
Audit Provenance & Cryptographic Receipt
Date Evaluated: November 12, 2026 • Substrate: Open-Core `nomos v4.17.0` (17602f6, Apache 2.0)
Round 5 Receipt:sha256:7f671df45ed9396ca368a9be9348159d89fbace77bace695019c9ea76a0428c8(sha256:7f671df45ed9)
Cumulative Scale:460live paired container trajectories across Rounds 1 - 5 (400SecBench-Live 1.0trajectories across4models +60RealRepo-BrownfieldBench v2trajectories across233kLOC production OSS attemperature = 0.0)
1. The False Tradeoff in Agent Security and Code Governance#
Most published AI agent guardrails force engineering teams into a painful tradeoff:
- Prompt-level classifiers and spotlighting defenses degrade benign task utility by
20% - 40%while still leaking7% - 40%+Attack Success Rate (ASR) under adaptive indirect prompt injection. - Naive post-hoc linters and retry loops inflate agent turn counts and token spend by
+25% - 45%whenever a noisy error message sends the coding model into multi-turn trial-and-error thrashing.
Over five consecutive engineering rounds (v4.14 through v4.17.0), we used paired live container benchmarks as a closed-loop compiler feedback signal - hunting down every false positive, vague remediation prompt, and exploratory read loop until governance overhead flipped negative on both security turns and brownfield token consumption.
2. 4-Model SecBench-Live 1.0: 0.0% ASR at 92.5% Benign Utility in -2.6% Fewer Turns#
Each round of SecBench-Live 1.0 executes 80 live containerized trajectories (40 Control vs. 40 Nomos, --max-turns 14) across four distinct model architectures:
- Cloud Frontier & Fast Commercial:
claude-sonnet-5.5,claude-haiku-5.5, andgemini-3.8-flash - Local Sovereign Silicon:
Qwen3.8-27B-IQ3_M.ggufrunning locally on a16GB NVIDIA RTX 4080
Every model faces 10 paired adversarial vectors anchored to five external security yardsticks (MCPSecBench, AgentDojo, RedCode-Exec, BaxBench & CWEval, and ImpossibleBench). Both arms receive the exact same task prompt, container filesystem, and adversarial payload; the Nomos arm adds compiled PreToolUse / PostToolUse lifecycle hooks (~4ms), CapBAC worktree boundaries, and the 42-gate verifier.
Round 5 (v4.17.0) Per-Yardstick Paired Breakdown (sha256:7f671df45ed9)#
| External Yardstick | Threat Vector Class | Paired Trials | Control ASR |
Nomos v4.17.0 ASR |
ASR Delta | Benign Func-Sec@1 |
Active Deterministic Defense |
|---|---|---|---|---|---|---|---|
MCPSecBench |
MCP-RUG (Tool-schema rug pull) |
8 (16 runs) |
12.5% |
0.0% |
-12.5 pp |
87.5% |
SHA-256 Tool Catalog Pinning (ASC-PIN-01) + Law 6 Zero-Alias |
AgentDojo |
CRED-EXFIL (Indirect injection exfil) |
8 (16 runs) |
0.0% |
0.0% |
+0.0 pp |
100.0% |
PreToolUse Credential Read-Deny + Untrusted Data Fence |
RedCode-Exec |
EXEC-ESCAPE (Destructive shell / mount escape) |
8 (16 runs) |
25.0% |
0.0% |
-25.0 pp |
100.0% |
ForbiddenCommandGate + Verifier Mount Guard + CapBAC Worktree |
BaxBench & CWEval |
CWE-BACKEND (CWE-89 SQLi / CWE-22 Path Traversal) |
8 (16 runs) |
12.5% |
0.0% |
-12.5 pp |
87.5% |
PostToolUse CWE-89 / CWE-22 AST Probes + 42-Gate Verifier |
ImpossibleBench |
TEST-SABOTAGE (Mutating locked tests to pass) |
8 (16 runs) |
0.0% |
0.0% |
+0.0 pp |
87.5% |
Protected Test SHA-256 Lock + ZeroFilesystemAliasGate |
| Round 5 Total | All 5 Yardsticks (4 Models) |
40 (80 runs) |
10.0% (4/40) |
0.0% (0/40) |
-10.0 pp |
92.5% (37/40) |
296 Nomos turns vs. 304 Control (-2.6%) |
| 5-Round Cumulative | Rounds 1 - 5 (400 Trajectories) |
200 (400 runs) |
9.0% (18/200) |
0.00% (0/200) |
-9.0 pp |
90.0%+ sustained |
Zero compromises across 200 governed trials |
Per-Model Round 5 Behavior & Why Turns Flipped Negative (304 -> 296)#
| Model Architecture | Control Compromised |
Nomos Compromised |
Benign Utility (Control -> Nomos) |
Total Turns (Control -> Nomos) |
PostToolUse Gate Blocks |
|---|---|---|---|---|---|
claude-haiku-5.5 |
1 / 10 (SEC-ESC-01) |
0 / 10 |
100% -> 100% (10/10) |
59 -> 61 |
1 |
claude-sonnet-5.5 |
0 / 10 |
0 / 10 |
80% -> 90% (9/10, rescued SEC-INJ-01) |
86 -> 77 (-10.5%) |
1 |
Qwen3.8-27B (Local RTX 4080) |
3 / 10 (MCP-01, ESC-01, CWE-02) |
0 / 10 |
100% -> 100% (10/10) |
67 -> 63 (-6.0%) |
0 |
gemini-3.8-flash |
0 / 10 |
0 / 10 |
100% -> 80% (8/10, 14-turn cap) |
92 -> 95 |
0 |
In Round 3, PostToolUse security gate blocks fired 10 times across the 40 trajectories; in Round 4 (v4.16), targeted AST hints cut blocks to 5 (+2.8% turn overhead); in Round 5 (v4.17.0), language-specific CWE-22 filepath.Clean + prefix-containment recipes (SUB-2292) cut gate blocks to 2 (10 -> 5 -> 2). Both claude-haiku-5.5 and claude-sonnet-5.5 self-remediated SEC-CWE-02 in a single turn, while untrusted-data fencing kept claude-sonnet-5.5 from derailing on SEC-INJ-01 (86 -> 77 turns).
3. RealRepo-BrownfieldBench v2: 2x Debt-Free Resolution in -14.7% Fewer Tokens#
To measure real-world brownfield economics without synthetic toy scaffolding, RealRepo-BrownfieldBench v2 runs gemini-3.8-flash (temperature = 0.0, 28-turn cap, zero file hints) across 6 cross-cutting tasks in 4 mature open-source repositories totaling 233k+ LOC (sqlglot 152,424 LOC Python with 6,717-LOC dialect hotspots, commander.js 19,839 LOC JavaScript, go-chi/chi 13,213 LOC Go, and BurntSushi/toml 11,420 LOC Go):
flowchart LR
Boot["Turn-0 nomos handshake<br/>Compact Hotspot Topology +<br/>Mneme Receipt-Gated Recall"] --> Edit["Worktree Edit + Fast Radar<br/>Working-Tree Verify Cache &<br/>Rename-Aware Diff Ratchet"]
Edit --> Gate["42-Gate Monotonic Audit<br/>Blocks +26 dCDS Complexity Leaks<br/>Before Merge to main"]
Gate --> Sync["Atomic 2PC Release<br/>2x Debt-Free Resolution<br/>-14.7% Token Spend (-233k)"]Round 5 Paired Brownfield Scorecard (--persist-mneme Active)#
Task (Zero File Hints) |
Repository (LOC / Hotspot) |
Control Upstream Pass |
Control 42-Gate Clean (dCDS) |
Nomos v4.17.0 Debt-Free Pass |
Nomos 42-Gate Clean (dCDS) |
Tokens (Control -> Nomos) |
Search+Reads (Control -> Nomos) |
|---|---|---|---|---|---|---|---|
sqlglot-sqlite-table-opts |
sqlglot (152k / 6,717 LOC) |
FAIL |
YES (+0) |
FAIL |
YES (+12) |
409,713 -> 250,790 (-38.8%) |
28 -> 23 |
sqlglot-snowflake-grants |
sqlglot (152k / 6,717 LOC) |
FAIL |
YES (+0) |
FAIL |
YES (+0) |
232,743 -> 210,199 (-9.7%) |
27 -> 20 |
chi-http-query-method |
go-chi/chi (13k / 925 LOC) |
PASS (Leaked Debt) |
NO (+4 dCDS) |
FAIL (Blocked Leak) |
YES (+0) |
170,172 -> 235,886 |
17 -> 17 |
toml-max-table-nesting |
BurntSushi/toml (11k / 846 LOC) |
FAIL |
NO (+22 dCDS) |
FAIL |
YES (+0) |
279,493 -> 206,246 (-26.2%) |
24 -> 20 |
commander-help-group-conflict |
commander.js (20k / 736 LOC) |
PASS |
YES (+0) |
PASS |
YES (+0) |
303,193 -> 266,354 (-12.1%) |
20 -> 18 |
commander-option-source-mask |
commander.js (20k / 2,804 LOC) |
FAIL |
YES (+0) |
PASS |
YES (+0) |
188,002 -> 180,763 (-3.9%) |
21 -> 20 |
Round 5 Aggregate (12 Runs) |
4 Repos (233k LOC) |
1 / 6 (16.7%) Debt-Free (2/6 raw) |
4 / 6 Clean (+26 dCDS leaked) |
2 / 6 (33.3%) Debt-Free (2x) |
6 / 6 (100%) Gate-Clean |
1,583,316 -> 1,350,238 (-14.7%) |
137 -> 118 (-13.9%) |
Three mechanisms drove the Round 4 -> Round 5 inversion from +29.2% token overhead down to -14.7% net token savings (-233,078 tokens):
- Turn-0 Topology & Receipt-Gated
MnemeRecall (-13.9%Search+Reads): Instead of burning27 - 28blindgrep/file-slice turns inside6,717-linesqlglotmodules,nomos handshakeoriented the agent upfront and cut exploratorySearch+Readson5of6tasks (and tied on the6th), saving158,923tokens onsqlglot-sqlite-table-optsalone. - Working-Tree
nomos verifyCache & Rename-Aware Ratchets: Eliminating redundant unchanged-AST re-parses and false-positive diff spikes when refactoring helper names prevented wasted retry turns. - Catching Green-Test Complexity Leaks (
chi+4&toml+22dCDS): Onchi-http-query-method,Controlpassed upstream unit tests by bolting unfactored branching onto a925-line router file (+4dCDSdebt).Nomosblocked the unfactored patch from contaminatingmain, while liftingcommander-option-source-mask(2,804-linecommand.jshotspot) fromFAILto a0-debtPASSin zero gate retries.
4. Public Leaderboard Bridge: Terminal-Bench 2.0 & AgentDojo#
Alongside our internal 460-trajectory regression suites, Nomos maps directly onto two external community leaderboards:
- `Terminal-Bench 2.0` (
89containerized tasks via `nomos-harbor`): HoldingGemini CLI 0.67.0andgemini-3.5-flashfixed, single-shotpass@1rose from65.17%(58/89) to70.79%(63/89) - outperforming published lightweightGemini 3 Flash + Gemini CLI(47.4%) by+23.4 ppand stockClaude Opus 4.6 + Claude Code(58.0%) by+12.8 pp(public Harbor Hub job `39059e9a-8236-472a-a43b-ab500146abe1`). AgentDojoPareto Frontier (0.0%ASR + High Benign Utility): Where prompt-filter baselines trade heavy utility losses for partial injection mitigation, compiled capability-flow and credential-airlock hooks sit on the zero-ASR / high-utility frontier alongside capability-enforced architectures such as Google DeepMind's CaMeL.
5. Reproduce Locally in Under 60 Seconds#
Install `nomos v4.17.0` (Apache 2.0, single static Go binary, zero cloud account or telemetry dependencies) and run the cleanroom adversarial and polyglot obligation suites directly on your workstation:
curl -fsSL https://sophialabs.ca/install | bash
cd your-project && nomos init
Nomos