summaryrefslogtreecommitdiff
path: root/.makima/specs/red-team-system.md
blob: 31f4b78bfe6720a101e20d7f6a6e8e48b192a501 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# Red Team System Specification

## Overview

The Red Team system is an adversarial review feature for makima contracts that provides real-time quality assurance during task execution. When enabled, a parallel "red team" task instance monitors the output of work tasks, verifying that implementations adhere to the contract requirements, repository standards, and the execution plan.

### Goals

1. **Quality Assurance**: Catch deviations from the plan before they compound
2. **Standards Compliance**: Ensure code follows repository conventions (CONTRIBUTING.md, linting rules, etc.)
3. **Contract Adherence**: Verify implementations match the specification and requirements
4. **Proactive Issue Detection**: Flag potential problems early, not after task completion

### Non-Goals

1. The red team should NOT write code or make commits
2. The red team should NOT be overly pedantic or block progress for minor style issues
3. The red team is NOT a replacement for code review - it's an early warning system

---

## 1. Feature Overview

### 1.1 Concept

The Red Team operates as a parallel observer task that:
- Monitors all work task outputs in real-time via the broadcast system
- Has read-only access to task diffs and outputs
- Can access contract specifications, plans, and repository standards
- Can notify the supervisor when it detects issues requiring attention

### 1.2 Relationship to Existing Components

```
┌─────────────────────────────────────────────────────────────┐
│                       Contract                               │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │  Supervisor  │    │  Work Task 1 │    │  Work Task 2 │  │
│  │              │<───│              │    │              │  │
│  │              │<───│              │    │              │  │
│  └──────────────┘    └──────────────┘    └──────────────┘  │
│         ^                   │                   │           │
│         │              outputs             outputs          │
│         │                   │                   │           │
│    [NOTIFY]                 v                   v           │
│         │            ┌─────────────────────────────┐        │
│         └────────────│       Red Team Task         │        │
│                      │  (Monitoring & Validation)  │        │
│                      └─────────────────────────────┘        │
└─────────────────────────────────────────────────────────────┘
```

### 1.3 Task Type

The Red Team task is a special task variant with the following characteristics:
- `is_red_team: true` flag on the Task model
- Has tool key for API access (like supervisor tasks)
- Does NOT have write permissions to the repository
- Subscribes to task output broadcasts
- Can use `makima red-team notify` command to alert supervisor

---

## 2. Contract Configuration

### 2.1 Contract Model Changes

Add the following field to the `Contract` model in `makima/src/db/models.rs`:

```rust
/// Contract record from the database
#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct Contract {
    // ... existing fields ...

    /// Whether to spawn a red team task to monitor work tasks.
    /// When enabled, a parallel task monitors outputs and can alert
    /// the supervisor about potential issues.
    #[serde(default)]
    pub red_team_enabled: bool,

    /// Optional custom prompt/criteria for the red team to use
    /// when evaluating task outputs. If not provided, uses default
    /// quality criteria.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub red_team_prompt: Option<String>,
}
```

### 2.2 CreateContractRequest Changes

```rust
#[derive(Debug, Clone, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreateContractRequest {
    // ... existing fields ...

    /// Enable red team monitoring for this contract.
    /// When enabled, a parallel task monitors work task outputs
    /// and can alert the supervisor about potential issues.
    #[serde(default)]
    pub red_team_enabled: Option<bool>,

    /// Optional custom criteria for the red team to evaluate.
    /// Examples: "Focus on security vulnerabilities",
    /// "Ensure all functions have tests", etc.
    pub red_team_prompt: Option<String>,
}
```

### 2.3 CLI Flag for Contract Creation

The daemon CLI should support red team enablement during contract creation:

```bash
# Enable red team with default criteria
makima supervisor create --red-team "Contract Name" "Description"

# Enable red team with custom review criteria
makima supervisor create --red-team --red-team-prompt "Focus on performance and memory usage" "Contract Name" "Description"
```

---

## 3. Red Team Task Lifecycle

### 3.1 Spawning

The red team task is spawned automatically when:
1. A contract has `red_team_enabled: true`
2. The first work task is spawned (not the supervisor itself)

**Spawn Logic** (in `spawn_task` handler or supervisor spawn logic):

```rust
// In spawn_task after creating a work task:
if contract.red_team_enabled && !is_supervisor_task {
    // Check if red team task already exists
    let existing_red_team = repository::get_red_team_task_for_contract(pool, contract_id).await?;

    if existing_red_team.is_none() {
        // Spawn red team task
        let red_team_task = spawn_red_team_task(
            pool,
            state,
            contract_id,
            owner_id,
            contract.red_team_prompt.as_deref(),
        ).await?;

        tracing::info!(
            contract_id = %contract_id,
            red_team_task_id = %red_team_task.id,
            "Spawned red team task for contract"
        );
    }
}
```

### 3.2 Task Properties

When creating the red team task:

```rust
CreateTaskRequest {
    name: "Red Team Monitor".to_string(),
    description: Some("Adversarial review task monitoring work task outputs".to_string()),
    plan: generate_red_team_plan(contract, custom_prompt),
    contract_id: Some(contract_id),
    parent_task_id: None,  // Not a child of supervisor
    is_supervisor: false,
    is_red_team: true,     // NEW FIELD
    // ... other fields ...
}
```

### 3.3 Lifespan

The red team task:
- Lives for the duration of the **execute phase**
- Is automatically terminated when:
  - The contract advances past the execute phase
  - The contract is completed
  - The contract is archived
- Can be paused/resumed along with other contract tasks
- Does NOT restart automatically after daemon failure (not critical path)

### 3.4 Read-Only Enforcement

The red team task:
- Has NO worktree of its own (or a read-only clone)
- Cannot use git operations (commit, branch, etc.)
- Can only READ files, not write them
- Has API access limited to read operations

---

## 4. Red Team Notification CLI Command

### 4.1 Command Specification

New CLI command available only to red team tasks:

```bash
makima red-team notify "<message>"
```

**Arguments:**
- `<message>`: A detailed description of the issue detected

**Options:**
- `--severity <level>`: Issue severity: `low`, `medium`, `high`, `critical` (default: `medium`)
- `--task <task_id>`: The specific task this relates to (optional)
- `--file <path>`: The file path where the issue was detected (optional)
- `--context <text>`: Additional context about the issue (optional)

**Example:**

```bash
makima red-team notify "Task is adding console.log statements which violates the no-debug-logging rule in CONTRIBUTING.md" \
  --severity medium \
  --task 550e8400-e29b-41d4-a716-446655440000 \
  --file "src/api/handler.rs"
```

### 4.2 CLI Arguments Structure

```rust
// In makima/src/daemon/cli/mod.rs

/// Red Team subcommand - red team task commands.
#[derive(Subcommand, Debug)]
pub enum RedTeamCommand {
    /// Send a notification to the supervisor about a detected issue.
    /// Only available to red team tasks.
    Notify(NotifyArgs),
}

/// Arguments for red-team notify command.
#[derive(Args, Debug)]
pub struct NotifyArgs {
    /// API URL
    #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp")]
    pub api_url: String,

    /// API key for authentication
    #[arg(long, env = "MAKIMA_API_KEY")]
    pub api_key: String,

    /// Current task ID (must be a red team task)
    #[arg(long, env = "MAKIMA_TASK_ID")]
    pub task_id: Uuid,

    /// Contract ID
    #[arg(long, env = "MAKIMA_CONTRACT_ID")]
    pub contract_id: Uuid,

    /// The notification message
    #[arg(index = 1)]
    pub message: String,

    /// Severity level: low, medium, high, critical
    #[arg(long, default_value = "medium")]
    pub severity: String,

    /// Related task ID (optional)
    #[arg(long)]
    pub task: Option<Uuid>,

    /// Related file path (optional)
    #[arg(long)]
    pub file: Option<String>,

    /// Additional context (optional)
    #[arg(long)]
    pub context: Option<String>,
}
```

### 4.3 API Endpoint

**POST** `/api/v1/mesh/red-team/notify`

**Request Body:**
```json
{
  "message": "Issue description",
  "severity": "medium",
  "relatedTaskId": "uuid-optional",
  "filePath": "src/path/optional.rs",
  "context": "Additional context optional"
}
```

**Response:**
```json
{
  "notificationId": "uuid",
  "delivered": true,
  "supervisorTaskId": "uuid"
}
```

### 4.4 Notification Delivery

When a red team notification is received:

1. **Validate Caller**: Ensure the request comes from a valid red team task
2. **Find Supervisor**: Get the supervisor task for the contract
3. **Format Message**: Create an `[ACTION REQUIRED]` formatted message
4. **Send to Supervisor**: Inject the message into the supervisor's stdin via `SendMessage` command

**Message Format:**

```
════════════════════════════════════════════════════════════════
[RED TEAM ALERT] Severity: MEDIUM
════════════════════════════════════════════════════════════════

Issue: Task is adding console.log statements which violates the
no-debug-logging rule in CONTRIBUTING.md

Related Task: 550e8400-e29b-41d4-a716-446655440000
File: src/api/handler.rs

Context: The CONTRIBUTING.md file explicitly states that debug
logging should use the tracing crate, not console.log or println!

════════════════════════════════════════════════════════════════
You can:
- Pause the related task to investigate
- Send feedback to the task to correct the issue
- Acknowledge this alert and continue monitoring
════════════════════════════════════════════════════════════════
```

### 4.5 Supervisor Response Handling

The supervisor can respond to red team notifications by:
1. **Pausing the task**: `makima supervisor pause <task_id>`
2. **Sending feedback**: `makima supervisor message <task_id> "Please use tracing instead of console.log"`
3. **Acknowledging**: Simply continue (the red team will keep monitoring)
4. **Dismissing**: Mark the alert as false positive (future consideration)

---

## 5. Red Team Access Patterns

### 5.1 Task Output Subscription

The red team task subscribes to the `task_outputs` broadcast channel:

```rust
// In red team task initialization
let mut task_output_rx = state.task_outputs.subscribe();

loop {
    match task_output_rx.recv().await {
        Ok(notification) => {
            // Only process outputs from work tasks in our contract
            if notification.contract_id == Some(self.contract_id)
               && !notification.is_supervisor
               && !notification.is_red_team {
                self.analyze_output(notification).await;
            }
        }
        Err(e) => {
            tracing::warn!("Red team task output subscription error: {}", e);
        }
    }
}
```

### 5.2 Task Diff Access

The red team can request diffs via the supervisor API:

**GET** `/api/v1/mesh/supervisor/tasks/{task_id}/diff`

This endpoint already exists and can be used by the red team (with tool key auth).

### 5.3 Contract Information Access

The red team can read:
- Contract plan and specifications (via contract files)
- Repository standards (CONTRIBUTING.md, .editorconfig, etc.)
- Task descriptions and plans

**Existing endpoints used:**
- `GET /api/v1/contracts/{id}` - Contract details
- `GET /api/v1/contracts/{id}/files` - Contract files
- `GET /api/v1/files/{id}` - File content

### 5.4 Repository File Access

For repository standards, the red team uses the existing daemon file read capability:

```bash
# Via makima CLI (from within the red team task)
makima supervisor read-file <task_id> "CONTRIBUTING.md"
makima supervisor read-file <task_id> ".editorconfig"
makima supervisor read-file <task_id> "rustfmt.toml"
```

Or direct filesystem access if the red team has a read-only worktree clone.

---

## 6. System Prompt for Red Team Task

The red team task receives a specialized system prompt that guides its behavior:

```markdown
# Red Team Monitor

You are an adversarial quality reviewer for a software development contract. Your role is to monitor work task outputs in real-time and flag potential issues BEFORE they compound into larger problems.

## Your Mission

Monitor all task outputs and verify:
1. **Plan Adherence**: Are tasks following the implementation plan?
2. **Code Quality**: Does the code meet repository standards?
3. **Contract Requirements**: Does the implementation match the specification?
4. **Best Practices**: Are there obvious anti-patterns or issues?

## Access Available

You have read-only access to:
- Task outputs (streamed in real-time)
- Task diffs (code changes)
- Contract specifications and plan documents
- Repository configuration files (CONTRIBUTING.md, linting configs, etc.)

## How to Monitor

1. **Subscribe to task outputs**: You'll receive outputs from all work tasks
2. **Analyze code changes**: Request diffs for completed tasks
3. **Cross-reference**: Compare outputs against the plan and specifications
4. **Report issues**: Use `makima red-team notify` when you detect problems

## When to Notify

NOTIFY the supervisor when you observe:
- **Critical**: Security vulnerabilities, data loss risks, breaking changes
- **High**: Significant deviations from the plan, major code quality issues
- **Medium**: Missing tests, suboptimal implementations, minor standard violations
- **Low**: Style inconsistencies, documentation gaps (use sparingly)

## What NOT to Do

- Do NOT nitpick minor style issues (that's what linters are for)
- Do NOT block progress for trivial concerns
- Do NOT write code or make changes yourself
- Do NOT notify for things that are already in progress and being addressed
- Do NOT create duplicate notifications for the same issue

## Notification Format

When notifying, always include:
1. A clear, concise description of the issue
2. The severity level (critical/high/medium/low)
3. The related task ID if applicable
4. The specific file or code location if known
5. Why this matters (reference to plan, spec, or standards)

## Example Notification

```
makima red-team notify "Task is implementing authentication with plaintext password storage, which contradicts the security requirements in the specification document" \
  --severity critical \
  --task <task_id> \
  --file "src/auth/user.rs" \
  --context "Specification section 3.2 requires bcrypt hashing for all passwords"
```

## Custom Review Criteria

{{#if red_team_prompt}}
Additional review criteria for this contract:
{{red_team_prompt}}
{{/if}}

## Contract Context

Contract: {{contract_name}}
Phase: {{contract_phase}}
Repository: {{repository_url}}

Focus your monitoring on outputs that relate to the active work tasks. Prioritize issues that could affect the success of the contract or introduce technical debt.
```

---

## 7. API Changes Summary

### 7.1 New Endpoints

| Method | Path | Description |
|--------|------|-------------|
| POST | `/api/v1/mesh/red-team/notify` | Send notification from red team to supervisor |
| GET | `/api/v1/mesh/red-team/status` | Get red team task status for a contract |

### 7.2 Modified Endpoints

| Method | Path | Change |
|--------|------|--------|
| POST | `/api/v1/contracts` | Add `red_team_enabled` and `red_team_prompt` fields |
| GET | `/api/v1/contracts/{id}` | Include red team task info in response |

### 7.3 New Request/Response Types

**RedTeamNotifyRequest:**
```rust
#[derive(Debug, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct RedTeamNotifyRequest {
    pub message: String,
    #[serde(default = "default_severity")]
    pub severity: String,
    pub related_task_id: Option<Uuid>,
    pub file_path: Option<String>,
    pub context: Option<String>,
}
```

**RedTeamNotifyResponse:**
```rust
#[derive(Debug, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct RedTeamNotifyResponse {
    pub notification_id: Uuid,
    pub delivered: bool,
    pub supervisor_task_id: Uuid,
}
```

**RedTeamStatusResponse:**
```rust
#[derive(Debug, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct RedTeamStatusResponse {
    pub contract_id: Uuid,
    pub red_team_task_id: Option<Uuid>,
    pub status: Option<String>,
    pub notifications_sent: i32,
    pub last_activity: Option<DateTime<Utc>>,
}
```

---

## 8. Database Schema Changes

### 8.1 Contracts Table

```sql
ALTER TABLE contracts
ADD COLUMN red_team_enabled BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN red_team_prompt TEXT;
```

### 8.2 Tasks Table

```sql
ALTER TABLE tasks
ADD COLUMN is_red_team BOOLEAN NOT NULL DEFAULT FALSE;
```

### 8.3 Red Team Notifications Table (New)

```sql
CREATE TABLE red_team_notifications (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    contract_id UUID NOT NULL REFERENCES contracts(id) ON DELETE CASCADE,
    red_team_task_id UUID NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
    related_task_id UUID REFERENCES tasks(id) ON DELETE SET NULL,

    message TEXT NOT NULL,
    severity VARCHAR(20) NOT NULL DEFAULT 'medium',
    file_path TEXT,
    context TEXT,

    -- Delivery status
    delivered BOOLEAN NOT NULL DEFAULT FALSE,
    delivered_at TIMESTAMP WITH TIME ZONE,
    acknowledged BOOLEAN NOT NULL DEFAULT FALSE,
    acknowledged_at TIMESTAMP WITH TIME ZONE,

    created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);

-- Indexes
CREATE INDEX idx_red_team_notifications_contract_id ON red_team_notifications(contract_id);
CREATE INDEX idx_red_team_notifications_red_team_task_id ON red_team_notifications(red_team_task_id);
CREATE INDEX idx_red_team_notifications_created_at ON red_team_notifications(created_at DESC);
```

### 8.4 Index for Red Team Task Lookup

```sql
CREATE INDEX idx_tasks_contract_red_team ON tasks(contract_id, is_red_team)
WHERE is_red_team = TRUE;
```

---

## 9. Implementation Phases

### Phase 1: Foundation (MVP)
- [ ] Add `red_team_enabled` and `red_team_prompt` to Contract model
- [ ] Add `is_red_team` to Task model
- [ ] Database migrations
- [ ] Basic red team task spawning logic
- [ ] `makima red-team notify` CLI command
- [ ] Red team notification API endpoint

### Phase 2: Monitoring Infrastructure
- [ ] Task output subscription for red team
- [ ] Diff access for red team tasks
- [ ] Red team system prompt generation
- [ ] Notification delivery to supervisor

### Phase 3: Polish & UX
- [ ] Red team status in contract view
- [ ] Notification history and acknowledgment
- [ ] TUI integration for red team alerts
- [ ] Frontend display of red team notifications

### Phase 4: Future Enhancements
- [ ] Configurable notification thresholds
- [ ] Automatic pause on critical issues
- [ ] Red team notification digest/summary
- [ ] Integration with external code review tools

---

## 10. Security Considerations

### 10.1 Access Control

- Red team tasks MUST only have read access
- Verify `is_red_team` flag before allowing notification API calls
- Red team cannot spawn tasks or modify contract state
- Tool key scope should be limited for red team tasks

### 10.2 Abuse Prevention

- Rate limit red team notifications (max 10 per minute per task)
- Prevent notification spam with deduplication
- Log all red team activities for audit

### 10.3 Isolation

- Red team task runs in separate worktree (or no worktree)
- Cannot affect work task execution directly
- Supervisor controls whether to act on notifications

---

## 11. Testing Strategy

### 11.1 Unit Tests

- Contract model serialization with red team fields
- Red team task spawning conditions
- Notification message formatting

### 11.2 Integration Tests

- Full contract lifecycle with red team enabled
- Notification delivery to supervisor
- Red team output subscription

### 11.3 E2E Tests

- Create contract with `--red-team` flag
- Red team detects intentional violation
- Supervisor receives and responds to notification

---

## 12. Success Metrics

1. **Detection Rate**: Percentage of issues caught by red team before task completion
2. **False Positive Rate**: Percentage of notifications that are dismissed as not actionable
3. **Response Time**: Time between red team detection and supervisor acknowledgment
4. **Contract Success Rate**: Compare success rates for contracts with/without red team

---

## Appendix A: Message Protocol

### Task Output Notification Structure

The red team subscribes to `TaskOutputNotification`:

```rust
pub struct TaskOutputNotification {
    pub task_id: Uuid,
    pub owner_id: Option<Uuid>,
    pub message_type: String,      // "assistant", "tool_use", "tool_result", etc.
    pub content: String,
    pub tool_name: Option<String>,
    pub tool_input: Option<serde_json::Value>,
    pub is_error: Option<bool>,
    pub cost_usd: Option<f64>,
    pub duration_ms: Option<u64>,
    pub is_partial: bool,
}
```

### Daemon Command for Supervisor Message

```rust
DaemonCommand::SendMessage {
    task_id: supervisor_id,
    message: formatted_red_team_alert,
}
```

---

## Appendix B: Configuration Examples

### Contract Creation with Red Team (API)

```json
POST /api/v1/contracts
{
  "name": "Implement User Authentication",
  "description": "Add OAuth2 authentication flow",
  "contract_type": "specification",
  "red_team_enabled": true,
  "red_team_prompt": "Pay special attention to security best practices and OWASP guidelines. Flag any hardcoded secrets or insecure token handling."
}
```

### Contract Creation with Red Team (CLI)

```bash
makima contract create \
  --type specification \
  --red-team \
  --red-team-prompt "Focus on API backwards compatibility and deprecation handling" \
  "API v2 Migration" \
  "Migrate public API from v1 to v2"
```