PRAGMATIC ARCHITECTURE ZERO LOCK-IN • FULLY CONFIGURABLE

The Pragmatic Guide to LLM Blast Radius

You are never locked into an inflexible box. Chemical X is designed to give you surgical control over AI blast radius, token budgets, and slop detection via a simple .chemxrc configuration file.

Why Enforce Bounded Component Weight?

The 500-line ceiling and 100-line molecule targets are not arbitrary aesthetic dogma. They are empirical boundaries designed around machine attention mechanics:

Unbounded Monoliths (400+ LOC)

When asked to modify a single button state inside a 500-line file with 12 nested hooks, an LLM must ingest and predict attention weights across all 500 lines. It hallucinates missing imports, inadvertently mutates neighboring reactive state, and burns thousands of unnecessary prompt tokens.

Bounded Capsules (50-150 LOC)

When state, styling, and markup are encapsulated into compact single-purpose capsules, the LLM’s blast radius is strictly bounded. The model reads 60 lines, executes the modification with 100% precision, and exits in under 2 seconds for ~30 tokens.

.chemxrc Configuration Reference JSON FORMAT

Place in your repository root to override defaults and customize thresholds.

{
  "$schema": "https://chemicalx.xophz.com/schema/chemxrc.json",
  "version": "1.0",
  "rules": {
    "lineBudget": {
      "enabled": true,
      "maxFileLines": 500,
      "maxCapsuleLines": 100,
      "severity": "warn"
    },
    "aiSlopDetection": {
      "enabled": true,
      "conversationalResidue": true,
      "echoComments": true,
      "lazyPlaceholders": true,
      "shallowTryCatch": true,
      "severity": "error"
    },
    "tokenBudget": {
      "enabled": true,
      "maxTokensPerFile": 3000,
      "warnAt": 2000
    },
    "designSystemBoundaries": {
      "enabled": true,
      "encapsulateRawPrimitives": true,
      "allowedPrimitivePaths": ["src/components/atoms/**"]
    }
  },
  "mcp": {
    "masterGateway": true,
    "sqliteWalMode": true,
    "concurrencyLeases": true
  },
  "exclude": [
    "node_modules/**",
    ".nuxt/**",
    "dist/**",
    "legacy/**",
    "**/*.spec.ts"
  ]
}
rules.lineBudget
Adjust max lines per file or molecule. Set to "warn" during migrations to avoid blocking CI builds.
rules.aiSlopDetection
Catch conversational residue, empty try/catches, and lazy comments before code is committed.
rules.designSystemBoundaries
Enforce that raw DOM tags are encapsulated inside primitives to ensure accessible tokens.
exclude
Glob patterns to exempt vendor directories, test files, and legacy modules from strict checks.

4-Step Progressive Adoption Strategy

STEP 01
Zero-Install Audit

Run npx chemx audit to benchmark your baseline token burn and MHI score without changing any code.

STEP 02
Set Pragmatic Rules

Create a .chemxrc with your team's file limits and exclude legacy modules so you migrate iteratively.

STEP 03
Silent Verification

Switch your agent scripts and pre-commit hooks to chemx verify, saving 99% of verification tokens.

STEP 04
Master MCP Gateway

Equip Cursor, Claude Code, and Cline with chemx for 1-click approvals and SQLite symbol lookups.