AI coding tools are amazing… until they silently break your architecture.
This article shows exactly why drift happens — and how ASA Core v1.0 fixes it with deterministic slice-based generation.
1. The Real Pain: AI Code Is Not Deterministic
Run the same instruction twice and you get different outputs:
# Version 1
class LoginService:
def execute(self): ...
# Version 2
class Login:
def run(self): ...
Same prompt → different structure → instant drift.
2. Drift Gets Worse When Specs Change
Traditional workflow:
edit spec
↓
Regenerate
↓
💀 Custom code overwritten
So engineers stop regenerating.
Schemas drift from implementation.
Tests no longer match the API.
3. ASA Core v1.0: Deterministic Pipeline
ASA uses a strict 3-step flow:
slice.spec.md → slice.contract.json → skeleton code
Every step is deterministic — no randomness, no inference.
4. Before vs After (Real ASA Behavior)
❌ Before (traditional generation)
# Business logic gets overwritten when spec changes
def execute(self, req):
# custom logic
Change the spec → overwrite → cry.
✅ After (ASA regeneration)
You write logic ONLY between markers:
# === BEGIN USER CODE ===
def execute(self, request: LoginRequest) -> LoginResponse:
user = self.repo.get_user_by_email(request.email)
return LoginResponse(jwt_token="123", expires_in=3600)
# === END USER CODE ===
Change the spec:
asa generate-contract auth/login
asa regenerate-slice auth/login
ASA regenerates the file structure and injects your preserved logic back in.
This is guaranteed — documented and implemented in Core.
5. Boundary Violations Stop Instantly
ASA lints with AST analysis:
$ asa lint auth/login
❌ [LINT FAIL] Boundary violation in repository.py:
Line 1: Illegal import 'domains.billing.invoice'
-> Cannot import from other domains.
Same-domain imports are fully allowed; cross-domain imports are forbidden.
6. Quick Reproducible Workflow
pip install -e ".[dev]"
asa create-slice auth/login
# edit slice.spec.md
asa generate-contract auth/login
asa generate-skeleton auth/login
# implement logic between markers
asa lint auth/login
And when specs change:
asa generate-contract auth/login
asa regenerate-slice auth/login
Zero drift. Zero overwrite. Fully deterministic.
7. Why This Matters
Clean architecture + deterministic regeneration =
AI codebases that don’t collapse.
This is the foundation for stable AI-assisted engineering.
Source code & starter kit:
https://github.com/vibecodiq/asa-starter-kit
Top comments (0)