# Celena CMS — rules for AI assistants

1. NEVER edit `core/`, `modules/`, `config/`, `bin/`, `docs/`, `public/assets/` — they are overwritten on every engine update; changes WILL be lost.
2. Customize ONLY via your own plugin (`plugins/<your-slug>/`) or your own theme (`templates/<your-theme>/`).
3. Never edit bundled plugins (`leads`, `shop`, `analytics`, `handbook`) or bundled themes (`default`, `admin`, `commerce`) in place — copy a theme under a new name first.
4. After ANY change to a `.tpl` file run `php bin/celena cache:clear` (or delete `storage/cache/tpl/*`) — mtime-based invalidation is unreliable.
5. After changing CSS/JS bump the `?v=` version in the include.
6. SQL must work on BOTH PostgreSQL and MySQL (`DB_DRIVER`): no backticks, no `LIMIT x,y`, no `ON DUPLICATE KEY UPDATE`, no `ILIKE`, no `RETURNING`, no `::casts`. Schema changes only via `Blueprint` migrations; prepared statements only.
7. Table names ONLY via `$conn->table('x')` / `$conn->builder('x')` — never hardcode the `cl_` prefix.
8. No PHP in `.tpl` templates; every `[if]`/`[foreach]` must be closed; never put `*}` inside a `{* comment *}`.
9. No external CDNs — CSP in `.htaccess` blocks them; ship assets locally in the theme/plugin. Site settings live in `.env` and the admin panel, NOT in `config/*.php`.
10. Never touch `storage/`, `public/uploads/`, `install.lock`. Before editing any protected file: STOP and propose a hook / plugin / theme fork instead.

Full rules, directory zone map, hooks and template syntax: see `/AGENTS.md` in the site root. Project-specific notes belong in `/AGENTS.local.md`.
