# Task Spec: Architect-Omega **Agent:** Architect-Omega **Model:** Kimi-K2.5 **Mission:** Design approval system with clean apply locks ## Background The Community ADE has task execution but lacks governance. Workers pull jobs and execute immediately. We need approval gates, locking, and human review. ## Requirements ### 1. Clean Apply Locks - Distributed locking via Redis (we have Redis from Alpha) - Lock per task, per resource, per agent - Auto-expiry with heartbeats (30s default) - Deadlock detection and resolution - Lock queue (ordered acquisition) ### 2. Approval Lifecycle ``` DRAFT → SUBMITTED → REVIEWING → APPROVED → APPLYING → COMPLETED ↓ REJECTED ``` - SUBMIT: Validation runs, preview generated, no side effects - APPLY: Actual execution after approval - Rollback: Stash changes between SUBMIT and APPLY ### 3. Human Gates - Review queue in dashboard - Batch approve/reject - Approval delegation ("if X approves, auto-approve for me") - Required reviewers based on task type ### 4. Technical Design Design these components: - Redis key schemas (lock:*, approval:*, task:*) - Express routes (POST /tasks/:id/submit, POST /approvals/:id/approve, etc.) - Zod schemas for all inputs - WebSocket events (approval:requested, approval:approved, lock:acquired) - Database models (if needed beyond Redis) ### 5. Integration - Uses Alpha's Redis - Uses Beta's Express patterns - Gamma workers check locks before execution - Delta-V2 dashboard shows approval queue ## Deliverables Create in this worktree: - `design.md` - Full architecture specification - `api-spec.ts` - Express routes + Zod schemas (TypeScript) - `redis-schema.md` - All Redis key patterns - `ui-components.md` - Dashboard UI descriptions ## Success Criteria - Design handles concurrent task execution safely - Human can review before destructive operations - System degrades gracefully (locks expire, approvals timeout) - All edge cases documented **Begin immediately. You are the master here.**