ASAASA Standard

Problems ASA Solves

The structural failures in AI-generated codebases — and how ASA addresses them.

Problems ASA Solves

Structural failures in AI-generated codebases and how ASA addresses them.


1. Architecture Drift

Failure: Business logic spreads unpredictably across files. Ownership becomes unclear. Files grow beyond maintainable size. AI generates code that contradicts existing patterns because it lacks architectural context.

Root cause: AI tools operate without architectural boundaries. Each generation adds code based on statistical patterns, not project-specific design rules.

ASA mechanism:

  • Atomic Slices isolate each feature into a single directory
  • Boundary Enforcement prevents cross-slice imports via linting
  • Explicit Contracts make the intended structure machine-readable

Research shows low-quality code takes 124% longer to resolve issues and creates 9x more unpredictability in delivery timelines (Tornhill & Borg, 2022).


2. Dependency Graph Corruption

Failure: Circular dependencies form between modules. Changing one feature breaks unrelated features. The dependency graph becomes untraceable.

Root cause: AI creates dependencies by taking the shortest path. It imports directly from implementation files rather than through defined interfaces. Over time, bidirectional and circular dependencies accumulate.

ASA mechanism:

  • Unidirectional dependency flow — slices depend on shared modules, never on other slices
  • Contract-only interfaces — external access goes through public contracts
  • Linter enforcement — forbidden imports are caught before commit

3. Context Window Exhaustion

Failure: After extended interaction, AI contradicts earlier decisions. It loses track of architectural choices made 50 prompts ago. Code quality degrades as project size grows.

Root cause: LLMs have finite context windows. As codebases grow, early design decisions fall out of attention. AI operates on recent context only.

ASA mechanism:

  • Self-contained slices — each slice includes its own spec and contract
  • Bounded context per operation — AI only needs to read one slice, not the entire codebase
  • Deterministic contracts — the contract is the source of truth, not the conversation history

4. Cascade Failures

Failure: Fixing a bug in login breaks checkout. Fixing checkout breaks user profiles. Every change has unpredictable blast radius.

Root cause: Tight coupling between features. Multiple features share global state, utility functions, or implicit dependencies that are not visible in the code structure.

ASA mechanism:

  • Slice isolation — each feature has its own implementation, no shared business logic
  • Explicit dependency declaration — all external dependencies are listed in the contract
  • Independent testing — each slice has its own test suite

5. Regeneration Data Loss

Failure: Regenerating code from a spec overwrites custom business logic. Developers avoid regeneration entirely, causing drift between spec and implementation.

Root cause: Traditional code generators treat the entire file as generated output. There is no mechanism to distinguish generated structure from developer-authored logic.

ASA mechanism:

  • Marker-based preservationBEGIN USER CODE / END USER CODE markers define protected regions
  • Structure regeneration — imports, class signatures, and type hints update while user code survives
  • Deterministic output — same spec always produces same generated structure

6. Inconsistent Structure

Failure: Each feature follows a different pattern. Naming conventions vary. File organization is unpredictable. New developers cannot navigate the codebase.

Root cause: AI generates code based on training data patterns, which mix conventions from different frameworks, versions, and coding styles. Without enforced structure, entropy accumulates with each generation.

ASA mechanism:

  • Deterministic skeleton generation — every slice follows the same directory structure
  • Predictable file naming — handler, service, repository, schemas per slice
  • Spec-driven creation — structure derives from specification, not from AI inference

7. Verification Bottleneck

Failure: Code review cannot keep pace with AI-generated output. Bugs that "look correct" pass review and reach production. Test coverage is low because tests are not co-located with features.

Root cause: AI generates code faster than teams can verify it. Without structural boundaries, reviewers must understand the entire system to assess a single change.

ASA mechanism:

  • Co-located tests — each slice contains its own test directory
  • Contract validation — linter verifies contract-spec consistency
  • Bounded review scope — a change to one slice cannot affect others, reducing review surface

Summary

Problem Root Cause ASA Mechanism
Architecture Drift No structural rules Atomic Slices + Boundary Enforcement
Dependency Corruption Shortest-path imports Unidirectional flow + Linter
Context Exhaustion Finite AI context window Self-contained slices + Contracts
Cascade Failures Tight coupling Slice isolation + Explicit dependencies
Regeneration Data Loss No code preservation Marker-based preservation
Inconsistent Structure Mixed AI patterns Deterministic skeleton generation
Verification Bottleneck Faster generation than review Co-located tests + Bounded scope

Each problem is a structural failure. ASA addresses them through architectural rules, not tooling workarounds.


Further Reading