The Triad Pattern
What is a Triad?
A triad is a three-legged execution pattern where each leg handles a different aspect of a task:
- Strategy (Claude Opus/Sonnet) — Designs the approach
- Dispatch (Claude Haiku) — Routes to Cursor CLI
- Implementation (Cursor Composer/Codex) — Writes the code
Why Three Legs?
The Problem with Two Legs
With just Claude + Cursor:
- Claude tends to do the work itself instead of delegating
- No cost control over which Cursor model is used
- No QC step between generation and delivery
The Bridge Agent Solution
The middle leg (Haiku bridge) solves this:
- Enforced dispatch: Bridge agents have strict rules against self-implementation
- Model selection: Bridge chooses the right Codex tier for the task
- Dual-step QC: Codex generates, then Composer reviews
- Cost control: Bridge uses cheap Haiku; expensive models only for real work
Step-by-Step Walkthrough
Example: API Design Triad
User request: “Add a user registration endpoint with email validation”
Leg 1: Claude Strategy Agent (api-designer)
Claude (Opus) analyzes:
- Endpoint design: POST /api/v1/users/register
- Validation: email format, password strength, duplicate check
- Response: 201 Created with user object, or 422 with errors
- Auth: Public endpoint, rate-limited to 5/min
Output: Structured API specification with schemas.
Leg 2: Cursor Bridge Agent (api-designer-cursor)
Haiku receives the specification and dispatches:
Step 1 (Codex generates):
cursor-agent --model codex-standard \
"Implement POST /api/v1/users/register with email validation..."
Step 2 (Composer reviews):
cursor-agent --model composer-1.5 \
"Review this endpoint implementation for security and edge cases..."
Bridge NEVER writes code itself — only dispatches CLI commands.
Leg 3: Cursor CLI (Real Models)
Codex Standard generates:
- Route handler with validation
- Email format checking
- Password hashing
- Database insertion
- Error responses
Composer 1.5 reviews:
- Checks for SQL injection
- Verifies error handling
- Validates response format
- Suggests improvements
Result
QC-validated endpoint implementation delivered back through the chain.
Execution Patterns
Pattern 1: Full Triad (High Quality)
# Claude designs → Bridge dispatches → Codex+Composer execute
# Best for: New features, complex logic, security-sensitive code
Use when: Task requires both strategic thinking and implementation.
Pattern 2: Swarm Dispatch (Fast)
$CLI_ROOT/bin/subagent-router "Fix the type error on line 42"
# Auto-routes to cursor-agent with appropriate tier
Use when: Task is implementation-only, no strategy needed.
Pattern 3: Tier Dispatch (Targeted)
$CLI_ROOT/bin/cursor-dispatch.sh codex-high "Audit for SQL injection"
# Direct dispatch to a specific Codex tier
Use when: You know exactly which tier is needed.
Pattern 4: Direct Agent (Simple)
$CLI_ROOT/bin/cursor-agent "Rename variable x to count"
# Direct composer-1.5 execution
Use when: Simple edit, no routing needed.
When to Use Each Pattern
| Scenario | Pattern | Why |
|---|---|---|
| New API endpoint | Full Triad | Needs design + implementation + review |
| Fix a typo | Direct Agent | Simple, no strategy needed |
| Security audit | Tier Dispatch (high) | Targeted use of expensive model |
| Refactor module | Swarm Dispatch | Auto-routes based on keywords |
| Test suite design | Full Triad | Needs strategy for coverage planning |
| Rename variable | Direct Agent | Trivial change |
The Enforcement Problem
Why do bridge agents need explicit enforcement rules?
Without enforcement, Claude (even Haiku) naturally tends to:
- Read the code and try to fix it directly
- Generate implementations instead of dispatching
- Skip the CLI call and “help” by doing the work
The CURSOR_CLI_ENFORCEMENT.md protocol prevents this by:
- Mandating Bash tool calls before any other action
- Requiring BOTH Codex AND Composer steps
- Adding a self-check checklist
- Explicitly forbidding fallback to self-implementation
Failure Modes
| Failure | Recovery |
|---|---|
| Cursor CLI not found | Install: curl https://cursor.com/install -fsSL \| bash |
| Model not in allowed list | Edit etc/cursor_config.json to add model |
| CLI timeout | Use --no-timeout flag or increase -t value |
| Bridge self-implements | Reinforce enforcement rules in agent definition |
| Codex output has bugs | Composer review step should catch them |
| Both models agree on wrong answer | Human review required (rare) |
Cost Implications
| Component | Model | Relative Cost | Usage % |
|---|---|---|---|
| Strategy | Opus/Sonnet | High | 5% |
| Bridge | Haiku | Very Low | 5% |
| Codex Standard | Codex | Medium | 15% |
| Composer 1.5 | Composer | Low | 75% |
The bridge agent using Haiku costs almost nothing — it’s just routing. The real cost is in the Cursor models, which is why we use Composer 1.5 for 80% of work.
| Home | Architecture | Triad Pattern | Customization | Cost Optimization |