|
| 1 | +# Cross-Role Contracts Matrix |
| 2 | + |
| 3 | +## Overview |
| 4 | +This document defines the contracts and interfaces between different agent roles in Conductor-Score. Each contract specifies inputs, outputs, service level agreements (SLAs), and escalation protocols to ensure smooth collaboration. |
| 5 | + |
| 6 | +## Contract Definitions |
| 7 | + |
| 8 | +### 1. Dev ↔ Code-Reviewer |
| 9 | +**Trigger**: Pull request created or updated |
| 10 | +**Contract**: |
| 11 | +```yaml |
| 12 | +provider: code-reviewer |
| 13 | +consumer: dev |
| 14 | +interface: |
| 15 | + request: |
| 16 | + - pull_request_url: string |
| 17 | + - changed_files: list[string] |
| 18 | + - diff_content: string |
| 19 | + response: |
| 20 | + - review_status: enum[approved, changes_requested, commented] |
| 21 | + - comments: list[{file, line, severity, message}] |
| 22 | + - suggestions: list[{file, line, original, suggested}] |
| 23 | +sla: |
| 24 | + initial_review: 15 minutes |
| 25 | + follow_up: 5 minutes |
| 26 | +escalation: |
| 27 | + - trigger: no_response_30min |
| 28 | + action: notify_dev_lead |
| 29 | +``` |
| 30 | +
|
| 31 | +### 2. Dev ↔ DevOps |
| 32 | +**Trigger**: CI/CD failure or deployment request |
| 33 | +**Contract**: |
| 34 | +```yaml |
| 35 | +provider: devops |
| 36 | +consumer: dev |
| 37 | +interface: |
| 38 | + ci_failure: |
| 39 | + request: |
| 40 | + - workflow_run_id: string |
| 41 | + - failure_type: enum[build, test, lint, deploy] |
| 42 | + - error_logs: string |
| 43 | + response: |
| 44 | + - root_cause: string |
| 45 | + - fix_actions: list[string] |
| 46 | + - estimated_time: minutes |
| 47 | + deployment: |
| 48 | + request: |
| 49 | + - environment: enum[dev, staging, prod] |
| 50 | + - version: string |
| 51 | + - rollback_plan: object |
| 52 | + response: |
| 53 | + - deployment_url: string |
| 54 | + - health_check_status: object |
| 55 | + - metrics_dashboard: url |
| 56 | +sla: |
| 57 | + ci_failure_triage: 5 minutes |
| 58 | + deployment_staging: 10 minutes |
| 59 | + deployment_prod: 30 minutes |
| 60 | +``` |
| 61 | +
|
| 62 | +### 3. Dev ↔ Security |
| 63 | +**Trigger**: Security scan findings or code review |
| 64 | +**Contract**: |
| 65 | +```yaml |
| 66 | +provider: security |
| 67 | +consumer: dev |
| 68 | +interface: |
| 69 | + vulnerability_scan: |
| 70 | + request: |
| 71 | + - scan_type: enum[sast, dast, dependency] |
| 72 | + - target: string |
| 73 | + - priority: enum[critical, high, medium, low] |
| 74 | + response: |
| 75 | + - vulnerabilities: list[{cve, severity, description, fix}] |
| 76 | + - compliance_status: object |
| 77 | + - remediation_plan: object |
| 78 | + code_review: |
| 79 | + request: |
| 80 | + - code_diff: string |
| 81 | + - sensitive_operations: list[string] |
| 82 | + response: |
| 83 | + - security_issues: list[{type, severity, location, fix}] |
| 84 | + - approved: boolean |
| 85 | +sla: |
| 86 | + critical_vulnerability: 1 hour |
| 87 | + high_vulnerability: 4 hours |
| 88 | + security_review: 2 hours |
| 89 | +``` |
| 90 | +
|
| 91 | +### 4. Frontend ↔ UI-Designer |
| 92 | +**Trigger**: Design implementation or UI review |
| 93 | +**Contract**: |
| 94 | +```yaml |
| 95 | +provider: ui-designer |
| 96 | +consumer: frontend |
| 97 | +interface: |
| 98 | + design_handoff: |
| 99 | + request: |
| 100 | + - component_name: string |
| 101 | + - design_url: string |
| 102 | + - requirements: list[string] |
| 103 | + response: |
| 104 | + - design_tokens: object |
| 105 | + - accessibility_requirements: list[string] |
| 106 | + - responsive_breakpoints: object |
| 107 | + - animations: list[object] |
| 108 | + ui_review: |
| 109 | + request: |
| 110 | + - component_url: string |
| 111 | + - screenshots: list[url] |
| 112 | + response: |
| 113 | + - visual_diff: object |
| 114 | + - accessibility_score: number |
| 115 | + - performance_metrics: object |
| 116 | +sla: |
| 117 | + design_clarification: 2 hours |
| 118 | + ui_review: 4 hours |
| 119 | +``` |
| 120 | +
|
| 121 | +### 5. Data ↔ ML-Engineer |
| 122 | +**Trigger**: Feature engineering or data quality issues |
| 123 | +**Contract**: |
| 124 | +```yaml |
| 125 | +provider: data |
| 126 | +consumer: ml-engineer |
| 127 | +interface: |
| 128 | + feature_engineering: |
| 129 | + request: |
| 130 | + - feature_requirements: list[object] |
| 131 | + - data_sources: list[string] |
| 132 | + - update_frequency: string |
| 133 | + response: |
| 134 | + - feature_table: string |
| 135 | + - schema: object |
| 136 | + - quality_metrics: object |
| 137 | + - lineage: object |
| 138 | + data_quality: |
| 139 | + request: |
| 140 | + - dataset_id: string |
| 141 | + - quality_checks: list[string] |
| 142 | + response: |
| 143 | + - quality_report: object |
| 144 | + - drift_analysis: object |
| 145 | + - recommendations: list[string] |
| 146 | +sla: |
| 147 | + feature_delivery: 24 hours |
| 148 | + quality_report: 2 hours |
| 149 | + urgent_fix: 4 hours |
| 150 | +``` |
| 151 | +
|
| 152 | +### 6. Mobile ↔ DevOps |
| 153 | +**Trigger**: App build or deployment |
| 154 | +**Contract**: |
| 155 | +```yaml |
| 156 | +provider: devops |
| 157 | +consumer: mobile |
| 158 | +interface: |
| 159 | + build_request: |
| 160 | + request: |
| 161 | + - platform: enum[ios, android] |
| 162 | + - build_type: enum[debug, release] |
| 163 | + - signing_config: object |
| 164 | + response: |
| 165 | + - build_artifact: url |
| 166 | + - build_logs: url |
| 167 | + - test_results: object |
| 168 | + store_deployment: |
| 169 | + request: |
| 170 | + - platform: enum[ios, android] |
| 171 | + - release_notes: string |
| 172 | + - rollout_percentage: number |
| 173 | + response: |
| 174 | + - submission_id: string |
| 175 | + - review_status: enum[pending, approved, rejected] |
| 176 | + - crash_metrics: object |
| 177 | +sla: |
| 178 | + build_completion: 30 minutes |
| 179 | + store_submission: 1 hour |
| 180 | +``` |
| 181 | +
|
| 182 | +## Collaboration Workflows |
| 183 | +
|
| 184 | +### 1. Feature Development Flow |
| 185 | +```mermaid |
| 186 | +graph LR |
| 187 | + A[Dev] -->|PR| B[Code-Reviewer] |
| 188 | + B -->|Security Check| C[Security] |
| 189 | + B -->|UI Components| D[Frontend] |
| 190 | + D -->|Design Review| E[UI-Designer] |
| 191 | + A -->|Deploy Ready| F[DevOps] |
| 192 | + F -->|Monitoring| A |
| 193 | +``` |
| 194 | + |
| 195 | +### 2. Incident Response Flow |
| 196 | +```mermaid |
| 197 | +graph TD |
| 198 | + A[Alert Triggered] -->|Page| B[DevOps] |
| 199 | + B -->|Triage| C{Root Cause?} |
| 200 | + C -->|Code Issue| D[Dev] |
| 201 | + C -->|Security| E[Security] |
| 202 | + C -->|Data| F[Data] |
| 203 | + C -->|ML Model| G[ML-Engineer] |
| 204 | + D & E & F & G -->|Fix| H[Resolution] |
| 205 | +``` |
| 206 | + |
| 207 | +### 3. Data Pipeline Flow |
| 208 | +```mermaid |
| 209 | +graph LR |
| 210 | + A[Data Sources] -->|Ingestion| B[Data] |
| 211 | + B -->|Quality Gates| C[Data] |
| 212 | + C -->|Features| D[ML-Engineer] |
| 213 | + D -->|Model| E[DevOps] |
| 214 | + E -->|Deploy| F[Production] |
| 215 | + F -->|Monitoring| B |
| 216 | +``` |
| 217 | + |
| 218 | +## Communication Protocols |
| 219 | + |
| 220 | +### Synchronous Communication |
| 221 | +- **Emergency**: Direct message with @here mention |
| 222 | +- **High Priority**: Thread in #team-channel with role mention |
| 223 | +- **Normal**: GitHub issue comment or PR review |
| 224 | + |
| 225 | +### Asynchronous Communication |
| 226 | +- **Updates**: Daily standup notes in workflow-state.json |
| 227 | +- **Documentation**: Markdown files in .conductor/docs/ |
| 228 | +- **Decisions**: ADRs (Architecture Decision Records) |
| 229 | + |
| 230 | +## Quality Gates |
| 231 | + |
| 232 | +### Code Quality |
| 233 | +| Role | Metric | Threshold | Enforcement | |
| 234 | +|------|--------|-----------|-------------| |
| 235 | +| Dev | Test Coverage | ≥85% | PR Block | |
| 236 | +| Dev | Linting | Zero Errors | PR Block | |
| 237 | +| Frontend | Lighthouse Score | ≥90 | Warning | |
| 238 | +| Mobile | App Size | <100MB | Warning | |
| 239 | + |
| 240 | +### Performance |
| 241 | +| Role | Metric | Threshold | Enforcement | |
| 242 | +|------|--------|-----------|-------------| |
| 243 | +| DevOps | Uptime | ≥99.9% | Alert | |
| 244 | +| Frontend | LCP | <2.5s | PR Block | |
| 245 | +| ML-Engineer | Inference | <100ms | Alert | |
| 246 | +| Data | Pipeline SLA | <5min | Alert | |
| 247 | + |
| 248 | +### Security |
| 249 | +| Role | Metric | Threshold | Enforcement | |
| 250 | +|------|--------|-----------|-------------| |
| 251 | +| All | Critical Vulns | Zero | PR Block | |
| 252 | +| Security | OWASP Top 10 | Pass | PR Block | |
| 253 | +| DevOps | Secrets in Code | Zero | PR Block | |
| 254 | + |
| 255 | +## Escalation Matrix |
| 256 | + |
| 257 | +### Severity Levels |
| 258 | +1. **P0 (Critical)**: Production down, data loss risk |
| 259 | +2. **P1 (High)**: Major feature broken, security vulnerability |
| 260 | +3. **P2 (Medium)**: Performance degradation, minor feature broken |
| 261 | +4. **P3 (Low)**: UI issues, documentation |
| 262 | + |
| 263 | +### Escalation Chain |
| 264 | +| Severity | Initial Response | Escalation 1 (30min) | Escalation 2 (2hr) | |
| 265 | +|----------|-----------------|---------------------|-------------------| |
| 266 | +| P0 | On-call Engineer | Team Lead | Director | |
| 267 | +| P1 | Primary Role | Team Lead | Manager | |
| 268 | +| P2 | Primary Role | Senior Role | Team Lead | |
| 269 | +| P3 | Primary Role | - | - | |
| 270 | + |
| 271 | +## Contract Versioning |
| 272 | + |
| 273 | +### Version Format |
| 274 | +`v{major}.{minor}.{patch}` |
| 275 | +- **Major**: Breaking changes to interface |
| 276 | +- **Minor**: New optional fields or endpoints |
| 277 | +- **Patch**: Documentation or SLA updates |
| 278 | + |
| 279 | +### Deprecation Policy |
| 280 | +1. Announce deprecation with 30-day notice |
| 281 | +2. Support both versions for 14 days |
| 282 | +3. Automated migration tools provided |
| 283 | +4. Rollback plan required |
| 284 | + |
| 285 | +## Monitoring & Compliance |
| 286 | + |
| 287 | +### SLA Dashboard |
| 288 | +```yaml |
| 289 | +dashboard: |
| 290 | + url: "/.conductor/metrics/sla-dashboard" |
| 291 | + refresh: 5_minutes |
| 292 | + alerts: |
| 293 | + - sla_breach: email + slack |
| 294 | + - repeated_failure: pagerduty |
| 295 | +``` |
| 296 | +
|
| 297 | +### Monthly Review |
| 298 | +- Contract effectiveness metrics |
| 299 | +- SLA compliance rates |
| 300 | +- Escalation frequency |
| 301 | +- Cross-role satisfaction scores |
| 302 | +
|
| 303 | +## Amendment Process |
| 304 | +1. Propose change via GitHub issue |
| 305 | +2. Impact analysis by affected roles |
| 306 | +3. 72-hour review period |
| 307 | +4. Unanimous approval required |
| 308 | +5. Update version and notify all roles |
0 commit comments