# Feature Plan: Policy Engine Middleware ## Goal Implement deterministic middleware policies for inbound/outbound message transforms and automations. ## Why This Fits GIA - Existing command/task/approval flows provide natural control points. ## Scope - Per-chat and per-person policy rules. - Rule actions: notify, suggest rewrite, create task, rate-limit send, require approval. - Dry-run/audit mode for every policy decision. ## Implementation 1. Add policy schema and evaluator (`if conditions -> actions`). 2. Hook evaluator into compose send and inbound task intelligence paths. 3. Add policy decision logs with trace IDs. 4. Add UI for policy creation/testing with preview mode. 5. Add safe defaults: all transform rules start as suggest-only. ## Acceptance Criteria - Policy decisions are deterministic and replayable. - Any transform is visibly annotated in UI. - Users can disable policy per chat instantly. ## Out of Scope - Natural-language-to-policy compiler in first release.