{"id":"a666184d-2925-457a-ae94-11001d9fe9ec","slug":"anti-vibe-coding-android-engine","kind":"skill","name":"Anti-Vibe-Coding-Android-Engine","summary":"","owner":"vinhvox","repoUrl":"https://github.com/vinhvox/Anti-Vibe-Coding-Android-Engine","license":"Apache-2.0","licenseTier":"permissive","trust":"community","stars":6,"match":null,"fewStars":false,"format":"skill","createdAt":"2026-09-07T02:22:02.000Z","addedAt":"2026-10-22T03:35:11.345Z","logoUrl":"https://avatars.githubusercontent.com/u/62163963?u=f69ec4c5b04bddb20e58711848b69d82384a6995&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["writing"],"tags":[],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-25T16:59:19.107Z","sample":false,"url":"https://conduits.dev/tools/anti-vibe-coding-android-engine","language":"Shell","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# 🚀 Anti-Vibe-Coding-Android-Engine\n### The Multi-Role AI Engineering Syndicate & Cognitive Operating System for Android\n*Zero-Crash. Zero-ANR. Zero-Leak. Zero-AI-Slop. 60/120 FPS by Default.*  \n**CTO • Product Owner • UI/UX Director • Vitals Principal • Memory Specialist • Security Architect • Modular Architect • Staff QA**\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![Platform](https://img.shields.io/badge/Platform-Modern_Android_2026_%7C_KMP-green.svg)](https://developer.android.com)\n[![Jetpack Compose](https://img.shields.io/badge/UI-Jetpack_Compose_M3-4285F4.svg)](https://developer.android.com/jetpack/compose)\n[![Adaptive HAL](https://img.shields.io/badge/Stack-Hilt_%7C_Koin_%7C_Retrofit_%7C_Ktor-orange.svg)](#-adaptive-stack-architecture-hardware-abstraction-layer)\n[![Multi-Role Council](https://img.shields.io/badge/Council-10_Specialized_Roles-9C27B0.svg)](#-the-multi-role-engineering-syndicate)\n[![Quality Gates](https://img.shields.io/badge/Quality_Gates-E1_to_E40-EA4335.svg)](#-the-40-quality-gates-e1--e40-deep-dive)\n[![Vitals](https://img.shields.io/badge/Android_Vitals-Zero--Crash_%7C_16KB_Safe-34A853.svg)](rules/27-app-quality-vitals.md)\n\n---\n\n## 👥 THE MULTI-ROLE ENGINEERING SYNDICATE\n\nAnti-Vibe-Coding-Android-Engine **is not a single monolithic AI persona**. It is an **Executive Engineering Syndicate** composed of **10 specialized virtual engineering roles**.\n\nDepending on the prompt, task, symptom, or project lifecycle phase, the AI dynamically switches its cognitive lens, active skills, and enforcement gates to collaborate like an entire senior engineering department:\n\n```mermaid\nflowchart TD\n    Project([\"📱 Your Android Project Codebase\"])\n    \n    subgraph Syndicate [\"👥 The Multi-Role Engineering Syndicate\"]\n        CTO[\"1. Chief Technology Officer (CTO)<br/>Architecture & Tech Stack Governance\"]\n        PO[\"2. Product Owner (PO)<br/>5-State UI, Defensiveness & User Empathy\"]\n        UIUX[\"3. Lead UI/UX Architect<br/>Rule 36 & UI/UX Pro Max: Anti-AI-Slop\"]\n        Vitals[\"4. Android Vitals Principal<br/>Zero-Crash, TTID < 500ms, Baseline Profiles\"]\n        Memory[\"5. Low-Level Memory Specialist<br/>Stack vs Heap, 16KB Alignment, Value Classes\"]\n        SDK[\"6. Modular Core & SDK Architect<br/>Minimal Surface, :testing Fakes, ABI Defense\"]\n        QA[\"7. Staff QA & Test Architect<br/>TDD Red-Green, Turbine, Real Gradle Gate\"]\n        Security[\"8. Security & Cryptography Specialist<br/>Keystore, FLAG_SECURE, Vault Encryption\"]\n        Domain[\"9. Ubiquitous Language Guardian<br/>Rule 37, CONTEXT.md, 1-to-1 Domain Mapping\"]\n        Router[\"10. Chief Meta-Router (ask-cto)<br/>Instant Technical Symptom Routing\"]\n    end\n    \n    Syndicate <--> Project\n```\n\n### 📋 10-Role Responsibility & Governance Matrix\n\n| # | Specialist / Role | Cognitive Lens & Core Responsibility | Governed Rules & Skills | Invariants & Acceptance Standards |\n|:---|:---|:---|:---|:---|\n| **1** | **Chief Technology Officer (CTO) & Principal Architect** | Overall architecture, Clean Architecture boundaries, technical debt governance, proactive technical advisory & constructive pushback (**Anti-Yes-Man Protocol**). | `rules/00-system-mandate.md`<br/>`rules/01-architecture.md`<br/>`rules/01-tech-stack.md` | Single Source of Truth (SSOT), strictly forbids presentation leaks into data layer, auto-extracts Living ADRs into `docs/adr/`. |\n| **2** | **Product Owner (PO) & Product Strategist** | Product viability, seamless user experience with zero dead-ends, conversion rate optimization. | `memory/06-user-preference-memory.md`<br/>`skills/spec-driven-development` | **5-State UI Matrix** (Empty, Loading, Error, Content, Offline), minimum 48x48dp touch bounds, non-linear 200% font scaling defense. |\n| **3** | **Lead UI/UX Architect & Product Design Director** | Completely eliminates rigid AI aesthetic tropes (**Anti-AI-Slop**); enforces premium visual depth and human-grade craft. | `rules/36-ui-ux-design-standard.md`<br/>`skills/ui-ux-pro-max`<br/>**Gate E27** | Subtle 0.5dp translucent borders, layered tonal surfaces, 8-pt grid visual rhythm, 3-tier typography, 0% neon purple glows or vibrating pills. |\n| **4** | **Google Play Vitals & Zero-Crash Principal Engineer** | Optimizes Google Play Console vitals, eliminates silent crashes and background ANRs, accelerates cold startup. | `rules/27-app-quality-vitals.md`<br/>`rules/19-build.md`<br/>`skills/app-quality-vitals` | Cold start TTID < 500ms, TTFD < 800ms, 2-Tier Hybrid Splash Orchestration, Baseline Profiles, Zero-Crash & Zero-ANR invariants. |\n| **5** | **Low-Level Memory & ART Runtime Specialist** | Stack vs Heap memory discipline, eliminates Garbage Collection (GC) churn in Composable render loops, optimizes 60/120 FPS. | `rules/26-stack-heap-memory.md`<br/>`skills/stack-heap-memory` | Zero object allocations in render loops, mandatory `@JvmInline value class` for IDs, primitive State, 16KB memory page alignment. |\n| **6** | **Principal Modular Core & SDK Architect** | Advanced modular design, shared library isolation, host app protection from 3rd-party SDK crashes. | `rules/34-sdk-modular-architecture.md`<br/>`skills/sdk-modular-engineering`<br/>**Gate E25** | All APIs `internal` by default, bundled `:testing` fakes, zero ContentProvider auto-init, binary backward compatibility (ABI). |\n| **7** | **Staff QA & Test Automation Architect** | Test-Driven Development (TDD), eliminates flaky tests, asynchronous Flow stream testing, adversarial red-team audits. | `rules/20-testing.md`<br/>`rules/42-adversarial-red-team-verification.md`<br/>`skills/subagent-modes` | Red-Green-Refactor lifecycle, Flow testing with Turbine, DI graph validation (`verify()`), Gate E39 Mirror Self-Review & Gate E40 Bounded 3-Round QA. |\n| **8** | **Senior Android Security & Cryptography Specialist** | Protects sensitive data at rest and in transit, guards against reverse engineering, device abuse, and tampering. | `rules/17-security.md`<br/>`rules/38-device-network-abuse-policy.md`<br/>**Gate E29** | Hardware Android Keystore, `REQUIRE_SECURE_ENV` container defense, `FLAG_SECURE` compliance, Zero DCL, Android 14+ FGS types, UIDT API. |\n| **9** | **Domain Modeler & Ubiquitous Language Guardian** | Unifies business vocabulary between Product and Code, enforces self-documenting naming & zero magic literals, executes vertical slices. | `rules/37-ubiquitous-language-standard.md`<br/>`skills/writing-plans`<br/>**Gate E28** | Living domain dictionary (`CONTEXT.md`), 1-to-1 concept-to-symbol mapping, Gates E28.6–E28.10 coding conventions, **Tracer-Bullet Vertical Slicing**. |\n| **10**| **Chief Engineering Router & Meta-Orchestrator** | Instant diagnosis of technical symptoms and precise routing to the exact specialist skills & quality gates. | `skills/ask-cto/SKILL.md`<br/>`skills/dispatching-parallel-agents` | Routes symptoms (dropped FPS, memory leak, process death, offline sync) to the exact 1-2 skills and quality gates without context bloat. |\n\n---\n\n## 💡 THE MANIFESTO: WHAT IS \"ANTI-VIBE-CODING\"?\n\nIn recent years, AI coding assistants have introduced a massive productivity paradox known as **\"Vibe Coding\"**:\n- ❌ **Guessing & Hallucination:** Fabricating non-existent APIs, guessing business rules, or using deprecated methods without verifying official documentation.\n- ❌ **Try-Catch Sprawl:** Wrapping entire screens, ViewModels, or Composable functions in generic `try-catch (e: Exception)` blocks to hide underlying architectural flaws and crashes.\n- ❌ **Fake Simulation & Delays:** Inserting dummy `delay(1000)` calls with hardcoded mock lists to fake feature completion, leaving the developer with broken production code.\n- ❌ **\"AI-Slop\" UI:** Generating clichéd, uninspired interfaces (purple-on-dark neon glow, vibrating biscuit pill badges, nested cards 4-levels deep, zero accessibility bounds).\n- ❌ **Android Lifecycle Ignorance:** Dropping frames on unkeyed `LazyColumn` layouts, losing form input on screen rotation/Process Death, forgetting keyboard `imePadding()`, and ignoring the 16KB memory page alignment mandated by Android 15+.\n- ❌ **False \"Done\" Claims:** Declaring tasks \"completely finished\" without ever executing a real terminal compilation command or verifying Gradle test logs.\n- ❌ **Dogmatic Library Imposition:** Forcing arbitrary frameworks onto existing legacy codebases, breaking project architecture.\n\n**Anti-Vibe-Coding-Android-Engine** transforms your AI agent from a fragile auto-complete into a **Multi-Role Executive Engineering Syndicate**. It provides a deterministic, **8-layer cognitive operating system** governed by **46 Standards (00-45) and 40 automated Quality Gates (E1 to E40)**, adapting seamlessly to your existing project without dictating your tech stack.\n\n---\n\n### ⚖️ SIDE-BY-SIDE: VIBE CODING VS. ANTI-VIBE-CODING ENGINE\n\n| Engineering Aspect | ❌ The \"Vibe Coding\" AI Experience | ✅ Anti-Vibe-Coding-Android-Engine |\n|:---|:---|:---|\n| **Thinking Rhythm** | Immediately spits out code on the first prompt based on intuition and guesswork. | **11-Engine Brain Pipeline:** Clarifies ambiguity, computes confidence score (>=85% required), and plans before touching code. |\n| **Error Handling** | Paranoic `try-catch` sprawl across UI and ViewModel to sweep crashes under the rug. | **Structural Safety:** Kotlin null safety, exhaustive `when`, and strict I/O boundary wrapping with `AppResult<T>`. |\n| **Feature Delivery** | Injects `delay(1000)` and fake dummy lists, then claims \"Feature works perfectly!\". | **Stub/Placeholder Ban:** Scans and forbids fake stubs. Binds real DataSources, repositories, and Room entities. |\n| **UI/UX Design** | Purple-on-dark neon glowing cards, vibrating pills, unkeyed lists that stutter at 20 FPS. | **Rule 36 & UI/UX Pro Max:** 0.5dp subtle borders, tonal surfaces, 8-pt grid, explicit `key` + `contentType` for 60/120 FPS. |\n| **Platform Defense** | App crashes on screen rotation, keyboard covers input fields, rejected on Android 15+ (16KB). | **19 Core Domains:** `SavedStateHandle` process death survival, `.imePadding()`, 16KB memory alignment flags. |\n| **Verification Gate** | \"I have completed all changes!\" (Zero compilation performed, project fails to build). | **Adversarial Dev ↔ QA + Compiler Gate:** Gate E39 Dev Mirror Self-Review, Gate E40 Blind-Context QA Audit, and real `./gradlew` verification. |\n| **Tech Stack Policy** | Dictates \"You must use library X\", breaking existing code. | **Adaptive Stack HAL:** Auto-detects Hilt vs Koin, Retrofit vs Ktor, and enforces safety on *your* stack. |\n\n---\n\n## 🏛️ THE 8-TIER COGNITIVE OPERATING SYSTEM\n\nEvery prompt and feature request processed by the AI flows through an invariant 8-tier cognitive sequence:\n\n```mermaid\nflowchart TD\n    User([User Request / Prompt]) --> Phase0[Phase 0: Workspace & Stack Auto-Discovery]\n    Phase0 --> Brain[Tier 1: Brain Engine - 11 Cognitive Engines]\n    Brain --> Memory[Tier 2: Memory Core - 6-Tier Architecture Knowledge]\n    Memory --> HAL[Tier 3: Adaptive Stack HAL - Koin/Hilt & Ktor/Retrofit]\n    HAL --> Workflow[Tier 4: Workflow Engine - 10 Disciplined Pipelines]\n    Workflow --> Skills[Tier 5: Skills Engine - Specialized Blueprints]\n    Skills --> Rules[\"Tier 6: Rules Engine - 46 Standards (00-45) & Gates E1-E40\"]\n    Rules --> PlanGate{Plan Approval Gate}\n    PlanGate -->|User Explicit Approval| Implementation[\"Implementation: dev-builder + Gate E39 Mirror Self-Review\"]\n    Implementation --> Verification[\"Tier 7: Independent QA Audit (qa-enforcer + Gate E40 Bounded 3-Round Convergence)\"]\n    Verification --> Reflection[\"Tier 8: Reflection & Gate E1-E40 Audit\"]\n    Reflection --> MemoryUpdate[Memory & Living ADR Auto-Update]\n    MemoryUpdate --> FinalDelivery([CTO-Grade Production Delivery])\n```\n\n### 1. The 11 Cognitive Engines (`brain/`)\nThe AI thinks before acting through a sequential cognitive pipeline:\n1. **Context Engine (`02-context-engine.md`):** Collects codebase architecture, Gradle catalogs, and constraints.\n2. **Clarification Engine (`03-clarification-engine.md`):** Identifies missing business logic; stops and clarifies instead of guessing.\n3. **Assumption Engine (`04-assumption-engine.md`):** Marks assumptions with reasons and impact; forbids inventing business requirements.\n4. **Decision Engine (`05-decision-engine.md`):** Chooses execution strategy (Clarify, Plan, Implement, Refactor, Debug).\n5. **Confidence Engine (`06-confidence-engine.md`):** Calculates internal confidence. If < 85%, halts execution to ask the user.\n6. **Planning Engine (`07-planning-engine.md`):** Designs Tracer-Bullet Vertical Slices before writing any code.\n7. **Execution Engine (`08-execution-engine.md`):** Coordinates disciplined, incremental coding.\n8. **Reflection Engine (`09-reflection-engine.md`):** Self-evaluates: Did we solve the real problem? Is there duplicate code?\n9. **Enforcement Engine (`21-enforcement-engine.md`):** Audits code against all 40 Quality Gates (E1 to E40).\n10. **Initiative Engine (`10-initiative-engine.md`):** Proactively highlights performance risks, memory leaks, and architectural bottlenecks.\n11. **Learning Engine (`11-learning-engine.md`):** Extracts reusable design patterns and lessons learned into long-term memory.\n\n### 2. The 6-Tier Memory Core (`memory/`)\nPrevents \"AI dementia\" by preserving stable knowledge across sessions:\n* **Project Memory (`01-project-memory.md`):** Active project profile, architecture boundaries, and module graph.\n* **Session Memory (`02-session-memory.md`):** Ephemeral conversation context and immediate working objectives.\n* **Task Memory (`03-task-memory.md`):** Living task state, dependencies, blockers, and completion criteria.\n* **Decision Memory (`04-decision-memory.md`):** Architecture Decision Records (ADRs) to never repeat past mistakes.\n* **Pattern Memory (`05-pattern-memory.md`):** Approved UI and architectural patterns verified within the codebase.\n* **User Preference Memory (`06-user-preference-memory.md`):** Developer collaboration style, Anti-AI-slop rules, no auto-commit.\n\n### 3. ⚔️ Zero-Compromise Dev (`dev-builder`) ↔ QA (`qa-enforcer`) Adversarial Architecture (Rule 42 & Gates E39–E40)\nTo eliminate AI self-grading bias while preventing infinite ping-pong loops, the framework enforces a two-tier quality architecture:\n* **Tier 1 — Mandatory 4-Step Dev Mirror Self-Review (`Gate E39`):** Before handing off any implementation, `dev-builder` (`enable_write_tools = true`) must physically re-read 100% of modified files on disk (`view_file` / `git diff`), audit Draft 1 across the **5-Mirror Lenses** (Minimalism, Self-Documenting Naming & Zero Magic Literals, Vitals/Safety, Architecture/UI, 6-Dimension Edge Cases), self-refactor Draft 1 into Clean Draft 2, and emit a `🪞 Dev Mirror Self-Review` report block.\n* **Tier 2 — Uncompromising Blind-Context `qa-enforcer` (`Gate E40`):** Spawned with a hard read-only lock (`enable_write_tools = false`) in a **100% blind fresh context** (receiving only Spec + Exact Diff + Raw Test Logs). Issues strictly binary verdicts (**`VERDICT: APPROVED`** or **`VERDICT: REJECTED`**) governed by the **4 Laws of Bounded 3-Round Convergence (`Gate E40`)**:\n  1. **Bounded 3-Round Cap & Circuit Breaker (`Gate E40.1`):** `MAX_QA_ROUNDS = 3`. If Round 3 still fails, triggers **`🛑 CIRCUIT BREAKER TRIGGERED: ARCHITECTURAL PIVOT REQUIRED`** and escalates to the user.\n  2. **Delta-Only Scope in Rounds 2–3 (`Gate E40.2`):** Rounds 2 and 3 audit strictly the remediation delta and prior open clusters.\n  3. **Pattern-Clustered `[CLUSTER-XX]` Batching & Systemic Codebase Sweep (`Gate E40.3`):** Identical root causes are grouped into a single `[CLUSTER-XX]` item and swept across all modified files in one pass.\n  4. **Zero Moving Goalposts (`Gate E40.4`):** Untouched code that passed Round 1 cannot be newly flagged for subjective nitpicks in Rounds 2–3.\n\n---\n\n## ⚡ ADAPTIVE STACK ARCHITECTURE (HARDWARE ABSTRACTION LAYER)\n\nThe Anti-Vibe-Coding Engine is **framework-agnostic**. During **Phase 0 (Workspace & Stack Auto-Discovery)**, it inspects your `settings.gradle.kts`, `build.gradle.kts`, or `libs.versions.toml` and binds the corresponding stack driver:\n\n```mermaid\ngraph TD\n    HAL[Adaptive Stack Hardware Abstraction Layer]\n    \n    subgraph DI [Dependency Injection Driver]\n        Koin[Koin 4.x: singleOf / viewModelOf]\n        Hilt[Hilt / Dagger: @HiltViewModel / @Inject]\n    end\n    \n    subgraph Net [Networking Driver]\n        Ktor[Ktor Client: CIO / OkHttp / ContentNegotiation]\n        Retrofit[Retrofit + OkHttp: suspend / Moshi / Converters]\n    end\n    \n    subgraph Nav [Navigation Driver]\n        Nav3[Navigation 3: SnapshotStateList / Type-Safe NavKeys]\n        NavCompose[Jetpack Navigation Compose: @Serializable Routes]\n    end\n    \n    subgraph Storage [Storage Driver]\n        Room[Room Database: SQLite WAL / MigrationTestHelper]\n        SQLDelight[SQLDelight: Type-Safe SQL Drivers]\n    end\n    \n    HAL --> DI\n    HAL --> Net\n    HAL --> Nav\n    HAL --> Storage\n```\n\n| Architectural Layer | Adaptive Stack Drivers (Auto-Detected) | Universal Cognitive Invariants (Mandatory) |\n|:---|:---|:---|\n| **UI Toolkit** | Jetpack Compose / Compose Multiplatform | Material 3 Design Tokens, 60/120 FPS, explicit `key` & `contentType` on Lazy Layouts. |\n| **Aesthetics** | [Rule 36 (World-Class UI/UX)](rules/36-ui-ux-design-standard.md) | Subtle 0.5dp borders, tonal surfaces, 8-pt grid, anti-AI design clichés. |\n| **Dependency Injection** | **Koin 4.x** OR **Hilt / Dagger** | 100% Constructor Injection. Zero manual instantiation in Presentation. Scope isolation. |\n| **Networking** | **Ktor Client** OR **Retrofit + OkHttp** | Non-blocking I/O (`Dispatchers.IO`), DTO-to-Domain mappers, structured `AppResult<T>` boundary. |\n| **Navigation** | **Navigation 3** OR **Jetpack Nav Compose** | Compile-time type safety via Kotlin `@Serializable` routes. 400ms transition debounce. |\n| **Local Storage** | **Room Database** OR **SQLDelight** | Single Source of Truth (SSOT), WAL mode enabled, zero data loss migration defense. |\n| **Presentation** | MVI / UDF (`BaseViewModel<State, Intent, Effect>`) | Immutable `StateFlow<UIState>` exposed to UI. Pure UI intent emission. |\n| **Android Vitals** | [App Quality Vitals](skills/app-quality-vitals/SKILL.md) & [Stack vs Heap](skills/stack-heap-memory/SKILL.md) | Zero-Crash, Zero-ANR, Zero-Leak, Startup TTID < 500ms, 16KB page alignment. |\n\n---\n\n## 🛡️ THE 40 QUALITY GATES (E1 — E40) DEEP DIVE\n\nEvery piece of code generated or reviewed by the AI must pass all 40 automated quality gates defined in [rules/21-enforcement-engine.md](rules/21-enforcement-engine.md):\n\n| Gate ID | Category | Name | Enforcement Invariant |\n|:---|:---|:---|:---|\n| **Gate E1** | Architecture | **Clean Architecture Boundary** | Domain has zero dependencies on Data or Presentation. |\n| **Gate E2** | Presentation | **BaseViewModel Inheritance** | Every ViewModel extends `BaseViewModel<State, Intent, Effect>`. Direct `ViewModel()` is forbidden. |\n| **Gate E3** | Concurrency | **Safe Coroutine Scope** | All ViewModel coroutines use `safeLaunch {}`. Direct `viewModelScope.launch` is banned. |\n| **Gate E4** | Presentation | **Pure MVI Intent & Modifier Purity** | Exhaustive `when (intent)` without `else ->`; `E4.6` enforces Root-only `modifier` and parameter order. |\n| **Gate E5** | Presentation | **StateFlow Immutability** | Presentation exposes only read-only `StateFlow<UIState>`. MutableStateFlow is strictly private. |\n| **Gate E6** | Navigation | **Type-Safe Route Definition** | Internal navigation routes MUST use `@Serializable` classes/objects. Raw string paths are banned. |\n| **Gate E7** | Architecture | **Single Source of Truth (SSOT)** | UI observes local database. Network syncs to database; network never feeds UI directly. |\n| **Gate E8** | Navigation | **Navigation Debounce** | Navigation actions must debounce with a minimum 400ms threshold to prevent double-push. |\n| **Gate E9** | Data | **DTO Boundary Isolation** | DTOs live strictly in Data layer and map to pure Domain models before leaving Repository. |\n| **Gate E10**| Data | **Error Boundary Wrapping** | Remote/local operations must wrap exceptions in `AppResult<T>` or `Result<T>`. |\n| **Gate E11**| UI | **Design System Token Purity** | Zero hardcoded colors (`Color(0x...)`) or sizes (`16.dp`). 100% mapped to `AppTheme` tokens. |\n| **Gate E12**| UI | **Lazy Layout Key Stability** | Every item in `LazyColumn`/`LazyRow` MUST specify an explicit `key = { it.id }` and `contentType`. |\n| **Gate E13**| UI | **Recomposition Stability** | External models annotated with `@Immutable` or `@Stable`. Lambdas memoized via `remember`. |\n| **Gate E14**| UI | **Dark Theme Compatibility** | Direct use of `Color.White` or `Color.Black` is forbidden. All surfaces adapt to theme mode. |\n| **Gate E15**| UI | **Accessibility Bounds** | All clickable elements have a minimum touch target of 48x48dp (`minimumInteractiveComponentSize`). |\n| **Gate E16**| Concurrency | **Main-Thread Purity** | Zero blocking calls or file/network I/O on `Dispatchers.Main`. All I/O runs on `Dispatchers.IO`. |\n| **Gate E17**| Concurrency | **Cancellation Preservation** | Never swallow `CancellationException` in coroutine exception handling blocks. |\n| **Gate E18**| Background | **WorkManager NonCancellable** | Deferrable background work uses WorkManager. Cleanup blocks run in `NonCancellable`. |\n| **Gate E19**| Storage | **Database WAL & Migrations** | Room database configured with WAL mode. `fallbackToDestructiveMigration()` forbidden in prod. |\n| **Gate E20**| Security | **Hardware Keystore & Security** | Tokens stored in `EncryptedSharedPreferences` / Keystore. `FLAG_SECURE` on payment screens. |\n| **Gate E21**| Audit | **Enforcement Pre-Delivery Audit**| Full self-audit across modified files. Zero violations tolerated before task handover. |\n| **Gate E22**| Minimalism | **Anti-Overengineering Gate** | Zero redundant wrappers or 1-line delegate UseCases. Ponytail minimalist standard. |\n| **Gate E23**| Resilience | **The 7 AI Blind Spots Defense** | SavedStateHandle survives Process Death, `.imePadding()`, JIT permissions, zero fake delays. |\n| **Gate E24**| Testing | **Modern Testing & QA Gate** | StateFlow emissions tested via Turbine. Fakes preferred over fragile mocks. |\n| **Gate E25**| SDK/Core | **Modular Public Surface Isolation**| Core libraries use `internal` by default. Pluggable `:testing` fakes provided. |\n| **Gate E26**| Release | **DB Migration & R8 ProGuard Gate** | ProGuard `consumer-rules.pro` synthesized. Release builds verified with R8 minification. |\n| **Gate E27**| Aesthetic | **World-Class UI/UX Audit** | Zero purple neon AI clichés. Subtle 0.5dp borders, tonal depth, 8-pt grid, domain palette. |\n| **Gate E28**| Domain | **Ubiquitous Language & Conventions** | 1-to-1 `CONTEXT.md` mapping; `E28.6–E28.10` Self-Documenting Naming, Zero Magic Literals, Affirmative Booleans, Named Args, `internal`/`private` Visibility. |\n| **Gate E29**| Policy | **Google Play 2026–2027 12-Pillar Policy [`#policy`]** | Zero DCL, Android 14–16 FGS & 2027 Geofencing FGS Ban, UIDT API, `REQUIRE_SECURE_ENV`, `FLAG_SECURE`, WebView Guard, Web Account Deletion, AI Disclosure, Age-Gate, `PickContact` Mandate. |\n| **Gate E30**| Resilience | **8-Vector Hostile Runtime Defense** | Process Death <500KB bundle, Captive Portal check, 401 Mutex, Preserved Cancellation, 400ms Debounce, AtomicFile, 200% Font Scale, JIT Permissions. |\n| **Gate E31**| Testing | **6-Dimension Edge-Case Torture Matrix** | Rejects happy-path-only tests; enforces Empty/Blank/Overflow, Multi-Tap <400ms, Concurrent Races, and Process Death tests. |\n| **Gate E32**| Refactoring | **Senior Refactoring Safety Net** | Characterization tests & Green Baseline required before structural edits; enforces micro-step discipline. |\n| **Gate E33**| Agentic | **Scientific Closed-Loop & Red-Team Gate** | Minimal Failing Test before bugfix, Single-Variable Isolation, 1-to-1 Living Traceability, Adversarial Audit. |\n| **Gate E34**| Vitals 2026–2027 | **Google Play 2026–2027 Core Vitals Mandate** | Crash <0.05%, ANR <0.02%, 16KB Page Alignment, Target SDK 36, Zero Excessive WakeLocks, Bitmap RAM <50MB BG P90, R8 DEX Opt >=75%, Zero-Tap `RestoreCredentials`. |\n| **Gate E35**| Interop | **Hybrid XML & Compose Interoperability** | `DisposeOnViewTreeLifecycleDestroyed`, `ViewBinding` nullification in `onDestroyView`, `AndroidView` `onRelease`. |\n| **Gate E36**| Modern XML | **100% Pure Modern XML Architecture** | `ListAdapter` + `DiffUtil`, `WindowInsetsCompat` Edge-to-Edge, SafeArgs compile-time type safety. |\n| **Gate E37**| Context | **GSD Wave Context Isolation** | Fresh-context subagent wave execution for multi-file features; automatic milestone archiving. |\n| **Gate E38**| Pre-Flight | **Zero-Tolerance Pre-Flight Vitals Audit** | Bans verbal safety claims; enforces static Zero-Crash, Zero-ANR <5ms Main Thread, and Zero-Leak audit. |\n| **Gate E39**| Self-Review | **Mandatory Dev Mirror Self-Review** | `view_file` physical read-back, 5-Mirror Lens self-refactor (Draft 1 -> Clean Draft 2), and `🪞 Dev Mirror Self-Review` block. |\n| **Gate E40**| Convergence | **Bounded 3-Round QA Convergence & Circuit Breaker** | `MAX_QA_ROUNDS = 3`, Pattern-Clustered `[CLUSTER-XX]` batching + Systemic Sweep, Delta-Only Rounds 2–3, Zero Moving Goalposts. |\n\n---\n\n## 📱 THE 19 CORE MOBILE ENGINEERING DOMAINS\n\nThe engine embeds deep architectural defenses across the 19 core mobile domains defined in [rules/31-mobile-engineering-core.md](rules/31-mobile-engineering-core.md):\n\n```\n1. Lifecycle & State Management    7. Adaptive UI & Insets            13. Cross-Platform Bridge\n2. Background Execution           8. Accessibility (a11y)            14. System Integrations (Camera/Sensors)\n3. Permissions & Privacy           9. Localization & Theming          15. Security & Cryptography\n4. Networking & Offline-First     10. Concurrency & Asynchronous Flow 16. Build & 16KB Release Engineering\n5. Persistence & Migration        11. Performance & Android Vitals   17. Observability, Telemetry & Tracing\n6. Navigation & Deep Links        12. Platform-Specific Behaviors    18. Testing & Automation Strategy\n                                                                     19. Complete Failure Modeling\n```\n\n---\n\n## 👁️ THE 7 AI BLIND SPOTS DEFENSE MATRIX\n\nAI models typically introduce 7 recurring architectural bugs when generating Android code. The engine automatically monitors and blocks them:\n\n1. **Lazy Layout Recomposition Lag:** AI forgets `key = { it.id }` and `contentType`, causing Compose to recompose the entire list on every state change and dropping FPS to 20.  \n   *Engine Fix:* Gate E12 automatically checks and requires `key` on every Lazy list item.\n2. **Duplicate Click Race Conditions:** Fast double-tapping a button launches duplicate network requests or pushes duplicate screens onto the backstack.  \n   *Engine Fix:* Mandates ViewModel-level click locks and a 400ms navigation debounce.\n3. **Loss of Form State on Rotation / Process Death:** AI uses simple `remember { mutableStateOf(\"\") }` which resets user inputs when the device rotates or Android OS reclaims memory.  \n   *Engine Fix:* Mandates `rememberSaveable` or hoisting state into `SavedStateHandle`.\n4. **Keyboard Covering Input Fields:** Bottom input fields become inaccessible when the soft keyboard appears.  \n   *Engine Fix:* Mandates `Modifier.imePadding()` with scrollable containers and `BringIntoViewRequester`.\n5. **String Concatenation in UI:** AI writes `Text(\"$count items\")` or `Text(\"$ \" + price)`, breaking pluralization and localization rules.  \n   *Engine Fix:* Mandates `pluralStringResource` and localized string templates.\n6. **Fake Simulations & Delays:** AI adds `delay(1000)` and fake dummy lists when it doesn't know how to implement the real API.  \n   *Engine Fix:* Stub/Placeholder detection blocks fake delays and requires real DataSource bindings.\n7. **16KB Memory Page Alignment Blindness:** Starting in Android 15, all native C/C++ libraries (`.so`) MUST be aligned to 16KB page boundaries or the app crashes immediately on launch.  \n   *Engine Fix:* Rule 19 & Rule 31 automatically enforce 16KB linker flags (`-Wl,-z,max-page-size=16384`) and audit 3rd-party dependencies.\n\n---\n\n## 📦 QUICKSTART INSTALLATION (IN 60 SECONDS)\n\n### Option 1: One-Line Automated Installer (Recommended)\nRun this single command in your terminal (macOS / Linux / WSL):\n```bash\ncurl -fsSL https://raw.githubusercontent.com/vinhvox/Anti-Vibe-Coding-Android-Engine/main/scripts/install.sh | bash\n```\nThe installer automatically:\n1. Detects your operating system and shell environment.\n2. Installs or updates the engine into `~/.antigravity`.\n3. Auto-configures **Antigravity CLI (`agy`)** by binding the System Mandate in `~/.gemini/GEMINI.md` and symlinking skills into `~/.gemini/antigravity-cli/skills/`.\n4. Grants execution permissions and runs an automated environment diagnostic.\n\n### ⚡ Option 2: Fast One-Line Update (For Existing Users)\nUpdate an existing `~/.antigravity` installation and `~/.gemini/GEMINI.md` mandate in seconds (100% non-interactive, preserves custom `01-project-memory.md`, and automatically backs up `~/.antigravity/memory` to `~/.antigravity_backups/`):\n\n- **Remote 1-Liner:**\n  ```bash\n  curl -fsSL https://raw.githubusercontent.com/vinhvox/Anti-Vibe-Coding-Android-Engine/main/scripts/update.sh | bash\n  ```\n- **Local CLI Shortcut:**\n  ```bash\n  ~/.antigravity/bin/agy-update\n  # or: bash ~/.antigravity/scripts/update.sh\n  ```\n- **Check-Only Mode (Preview Incoming Updates Without Applying):**\n  ```bash\n  ~/.antigravity/bin/agy-update --check\n  ```\n\n### Option 3: Clone and Install Locally\n```bash\ngit clone https://github.com/vinhvox/Anti-Vibe-Coding-Android-Engine.git\ncd Anti-Vibe-Coding-Android-Engine\nbash scripts/install.sh\n```\n\n### Option 4: Initialize in an Existing Android Project\nTo bind the engine and project memory directly to any Android / KMP project repository:\n```bash\ncd /path/to/your/android-project\nbash ~/.antigravity/scripts/init-project.sh\n```\n\n### Option 5: Run Diagnostic Health Check\nVerify that your development environment (JDK 17+, Android SDK, Git) is fully configured:\n```bash\nbash ~/.antigravity/scripts/doctor.sh\n```\n\n---\n\n## ❓ ANTIGRAVITY CLI FAQ & TROUBLESHOOTING\n\n### Q: Why does the initial Antigravity CLI terminal screen look default?\n> **Answer:** The initial startup ASCII header (*\"Welcome to Antigravity CLI\"*) is compiled statically into the `agy` binary. The engine's **CTO Persona, 46 Standards (00-45), and 40 Quality Gates (E1–E40)** live inside the AI's cognitive pipeline and are activated upon your very first message or tool call.\n\n### Q: How do I verify that the engine is active in Antigravity CLI?\n> **Answer:** Run `agy` in your terminal and test either of these:\n> 1. Type `/skills` — You will see custom skills listed (`ask-cto`, `subagent-modes`, `ui-ux-pro-max`, `app-quality-vitals`, etc.).\n> 2. Ask: *\"Who are you and what rules do you follow?\"* — The assistant will immediately identify as the **CTO & Android Principal Architect** enforcing the 46 Standards (00-45) and 40 Quality Gates (E1–E40).\n\n---\n\n## 🛠️ CUSTOMIZING FOR YOUR PROJECT\n\nThe engine is 100% plug-and-play. To customize it for a specific project repository:\n\n1. Run the project initializer inside your project's root:\n   ```bash\n   bash ~/.antigravity/scripts/init-project.sh\n   ```\n2. Or copy the project memory template manually:\n   ```bash\n   mkdir -p .antigravity/memory\n   cp templates/memory/project-memory.template.md .antigravity/memory/01-project-memory.md\n   ```\n3. Fill in your application's details (Package name, active DI framework, database, and repository boundaries).\n4. Any AI coding assistant (Antigravity CLI, Cursor, Claude Code, Gemini CLI) will automatically discover your project's profile and enforce CTO-grade engineering.\n\n---\n\n## 🤖 AI COMPATIBILITY MATRIX\n\nAnti-Vibe-Coding-Android-Engine is designed to empower any modern AI coding tool:\n\n| AI Tool / Environment | Integration Method | Supported Features |\n|:---|:---|:---|\n| **Google Antigravity CLI (`agy`)** | Native custom framework (`~/.antigravity`) | Full 8-tier cognitive pipeline, skills, subagents (`dev-builder` / `qa-enforcer`), 46 Standards & 40 Gates. |\n| **Cursor IDE** | Include as `.cursorrules` or system prompt reference | Full 40 Quality Gates (E1–E40), Clean Architecture enforcement, Rule 36 UI/UX. |\n| **Claude Code (Anthropic)** | Load via `CLAUDE.md` linking to `.context-digest.md` | Invariant enforcement, Tracer-Bullet planning, compiler verification. |\n| **Gemini CLI** | Native custom configuration | Brain reasoning, adaptive HAL, zero-crash default invariant. |\n| **Windsurf / GitHub Copilot** | Workspace rules reference | Compose stability, design system token purity, 19 core mobile domains. |\n\n---\n\n## 🗂️ REPOSITORY DIRECTORY LAYOUT\n\n```\nAnti-Vibe-Coding-Android-Engine/\n├── .github/\n│   ├── workflows/lint-and-validate.yml  # GitHub Actions CI for path sanitization & syntax\n│   └── ISSUE_TEMPLATE/                  # Standardized bug reports & feature requests\n├── bin/\n│   ├── agy-doctor                       # Fast CLI diagnostic shortcut\n│   ├── agy-update                       # Fast CLI non-interactive updater shortcut\n│   └── load-antigravity.py              # Context bootstrap utility\n├── brain/                               # 11 Cognitive engines (Context, Clarification, Decision...)\n│   ├── 00-master-cognition.md\n│   ├── ...\n│   └── 11-learning-engine.md\n├── rules/                               # 46 Standards (00-45) & Gates E1 to E40\n│   ├── 00-system-mandate.md             # Highest system priority mandate\n│   ├── 01-tech-stack.md                 # Adaptive Stack Hardware Abstraction Layer (HAL)\n│   ├── 09-networking.md                 # Ktor Client & Retrofit + OkHttp standards\n│   ├── 12-dependency-injection.md       # Koin 4.x & Hilt/Dagger standards\n│   ├── 21-enforcement-engine.md         # The 40 Quality Gates (E1 to E40)\n│   ├── 27-app-quality-vitals.md         # 2026-2027 Google Play Core Vitals & 16KB alignment\n│   ├── 31-mobile-engineering-core.md    # The 19 Core Mobile Engineering Domains\n│   ├── 36-ui-ux-design-standard.md      # World-Class UI/UX & Anti-AI-Slop standard\n│   ├── 37-ubiquitous-language-standard.md # Domain Dictionary & Self-Documenting Conventions\n│   ├── 38-device-network-abuse-policy.md # Google Play 2026-2027 12-Pillar Policy Defense\n│   ├── 42-adversarial-red-team-verification.md # Dev Mirror Self-Review & Bounded 3-Round QA\n│   └── 45-apk-reverse-audit.md          # Automated APK/AAB/DEX Reverse Audit standard\n├── workflow/                            # 10 Specialized engineering workflows\n│   ├── 00-master-workflow.md            # Central orchestrator (Phases 0 to 8)\n│   ├── 03-architecture-design.md        # Architecture design & driver binding\n│   ├── 04-implementation-planning.md    # Tracer-Bullet Vertical Slicing planning\n│   ├── 06-code-review.md                # Gates E1-E40 code review audit\n│   └── 07-testing-validation.md         # Mandatory real terminal compiler execution\n├── skills/                              # Specialized drop-in domain skills\n│   ├── ask-cto/                         # Meta-router for instant technical diagnosis\n│   ├── subagent-modes/                  # Zero-Compromise Dev (dev-builder) & QA (qa-enforcer)\n│   ├── ui-ux-pro-max/                   # 240+ UI styles, 170+ palettes, 150+ font pairings\n│   ├── app-quality-vitals/              # Google Play Vitals, Zero-Crash, TTID < 500ms\n│   ├── stack-heap-memory/               # Stack vs Heap memory allocation discipline\n│   ├── dex-optimization/                # R8 fullMode, Baseline Profiles & >=75% DEX Opt\n│   ├── policy/                          # Instant #policy 12-Pillar Google Play compliance audit\n│   ├── panda-ads-integration/           # High-ROAS AdMob & Mediation lifecycle architecture\n│   ├── rea/ & reverse-engineer-anything/# Deep APK/DEX/SO binary & Smali reverse audit\n│   ├── gsd-orchestrator/                # Context-isolated wave execution & milestone archiving\n│   ├── ai-product-team/                 # Autonomous multi-role product & architecture studio\n│   ├── screenshot-to-compose/           # Pixel-accurate Compose M3 synthesis from mockups\n│   ├── ponytail-minimalist/             # Zero over-engineering & Kotlin idioms\n│   ├── spec-driven-development/         # Tri-Artifact standard (Spec -> Plan -> Tasks)\n│   └── systematic-debugging/            # 4-step scientific root cause analysis\n├── memory/                              # 6-Tier memory architecture & generic profile\n│   ├── 00-memory-core.md\n│   └── 01-project-memory.md\n├── templates/                           # Reusable project starter templates\n│   └── memory/\n│       ├── project-memory.template.md   # App identity & architecture template\n│       └── user-preference.template.md  # Developer preferences template\n├── scripts/                             # Automation scripts\n│   ├── install.sh                       # Automated curl-to-bash installer\n│   ├── update.sh                        # Fast non-interactive git delta updater & memory backup\n│   ├── doctor.sh                        # Environment diagnostic health check\n│   ├── rever_audit.py                   # Automated APK/AAB/DEX reverse security auditor\n│   └── uninstall.sh                     # Safe uninstaller with backup archiving\n├── .context-digest.md                   # Ultra-dense 5.4K token instant boot context\n├── INDEX.md                             # Full cross-reference index\n├── CONTRIBUTING.md                      # Open-source contribution guidelines\n├── LICENSE                              # Apache License 2.0\n├── README.md                            # Comprehensive project homepage\n└── install.sh                           # Root installer convenience wrapper\n```\n\n---\n\n## 🤝 CONTRIBUTING\n\nWe welcome contributions from Android architects, mobile engineers, and AI developers passionate about bringing true engineering rigor to AI coding assistants!\n\nPlease read our [Contributing Guidelines](CONTRIBUTING.md) to learn how to propose new Quality Gates, domain skills, or architectural drivers.\n\n---\n\n## 📄 LICENSE\n\nThis project is open-sourced under the **Apache License 2.0** — see the [LICENSE](LICENSE) file for details.\n"}