FRICTIONBENCH // 27,025 AGENT SESSIONS · 5,716 AGENT-HOURS · 3 HARNESSES · 26 REPOS

Clean code still matters. Messy code is expensive.

Many teams assume smarter models make code structure obsolete. Across 27,025 coding-agent sessions (20,110 pre-session AST-joined edit episodes and 18,824 edited-function episodes across oh-my-pi, Claude Code, and Codex), structural debt taxes every model—and breaks cheaper models first: frontier reasoning models (Tier1) mask debt by burning extra tokens, while mid-tier and fast models (Tier2 & Tier3) hit sharp thrash, edit-failure, and test-failure gaps on the exact same files.

MODEL TIER DEFINITIONS: Tier1 = Top frontier reasoning models (n = 3,563) | Tier2 / Tier3 = Mid-tier & fast coding models (n = 16,547) | 3 harnesses (oh-my-pi · Claude Code · Codex) · 26 git repos · 5 languages

Token burn snaps past a complexity cliff. Edit thrash climbs with file length.

LARGE-N PROFILES · N = 18,824 FUNCTION EPISODES · N = 20,110 FILE EPISODES
7505002500 CLIFF (>25) 340 tok 439 tok 449 tok 619 tok 1.62× within-file LOW (≤10)n=13,351 MOD (11–20)n=3,008 ELEV (21–25)n=665 CLIFF (>25)n=1,800
A · FUNCTION COMPLEXITY CLIFF (MEDIAN OUTPUT + REASONING TOKENS · N = 18,824)
Plateaus from 11–25, then jumps to 619 tok (+82% raw vs LOW; 1.62× controlled within the same file across 2,508 files and 1,595 sessions, t = +11.78, p = 5.1e-32). Remains a significant nonlinear break (+14.0%, p = 0.0008) even controlling simultaneously for function length and smooth log-complexity.
60%40%20%0% 19.8% 31.0% >500 LOC · 1.56× TOKENS 38.5% 45.9% ≤ 200 LOCn=6,514 201–500n=5,925 501–1,000n=3,581 > 1,000 LOCn=4,090
B · FILE-LENGTH THRASH (4+ EDIT LOOPS PER FILE EPISODE · N = 20,110)
Smooth monotonic climb across all 20,110 edit episodes (2.31×, log-LOC FE t = +20.55, p = 7.7e-94), steepest past ~200–300 LOC read windows. Past 500 LOC, edit failures rise 14.1% → 29.9%, anchor errors jump 2.6× (4.4% → 11.4%), and controlled output/total tokens rise 1.56× / 1.52×. Positive in 20/20 repos, 5/5 languages, 3/3 harnesses—and steepest in Nov–Dec 2026.

Structural debt taxes every model—and widens the Tier2/Tier3 failure gap 3×–6× on the same files.

2D COMPLEXITY × I/O SURFACE + 5 DEBT SIGNALS (N = 20,110) · WITHIN-FILE TIERS (1,121 FILES)
FUNCTION COMPLEXITY → I/O & SYSTEM COUPLING → LOW COMPLEXITY (≤25) HIGH COMPLEXITY (>25) HIGH I/O LOW I/O 39.0% THIN I/O SHELL (+0.6 PP) 49.2% CLIFF BASIN · +10.7 PP 38.4% SAFE BASIN (n=7,529) 38.4% PURE LOGIC (+0.0 PP)
C · 2D BEHAVIOR SURFACE (POST-EDIT TEST-COMMAND FAILURES · N = 12,718)
Pure logic (+0.0 pp) and thin I/O shells (+0.6 pp) stay flat; collapsing high complexity (>25) into high I/O coupling jumps +10.7 pp raw (49.2%; borderline FE interaction p = 0.068 after repo, model, harness & LOC controls).
CLEAN FILE WITH DEBT (4+ EDIT THRASH · ALL p<0.001) FILE > 500 LOC 25.2% 42.4% (1.69×) DEEP NESTING 30.0% 44.2% (1.48×) COMPLEXITY >25 28.2% 41.3% (1.46×) SUPPRESSIONS 30.5% 41.9% (1.37×) MODULE CYCLES 31.3% 42.7% (1.36×) 0%20%40%60%
Same-file matched Tier1 vs. Tier2/Tier3 arbitrage (1,106 same-state matched files — 624 clean, 482 debt; 1,121 matched files total): On clean files (n = 624), Tier2/Tier3 matches Tier1 on edit thrash (25.4% vs. 23.7%, p = 0.36) and sits +4.2 pp on edit failures. On debt files (n = 482), the Tier2/Tier3 gap widens 6× on thrash (+10.5 pp, p = 1.7e-06), 3.3× on edit failures (+13.9 pp, p = 4.6e-13), and to +31.0 pp on test failures (p = 2.1e-33; within-file FE interaction +7.6 pp, p = 0.025)—while Tier1 masks debt by burning 1.76× more tokens past the complexity cliff.

Goodhart’s Law hits even strong complexity metrics.

ANTI-GOODHART HISTORICAL REPLAY · 16-REFACTOR AUDIT
87.5%

In our 16-refactor audit, 14 of 16 complexity-cap refactors were mechanical helper slicing.

Cognitive complexity is already a stronger structural signal than standard syntax or formatting linters. Yet once an autonomous agent treats a single-function cap as its target, it splits one tangled routine into 6–27 thin private helpers—turning the check green while increasing total file complexity and jump-cost for the next session.

SINGLE-FUNCTION CAP · 16-REFACTOR AUDIT · 14 / 16 (87.5%) GAMED 1 TANGLED FN EXCEEDS CAP 6–27 THIN HELPERS · CHECK GREEN · TOTAL COMPLEXITY HIGHER WHAT ACTUALLY MOVES RELIABILITY (WHOLE-DIFF SHAPE) PURE LOGIC CORE (+0.0 PP VS. SAFE BASIN) THIN I/O SHELL (+0.6 PP VS. SAFE BASIN)

Enforcing whole-diff structure unlocks model optionality. Teams stay trapped on Tier1 pricing only when structural debt breaks cheaper models. Gate the cliffs cleanly and route routine execution safely down the compute curve.