# Programmer Guide

## Coding Standards
- Follow manifest naming standards in `system/manifest.json`.
- Use prepared statements for DB writes.
- Route diagnostics through `DiagnosticsQueryInspector`.
- Keep public entrypoint naming explicit: `public/aicode.index.php` (no `public/index.php`).

## Two-Tier Environment And Paths
- Environment loading is centralized in `config/bootstrap.env.php`.
- The loader reads system env first, then app env:
	- `.../websites/system/.env`
	- `.../websites/apps/aicode/.env`
- App values override system values when keys overlap.
- `APP_ROOT` is treated as the runtime root and all tool/config path resolution must use it.

## Standards Validation Checklist
- `php tools/test.env.php`
- `php tools/test.structure.php`
- `php tools/test.permissions.php test`
- `php tools/test.standards.php`
- `php tools/system.manager.php envcheck`
- `php tools/system.manager.php selftest`

## Development Workflow
- Make code changes.
- Run the standards validation checklist before release.
- Update docs/site-map.md when adding docs.
