← All 7 Engineering Studies (/research)
STUDY 05 OF 07commit 0316ff9 → 5dd671a2026-10-25
Zero-Token EnforcementFirst-Pass YieldPM & Design EnginesAST Auditing

122 Best-Practice Rules at Zero Extra Tokens: Deterministic AST & Regex Auto-Healers for Dev, Design, and PM

How we replaced prompt-stuffed rulebooks and multi-turn LLM critique loops with 3-Layer Zero-Token Engines across Software Engineering (42 rules), Product Design (40 rules), and Product Management (40 rules).

Window: Pipeline Efficiency & First-Pass Yield Audit·Empirical Sample: 122 Rules · 3 Squad Roles · ~4,200 Tokens Saved per Feature
1. Failure Mode Observed

Injecting 100+ engineering, UX, and product rules into every agent system prompt wastes 3,000–5,000 input tokens per call and degrades instruction adherence. Worse, when a Product Manager or Designer emitted a weak acceptance criterion or sub-12px typography token, the pipeline triggered 2–3 extra LLM repair calls (~3,500 tokens each).

2. Deterministic Architecture Fix

Engineered a 3-Layer Zero-Token Architecture (dev_rules.py, design_rules.py, pm_rules.py): Layer 0 runs deterministic Python auto-healers (<2ms, 0 LLM tokens) that rewrite weak Gherkin ACs, link (source: F#) research citations by lexical overlap, and upgrade sub-12px Tailwind classes in place; Layer 1 runs 0-token diff/AST/regex auditors; Layer 2 injects a <110-token file-extension or domain-routed micro-brief only when a retry occurs.

3. Measured Production Impact

Net token-negative enforcement: ~65% token reduction in PM/UX node retries and 100% deterministic compliance across 122 rules.

Full Technical Findings & Reproducible Telemetry

1. Layer 0 Auto-Healing vs. Multi-Turn LLM Repair

Instead of paying an LLM 3,500 tokens to fix a missing threshold in an acceptance criterion or replace a banned sub-12px font class, deterministic Python healers repair the artifact on disk before the linter runs. Across test suites, PM node invocations dropped from 3 LLM calls to exactly 1 call while maintaining 1.0 AC testability.

Engine Module                   | Catalog Size | Layer 0 Zero-Token Auto-Healer                | Net Token Delta
--------------------------------+--------------+-----------------------------------------------+-------------------
brevio/pipeline/dev_rules.py    | 42 Rules     | Git diff added-line scanner + targeted brief  | 0 tokens on pass
brevio/pipeline/design_rules.py | 40 Rules     | Auto-heal text-[10px]/h-6/gradients in <1ms   | -1,800 tokens/run
brevio/pipeline/pm_rules.py     | 40 Rules     | Auto-heal weak ACs, (source: F#) & 3-tier KPI | -4,150 tokens/run

2. Three-Layer Execution Architecture (<2ms Latency)

Layer 0 mutates known deterministic defects directly in the AST or text buffer. Layer 1 verifies the diff against all 122 catalog rules in under 2 milliseconds. Only if a semantic violation remains does Layer 2 attach a compact, <110-token remediation directive targeted to the exact failing rule ID.

Run these exact deterministic gates on your repository.

Start free with Brevio Core CLI or deploy the 24/7 6-Lane Harness (€0 through Mar 31, 2027).