# Hayva.ai Engineering Guide

Hayva.ai is security-sensitive. Preserve workspace isolation, explicit authorization, auditability, idempotency, and honest integration state.

1. Read `docs/ARCHITECTURE.md`, `docs/SECURITY.md`, and `docs/PROGRESS.md` before editing.
2. Never hard-code a user, workspace, credential, model, or contact.
3. Scope owned records by `workspace_id`; enforce authorization server-side.
4. External side effects require policy evaluation, idempotency, audit, and verification.
5. Missing credentials mean `unconfigured`, never simulated success.
6. Use migrations for schema changes and add tests for behavior changes.
7. Human pause, takeover, and emergency stop override agent work.
8. Do not commit secrets, browser profiles, recordings, screenshots, or user files.

Boundaries: `services/core-api` owns identity/policy/audit; `services/ai-agent` owns orchestration; `services/computer-agent` owns isolated browser control; `web` owns UI; `infra` owns deployment.
