# COE Framework — Academy & Developer Knowledge Base for LLMs and AI Agents > Canonical Academy URL: https://academy.coeroleplay.app/ > Target Runtime: FXServer cerulean (GTA V Gen9 / DirectX 12) · Lua 5.4 · Node.js 24 LTS / Node 26 (libnode26) · MariaDB 11.x+ > Core Architecture: Clean Architecture (Domain, Adapters, Application) · Hardware Abstraction Layer (Core.Platform) · Strict Server-Authoritative · 0.00ms Idle Draw · 50 MIT First-Party Resources ## The 15 Non-Negotiable Rules for AI Coding Agents 1. **Server is the Single Source of Truth**: Client only requests intent; server validates type, range, distance, permissions, cooldowns, and recalculates prices/quantities. 2. **Strict Open-Core Boundary**: Code in `coe-framework/` NEVER references private resources by name. Use public registration ports (`RegisterTab`, `RegisterPaymentMethod`) and ACEs. 3. **Zero Legacy Frameworks**: Absolutely NO ESX, QBCore, vRP, oxmysql, or ox_lib. Database access ONLY via `coe_database` with prepared statements (`?`). 4. **No Shared Mutable Globals**: Cross-resource communication exclusively via typed `exports` or `Core.Events`. 5. **Typed Public Exports**: Documented in `types.lua` (`---@meta`) with bilingual descriptions. `types.lua` is NEVER included in `fxmanifest.lua`. 6. **Mandatory Bilingual i18n**: 100% key parity between `locales/pt-br.lua` (`Locales['pt-BR']`) and `locales/en-us.lua` (`Locales['en-US']`). 7. **Parameterized Async SQL & Migrations**: Schema changes exclusively via `Core.Migrations:Register` (`CoeMigrations`). 8. **Performance 0.00 ms in idle**: Never write permanent `while true do Wait(0)` loops. Use `exports.coetarget` and event-driven callbacks. 9. **Hardware Abstraction Layer (`Core.Platform.*`)**: Never call raw entity/vehicle/routing/colshape natives directly in migrated resources (`coe_platform 'hal'`). 10. **Async Session Validation**: Capture `(source, charId, gen)` before any database/async wait and validate with `Core.Players.ValidateSession(source, charId, gen)`. 11. **Physical Device TOCTOU Mitigation**: Revalidate physical possession of phone/tablet items in `coe_inventory` at the exact moment of state mutation. 12. **Coroutine Watchdogs**: Client action waits enforce a strict timeout (`SetTimeout(20000)`) and purge state on `playerDropped`. 13. **Engine Lockdown Compliance (`coe_shield`)**: Client preview/animation props/peds/vehicles MUST use `isNetwork = false` for `sv_entityLockdown "full"`; synced entities spawn server-side only. 14. **Maturity & Promotion Pipeline**: New scripts start in `experimental/`, promote to `dev/` (`[coe-dev]`) for in-game testing, and graduate to `coe-framework/` after strict CI checks. 15. **PR & CI Governance**: Never push directly to `main`. Always run `lua tools/check_contracts.lua --strict --audit-natives --audit-locales`. ## Official 8 AI Agent Skills (.agents/skills/) - `coe-novo-resource`: Scaffolds a layered resource (`domain/`, `adapters/`, `application/`, `locales/`, `types.lua`, `test/`). - `coe-evento-rede`: Implements hardened client->server net events with `ValidateSession`, mutex, distance check, and rollback. - `coe-interface-nui`: Builds NUI interfaces using `coe_ui` tokens, 5 themes, 100% vector SVG icons (zero emojis), and i18n. - `coe-migracao-db`: Creates idempotent `CoeMigrations` schemas and `coe_database` ACID persistence adapters. - `coe-export-contrato`: Adds ACE-guarded public exports, LuaLS `types.lua` contracts, and generated reference docs. - `coe-teste-unitario`: Authors pure Lua 5.4 offline unit tests with `Core.Platform` mocks. - `coe-servidor-dev`: Manages local FXServer testing (`coe.ps1 dev`). - `coe-validar-ci`: Runs the complete local CI validation pipeline. ## 50 MIT Resources by Architectural Tier - **Core Infrastructure (9)**: `coe_supervisor`, `coe_logging`, `coe_database`, `coe_core`, `coe_ui`, `coe_notify`, `coetarget`, `coe_audit`, `coe_admin`. - **City Base (15)**: `coe_characters`, `coe_spawn`, `coe_loadscreen`, `coe_appearance`, `coe_hud`, `coe_needs`, `coe_talk`, `coe_inventory`, `coe_economy`, `coe_shops`, `coe_jobs`, `coe_vehicles`, `coe_fuel`, `coe_doors`, `coe_map`. - **Advanced Systems (26)**: `coe_banking`, `coe_crypto`, `coe_elos`, `coe_businesses`, `coe_crafting`, `coe_garages`, `coe_rentals`, `coe_vehicle_catalog`, `coe_handling`, `coe_mechanic`, `coe_races`, `coe_housing`, `coe_factions`, `coe_loot`, `coe_deepweb`, `coe_police`, `coe_ems`, `coe_dispatch`, `coe_mdt`, `coe_phone`, `coe_tablet`, `coe_telecom`, `coe_apps`, `coe_mail`, `coe_news`, `coe_amzg`. ## 11 Curriculum Tracks (20 Lessons) - Track 01: Foundations & The 15 Non-Negotiable Rules (`por-que-coe`, `regras-inegociaveis`) - Track 02: Resource Anatomy & Clean Architecture (`estrutura-pastas`, `ciclo-de-vida-init`) - Track 03: Hardware Abstraction Layer (`isolando-natives-platform`, `mocks-testes-offline`) - Track 04: Server-Authoritative Security (`eventos-rede-seguros`, `ace-auditoria-livro-razao`) - Track 05: Async Persistence & ACID (`prepared-statements-acid`, `migracoes-versionadas`) - Track 06: NUI & CoE UI Design System (`tokens-e-temas`, `dialogos-e-callbacks-seguros`) - Track 07: Native Localization (`paridade-locales-interpolacao`) - Track 08: Typed Contracts & CI (`types-lua-referencia`, `testes-unitarios-ci`) - Track 09: 50-Script Ecosystem & Yield (`ecossistema-50-scripts-yield`, `estendendo-scripts-ports`) - Track 10: AI Agent Engineering & Prompt Playbook (`agentes-ia-rules-skills`, `engenharia-prompts-coe`) - Track 11: Hands-On Project (`projeto-coe-delivery`) For complete consolidated text and code examples, see https://academy.coeroleplay.app/llms-full.txt