ARCHITECTURAL PLAYBOOK THE 7 PILLARS

Engineering Standards for Chemical X

AI models do not just need more context; they need strictly bounded context. These 7 pillars eradicate context rot, prevent phantom imports, and keep Claude, Gemini, Antigravity, and Cursor fully reliable.

$npx chemx auditFree Local AST Audit • Zero Upload
STATIC ANALYSIS ENGINE · 7 PILLARS

The 7 Pillars of Molecular Architecture

Every AST hazard check executed locally in under 5 seconds by the Chemical X auditor. Guarantees single-purpose files, reduces context token burn, and eliminates LLM hallucinations.

Pillar 1: File Line Budget (< 500 LOC)

LINE_BUDGET_FILE

Calibrated 3-tier sliding scale: Warning (500-999), Severe (1000-1999), and Extreme (2000+) monoliths.

Hazard: Files > 500 lines
Decompose into crystalline domain capsules (< 100 LOC)

Pillar 1: Molecule Capsule Limit (< 100 LOC)

LINE_BUDGET_MOLECULE

Enforces strictly single-purpose UI capsules with declarative bindings and zero business logic bloat.

Hazard: Molecules > 100 lines
Split into focused sub-molecules or extract state to hook

Pillar 2: Two-Stage Atomic Booleans

CONTROL_FLOW_INLINE_BOOLEAN

Catches multi-clause inline logic: single-concept atomic booleans composed into unified decisions.

Hazard: > 2 logical operators inline
Stage 1 concepts -> Stage 2 unified computed decisions

Pillar 2: Zero Nested Ternaries

CONTROL_FLOW_NESTED_TERNARY

Eliminates nested conditional branches that cause AI hallucination and logical degradation.

Hazard: Nested ? : branches
Extract display states to computed descriptor objects

Pillar 3: Composable Destructuring Contract

HOOK_SATURATION

Limits hooks to 3-5 return properties; flags components importing more than 5 individual hooks.

Hazard: > 5 hooks in one scope
Group related state into dedicated domain composables

Pillar 4: Domain Type Co-Location

TYPE_COLOCATION

Prohibits type monoliths; mandates co-located types/*.d.ts capsules (< 100 LOC) per feature.

Hazard: Anonymous types > 3 fields or global dumps
Define co-located domain contracts in types/*.d.ts

Pillar 5: 4-Tier Zero-Inline-Style & Anti-Tailwind-Soup

RAW_INLINE_STYLE

Prohibits raw inline styles and long utility chains (> 4-5 classes); mandates Level 1 atom props or scoped classes via @apply or mixins.

Hazard: Inline styles or long utility soup
Decouple into Level 1 atom props or scoped classes with @apply

Pillar 6: Self-Cleaning Lifecycle Timers

TIMER_DISCIPLINE

Detects raw setInterval or setTimeout calls lacking automatic unmount disposal.

Hazard: Unmanaged intervals and timer leaks
Wrap timers in onScopeDispose self-cleaning hooks
CHAPTER SPECIFICATIONS

Explore the 7 Chapter Specifications

Expand each chapter below to inspect key architectural takeaways, clean molecular code patterns, and common monolith traps.

Every entity in the codebase has a single, indivisible molecular responsibility. Keep top-level views under 20 lines reading like a Table of Contents.

Quantum Architectural Rules & Code Locked

To protect our competitive edge, full code patterns and copyable AGENTS.md rules for Chapter 1 are reserved for Vault members.

PRODUCTION BLUEPRINTS & RULES

Unlock the Complete Vault & Agent Directives

Get unrestricted access to the complete 7-chapter specification, ready-to-use .cursorrules, AGENTS.md, CI pre-commit gates, and the private starter repository.

Book Live Onboarding ($150)