דלג לתוכן הראשי

Policies

Each YAML file in this directory declares one policy. The Policy Engine reads every file at step 4 of the autonomous loop, aggregates the ones whose triggered_by clauses match the work the AI is about to do, and outputs the union of required agents, gates, risk score, and human- approval conditions.

Schema: schema.json. Authoring guide: README.md. Event names live in events/vocabulary.md. Validator: pnpm validate:policies (CI runs it automatically).

Current catalog

PolicyRiskRequired agentsWhen it fires
api-contract-change.yaml8backend-developer, code-reviewerapi/**, openapi.yaml, contracts/**, controllers
schema-migration.yaml9database, backend-developer, devops-infra, code-reviewer**/migrations/**, *.migration.{ts,sql}
auth-touch.yaml8auth-security, code-reviewer**/auth/**, **/cognito/**, **/rbac/**, *.jwt.*, auth.touched event
legacy-php-change.yaml7legacy-php-guide, code-reviewersuperco-consumer/**, **/yii2/**, **/*.php
frontend-i18n.yaml4i18n-localization, frontend-developer**/i18n/**, **/locales/**, i18n.string_added event
production-deploy.yaml10devops-infradeploy.requested event
secret-rotation.yaml10auth-security, devops-infra**/.env*, **/secrets/**, secret.referenced event
large-refactor.yaml6architect, code-reviewerPR diff > 20 files
cross-repo-impact.yaml5code-reviewerpr.cross_repo_overlap event

Approval categories

PolicyApproval
production-deployHard Floor — always requires human approval (autonomy/defaults.yaml)
secret-rotationHard Floor — always requires human approval
auth-touchAlways — second pair of eyes mandatory
schema-migrationConditional — required on data_loss_detected or production_target == true
legacy-php-changeConditional — required on touches.auth_path or touches.payment_path
api-contract-changeConditional — required on breaking change
large-refactorConditional — required when diff > 50 files
frontend-i18nNone — gates only
cross-repo-impactNone initially — warn-only

Adding a policy

  1. Create policies/<id>.yaml from the schema (or copy an existing policy and edit).
  2. Run pnpm validate:policies — should pass before opening a PR.
  3. If the policy uses a new event, add it to events/vocabulary.md.
  4. If the policy references an agent that doesn't exist yet, that's fine: the engine will log a warning at runtime until the agent lands. Don't gate the policy on an agent existing — that creates ordering deadlocks during migration.

Agents referenced but not yet authored

These names appear in required_agents and will resolve once their files land under .claude/agents/:

  • backend-developer
  • frontend-developer
  • code-reviewer
  • architect
  • database
  • devops-infra
  • auth-security
  • i18n-localization
  • legacy-php-guide