Incident Agent
The ephemeral agent that investigates CI failures and production errors — correlating errors with recent changes and suggesting fixes using Claude.
Incident Agent
The Incident Agent is an automated investigator that activates when things break. It's spawned automatically when a CI build fails or a production error is detected, and it correlates the failure with recent code changes to identify the likely cause and suggest a fix.
Characteristics
| Property | Value |
|---|---|
| Lifecycle | Ephemeral — spawned per incident, terminates after investigation |
| Spawned by | Project Agent, on CI failure events or manual investigate commands |
| AI Model | Claude Sonnet (via ClaudeBridge) |
| Color | Critical Red (#EF4444) |
When It Activates
The Incident Agent is spawned in two scenarios:
1. CI Build Failure (Automatic)
When the Project Agent receives a workflow_run webhook event with conclusion: "failure", it automatically spawns an Incident Agent:
2. Manual Investigation (User-Triggered)
A team member can manually request an investigation:
Investigation Flow
Step 1: Fetch Error Logs
The agent retrieves build logs from GitHub Actions:
Step 2: Get Recent Changes
The agent fetches commits between the last successful build and the failed one:
Step 3: Correlate Errors with Changes
The agent matches error patterns in the logs with files modified in recent commits:
Step 4: Claude Analysis
All gathered context is sent to Claude for root cause analysis:
Step 5: Generate Investigation Report
The final output is a structured report:
Example Investigation
⚡ Severity: medium (Test suite failure, no production impact)
CodeSpar: 🔧 Suggested Fix available.
Options:
- @codespar fix the null check in user.ts (spawns Task Agent to implement the fix)
- @codespar revert abc1234 (reverts the problematic commit)
- Manually fix and push
User: @codespar fix the null check in user.ts CodeSpar: 🔍 Task Agent spawned. Working on the fix... ✅ PR #93 created: "Add null check in UserService.getProfile"